*, *::before, *::after { box-sizing: border-box; }
html { font-size: calc(16px * var(--font-scale)); -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; height: 100%; font-family: var(--font); color: var(--text); background: var(--bg);
  line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
svg.i { width: 1.375rem; height: 1.375rem; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 1.125rem; height: 1.125rem; }
svg.i.lg { width: 1.75rem; height: 1.75rem; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Stage: on desktop the app is shown inside a phone frame */
.stage { min-height: 100%; display: flex; align-items: center; justify-content: center; gap: 56px; }
.device {
  position: relative; width: 100%; height: 100dvh; background: var(--bg); overflow: hidden;
  display: flex; flex-direction: column;
}
.stage-info { display: none; }

@media (min-width: 760px) and (min-height: 640px) {
  body { background: radial-gradient(1200px 600px at 20% 10%, #EDE7FF 0%, transparent 60%), radial-gradient(900px 600px at 90% 90%, #F6E9FF 0%, transparent 60%), #F5F3FB; }
  [data-theme="dark"] body, body[data-theme="dark"] { background: radial-gradient(1200px 600px at 20% 10%, #231B4A 0%, transparent 60%), #0B0A10; }
  .stage { padding: 24px; }
  .device {
    width: 400px; height: min(860px, calc(100dvh - 48px)); border-radius: 44px;
    box-shadow: var(--shadow-3), 0 0 0 10px #1A1726, 0 0 0 11px #2E2A40;
  }
  .stage-info { display: block; max-width: 360px; color: var(--text); }
  .stage-info h1 { font-family: var(--font-display); font-size: 2.6rem; line-height: 1.05; margin: 16px 0 12px; letter-spacing: -.03em; }
  .stage-info p { color: var(--text-2); margin: 0 0 12px; }
  .stage-info ul { padding-left: 18px; color: var(--text-2); margin: 0 0 16px; }
  .stage-info li { margin: 4px 0; }
  .stage-info .url { font-family: var(--font-mono); font-size: .85rem; background: var(--surface); border: 1px solid var(--border); padding: 10px 12px; border-radius: var(--r-sm); word-break: break-all; }
}
@media (min-width: 760px) and (max-width: 1040px) { .stage-info { display: none; } }

#app { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
#overlay-root { position: absolute; inset: 0; pointer-events: none; z-index: 50; }
#overlay-root > * { pointer-events: auto; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); animation: screen-in var(--dur-3) var(--ease); }
.screen.back-anim { animation: screen-back var(--dur-3) var(--ease); }
@keyframes screen-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes screen-back { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.screen.fade { animation: fade-in var(--dur-3) var(--ease); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.content { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: var(--s-4) var(--s-4) calc(var(--s-8) + var(--safe-bottom)); -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.with-tabbar .content { padding-bottom: calc(var(--tabbar-h) + var(--s-6) + var(--safe-bottom)); }
.content::-webkit-scrollbar { width: 4px; }
.content::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.row { display: flex; align-items: center; gap: var(--s-3); }
.col { display: flex; flex-direction: column; gap: var(--s-3); }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { justify-content: center; align-items: center; }
.gap-1 { gap: var(--s-1); } .gap-2 { gap: var(--s-2); } .gap-4 { gap: var(--s-4); }
.mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-2); } .mb-3 { margin-bottom: var(--s-3); } .mb-4 { margin-bottom: var(--s-4); }
.muted { color: var(--text-2); } .faint { color: var(--text-3); }
.small { font-size: .8125rem; } .tiny { font-size: .75rem; }
.bold { font-weight: 650; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hidden { display: none !important; }
.text-center { text-align: center; }

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -.015em; }
.t-display { font-size: 2rem; font-weight: 750; line-height: 1.1; letter-spacing: -.03em; }
.t-h1 { font-size: 1.5rem; font-weight: 720; line-height: 1.2; }
.t-h2 { font-size: 1.1875rem; font-weight: 680; line-height: 1.25; }
.t-h3 { font-size: 1rem; font-weight: 650; }
.t-body { font-size: 1rem; }
.t-label { font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
