/* T minus 90 web app — design tokens from docs/concept.html / Theme.swift */

:root {
  --paper: #F5F1E8;
  --paper-dark: #EDE7D8;
  --coral: #F26D5B;
  --coral-deep: #D9503E;
  --sky: #6BBAEC;
  --sky-deep: #4A9AD0;
  --leaf: #58A05C;
  --leaf-deep: #3F7F44;
  --leaf-light: #7FC383;
  --ink: #2B2620;
  --ink-soft: #6B6355;
  --card: #FFFDF7;
  --display: 'Fraunces', 'New York', Georgia, serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; color: var(--ink); }
input:focus, textarea:focus { outline: 2px solid var(--sky-deep); outline-offset: 1px; }

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen-body { flex: 1; padding: 0 22px 110px; }

/* ---------- The concept's card look: 2px ink border, hard offset shadow ---------- */

.paper-card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: 4px 4px 0 rgba(43, 38, 32, 0.15);
}

/* ---------- Type ---------- */

.display { font-family: var(--display); font-weight: 900; letter-spacing: -0.01em; }
.screen-title { font-family: var(--display); font-weight: 900; font-size: 38px; line-height: 1.05; padding-top: 22px; }
.screen-sub { font-size: 14px; font-weight: 600; color: var(--ink-soft); margin-top: 4px; }
.card-title { font-family: var(--display); font-weight: 800; font-size: 19px; }
.mini-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-soft);
}

/* ---------- Mission Control ---------- */

.mission-eyebrow {
  text-align: center; font-size: 12px; font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-soft); padding-top: 26px;
}
.tminus-dial {
  font-family: var(--display); font-weight: 900; font-size: 84px; line-height: 1;
  color: var(--coral); text-align: center; margin-top: 6px;
  text-shadow: 3px 3px 0 rgba(217, 80, 62, 0.18);
}
.day-count { text-align: center; font-size: 14px; font-weight: 600; color: var(--ink-soft); margin: 4px 0 18px; }

.quest-card {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 16px; margin-bottom: 12px; text-align: left;
  border-radius: 16px; transition: transform 0.12s ease;
}
.quest-card:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 rgba(43, 38, 32, 0.15); }
.quest-dot {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; font-weight: 800;
  transition: background 0.2s ease;
}
.quest-dot.work { background: var(--coral); }
.quest-dot.life { background: var(--sky); }
.quest-dot.done { background: var(--leaf); }
.quest-title { font-size: 16px; font-weight: 700; }
.quest-sub { font-size: 13px; color: var(--ink-soft); }

.fuel-labels { display: flex; justify-content: space-between; margin: 14px 0 6px; }
.fuel-bar {
  height: 16px; border: 2px solid var(--ink); border-radius: 99px;
  background: var(--card); overflow: hidden;
}
.fuel-fill {
  height: 100%; border-radius: 99px; min-width: 14px;
  background: linear-gradient(90deg, var(--leaf), var(--leaf-light));
  transition: width 0.3s ease;
}

.sideline {
  margin-top: 16px; font-size: 14px; font-style: italic; font-weight: 500;
  color: var(--ink-soft); border-left: 3px solid var(--coral);
  padding-left: 12px; border-radius: 2px;
}
.sideline .from-you {
  display: block; font-style: normal; font-size: 12px; font-weight: 700;
  color: var(--coral-deep); margin-top: 4px;
}

.note-field {
  width: 100%; margin-top: 16px; padding: 14px; font-size: 14px;
  border-radius: 14px; resize: none; background: var(--card);
  border: 2px solid var(--ink); box-shadow: 4px 4px 0 rgba(43, 38, 32, 0.15);
}

/* ---------- Mission Log ---------- */

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 14px 0; font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
  border: 1px solid rgba(43, 38, 32, 0.25);
}

.log-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px;
  padding: 16px;
}
.day-cell {
  position: relative; height: 40px; border-radius: 8px;
  border: 1px solid rgba(43, 38, 32, 0.15);
  font-size: 12px; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  background: var(--card); padding: 0;
}
.day-cell.full { background: var(--leaf); color: #fff; }
.day-cell.partial { background: rgba(88, 160, 92, 0.4); }
.day-cell.missed { background: rgba(242, 109, 91, 0.3); }
.day-cell.today { border: 2px solid var(--ink); font-weight: 900; }
.day-cell.future { background: var(--paper-dark); color: rgba(107, 99, 85, 0.5); cursor: default; }
.day-cell .note-dot {
  position: absolute; top: 3px; right: 3px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--sky);
}

/* ---------- Modal (day detail / archived report) ---------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(43, 38, 32, 0.45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 40;
}
.modal-sheet {
  background: var(--paper); border-radius: 24px 24px 0 0; width: 100%;
  max-width: 480px; max-height: 86vh; overflow-y: auto; padding: 24px 22px 34px;
  border-top: 2px solid var(--ink);
}
.modal-grab { width: 40px; height: 5px; border-radius: 3px; background: rgba(43, 38, 32, 0.25); margin: 0 auto 16px; }

.detail-quest { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 15px; font-weight: 600; }
.detail-check { font-size: 18px; }

/* ---------- Side missions ---------- */

.side-chip {
  display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 16px;
  padding: 12px 14px; border-radius: 14px; font: inherit; font-size: 15px; color: var(--ink); text-align: left; cursor: pointer;
}
.side-chip__icon { color: var(--coral-deep); font-weight: 800; }
.side-chip__count { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.side-chip__count.is-late { color: var(--coral-deep); }
.side-link {
  display: block; margin: 18px auto 0; background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 800; color: var(--coral-deep);
}
.side-sheet { max-width: 560px; }
.side-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.side-done { background: none; border: 0; font: inherit; font-weight: 800; font-size: 15px; color: var(--coral-deep); cursor: pointer; }
.side-hint { font-size: 13px; color: var(--ink-soft); margin: 8px 0 10px; line-height: 1.45; }
.side-add { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; margin: 10px 0 8px; }
.side-add > span { color: var(--coral); font-weight: 900; font-size: 18px; }
.side-input {
  width: 100%; border: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ink); padding: 6px 2px;
}
.side-input:focus { outline: none; }
.side-card textarea.side-input { border-top: 1px solid rgba(43, 38, 32, 0.12); margin-top: 6px; resize: vertical; }
.side-card input[type="date"], .side-card input[type="datetime-local"] {
  border: 2px solid rgba(43, 38, 32, 0.2); border-radius: 10px; padding: 8px 10px; margin: 2px 0 8px; background: var(--card);
}
.side-card { padding: 12px 14px; border-radius: 14px; margin: 12px 0; }
.side-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; font-weight: 700; font-size: 15px; }
.side-toggle input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--coral-deep); }
.side-select { font: inherit; font-size: 14px; padding: 6px 8px; border-radius: 10px; border: 2px solid rgba(43, 38, 32, 0.2); background: var(--card); }
.side-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(43, 38, 32, 0.1); }
.side-check {
  flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--ink); background: var(--card);
  color: #fff; font-weight: 900; font-size: 13px; line-height: 1; cursor: pointer; margin-top: 1px;
}
.side-row.is-done .side-check { background: var(--leaf); border-color: var(--leaf); }
.side-row__main { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: var(--ink); cursor: pointer; }
.side-row__title { display: block; font-size: 15px; font-weight: 700; }
.side-row.is-done .side-row__title { text-decoration: line-through; color: var(--ink-soft); }
.side-row__detail { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-top: 2px; }
.side-row__detail.is-late { color: var(--coral-deep); }
.side-row__detail.is-done { color: var(--leaf); }
.side-row__notes { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 2px; white-space: pre-line; }
.side-fold {
  display: block; margin: 16px 0 4px; background: none; border: 0; font: inherit; font-size: 12px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); cursor: pointer;
}
.side-cal { margin-top: 14px; }
.side-delete { margin-top: 8px; color: var(--coral-deep); }

/* ---------- Debrief ---------- */

.debrief-card { padding: 18px; margin-top: 16px; }
.fuel-chart { width: 100%; height: auto; display: block; margin-top: 8px; }

.week-grid { display: grid; gap: 6px; margin-top: 10px; align-items: center; }
.week-grid .wg-head { font-size: 10px; font-weight: 700; text-align: center; color: var(--ink-soft); }
.week-grid .wg-head.today { color: var(--ink); }
.week-grid .wg-label { font-size: 12px; font-weight: 800; }
.wg-cell {
  height: 30px; border-radius: 7px; border: 1px solid rgba(43, 38, 32, 0.15);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 800; background: var(--paper-dark);
}
.wg-cell.future { background: var(--card); }
.wg-cell.today { border: 2px solid var(--ink); }
.wg-cell.done.work { background: var(--coral); }
.wg-cell.done.life { background: var(--sky); }

.stat-chips { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.stat-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; padding: 5px 10px;
  border-radius: 99px; background: var(--paper);
  border: 1px solid rgba(43, 38, 32, 0.2);
}
.stat-chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.rhythm-row { margin-top: 10px; }
.rhythm-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 800; }
.rhythm-count { font-size: 11px; font-weight: 600; color: var(--ink-soft); }
.bucket-bar {
  display: flex; gap: 2px; height: 14px; margin-top: 5px; padding: 1px;
  background: var(--paper); border-radius: 5px;
  border: 1px solid rgba(43, 38, 32, 0.2);
}
.bucket-bar i { border-radius: 4px; min-width: 8px; }
.bucket-legend { display: flex; gap: 12px; margin-top: 10px; font-size: 10.5px; font-weight: 700; color: var(--ink-soft); }
.bucket-legend span { display: inline-flex; align-items: center; gap: 4px; }
.bucket-legend i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.bucket-morning { background: var(--sky); }
.bucket-afternoon { background: var(--leaf); }
.bucket-evening { background: var(--coral); }
.bucket-night { background: var(--ink-soft); }

.insight {
  margin-top: 12px; font-size: 13px; font-style: italic; font-weight: 500;
  color: var(--ink-soft); border-left: 3px solid var(--leaf);
  padding-left: 10px; border-radius: 2px;
}

.field-label { font-size: 12px; font-weight: 700; color: var(--ink-soft); margin: 12px 0 5px; }
.field-label.work { color: var(--coral); }
.field-label.life { color: var(--sky-deep); }
.text-input, .text-area {
  width: 100%; padding: 10px 12px; font-size: 14px; border-radius: 10px;
  background: var(--paper); border: 1.5px solid rgba(43, 38, 32, 0.35);
}
.text-area { resize: vertical; min-height: 56px; }

.cta {
  display: block; width: 100%; margin-top: 14px; padding: 13px;
  font-size: 15px; font-weight: 800; color: var(--card);
  background: var(--coral); border: none; border-radius: 99px;
  box-shadow: 3px 3px 0 rgba(43, 38, 32, 0.25); transition: transform 0.12s ease;
}
.cta:active { transform: translate(2px, 2px); box-shadow: none; }
.cta:disabled { background: rgba(107, 99, 85, 0.4); box-shadow: none; cursor: default; }
.cta.leaf { background: var(--leaf); }
.cta.ghost {
  background: var(--card); color: var(--ink); border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(43, 38, 32, 0.15);
}

.past-debrief { padding: 14px; margin-top: 10px; border-radius: 14px; }
.past-debrief .week-tag { font-size: 11px; font-weight: 800; color: var(--coral-deep); }
.past-debrief p { font-size: 13px; margin-top: 4px; }
.past-debrief p.change { color: var(--ink-soft); }

/* ---------- Ritual ---------- */

.ritual-step { padding-top: 30px; }
.step-pill {
  display: inline-block; background: var(--card); border: 2px solid var(--ink);
  border-radius: 999px; padding: 5px 18px; font-family: var(--display);
  font-weight: 600; font-size: 14px; margin-bottom: 12px;
}
.ritual-big {
  font-family: var(--display); font-weight: 900; font-size: 44px; line-height: 1;
}
.ritual-big.reflect { color: var(--coral); text-shadow: 3px 3px 0 rgba(217, 80, 62, 0.18); }
.ritual-big.align { color: var(--sky); text-shadow: 3px 3px 0 rgba(74, 154, 208, 0.22); }
.ritual-big.plan { color: var(--leaf); text-shadow: 3px 3px 0 rgba(63, 127, 68, 0.2); }
.ritual-lead { font-size: 15px; color: var(--ink-soft); margin: 10px 0 20px; }

.slider-row { margin-bottom: 14px; }
.slider-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.slider-score { font-family: var(--display); font-weight: 900; color: var(--coral-deep); }
input[type='range'] { width: 100%; accent-color: var(--coral); height: 28px; }

.ritual-nav { display: flex; gap: 10px; margin-top: 24px; }
.ritual-nav .cta { margin-top: 0; }
.ritual-nav .back { flex: 0 0 90px; }

.welcome-hero { text-align: center; padding-top: 60px; }
.welcome-hero .t90 {
  font-family: var(--display); font-weight: 900; font-size: 72px; line-height: 0.95;
  color: var(--coral); text-shadow: 4px 4px 0 rgba(217, 80, 62, 0.18);
}
.welcome-hero .sub { font-family: var(--display); font-weight: 600; font-size: 22px; margin-top: 8px; }
.welcome-hero p { font-size: 15px; color: var(--ink-soft); max-width: 320px; margin: 18px auto 0; }

/* ---------- Launch Day / Report ---------- */

.launch-hero { text-align: center; padding-top: 48px; position: relative; }
.launch-rocket { font-size: 84px; line-height: 1; display: inline-block; animation: rocket-rise 2.4s ease-in-out infinite alternate; }
@keyframes rocket-rise { from { transform: translateY(6px); } to { transform: translateY(-10px); } }
.launch-title { font-family: var(--display); font-weight: 900; font-size: 52px; color: var(--coral); text-shadow: 3px 3px 0 rgba(217, 80, 62, 0.18); margin-top: 12px; }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 30; }
.confetti i {
  position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px;
  animation: confetti-fall linear infinite;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(720deg); }
}

.report-stat-row { display: flex; gap: 10px; margin-top: 14px; }
.report-stat { flex: 1; text-align: center; padding: 12px 6px; border-radius: 14px; }
.report-stat .num { font-family: var(--display); font-weight: 900; font-size: 26px; }
.report-stat .lbl { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.report-stat.full .num { color: var(--leaf-deep); }
.report-stat.partial .num { color: var(--sky-deep); }
.report-stat.missed .num { color: var(--coral-deep); }

.area-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; margin-top: 10px; }
.area-name { font-size: 13px; font-weight: 600; }
.area-delta { font-size: 12px; font-weight: 800; }
.area-delta.up { color: var(--leaf-deep); }
.area-delta.down { color: var(--coral-deep); }
.area-delta.flat { color: var(--ink-soft); }
.area-bars { grid-column: 1 / -1; display: flex; gap: 4px; align-items: center; }
.area-bar-track { flex: 1; height: 8px; border-radius: 4px; background: var(--paper-dark); position: relative; }
.area-bar-track i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
.area-bar-track .before { background: rgba(107, 99, 85, 0.45); }
.area-bar-track .after { background: var(--leaf); }
.area-bar-tag { font-size: 10px; font-weight: 700; color: var(--ink-soft); width: 42px; }

.vision-quote {
  margin-top: 16px; padding: 16px; font-family: var(--display); font-size: 16px;
  font-weight: 600; font-style: italic; border-radius: 14px;
}
.report-footer { text-align: center; margin-top: 20px; font-size: 12px; font-weight: 700; color: var(--ink-soft); }

/* ---------- Archive ---------- */

.archive-card { width: 100%; text-align: left; padding: 16px; margin-top: 14px; }
.archive-name { font-family: var(--display); font-weight: 900; font-size: 22px; }
.archive-dates { font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-top: 2px; }
.archive-stats { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; font-weight: 700; }
.archive-stats b { font-family: var(--display); font-size: 16px; }
.archive-delete {
  margin-top: 10px; background: none; border: none; color: var(--coral-deep);
  font-size: 12px; font-weight: 700; padding: 0;
}

/* ---------- Tab bar ---------- */

.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: center; gap: 4px;
  background: var(--card); border-top: 2px solid var(--ink);
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
}
.tab-btn {
  flex: 1; max-width: 110px; background: none; border: none;
  font-size: 11px; font-weight: 700; color: var(--ink-soft);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border-radius: 12px;
}
.tab-btn .icon { font-size: 20px; }
.tab-btn.active { color: var(--coral-deep); background: var(--paper); }

/* ---------- Demo tools ---------- */

.demo-bar {
  /* below the Buddy System bar, which sits on top */
  position: fixed; top: calc(56px + env(safe-area-inset-top)); right: 10px; z-index: 50;
}
.sample-note { padding: 14px 16px; margin-bottom: 16px; font-size: 14px; line-height: 1.5; }
.demo-toggle {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 rgba(43, 38, 32, 0.2); font-size: 16px;
}
.demo-panel {
  position: absolute; top: 44px; right: 0; width: 230px; padding: 14px;
  border-radius: 14px; font-size: 12px;
}
.demo-panel .row { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.demo-panel button {
  background: var(--paper); border: 1.5px solid var(--ink); border-radius: 8px;
  font-size: 12px; font-weight: 700; padding: 4px 9px;
}
.demo-panel button.danger { color: var(--coral-deep); border-color: var(--coral-deep); }

@media (min-width: 700px) {
  .app-shell { border-left: 2px solid rgba(43, 38, 32, 0.12); border-right: 2px solid rgba(43, 38, 32, 0.12); }
}
