:root {
  color-scheme: dark;
  --obsidian: #0B1018;
  --gunmetal: #22262D;
  --graphite: #2E343D;
  --titanium: #8C939E;
  --platinum: #C9CED6;
  --ice: #A8D4EA;
  --ice-deep: #6FA8CC;
  --white: #F5F7FA;
  --glass: rgba(34, 38, 45, .55);
  --hair: rgba(201, 206, 214, .12);
  --head: "Sora", "Manrope", "Segoe UI", system-ui, sans-serif;
  --body: "Inter", "DM Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%; height: 100dvh; overflow: hidden;
  background: var(--obsidian); color: var(--white); font-family: var(--body);
  -webkit-text-size-adjust: 100%;
}

#app { position: fixed; inset: 0; background: linear-gradient(#3d80c0, #b8d9ef); }
#app::before { content: ""; position: absolute; inset: 0 0 auto; height: 130px; z-index: 1; pointer-events: none; background: linear-gradient(rgba(11, 16, 24, .6), rgba(11, 16, 24, 0)); transition: opacity .3s; }
body.clean #app::before, body.embed #app::before { opacity: 0; }
.hud, .credit { z-index: 2; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
canvas:active { cursor: grabbing; }
#fade { position: absolute; inset: 0; background: #b8d9ef; opacity: 0; transition: opacity .45s ease; pointer-events: none; }

.hud { position: absolute; color: var(--white); transition: opacity .3s; }
.credit { transition: opacity .3s; }
body.clean .hud, body.clean .credit, body.embed .hud { opacity: 0; pointer-events: none; }
body.embed canvas { cursor: default; }
body.embed .credit { display: none; }

/* header */
.title {
  display: flex; align-items: center; gap: 16px;
  left: calc(32px + env(safe-area-inset-left)); top: calc(22px + env(safe-area-inset-top));
  text-shadow: 0 1px 14px rgba(11, 16, 24, .7);
}
.mlogo { width: 64px; height: 64px; border-radius: 50%; box-shadow: 0 0 0 1px var(--hair), 0 6px 22px rgba(0, 0, 0, .5); }
.title h1 { margin: 0; font-family: var(--head); font-size: 36px; line-height: 1; letter-spacing: 8px; font-weight: 600; text-transform: uppercase; color: var(--white); }
.title p { margin: 0; text-transform: uppercase; }
.title .by { margin-top: 7px; font-size: 10.5px; letter-spacing: 4px; color: var(--platinum); }
.title .sub { margin-top: 3px; font-size: 11px; letter-spacing: 3px; color: var(--ice); }

/* mode panel */
.mode {
  left: calc(32px + env(safe-area-inset-left)); bottom: 132px; width: min(360px, calc(100vw - 64px));
  padding: 16px 20px 18px; background: var(--glass); border: 1px solid var(--hair); border-radius: 14px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, .35);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.tag { display: inline-block; font-family: var(--head); font-weight: 600; font-size: 11px; letter-spacing: 3px; color: var(--obsidian); background: var(--titanium); padding: 6px 13px; border-radius: 99px; transition: background .4s, box-shadow .4s; }
.mode p { margin: 12px 0 14px; font-size: 14px; line-height: 1.55; color: var(--white); }
.bar { height: 2px; background: rgba(201, 206, 214, .2); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--ice); }

/* controls */
.controls {
  left: 50%; bottom: 76px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  width: calc(100vw - 32px); max-width: 900px;
}
.controls .sep { width: 1px; height: 22px; background: var(--hair); margin: 0 4px; }
button, .controls a {
  font: inherit; font-size: 13px; font-weight: 500; letter-spacing: .6px; line-height: 1.2;
  color: var(--white); background: var(--glass); border: 1px solid rgba(140, 147, 158, .5);
  padding: 10px 18px; min-height: 40px; border-radius: 99px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  transition: background .2s, color .2s, border-color .2s, box-shadow .2s;
}
button:hover, .controls a:hover { background: rgba(46, 52, 61, .85); border-color: var(--platinum); }
button.on, button[aria-pressed="true"] {
  color: var(--ice); border-color: rgba(168, 212, 234, .55);
  box-shadow: 0 2px 0 -0.5px var(--ice), 0 8px 16px -8px rgba(168, 212, 234, .7);
}
button.solid { background: rgba(34, 38, 45, .75); border-color: rgba(168, 212, 234, .55); color: var(--ice); }
button:focus-visible, .controls a:focus-visible { outline: 2px solid var(--ice); outline-offset: 3px; }

.hint { right: calc(28px + env(safe-area-inset-right)); top: calc(30px + env(safe-area-inset-top)); font-size: 12px; text-align: right; line-height: 1.7; letter-spacing: .4px; color: var(--platinum); text-shadow: 0 1px 10px rgba(11, 16, 24, .8); }

/* footer */
.credit {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 24px calc(10px + env(safe-area-inset-bottom)); text-align: center;
  color: var(--platinum); background: linear-gradient(to top, rgba(11, 16, 24, .92), rgba(11, 16, 24, 0));
}
.credit p { margin: 0 auto; max-width: 1100px; font-size: 11.5px; line-height: 1.5; letter-spacing: .5px; }
.credit b { color: var(--white); font-weight: 600; }
.credit .disc { margin-top: 3px; font-size: 10.5px; color: var(--titanium); letter-spacing: .3px; }

/* drawer */
#scrim { position: fixed; inset: 0; z-index: 20; background: rgba(11, 16, 24, .55); opacity: 0; transition: opacity .25s; }
body.drawer-open #scrim { opacity: 1; }
#drawer {
  position: fixed; z-index: 21; top: 0; right: 0; bottom: 0; width: min(560px, 100vw);
  display: flex; flex-direction: column; visibility: hidden;
  background: rgba(34, 38, 45, .92); border-left: 1px solid var(--hair);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: -20px 0 60px rgba(0, 0, 0, .45);
  transform: translateX(100%); transition: transform .28s cubic-bezier(.2, .7, .2, 1), visibility 0s .28s;
  padding-top: env(safe-area-inset-top);
}
body.drawer-open #drawer { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2, .7, .2, 1), visibility 0s; }
#drawer:focus { outline: none; }
.d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 24px 28px 8px; }
.eyebrow { margin: 0 0 6px; font-size: 10.5px; letter-spacing: 3.5px; text-transform: uppercase; color: var(--ice); }
#drawer h2 { margin: 0; font-family: var(--head); font-weight: 600; font-size: 22px; letter-spacing: 4px; text-transform: uppercase; }
.icon-btn { width: 44px; height: 44px; padding: 0; flex: none; }
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tabs { display: flex; gap: 6px; padding: 8px 28px 0; border-bottom: 1px solid var(--hair); }
.tabs button { background: none; border: 0; border-radius: 0; border-bottom: 2px solid transparent; color: var(--platinum); padding: 12px 6px; margin-right: 16px; min-height: 44px; backdrop-filter: none; box-shadow: none; }
.tabs button[aria-selected="true"] { color: var(--ice); border-bottom-color: var(--ice); box-shadow: 0 8px 14px -10px var(--ice); }
.d-body { overflow-y: auto; padding: 8px 28px calc(32px + env(safe-area-inset-bottom)); flex: 1; overscroll-behavior: contain; }
#drawer h3 { margin: 28px 0 12px; font-family: var(--head); font-size: 11px; font-weight: 600; letter-spacing: 3.5px; text-transform: uppercase; color: var(--platinum); }
#drawer h4 { margin: 0 0 4px; font-family: var(--head); font-size: 14px; font-weight: 600; letter-spacing: .4px; color: var(--white); }
#drawer p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--platinum); }
.lead { margin-top: 18px !important; font-size: 16px !important; line-height: 1.55 !important; color: var(--white) !important; }
.lead.est span { display: inline-block; margin-right: 8px; padding: 3px 10px; font-family: var(--head); font-size: 10.5px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--obsidian); background: var(--ice); border-radius: 99px; vertical-align: 2px; }
.cases, .chips { list-style: none; margin: 0; padding: 0; }
.cases li { display: flex; gap: 16px; padding: 16px 0; border-top: 1px solid var(--hair); }
.cases li:first-child { border-top: 0; padding-top: 4px; }
.cases .ic { width: 30px; height: 30px; color: var(--ice); margin-top: 2px; }
.how { margin-top: 8px !important; font-size: 13px !important; color: var(--platinum); }
.how b, .modes3 b { display: block; margin-bottom: 1px; font-size: 10px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--ice); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 8px 14px; font-size: 13px; color: var(--white); border: 1px solid rgba(140, 147, 158, .5); border-radius: 99px; }
.modes3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.modes3 > div { padding: 14px; background: rgba(46, 52, 61, .55); border: 1px solid var(--hair); border-radius: 12px; }
.modes3 p { font-size: 12.5px !important; line-height: 1.55 !important; }
.modes3 .l { margin-top: 10px !important; }
.modes3 .l b { color: var(--titanium); }
.not { margin-top: 18px !important; padding: 14px 16px; border-left: 2px solid var(--ice); background: rgba(11, 16, 24, .45); color: var(--white) !important; font-size: 13.5px !important; }
.specs { margin: 20px 0 0; }
.specs > div { display: grid; grid-template-columns: 120px 1fr; gap: 14px; padding: 14px 0; border-top: 1px solid var(--hair); }
.specs dt { font-family: var(--head); font-size: 11px; font-weight: 600; letter-spacing: 2.5px; text-transform: uppercase; color: var(--ice); padding-top: 2px; }
.specs dd { margin: 0; font-size: 14px; line-height: 1.55; color: var(--white); }
.specs .tbd dd { color: var(--titanium); font-style: italic; }

/* responsive */
@media (max-width: 900px) {
  .hint { display: none; }
  .controls { max-width: 760px; }
}
@media (max-width: 720px) {
  .title { gap: 12px; top: calc(14px + env(safe-area-inset-top)); left: calc(16px + env(safe-area-inset-left)); }
  .mlogo { width: 48px; height: 48px; }
  .title h1 { font-size: 24px; letter-spacing: 5px; }
  .title .by { font-size: 9.5px; letter-spacing: 3px; margin-top: 5px; }
  .title .sub { font-size: 10px; letter-spacing: 2.5px; }
  /* bottom bar: one scrollable row of 44px buttons */
  .controls {
    left: 0; right: 0; width: auto; max-width: none; transform: none; justify-content: flex-start; flex-wrap: nowrap;
    bottom: calc(112px + env(safe-area-inset-bottom)); padding: 0 16px; gap: 8px;
    overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
  }
  .controls::-webkit-scrollbar { display: none; }
  .controls > * { flex: none; scroll-snap-align: start; }
  button, .controls a { min-height: 44px; font-size: 13px; padding: 10px 16px; }
  .controls .sep { display: none; }
  .mode { left: 16px; right: 16px; width: auto; bottom: calc(168px + env(safe-area-inset-bottom)); padding: 12px 16px 14px; }
  .mode p { font-size: 13px; margin: 9px 0 11px; line-height: 1.45; }
  .credit { padding: 14px 16px calc(8px + env(safe-area-inset-bottom)); text-align: left; }
  .credit p { font-size: 9.5px; line-height: 1.45; letter-spacing: .2px; }
  .credit .disc { font-size: 9.5px; }
  .d-head, .tabs, .d-body { padding-left: 20px; padding-right: 20px; }
  .specs > div { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 380px) { .mode p { display: none; } .mode { bottom: calc(160px + env(safe-area-inset-bottom)); } }
@media (max-height: 520px) and (orientation: landscape) {
  .mode { right: auto; width: min(300px, 40vw); bottom: calc(52px + env(safe-area-inset-bottom)); padding: 10px 14px; }
  .mode p { display: none; }
  .controls { left: auto; right: 12px; transform: none; bottom: calc(52px + env(safe-area-inset-bottom)); width: auto; max-width: 60vw; flex-wrap: nowrap; overflow-x: auto; padding: 0; justify-content: flex-start; }
  .title p.sub, .hint { display: none; }
  .credit { padding: 8px 12px 4px; } .credit p { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
