/* ==========================================================================
   Base / reset — tuned for iPhone Safari + standalone PWA
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html, body {
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

/* Only inputs may be selected/zoom-free */
body { -webkit-user-select: none; user-select: none; }
input, textarea { -webkit-user-select: text; user-select: text; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

svg { display: block; }

::-webkit-scrollbar { width: 0; height: 0; }

/* --- App frame ----------------------------------------------------------- */

.app {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg);
  overflow-x: hidden;
}

/* On wide screens, frame the phone-width column */
@media (min-width: 620px) {
  body { background: var(--surface-3); }
  .app {
    box-shadow: var(--shadow-lg);
    min-height: 100dvh;
  }
}

.screen {
  padding: 0 var(--pad);
  padding-top: calc(var(--safe-top) + 8px);
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 28px);
  animation: screen-in var(--med) var(--ease) both;
}

/* Screens with a sticky action bar need room for it as well as the tab bar. */
.screen--bar {
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 106px);
}

/* NB: opacity-only on purpose. A `transform` here (even an identity one left
   behind by animation-fill-mode) would make .screen a containing block and
   break `position: fixed` for the action bar nested inside it. */
@keyframes screen-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.boot {
  display: grid;
  place-items: center;
  height: 100dvh;
}
.boot__mark {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: var(--text-3);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* --- Typography ---------------------------------------------------------- */

.h1 { font-size: 32px; font-weight: 780; letter-spacing: -0.02em; line-height: 1.12; }
.h2 { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.h3 { font-size: 17px; font-weight: 640; letter-spacing: -0.005em; }
.body { font-size: 15px; }
.sub { font-size: 14px; color: var(--text-2); }
.cap {
  font-size: 11px;
  font-weight: 680;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
}
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.mono-num { font-variant-numeric: tabular-nums; }

/* --- Utilities ----------------------------------------------------------- */

.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.stack { display: flex; flex-direction: column; }
.grow { flex: 1 1 auto; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.accent { color: var(--accent); }
.hidden { display: none !important; }

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