*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: #eceaf6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
[data-go], [data-tab], [data-action], [data-back], [data-sheet], [data-jump] { cursor: pointer; touch-action: manipulation; }

/* ---------- Stage: index panel + phone ---------- */
.stage {
  min-height: 100%;
  display: flex; align-items: center; justify-content: center; gap: 48px;
  padding: 32px 24px;
}
.index {
  width: 300px; max-height: calc(100vh - 64px); overflow: auto;
  background: var(--white); border-radius: 20px; padding: 24px 20px;
  box-shadow: var(--shadow-2); align-self: center;
}
.index__eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); }
.index__title { font-size: 22px; font-weight: 800; margin-top: 4px; }
.index__sub { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
#index-list { margin-top: 18px; display: grid; gap: 4px; }
.index details { border-top: 1px solid var(--line-2); padding: 8px 0; }
.index summary { list-style: none; display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 14px; padding: 6px 4px; cursor: pointer; }
.index summary::-webkit-details-marker { display: none; }
.index summary::after { content: ""; width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform var(--dur-1); }
.index details[open] summary::after { transform: rotate(-135deg); }
.index summary .count { margin-left: auto; margin-right: 10px; font-size: 11px; color: var(--muted); font-weight: 600; }
.index a { display: block; font-size: 13px; padding: 6px 10px; border-radius: 8px; color: #3c3c42; cursor: pointer; }
.index a:hover { background: var(--primary-100); }
.index a.is-current { background: var(--primary); color: #fff; font-weight: 600; }

.device {
  width: calc(var(--device-w) + 24px); height: calc(var(--device-h) + 24px);
  border-radius: 56px; padding: 12px; background: #111114; flex: none;
  box-shadow: 0 0 0 2px #2b2b30, 0 40px 80px rgba(40, 30, 90, .25);
  position: relative;
}
.device::before { /* speaker slot */
  content: ""; position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; z-index: 50;
}
.device__screen {
  position: relative; width: var(--device-w); height: var(--device-h);
  border-radius: 44px; overflow: hidden; background: var(--surface);
  isolation: isolate;
}

/* Real phones: drop the frame and fill the screen */
@media (max-width: 760px) {
  body { background: var(--surface); }
  .stage { padding: 0; display: block; }
  .index { display: none; }
  .device { width: 100%; height: 100dvh; border-radius: 0; padding: 0; background: none; box-shadow: none; }
  .device::before { display: none; }
  .device__screen { width: 100%; height: 100dvh; border-radius: 0; }
  .statusbar { display: none; }
  .viewport { top: env(safe-area-inset-top); }
  .home-indicator { display: none; }
}

/* Screenshot QA mode (index.html?capture#/route): whole screen in normal flow, no frame */
html.capture body { background: var(--surface); }
html.capture .stage { padding: 0; display: block; }
html.capture .index, html.capture .device::before, html.capture .home-indicator { display: none; }
html.capture .device { width: 390px; height: auto; padding: 0; border-radius: 0; box-shadow: none; background: none; }
html.capture .device__screen { width: 390px; height: auto; min-height: 844px; border-radius: 0; overflow: visible; }
html.capture .viewport { position: relative; inset: auto; overflow: visible; }
html.capture .screen { position: relative; inset: auto; overflow: visible; min-height: 844px; }
html.capture .statusbar { display: flex; }
html.capture .bottom-nav { position: sticky; }
html.capture .sheet-host { position: fixed; }

/* ---------- Status bar + viewport ---------- */
.statusbar {
  position: absolute; inset: 0 0 auto 0; height: var(--status-h); z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 26px 0 36px; font-size: 14px; font-weight: 700; pointer-events: none;
  color: var(--ink);
}
.statusbar svg { fill: currentColor; }
.statusbar__icons { display: flex; gap: 6px; align-items: center; }
.device__screen.is-dark .statusbar { color: #fff; }

.viewport { position: absolute; inset: 0; overflow: hidden; }
.screen {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  background: var(--surface); padding-top: var(--status-h);
  scrollbar-width: none; overscroll-behavior: contain;
}
.screen::-webkit-scrollbar { display: none; }
.screen.has-nav { padding-bottom: calc(var(--nav-h) + 16px); }
.screen.no-pad-top { padding-top: 0; }

/* push / pop transitions */
.screen.enter { animation: in-right var(--dur-3) var(--ease-out) both; z-index: 2; }
.screen.leave { animation: out-left var(--dur-3) var(--ease-out) both; z-index: 1; }
.screen.enter-back { animation: in-left var(--dur-3) var(--ease-out) both; z-index: 1; }
.screen.leave-back { animation: out-right calc(var(--dur-3) * .8) var(--ease-in) both; z-index: 2; }
@keyframes in-right { from { transform: translateX(100%); } to { transform: none; } }
@keyframes out-left { to { transform: translateX(-28%); opacity: .6; } }
@keyframes in-left { from { transform: translateX(-28%); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes out-right { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .screen.enter, .screen.leave, .screen.enter-back, .screen.leave-back { animation: none; } }

.home-indicator {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 134px; height: 5px; border-radius: 3px; background: #4a4a4a; z-index: 60; pointer-events: none;
}
