@font-face {
  font-family: Inter;
  src: url("fonts/Inter-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #07070a;
  --bg-2: #0d0e14;
  --text: #f5f6fa;
  --muted: #9aa3b8;
  --faint: #6b7387;
  --lime: #c8ff4a;
  --mint: #3effc5;
  --violet: #8b7cff;
  --pink: #ff5ca8;
  --danger: #ff7a7a;
  --ok: #3effc5;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-2: rgba(255, 255, 255, 0.09);
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-2: rgba(255, 255, 255, 0.16);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --nav-h: 72px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: Inter, "IBM Plex Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  font-weight: 430;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }

.app-root {
  min-height: 100%;
  height: 100dvh;
  display: flex;
  justify-content: center;
  background:
    radial-gradient(900px 520px at 0% -10%, rgba(139, 124, 255, 0.28), transparent 55%),
    radial-gradient(700px 480px at 110% 0%, rgba(200, 255, 74, 0.14), transparent 50%),
    radial-gradient(800px 500px at 50% 120%, rgba(62, 255, 197, 0.1), transparent 50%),
    var(--bg);
}
.app-shell {
  width: 100%;
  max-width: 440px;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
}
@media (min-width: 520px) {
  .app-shell {
    border-color: var(--stroke);
    background: rgba(7, 7, 10, 0.55);
    box-shadow: var(--shadow);
  }
}

/* screens */
.screen {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}
.screen.is-on { display: flex; }
.screen-body {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(18px + var(--safe-top)) 18px calc(var(--nav-h) + var(--safe-bot) + 18px);
}
.screen-body.no-nav { padding-bottom: calc(28px + var(--safe-bot)); }

/* typography */
.kicker {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lime);
}
h1 {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin: 8px 0 10px;
}
h2 {
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.03em;
}
.lede, .muted { color: var(--muted); }
.tiny { font-size: 0.75rem; color: var(--faint); line-height: 1.45; }
.disclaimer {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(139, 124, 255, 0.08);
  border: 1px solid rgba(139, 124, 255, 0.18);
  color: var(--muted);
  font-size: 0.75rem;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  transition: transform 0.12s ease, filter 0.12s ease, background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-lime {
  background: var(--lime);
  color: #0b0d08;
  box-shadow: 0 8px 28px rgba(200, 255, 74, 0.28);
}
.btn-lime:hover { filter: brightness(1.05); }
.btn-ghost {
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--stroke-2);
}
.btn-danger {
  background: rgba(255, 122, 122, 0.12);
  color: var(--danger);
  border: 1px solid rgba(255, 122, 122, 0.25);
}
.btn-row { display: grid; gap: 10px; margin-top: 16px; }
.btn:disabled { opacity: 0.45; pointer-events: none; }

/* forms */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke-2);
  border-radius: 16px;
  padding: 13px 14px;
  outline: none;
  color: var(--text);
  caret-color: var(--lime);
}
.field input[type=number]::-webkit-outer-spin-button,
.field input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: rgba(200, 255, 74, 0.7);
  box-shadow: 0 0 0 3px rgba(200, 255, 74, 0.12);
}
.field textarea { min-height: 120px; resize: vertical; }
.prefix-input { position: relative; }
.prefix-input span {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 650;
}
.prefix-input input { padding-left: 28px; }

/* cards */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.card + .card { margin-top: 12px; }

/* onboarding */
.onboard-mark { display: flex; align-items: center; gap: 10px; margin: 8px 0 28px; }
.onboard-mark .word { font-weight: 700; letter-spacing: -0.04em; font-size: 1.15rem; }
.onboard-mark .word em { font-style: normal; color: var(--lime); }

/* dashboard clock */
.hero-clock {
  display: grid;
  place-items: center;
  padding: 8px 0 6px;
}
.clock {
  width: 236px;
  height: 236px;
  position: relative;
}
.clock svg { width: 236px; height: 236px; transform: rotate(-90deg); }
.clock .num {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.clock .num strong {
  font-size: 5.1rem;
  font-weight: 800;
  letter-spacing: -0.07em;
  line-height: 0.85;
  background: linear-gradient(160deg, #f8ffe8 10%, #c8ff4a 45%, #3effc5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}
.clock .num em {
  margin-top: 6px;
  font-style: normal;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.02em;
}
.goal-name { text-align: center; margin-bottom: 4px; }
.goal-name h2 { font-size: 1.05rem; }
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 8px 0 14px;
}
.stat b {
  display: block;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.stat span { font-size: 0.75rem; color: var(--muted); }
.ticks { display: flex; gap: 5px; margin-top: 8px; }
.ticks i {
  width: 18px;
  height: 5px;
  border-radius: 99px;
  background: rgba(255,255,255,0.1);
  display: block;
}
.ticks i.on { background: var(--lime); box-shadow: 0 0 8px rgba(200,255,74,0.5); }

.activity { list-style: none; }
.activity li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--stroke);
  font-size: 0.9rem;
}
.activity .ok { color: var(--mint); font-weight: 650; }
.section-label {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 18px 0 8px;
}

/* leaks list */
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.chip-btn {
  border: 1px solid var(--stroke-2);
  background: var(--glass);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 650;
}
.chip-btn.is-on { color: #0b0d08; background: var(--lime); border-color: var(--lime); }
.leak {
  width: 100%;
  text-align: left;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 10px;
  color: inherit;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.leak:active { transform: scale(0.99); }
.leak .row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.leak .name { font-weight: 700; letter-spacing: -0.02em; }
.leak .amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.leak .meta { font-size: 0.78rem; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.leak .days { color: var(--mint); font-weight: 650; font-size: 0.8rem; margin-top: 6px; }
.tag {
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 7px;
  white-space: nowrap;
}
.tag-open { color: #ffb3a0; background: rgba(255, 122, 122, 0.12); }
.tag-proved { color: var(--mint); background: rgba(62, 255, 197, 0.12); }
.tag-sample { color: var(--violet); background: rgba(139, 124, 255, 0.16); }

.fab-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

/* letter */
.letter {
  background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03));
  border: 1px solid var(--stroke);
  border-radius: 22px;
  padding: 20px 18px;
}
.letter .date { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.letter h3 {
  font-size: 1.45rem;
  letter-spacing: -0.04em;
  margin: 8px 0 14px;
}
.letter p { margin-bottom: 10px; color: #d8dbe6; font-size: 0.95rem; }
.letter .sign { color: var(--lime); font-weight: 650; }

/* settings list */
.setting {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--stroke);
  padding: 14px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: inherit;
  font-weight: 600;
}
.setting:first-child { border-top: 0; }
.setting span { color: var(--muted); font-weight: 500; font-size: 0.85rem; }

/* bottom nav */
.tabbar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(10px + var(--safe-bot));
  height: 62px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 6px;
  border-radius: 22px;
  background: rgba(16, 17, 24, 0.78);
  border: 1px solid var(--stroke-2);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  z-index: 20;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
.tabbar button {
  border: 0;
  background: transparent;
  color: var(--faint);
  border-radius: 16px;
  font-size: 0.65rem;
  font-weight: 650;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.tabbar button svg { width: 20px; height: 20px; }
.tabbar button.is-on {
  color: var(--text);
  background: rgba(200, 255, 74, 0.14);
  color: var(--lime);
}

/* overlays */
.overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 30;
  background:
    radial-gradient(700px 400px at 100% 0%, rgba(200, 255, 74, 0.1), transparent 50%),
    var(--bg);
  flex-direction: column;
  overflow: hidden;
}
.overlay.is-on { display: flex; }
.overlay-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + var(--safe-top)) 14px 8px;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--stroke-2);
  background: var(--glass);
  color: var(--text);
  display: grid;
  place-items: center;
  flex: none;
}
.overlay .screen-body { padding-top: 8px; }

/* toast */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(88px + var(--safe-bot));
  transform: translateX(-50%) translateY(16px);
  background: #16171f;
  border: 1px solid var(--stroke-2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 40;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* proof preview */
.proof-preview {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  margin-top: 8px;
}

.script-box {
  white-space: pre-wrap;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #e6e8f0;
  background: rgba(0,0,0,0.28);
  border-radius: 16px;
  padding: 14px;
  border: 1px solid var(--stroke);
  min-height: 180px;
}

.hidden { display: none !important; }
.empty {
  text-align: center;
  padding: 32px 12px;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
