:root {
  --bg: #130e1d;
  --ink: #f7ecd9;
  --muted: #b9abc9;
  --faint: #8a7c9f;
  --card: rgba(255, 255, 255, 0.045);
  --card-2: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.1);
  --orange: #ff8a1f;
  --orange-2: #ffb347;
  --amber: #ffd36b;
  --moss: #9fd36b;
  --alert: #ff7a5c;
  --modal: #1e1631;
  --radius: 18px;
  --font-display: 'Fraunces', Georgia, serif;
  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: var(--orange-2); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- night sky ---------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1100px 650px at 82% -8%, #3b2760 0%, transparent 62%),
    radial-gradient(900px 600px at 0% 105%, #2b1638 0%, transparent 60%),
    linear-gradient(#1b1229, #110b1a);
}
.stars { position: absolute; inset: 0; fill: #fff; }
.stars .tw { animation: twinkle 4s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: 0.1; } }
.moon {
  position: absolute;
  top: 9vh;
  right: 7vw;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 64% 38%, rgba(190, 168, 120, 0.35) 0 9%, transparent 10%),
    radial-gradient(circle at 36% 64%, rgba(190, 168, 120, 0.3) 0 7%, transparent 8%),
    radial-gradient(circle at 35% 35%, #fff8e4, #f0dfb6 60%, #d9c08b);
  box-shadow: 0 0 60px 18px rgba(255, 236, 190, 0.14), 0 0 180px 70px rgba(255, 236, 190, 0.06);
}
.hills { position: absolute; left: 0; bottom: 0; width: 100%; height: 24vh; }
.leaves { position: absolute; inset: 0; }
.leaf {
  position: absolute;
  top: -40px;
  left: var(--x);
  width: var(--s);
  height: var(--s);
  opacity: 0.75;
  animation: fall var(--d) linear var(--delay) infinite;
}
.leaf svg { display: block; width: 100%; height: 100%; animation: sway calc(var(--d) / 4) ease-in-out var(--delay) infinite alternate; }
@keyframes fall { to { transform: translateY(calc(100vh + 80px)); } }
@keyframes sway { from { transform: translateX(-34px) rotate(-35deg); } to { transform: translateX(34px) rotate(45deg); } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px max(16px, calc((100vw - 1160px) / 2));
  background: rgba(19, 14, 29, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}
.brand-mark { width: 30px; height: 30px; }
.tabs {
  display: flex;
  gap: 4px;
  margin: 0 auto;
  padding: 4px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
}
.tabs a {
  padding: 7px 16px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.925rem;
  transition: background 0.15s, color 0.15s;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { background: rgba(255, 138, 31, 0.18); color: var(--amber); }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}
.icon-btn:hover { color: var(--ink); background: var(--card-2); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn[aria-pressed='true'] { color: var(--amber); }
.icon-btn .slash { display: none; }
#btn-notify[aria-pressed='false'] .slash, #btn-sound[aria-pressed='false'] .slash { display: block; }
#btn-sound[aria-pressed='false'] .wave { display: none; }

/* ---------- layout ---------- */
main { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 28px 16px 40px; }
.focus-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.stage { display: flex; flex-direction: column; align-items: center; padding-top: 8px; }
.panel { display: flex; flex-direction: column; gap: 16px; }

/* ---------- speech bubble ---------- */
.bubble {
  position: relative;
  display: grid;
  width: min(440px, 100%);
  padding: 14px 20px;
  border-radius: 22px;
  background: #fff4e0;
  color: #2b1d33;
  font-weight: 500;
  font-size: 1.02rem;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 14px 40px -16px rgba(0, 0, 0, 0.7);
}
.bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -11px;
  width: 22px;
  height: 22px;
  background: #fff4e0;
  border-radius: 0 0 6px 0;
  transform: translateX(-50%) rotate(45deg);
}
.bubble > span:not(.sr-only) { grid-area: 1 / 1; }
.bubble-ghost { visibility: hidden; }
.bubble.pop { animation: bubble-pop 0.35s cubic-bezier(0.3, 1.5, 0.5, 1); }
@keyframes bubble-pop { from { transform: scale(0.94); opacity: 0.4; } }

/* ---------- Jack ---------- */
.jack {
  --fresh: 1;
  position: relative;
  width: min(440px, 84vw);
  aspect-ratio: 400 / 340;
  margin-top: -2%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.jack::before {
  content: '';
  position: absolute;
  inset: 8% 4% 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 140, 30, calc(0.34 * var(--fresh))), rgba(140, 160, 90, calc(0.16 * (1 - var(--fresh)))) 60%, transparent);
  filter: blur(8px);
  transition: background 1s;
}
.jack svg { position: relative; display: block; width: 100%; height: 100%; overflow: visible; animation: bob 4.5s ease-in-out infinite; }
.jack:focus-visible { outline: 3px solid var(--orange-2); outline-offset: 6px; border-radius: 30px; }
.jack.squish svg { animation: squish 0.45s cubic-bezier(0.3, 1.6, 0.5, 1), bob 4.5s ease-in-out 0.45s infinite; }
@keyframes bob { 50% { transform: translateY(-7px); } }
@keyframes squish {
  0% { transform: scale(1, 1); }
  30% { transform: scale(1.08, 0.9) translateY(10px); }
  60% { transform: scale(0.96, 1.05); }
  100% { transform: scale(1, 1); }
}
.jack [data-face] { transition: transform 0.3s ease-out; }
.glow { animation: flicker 3.4s infinite; }
@keyframes flicker { 0%, 100% { opacity: 1; } 7% { opacity: 0.78; } 9% { opacity: 0.96; } 38% { opacity: 0.86; } 41% { opacity: 1; } 72% { opacity: 0.9; } }
.eyes { transform-box: fill-box; transform-origin: center; animation: blink 5.2s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96.5% { transform: scaleY(0.08); } }
.fly-orbit { transform-origin: 200px 236px; animation: orbit 4s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
.wing { transform-box: fill-box; transform-origin: 50% 100%; animation: buzz 0.07s linear infinite alternate; }
@keyframes buzz { to { transform: scaleY(0.25); } }
.pop { transform-box: fill-box; transform-origin: center; animation: spot-pop 0.6s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
@keyframes spot-pop { from { transform: scale(0); } }
.zzz text { transform-box: fill-box; transform-origin: center; animation: zzz 2.6s ease-in-out infinite; }
.zzz text:nth-child(2) { animation-delay: 0.4s; }
.zzz text:nth-child(3) { animation-delay: 0.8s; }
@keyframes zzz { 0%, 100% { opacity: 0.2; transform: translateY(4px); } 50% { opacity: 1; transform: translateY(-4px); } }

.vitals { width: min(380px, 100%); margin-top: 6px; display: grid; gap: 8px; }
.vitals-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.vitals-row:first-child { justify-content: center; font-size: 1.05rem; }
.vitals-row strong { font-family: var(--font-display); font-size: 1.25rem; }
.sep { color: var(--faint); }
.meter { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.meter-fill { height: 100%; width: 100%; border-radius: 999px; transition: width 0.8s ease, background 0.8s ease; }

/* ---------- cards + controls ---------- */
.card {
  padding: 24px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.card h2 { font-size: 1.3rem; }
.card-title { font-size: 1.65rem; margin-bottom: 16px; overflow-wrap: anywhere; }
.eyebrow { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange-2); margin-bottom: 6px; }
.eyebrow-alert { color: var(--alert); }
.field-label { display: block; margin: 18px 0 8px; font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 138, 31, 0.2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.chip small { font-weight: 500; font-size: 0.75rem; color: var(--faint); }
.chip:hover { background: var(--card-2); }
.chip.is-on { background: rgba(255, 138, 31, 0.16); border-color: var(--orange); color: var(--amber); }
.chip.is-on small { color: var(--orange-2); }
.chip-custom { padding: 0 14px 0 6px; cursor: text; color: var(--muted); font-weight: 500; }
.chip-custom input { width: 72px; padding: 8px 6px; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 600; text-align: center; -moz-appearance: textfield; }
.chip-custom input::-webkit-inner-spin-button, .chip-custom input::-webkit-outer-spin-button { -webkit-appearance: none; }
.chip-custom input:focus { outline: none; }
.chip-custom:focus-within { border-color: var(--orange); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, filter 0.15s;
}
.btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .chip:focus-visible, .culprit:focus-visible, .tabs a:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--orange-2); outline-offset: 2px; }
.btn-primary {
  border: 0;
  background: linear-gradient(180deg, #ffa443, #f07812);
  color: #2a1405;
  box-shadow: 0 12px 30px -12px rgba(255, 138, 31, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:hover { background: linear-gradient(180deg, #ffb35e, #f6861f); filter: brightness(1.03); }
.btn-big { width: 100%; min-height: 54px; font-size: 1.08rem; }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.875rem; }
.btn-danger { border: 0; background: #d9533c; color: #fff; }
.btn-danger:hover { background: #e4644c; }
.danger { color: #ff9a85; }
.row { display: flex; gap: 10px; }
.row > .btn { flex: 1; }
.row.wrap { flex-wrap: wrap; }
.row.center { justify-content: center; }
.row.end { justify-content: flex-end; }
.row.end > .btn, .row.center > .btn { flex: 0 1 auto; }
.hint { margin-top: 14px; font-size: 0.875rem; color: var(--muted); }

.clock {
  font-size: clamp(3.6rem, 9vw, 5.2rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  margin: 4px 0 18px;
}
.is-paused .clock { color: var(--faint); }
.vine { position: relative; height: 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.vine-fill {
  position: relative;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #5e8f34, var(--moss));
  transition: width 0.9s linear;
}
.vine-fill::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  width: 18px;
  height: 12px;
  border-radius: 0 100% 0 100%;
  background: var(--moss);
  transform: translateY(-50%) rotate(-20deg);
}
.vine-break .vine-fill { background: linear-gradient(90deg, #6a5ca8, #a99cf0); }
.vine-break .vine-fill::after { background: #a99cf0; }
.small-vine { height: 8px; margin: 12px 0 8px; }
.small-vine .vine-fill::after { display: none; }
.run-status { margin-top: 12px; }
.run-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.run-stats div, .mini-stats div, .rep-stats div { padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); }
dt { font-size: 0.75rem; color: var(--faint); font-weight: 600; }
dd { margin: 2px 0 0; font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }

/* confession */
.card-confess { border-color: rgba(255, 122, 92, 0.45); box-shadow: 0 0 0 4px rgba(255, 122, 92, 0.08); }
.card-confess .card-title { margin-bottom: 8px; }
.damage { margin-bottom: 4px; }
.damage strong { color: var(--alert); }
.fatal { margin: 6px 0; padding: 8px 12px; border-radius: 10px; background: rgba(255, 122, 92, 0.14); color: #ffc2b3; font-weight: 600; font-size: 0.9rem; }
.card-confess > .muted:not(.small) { margin: 12px 0; }
.culprits { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.culprit {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 78px;
  padding: 10px 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
.culprit .em { font-size: 1.5rem; line-height: 1; }
.culprit:hover { background: var(--card-2); border-color: rgba(255, 255, 255, 0.2); transform: translateY(-2px); }
.culprit-work { grid-column: 1 / -1; flex-direction: row; gap: 12px; min-height: 60px; border-style: dashed; border-color: rgba(159, 211, 107, 0.5); font-size: 0.95rem; text-align: left; }
.culprit-work small { display: block; font-weight: 500; font-size: 0.78rem; color: var(--muted); }

/* how it works */
.card-how { background: transparent; }
.how-title { font-size: 1.05rem !important; margin-bottom: 12px; color: var(--muted); }
.how { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.how li { display: flex; gap: 12px; align-items: flex-start; font-size: 0.93rem; color: var(--muted); }
.how strong { color: var(--ink); }
.how-n {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 138, 31, 0.16);
  color: var(--amber);
  font-weight: 700;
  font-size: 0.82rem;
}
.card-dead form { margin-top: 4px; }
.card-dead .btn-big { margin-top: 14px; }

/* ---------- stats ---------- */
.page { display: grid; gap: 20px; }
.page-head h1 { font-size: clamp(2rem, 5vw, 2.6rem); margin-bottom: 6px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile { display: grid; gap: 4px; padding: 18px 20px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.tile-label { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.tile-val { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 > .card > h2 { margin-bottom: 4px; }
.bars { list-style: none; margin: 18px 0 12px; padding: 0; display: grid; gap: 12px; }
.bars li { display: grid; grid-template-columns: 9.5rem 1fr 4.2rem; align-items: center; gap: 12px; font-size: 0.9rem; }
.bars li.empty { display: block; color: var(--muted); padding: 18px 0; }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-label > span { margin-right: 4px; }
.bar-track { height: 14px; }
.bar { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--orange); }
.bar-val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.pumpkin-card { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: center; }
.pc-jack svg { display: block; width: 100%; height: auto; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 0; }
.mini-stats dd { font-size: 1rem; white-space: nowrap; }
.table-wrap { overflow-x: auto; margin-top: 12px; }
.sessions { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.sessions th { text-align: left; font-size: 0.75rem; font-weight: 600; color: var(--faint); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.sessions td { padding: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-variant-numeric: tabular-nums; }
.sessions td.empty { color: var(--muted); padding: 18px 10px; }
.task-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grade-pill { display: inline-block; min-width: 36px; padding: 2px 8px; border-radius: 999px; text-align: center; font-weight: 700; font-size: 0.82rem; background: rgba(255, 255, 255, 0.08); }
.grade-pill[data-grade='A'] { background: rgba(159, 211, 107, 0.18); color: #c6ec9e; }
.grade-pill[data-grade='B'] { background: rgba(255, 211, 107, 0.16); color: var(--amber); }
.grade-pill[data-grade='C'], .grade-pill[data-grade='D'] { background: rgba(255, 138, 31, 0.16); color: var(--orange-2); }
.grade-pill[data-grade='F'], .grade-pill[data-grade='X'], .grade-pill[data-grade='💀'] { background: rgba(255, 122, 92, 0.16); color: #ffb3a1; }
.reset-row { text-align: center; }

/* ---------- live slip risk ---------- */
.risk { margin: -4px 0 18px; padding: 12px 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); }
.risk-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 0.82rem; font-weight: 600; color: var(--faint); }
.risk-head strong { font-size: 1.1rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.risk-track { position: relative; height: 8px; margin: 8px 0 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.risk-fill { height: 100%; width: 0; border-radius: 999px; background: var(--moss); transition: width 0.8s ease, background 0.4s; }
.risk-mark { position: absolute; top: -3px; bottom: -3px; left: 30%; width: 2px; border-radius: 2px; background: var(--muted); }
.risk.is-high .risk-fill { background: var(--alert); }
.risk.is-high .risk-head strong { color: #ffc2b3; }

/* ---------- insights ---------- */
:root { --series: #e06a0a; --series-2: #8f7fe6; --grid: rgba(255, 255, 255, 0.07); }
.source { margin: 0; }
.banner { padding: 12px 16px; border-radius: 14px; background: rgba(143, 127, 230, 0.12); border: 1px solid rgba(143, 127, 230, 0.35); color: #ddd6ff; font-size: 0.92rem; }
.tile-sub { font-size: 0.8rem; color: var(--faint); }
.chart { margin: 16px 0 6px; min-height: 60px; }
.chart-svg { display: block; max-width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart-note { margin-top: 10px; font-size: 0.875rem; color: var(--muted); }
.empty { color: var(--muted); }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; }
.chart-svg .axis { stroke: rgba(255, 255, 255, 0.3); stroke-width: 1; }
.chart-svg .tick { fill: var(--faint); font: 500 12px var(--font); }
.chart-svg .ref { stroke: rgba(255, 255, 255, 0.28); stroke-width: 1; }
.chart-svg .ref-label { fill: var(--muted); font: 600 12px var(--font); }
.chart-svg .halo { paint-order: stroke; stroke: #1b1527; stroke-width: 4px; stroke-linejoin: round; }
.chart-svg .band { fill: var(--series); opacity: 0.18; }
.chart-svg .line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; }
.chart-svg .cross-line { stroke: rgba(255, 255, 255, 0.35); stroke-width: 1; }
.chart-svg .cross-dot { fill: var(--series); stroke: var(--modal); stroke-width: 2; }
.chart-svg .hit, .chart-svg .hit-bar, .chart-svg .hit-dot { fill: transparent; cursor: crosshair; }
.chart-svg .bar-mark { fill: var(--series); }
.chart-svg .bar-mark.is-thin { opacity: 0.5; }
.chart-svg .bar-empty { fill: rgba(255, 255, 255, 0.1); }
.chart-svg .bar-label-svg { fill: var(--ink); font: 600 12px var(--font); }
.chart-svg .row-label { fill: var(--ink); font: 500 13px var(--font); }
.chart-svg .fx-up { fill: var(--series); }
.chart-svg .fx-down { fill: var(--series-2); }
.chart-svg .fx.is-unclear { opacity: 0.4; }
.chart-svg .whisker { stroke: var(--ink); stroke-width: 1.5; opacity: 0.7; }
.chart-svg .fx-val { fill: var(--muted); font: 600 12px var(--font); font-variant-numeric: tabular-nums; }
.chart-svg .cal-dot { fill: var(--series); stroke: var(--bg); stroke-width: 2; }
.cost td:not(:first-child), .cost th:not(:first-child) { text-align: right; }
.cost td:first-child { white-space: nowrap; }
.check-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 16px; }
.check-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.check-stats.two { margin-top: 16px; max-width: 520px; }
.check-stats > div { padding: 12px 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); }
.check-stats dd { font-family: var(--font-display); font-size: 1.6rem; }
.check-stats .small { margin-top: 2px; }
.calib .chart { margin-top: 0; }
.toggle { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; font-size: 0.875rem; color: var(--muted); cursor: pointer; }
.toggle input { margin-top: 3px; accent-color: var(--orange); }
.export-row { margin-top: 14px; }
.export-row > .btn { flex: 0 1 auto; }
.tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  max-width: 260px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff4e0;
  color: #2b1d33;
  font-size: 0.82rem;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.7);
}

/* ---------- graveyard ---------- */
.graves { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.grave {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 26px 20px 20px;
  border-radius: 120px 120px 16px 16px;
  background: linear-gradient(#352d45, #241e33);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  box-shadow: 0 20px 40px -24px rgba(0, 0, 0, 0.8);
}
.grave-jack { width: 120px; margin-bottom: 4px; }
.grave-jack svg { display: block; width: 100%; height: auto; }
.rip { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.3em; color: var(--faint); }
.grave h3 { font-size: 1.5rem; }
.dates { color: var(--muted); font-size: 0.875rem; }
.cause { color: var(--orange-2); font-family: var(--font-display); font-weight: 600; margin-top: 6px; }
.epitaph { font-family: var(--font-display); font-style: italic; color: #e3d6c1; margin: 6px 0 10px; font-size: 0.95rem; }
.grave .btn { margin-top: auto; }
.empty-grave { grid-column: 1 / -1; text-align: center; display: grid; gap: 6px; padding: 48px 24px; }
.empty-grave .big { font-size: 2.6rem; }

/* ---------- dialogs ---------- */
.modal {
  width: min(500px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 32px 28px 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--modal);
  color: var(--ink);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.9);
}
.modal[open] { animation: rise 0.35s cubic-bezier(0.2, 1.2, 0.4, 1); }
.modal::backdrop { background: rgba(8, 5, 14, 0.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
@keyframes rise { from { transform: translateY(16px) scale(0.97); opacity: 0; } }
.modal-sm { width: min(420px, calc(100vw - 32px)); }
.modal-sm h2 { font-size: 1.4rem; margin-bottom: 8px; }
.modal-sm .row { margin-top: 22px; }
.modal-x { position: absolute; top: 12px; right: 12px; }
.modal-x .icon-btn { width: 36px; height: 36px; font-size: 0.9rem; }
.report { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.report h2 { font-size: 2rem; color: var(--orange-2); }
.grade-badge {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffc15e, #f07a12);
  color: #2a1405;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3.4rem;
  box-shadow: 0 0 0 6px rgba(255, 138, 31, 0.18), 0 18px 40px -14px rgba(255, 138, 31, 0.7);
  transform: rotate(-6deg);
  animation: stamp 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) 0.15s both;
}
.grade-badge[data-grade='D'], .grade-badge[data-grade='F'] { background: linear-gradient(135deg, #b3a874, #6f6538); }
@keyframes stamp { from { transform: rotate(-30deg) scale(1.8); opacity: 0; } }
.rep-task { margin-top: 6px; font-weight: 600; overflow-wrap: anywhere; }
.rep-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; margin: 14px 0 6px; }
.stageup { margin: 6px 0; padding: 8px 14px; border-radius: 999px; background: rgba(159, 211, 107, 0.16); color: #c6ec9e; font-weight: 600; }
.report .row { width: 100%; margin-top: 12px; }
.modal-death { text-align: center; }
.tomb {
  padding: 22px 20px 18px;
  margin-bottom: 18px;
  border-radius: 160px 160px 18px 18px;
  background: linear-gradient(#3a3249, #262036);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 4px;
  justify-items: center;
}
.tomb-jack { width: 150px; }
.tomb-jack svg { display: block; width: 100%; height: auto; }
.tomb h2 { font-size: 2rem; }

.footer { padding: 24px 16px 32px; text-align: center; font-size: 0.82rem; color: var(--faint); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  main { padding-top: 18px; }
  .focus-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .jack { width: min(320px, 78vw); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .check-grid { grid-template-columns: minmax(0, 1fr); }
  .moon { width: 56px; height: 56px; top: 80px; }
}
@media (max-width: 560px) {
  .topbar { gap: 8px; flex-wrap: wrap; }
  .brand { font-size: 1.2rem; }
  .tabs { order: 3; width: 100%; justify-content: space-between; }
  .tabs a { flex: 1; text-align: center; padding: 7px 8px; }
  .top-actions { margin-left: auto; }
  .card { padding: 20px 16px; }
  .culprits { grid-template-columns: repeat(2, 1fr); }
  .culprit { min-height: 64px; flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 12px; text-align: left; }
  .run-stats, .rep-stats { gap: 6px; }
  .run-stats div, .rep-stats div { padding: 8px; }
  .bars li { grid-template-columns: 7.5rem 1fr 3.6rem; gap: 8px; }
  .pumpkin-card { grid-template-columns: 96px 1fr; }
  .modal { padding: 28px 18px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .leaves { display: none; }
}
