*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; line-height: 1.15; }
p { margin: 0; }
button { font-family: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
ul { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Stage & phone chrome ---------- */
#stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 120% at 50% 0%, #E4F5F8 0%, #F3FAFB 45%, #F3FAFB 100%);
  padding: var(--sp-6) var(--sp-4);
}
@media (prefers-color-scheme: dark) {
  #stage { background: radial-gradient(120% 120% at 50% 0%, #0C2A30 0%, #071417 55%, #071417 100%); }
}
:root[data-theme="dark"] ~ body #stage,
[data-theme="dark"] #stage { background: radial-gradient(120% 120% at 50% 0%, #0C2A30 0%, #071417 55%, #071417 100%); }

.phone {
  position: relative;
  width: 390px;
  height: 844px;
  max-height: 92vh;
  background: var(--bg);
  border-radius: 54px;
  border: 10px solid #0B1418;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.phone__notch {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 120px; height: 28px;
  background: #0B1418;
  border-radius: 0 0 18px 18px;
  z-index: 50;
}
.app {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  position: relative;
}
.app::-webkit-scrollbar { display: none; }

.tabbar {
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: var(--sp-2) var(--sp-3) calc(var(--sp-2) + env(safe-area-inset-bottom, 0px));
  gap: var(--sp-1);
}

/* Edge-to-edge on narrow / actual-mobile viewports: behave like a real WebView, no bezel */
@media (max-width: 520px), (max-height: 600px) {
  #stage { padding: 0; }
  .phone {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  .phone__notch { display: none; }
}
