/* ============================================
   dopamine — iojeet
   reuses iojeet.xyz tokens (Space Grotesk / Inter / JetBrains Mono,
   dark bg, gold accent). introduces an acid-lime "dopamine"
   accent only for the meter, particle burst, reveal, and finale.
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* base — same vocabulary as /css/style.css */
  --bg-primary: #0a0a0b;
  --bg-secondary: #111113;
  --bg-card: #16161a;
  --bg-card-hover: #1c1c21;

  --text-primary: #f0ece4;
  --text-secondary: #9e9a90;
  --text-muted: #5c5952;
  --text-faint: #3d3a35;

  --accent: #e8c547;
  --accent-dim: #c9a830;
  --accent-glow: rgba(232, 197, 71, 0.18);

  --border: #2a2a2f;
  --border-light: #3a3a40;

  /* dopamine-only — used for meter, particle palette, reveal, finale */
  --dop: #c7ff3a;
  --dop-soft: #a3e635;
  --dop-glow: rgba(199, 255, 58, 0.22);

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.6, 0.4, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  line-height: 1.55;
  font-size: 16px;
  overflow-x: hidden;
  background-image:
    radial-gradient(900px 600px at 80% -10%, var(--accent-glow), transparent 65%),
    radial-gradient(700px 500px at -10% 90%, rgba(199, 255, 58, 0.06), transparent 70%);
  background-attachment: fixed;
  transition: background-color 0.18s ease;
}
button {
  font: inherit;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
}
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--dop); color: var(--bg-primary); }

.sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* whole-page accent flash, used by the 5/5 finale */
body.flash {
  background-color: rgba(199, 255, 58, 0.08);
}

/* fx canvas sits above everything but doesn't catch clicks */
#fxCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 64px) clamp(20px, 5vw, 36px) 96px;
  position: relative;
  z-index: 1;
}

/* ── header ─────────────────────────────────── */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(28px, 6vw, 56px);
}
.back {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  transition: color 0.18s;
}
.back:hover { color: var(--accent); }

.top-right { display: flex; gap: 6px; align-items: center; }
.ic-btn {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.ic-btn:hover {
  color: var(--text-primary);
  border-color: var(--border);
  background: var(--bg-card);
}
.ic-btn .ic-off { display: none; }
.ic-btn.is-muted { color: var(--text-faint); }
.ic-btn.is-muted .ic-on { display: none; }
.ic-btn.is-muted .ic-off { display: inline; }
.ic-btn--text { font-size: 12px; letter-spacing: 0.08em; text-transform: lowercase; }

/* ── stage: big count + vertical meter ────────────── */
.stage {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: end;
  padding: clamp(20px, 4vw, 32px) 0;
  margin-bottom: clamp(36px, 6vw, 64px);
  border-bottom: 1px solid var(--border);
}
.count {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.9;
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.count-num {
  font-size: clamp(72px, 14vw, 132px);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  display: inline-block;
  min-width: 0.7em;
}
.count-sep {
  font-size: clamp(48px, 8vw, 72px);
  color: var(--text-faint);
  font-weight: 500;
  margin: 0 4px 0 6px;
}
.count-total {
  font-size: clamp(48px, 8vw, 72px);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.16em;
  text-transform: lowercase;
  margin-top: 14px;
}

.meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.meter-track {
  position: relative;
  width: 12px;
  height: clamp(110px, 16vw, 150px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  overflow: visible;
}
.meter-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: linear-gradient(to top, var(--dop-soft), var(--dop));
  border-radius: 100px;
  transition: height 0.5s var(--ease-out);
  box-shadow: 0 0 18px var(--dop-glow);
}
.meter-fill::after {
  content: '';
  position: absolute;
  top: -3px; left: -2px; right: -2px;
  height: 3px;
  background: var(--dop);
  border-radius: 100px;
  opacity: 0.9;
}
.meter-fill--full {
  box-shadow: 0 0 28px var(--dop), 0 0 60px var(--dop-glow);
  animation: meterPulse 1.4s ease-in-out infinite;
}
.meter-tick--max {
  position: absolute;
  left: -7px; right: -7px;
  top: 0;
  height: 1px;
  background: var(--text-faint);
}
.meter-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--text-muted);
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: none;
}
@keyframes meterPulse {
  0%, 100% { box-shadow: 0 0 22px var(--dop-glow), 0 0 60px rgba(199,255,58,0.08); }
  50% { box-shadow: 0 0 36px var(--dop), 0 0 80px var(--dop-glow); }
}

/* ── section labels ───────────────────────────────── */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}
.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.section-label::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 1px;
  background: var(--accent);
}
.section-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ── task list ────────────────────────────────────── */
.tasks { margin-bottom: clamp(40px, 7vw, 72px); }
.task-list {
  display: flex;
  flex-direction: column;
}
.task {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
}
.task:first-child { border-top: 1px solid var(--border); }

.check {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: transform 0.16s var(--ease-out);
}
.check:active { transform: scale(0.92); }
.check-box {
  position: relative;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border-light);
  border-radius: 5px;
  background: transparent;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.check-mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s, transform 0.2s var(--ease-spring);
}
.check-mark::before {
  content: '';
  display: block;
  width: 11px;
  height: 6px;
  border-left: 2px solid var(--bg-primary);
  border-bottom: 2px solid var(--bg-primary);
  transform: rotate(-45deg) translate(0, -1px);
}
.check:hover .check-box { border-color: var(--text-secondary); }
.task.is-done .check-box {
  background: var(--dop);
  border-color: var(--dop);
  box-shadow: 0 0 16px var(--dop-glow);
}
.task.is-done .check-mark { opacity: 1; transform: scale(1); }

.task-text {
  font-family: var(--font-body);
  font-size: clamp(16px, 2.4vw, 19px);
  line-height: 1.35;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.005em;
  padding: 4px 0;
  outline: none;
  position: relative;
  word-break: break-word;
  cursor: text;
  border-radius: 4px;
  transition: color 0.4s ease;
}
.task-text[contenteditable="true"] {
  background: var(--bg-card);
  padding: 4px 8px;
  box-shadow: 0 0 0 1px var(--border-light);
}
.task-text::after {
  /* the strikethrough sweep */
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1.5px;
  background: var(--dop);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.52s cubic-bezier(0.65, 0, 0.35, 1);
  pointer-events: none;
  box-shadow: 0 0 6px var(--dop-glow);
}
.task.is-done .task-text {
  color: var(--text-muted);
  /* Fallback strikethrough for multi-line tasks (the animated sweep
     above only covers the first line). Color fades in so the sweep
     reads as the "primary" motion. */
  text-decoration: line-through;
  text-decoration-color: var(--dop);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0;
}
.task.is-done .task-text::after {
  transform: scaleX(1);
}

.task-del {
  font-size: 18px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  border-radius: 6px;
  opacity: 0;
  transition: color 0.18s, opacity 0.18s, background 0.18s;
}
.task:hover .task-del { opacity: 1; }
.task-del:hover { color: var(--text-primary); background: var(--bg-card); }
@media (hover: none) {
  .task-del { opacity: 0.5; }
}

.add-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  border-bottom: 1px dashed var(--border);
  transition: color 0.18s, background 0.18s, border-color 0.18s;
  border-radius: 0;
}
.add-row:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── menu (collapsable) ───────────────────────────── */
.menu {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  padding: 0;
  margin-bottom: 36px;
}
.menu-summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  user-select: none;
}
.menu-summary::-webkit-details-marker { display: none; }
.menu-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-left: auto;
}
.menu-chev {
  font-size: 14px;
  color: var(--text-muted);
  transition: transform 0.25s var(--ease-out);
  display: inline-block;
}
.menu[open] .menu-chev { transform: rotate(-180deg); }
.menu-help {
  padding: 0 20px 14px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 520px;
}
.menu-list {
  padding: 0 20px 4px;
  display: flex;
  flex-direction: column;
}
.menu-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.menu-item:last-child { border-bottom: 0; }
.menu-bullet {
  font-family: var(--font-mono);
  color: var(--accent);
  width: 12px;
  text-align: center;
  font-size: 18px;
  line-height: 1;
}
.menu-text {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  cursor: text;
  border-radius: 4px;
  padding: 2px 4px;
  word-break: break-word;
}
.menu-text[contenteditable="true"] {
  background: var(--bg-card-hover);
  box-shadow: 0 0 0 1px var(--border-light);
}
.menu-del {
  font-size: 16px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  border-radius: 5px;
  opacity: 0;
  transition: color 0.18s, opacity 0.18s, background 0.18s;
}
.menu-item:hover .menu-del { opacity: 1; }
.menu-del:hover { color: var(--text-primary); background: var(--bg-card-hover); }
@media (hover: none) { .menu-del { opacity: 0.5; } }

.menu .add-row {
  padding: 14px 20px;
  border-bottom: 0;
  border-top: 1px dashed var(--border);
}

.menu-sync {
  padding: 16px 20px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 7px;
  border: 1px solid var(--border-light);
  background: var(--bg-card-hover);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  transition: border-color 0.18s, color 0.18s, background 0.18s, transform 0.18s var(--ease-out);
}
.sync-btn::before {
  content: '↗';
  font-size: 13px;
  color: var(--dop);
  transition: transform 0.18s var(--ease-out);
}
.sync-btn:hover {
  border-color: var(--dop);
  color: var(--dop);
  background: rgba(199, 255, 58, 0.05);
}
.sync-btn:hover::before { transform: translate(2px, -2px); }
.sync-btn:active { transform: translateY(1px); }
.sync-help {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 460px;
}

/* ── footnote ─────────────────────────────────────── */
.footnote {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  text-align: center;
  margin-top: 32px;
}
.footnote a {
  color: var(--text-muted);
  border-bottom: 1px solid transparent;
  transition: color 0.18s, border-color 0.18s;
}
.footnote a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ── reveal modal ─────────────────────────────────── */
.reveal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.28s var(--ease-out);
  pointer-events: none;
}
.reveal[hidden] { display: none; }
.reveal.is-open {
  opacity: 1;
  pointer-events: auto;
}
.reveal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 10, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.reveal-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  padding: clamp(28px, 5vw, 44px) clamp(24px, 5vw, 48px);
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 0 60px var(--dop-glow),
    inset 0 1px 0 rgba(255,255,255,0.04);
  transform: translateY(16px) scale(0.96);
  transition: transform 0.42s var(--ease-spring), opacity 0.28s var(--ease-out);
  opacity: 0;
}
.reveal.is-open .reveal-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.reveal-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--dop);
  margin-bottom: 22px;
}
.reveal-text {
  font-family: var(--font-display);
  font-size: clamp(28px, 5.5vw, 44px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  min-height: 1.2em;
  margin-bottom: 28px;
  filter: blur(0);
  transition: filter 0.25s ease, color 0.25s ease, transform 0.25s var(--ease-spring);
}
.reveal-text:not(.is-locked) {
  color: var(--text-secondary);
  filter: blur(2px);
}
.reveal-text.is-locked {
  color: var(--dop);
  text-shadow: 0 0 26px var(--dop-glow);
  transform: scale(1.04);
}
.reveal-claim {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  background: var(--dop);
  color: var(--bg-primary);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.01em;
  border-radius: 8px;
  transition: transform 0.18s var(--ease-out), filter 0.18s;
}
.reveal-claim:hover { transform: translateY(-2px); filter: brightness(1.06); }
.reveal-claim:active { transform: translateY(0); }
.reveal-sub {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* ── 5/5 finale ───────────────────────────────────── */
.finale {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: radial-gradient(circle at 50% 38%, rgba(199, 255, 58, 0.10), transparent 55%),
              rgba(8, 8, 10, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s var(--ease-out);
}
.finale.is-on {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}
.finale-line {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 6vw, 52px);
  letter-spacing: -0.025em;
  line-height: 1.1;
  max-width: 780px;
  color: var(--text-primary);
  text-shadow: 0 0 28px var(--dop-glow);
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.7s var(--ease-spring), opacity 0.7s var(--ease-out);
  transition-delay: 0.12s;
}
.finale-sub {
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.5s ease;
  transition-delay: 0.6s;
}
.finale.is-on .finale-line {
  transform: translateY(0);
  opacity: 1;
}
.finale.is-on .finale-sub { opacity: 1; }

/* ── small screens ────────────────────────────────── */
@media (max-width: 520px) {
  .stage { grid-template-columns: 1fr auto; gap: 16px; }
  .meter-track { width: 10px; }
  .task { gap: 12px; padding: 12px 0; }
  .task-text { font-size: 16px; }
}

/* ── reduce motion ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .task-text::after { transition-duration: 0.001s; }
  .meter-fill { transition-duration: 0.001s !important; }
  .meter-fill--full { animation: none; }
  .reveal, .reveal-card, .finale, .finale-line, .finale-sub {
    transition-duration: 0.001s;
  }
}
