/* ═══════════════════════════════════════════════════════════════════════
   sway — house pour theme (Lucian Labs web family, shared with drinktix)
   Ivory paper, warm charcoal ink, champagne-gold accents; Cormorant
   Garamond for display, Avenir Next for UI, Kaushan Script for the brand.
   All fonts vendored — no CDN, nothing leaves the browser.
   ═══════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Kaushan Script';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url(../vendor/fonts/kaushan-script.ttf) format('truetype');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(../vendor/fonts/cormorant-garamond.woff2) format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic; font-weight: 500; font-display: swap;
  src: url(../vendor/fonts/cormorant-garamond-italic.woff2) format('woff2');
}

:root {
  --paper: #f7f5ef;
  --paper-2: #f1eee6;
  --panel: #fffefa;
  --ink: #262319;
  --muted: #71695a;
  --faint: #a79f8d;
  --line: rgba(38, 35, 25, 0.11);
  --line-2: rgba(38, 35, 25, 0.2);

  --gold: #a4813b;
  --gold-2: #c9a961;
  --gold-soft: rgba(164, 129, 59, 0.14);
  --purple: #8f6fc7;

  --good: #3c7a52;
  --bad: #a03d38;
  --warn: #a4813b;

  --radius: 16px;
  --r2: 11px;

  --font-display: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  --font-ui: 'Avenir Next', 'Avenir', -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-brand: 'Kaushan Script', cursive;

  font-size: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; overscroll-behavior: none; }
body {
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---- shell ------------------------------------------------------------ */
.app { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 18px max(22px, env(safe-area-inset-left)) 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(var(--panel), var(--paper));
  position: relative; z-index: 3;
}
.brand {
  font-family: var(--font-brand);
  font-size: 30px; line-height: 1;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.brand .y { color: var(--purple); }
.tagline {
  font-family: var(--font-display); font-style: italic;
  font-size: 15px; color: var(--faint);
}
.topbar nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  font: 500 13.5px var(--font-ui);
  color: var(--muted);
  text-decoration: none;
  padding: 7px 13px; border-radius: 999px;
  border: 1px solid transparent;
  transition: 0.15s;
}
.tab:hover { color: var(--ink); border-color: var(--line-2); }
.tab.on { color: var(--ink); background: var(--gold-soft); border-color: rgba(164, 129, 59, 0.4); }

main { flex: 1; display: flex; flex-direction: column; position: relative; }

/* ---- home ------------------------------------------------------------- */
.home {
  flex: 1; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  cursor: default; user-select: none; -webkit-user-select: none;
  touch-action: pan-x; /* vertical swipes are ours */
}
.home canvas.art {
  position: absolute; inset: 0; width: 100%; height: 100%;
  transition: opacity 3s ease-in-out;
  pointer-events: none;
}
.home .word {
  position: relative; z-index: 2;
  max-width: 620px; padding: 0 26px;
  font-family: var(--font-display);
  font-size: clamp(27px, 4.6vw, 40px);
  font-weight: 500; font-style: italic;
  text-align: center; line-height: 1.32;
  color: var(--ink);
  transition: opacity 3s ease-in-out;
  pointer-events: none;
}
.home .word.fading { opacity: 0; }
.home .gotthis {
  position: absolute; bottom: 12px; left: 0; right: 0;
  text-align: center; font-size: 12.5px; color: var(--faint);
  pointer-events: none; z-index: 2;
}
.home .hint {
  position: absolute; top: 14px; left: 0; right: 0;
  text-align: center; font-size: 11.5px; color: var(--faint);
  opacity: 0.8; pointer-events: none; z-index: 2;
}

/* ---- shared page container -------------------------------------------- */
.page {
  width: 100%; max-width: 760px;
  margin: 0 auto;
  padding: 26px max(20px, env(safe-area-inset-left)) 70px;
}
.eyebrow {
  font: 600 11px var(--font-ui);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 6px;
}
h1.display, h2.display {
  font-family: var(--font-display);
  font-weight: 600; line-height: 1.15;
  margin: 0 0 8px;
}
h1.display { font-size: 34px; }
h2.display { font-size: 26px; }
.sub { color: var(--muted); font-size: 14.5px; margin: 0 0 16px; }
.hint { color: var(--faint); font-size: 12.5px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 26px 22px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 10px 30px -18px rgba(38, 35, 25, 0.35);
}

/* ---- buttons ----------------------------------------------------------- */
.btn {
  font: 600 14.5px var(--font-ui);
  color: var(--panel); background: var(--gold);
  border: 0; border-radius: 12px;
  padding: 12px 24px; cursor: pointer;
  transition: 0.15s;
}
.btn:hover { background: #8f7134; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line-2);
}
.btn.ghost:hover { color: var(--ink); }
.nav-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }

/* ---- practices: the deck ---------------------------------------------- */
.section-title {
  font: 600 11.5px var(--font-ui);
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--gold);
  margin: 30px 0 4px;
}
.section-blurb { color: var(--faint); font-size: 13px; margin: 0 0 14px; }
.deck {
  display: grid; gap: 16px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 900px) { .deck { grid-template-columns: repeat(4, 1fr); } }

.tcard {
  aspect-ratio: 0.66;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 8px;
  cursor: pointer;
  display: flex; flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 6px 18px -12px rgba(38, 35, 25, 0.4);
  text-align: center;
}
.tcard:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -14px rgba(38, 35, 25, 0.45); }
.tcard .inner {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  border: 1px solid rgba(164, 129, 59, 0.35);
  border-radius: 9px;
  padding: 12px 10px 12px;
}
.tcard .kicker {
  font: 600 8.5px var(--font-ui);
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold-2);
}
.tcard canvas { width: 100%; flex: 1; min-height: 0; }
.tcard .t {
  font-family: var(--font-display);
  font-size: 16.5px; font-weight: 600; line-height: 1.2;
  color: var(--ink);
}
.tcard .m { font: 400 10px var(--font-mono); color: var(--faint); margin-top: 4px; }

/* ---- player ------------------------------------------------------------ */
.player .objective {
  font-family: var(--font-display); font-size: 18px; font-style: italic;
  color: var(--muted); line-height: 1.4; margin: 4px 0 18px;
}
.player .stepbox { min-height: 130px; display: flex; flex-direction: column; justify-content: center; }
.player .steptext {
  font-family: var(--font-display);
  font-size: 23px; font-weight: 500; line-height: 1.35; color: var(--ink);
}
.player textarea { margin-top: 14px; }
.player .round { font: 400 11.5px var(--font-mono); color: var(--faint); margin-top: 10px; }
.timer {
  margin: 16px auto 0; width: 74px; height: 74px; position: relative;
}
.timer svg { transform: rotate(-90deg); }
.timer .n {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font: 500 22px var(--font-mono); color: var(--gold);
}
.orb-wrap { display: flex; justify-content: center; margin: 18px 0 6px; }
.orb {
  width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--gold-2), var(--gold));
  opacity: 0.85; transform: scale(0.72);
  transition: transform 3.5s ease-in-out;
}
.orb.in { transform: scale(1.15); }
.done-marker {
  font-family: var(--font-display); font-style: italic;
  font-size: 19px; color: var(--good); line-height: 1.4;
}

/* ---- pips / steps ------------------------------------------------------ */
.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.pip { flex: 1; height: 3px; border-radius: 3px; background: var(--line); transition: 0.3s; }
.pip.done { background: var(--gold-soft); }
.pip.cur { background: var(--gold-2); }

/* ---- forms ------------------------------------------------------------- */
label.f {
  display: block;
  font: 600 12.5px var(--font-ui);
  color: var(--muted); margin: 16px 0 6px;
}
textarea, input[type="date"] {
  width: 100%;
  font: 400 15px var(--font-ui);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r2);
  padding: 12px 14px;
  resize: vertical; min-height: 64px;
}
input[type="date"] { min-height: 0; }
textarea:focus, input:focus { outline: 2px solid rgba(164, 129, 59, 0.4); border-color: var(--gold-2); }
textarea::placeholder { color: var(--faint); }

.slider .row { display: flex; justify-content: space-between; align-items: baseline; }
.slider .val { font: 500 22px var(--font-mono); color: var(--gold); }
.slider .val.amber { color: var(--purple); }
.slider input[type="range"] { width: 100%; accent-color: var(--gold); }
.slider input[type="range"].amber { accent-color: var(--purple); }
.slider .ticks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--faint); }

/* ---- defuse flow bits -------------------------------------------------- */
.reframe {
  background: var(--paper-2);
  border-left: 2.5px solid var(--gold);
  border-radius: 0 var(--r2) var(--r2) 0;
  padding: 14px 16px;
  font-family: var(--font-display); font-size: 18px; line-height: 1.45;
}
.reframe .stem { color: var(--gold); font-style: italic; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0 4px; }
.choice button {
  font: inherit; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--r2); padding: 14px 16px;
}
.choice button.on { border-color: var(--gold); background: var(--gold-soft); }
.choice .t { display: block; font-weight: 600; font-size: 14.5px; }
.choice .d { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.delta {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  margin: 18px 0 6px; text-align: center;
}
.delta .n { font: 500 30px var(--font-mono); display: block; }
.delta .from { color: var(--faint); }
.delta .to { color: var(--gold); }
.delta .lab { font-size: 11px; color: var(--faint); }
.delta .arrow { color: var(--faint); font-size: 20px; }
.dropline { text-align: center; color: var(--muted); font-size: 13.5px; }
.dropline b { color: var(--gold); }

/* ---- ledger ------------------------------------------------------------ */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r2); padding: 14px; text-align: center;
}
.stat .n { font: 500 26px var(--font-mono); }
.stat .l { font-size: 11px; color: var(--faint); letter-spacing: 0.04em; }
.verdict {
  background: var(--gold-soft); border: 1px solid rgba(164, 129, 59, 0.3);
  border-radius: var(--r2); padding: 13px 16px;
  font-size: 13.5px; color: var(--ink); margin-bottom: 16px;
}
.verdict b { color: var(--gold); }
.entry {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r2); padding: 15px 17px; margin-bottom: 12px;
}
.entry.due { border-color: var(--gold-2); box-shadow: 0 0 0 2.5px var(--gold-soft); }
.entry .top { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; }
.entry .thought { font-family: var(--font-display); font-size: 17px; font-weight: 500; line-height: 1.35; }
.badge {
  flex: none; font: 600 10.5px var(--font-ui); letter-spacing: 0.06em;
  border-radius: 999px; padding: 4px 10px;
}
.badge.open { background: var(--paper-2); color: var(--muted); }
.badge.didnt { background: rgba(60, 122, 82, 0.14); color: var(--good); }
.badge.partly { background: var(--gold-soft); color: var(--gold); }
.badge.happened { background: rgba(160, 61, 56, 0.12); color: var(--bad); }
.entry .meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11.5px; color: var(--faint); margin-top: 6px; }
.entry .meta .pred { color: var(--purple); }
.resolve { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.resolve button {
  font: 600 12px var(--font-ui); cursor: pointer;
  background: var(--paper-2); color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 13px;
}
.resolve button:hover { color: var(--ink); border-color: var(--gold-2); }
.exp summary { cursor: pointer; font-size: 12.5px; color: var(--gold); margin-top: 10px; }
.exp .kv { font-size: 13px; color: var(--muted); margin-top: 6px; }
.exp .kv b { color: var(--ink); font-weight: 600; }
.empty { text-align: center; color: var(--faint); padding: 40px 0; }
.datarow { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }
.datarow button {
  font: 600 12.5px var(--font-ui); cursor: pointer;
  background: transparent; color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 15px;
}
.datarow button:hover { color: var(--ink); }
.datarow button.danger:hover { color: var(--bad); border-color: var(--bad); }

/* ---- about ------------------------------------------------------------- */
.about .brandline { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.about .brandline .brand { font-size: 40px; }
.note-row { display: flex; gap: 13px; margin: 16px 0; }
.note-row .ic { flex: none; width: 20px; color: var(--gold); }
.note-row .t { font-weight: 600; font-size: 14.5px; }
.note-row .b { color: var(--muted); font-size: 13px; line-height: 1.5; }
.pnote {
  border-left: 2.5px solid var(--gold);
  padding: 4px 0 4px 15px; margin: 18px 0;
  font-family: var(--font-display); font-size: 17px; line-height: 1.45;
}
.pnote .sig { display: block; color: var(--gold); font-style: italic; margin-top: 4px; font-size: 15px; }
.linkrow {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 16px; text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--r2);
  margin-top: 10px; background: var(--panel);
}
.linkrow .t { color: var(--ink); font-weight: 600; font-size: 14.5px; }
.linkrow .s { color: var(--faint); font-size: 11.5px; }
.linkrow .arr { color: var(--gold); }
.smallprint { text-align: center; color: var(--faint); font: 400 11.5px var(--font-mono); margin-top: 24px; }

@media (max-width: 560px) {
  .topbar { padding-top: 14px; }
  .brand { font-size: 26px; }
  .tagline { display: none; }
  .card { padding: 20px 18px 18px; }
}
