/* Pikmin Day: bright morning garden. Tokens first, then hero stage, deck, sections. */
:root {
  --sky: #bfe6ff;
  --cream: #fff8e8;
  --paper: #fffdf6;
  --ink: #1d1630;
  --muted: #5d5670;
  --line: #1d1630;
  --leaf: #4fb22c;
  --leaf-d: #2f7a1c;
  --red: #e8402f;
  --yellow: #ffd23f;
  --blue: #2f6fe6;
  --purple: #8a4bd0;
  --soil: #cf9f62;
  --f-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --f-body: "Nunito", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --gl: max(16px, env(safe-area-inset-left, 0px));
  --gr: max(16px, env(safe-area-inset-right, 0px));
  --shadow: 0 4px 0 var(--ink);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 500 17px/1.6 var(--f-body); overflow-x: hidden; }
img { max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.05; margin: 0; }
.wrap { width: min(1180px, 100%); margin: 0 auto; padding: 0 var(--gr) 0 var(--gl); }

/* ---- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px;
  border: 2.5px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--ink);
  font: 700 16px var(--f-display); text-decoration: none; cursor: pointer; box-shadow: var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s, background 0.2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn-main { background: var(--yellow); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 15px; }
.btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.chip {
  border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--ink);
  font: 700 14px var(--f-display); padding: 6px 12px; cursor: pointer;
}
.chip:hover { background: var(--yellow); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* ---- nav */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 10px var(--gr) 10px var(--gl);
  background: rgba(255, 253, 246, 0.82); backdrop-filter: blur(10px); border-bottom: 2.5px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 700 21px var(--f-display); }
.links { display: flex; gap: 18px; margin-left: auto; font: 600 16px var(--f-display); }
.links a { text-decoration: none; }
.links a:hover { color: var(--leaf-d); }

/* ---- hero stage */
.hero { padding-top: 62px; background: linear-gradient(var(--sky), var(--cream) 85%); }
.stage { position: relative; height: min(84svh, 820px); min-height: 520px; overflow: hidden; border-bottom: 2.5px solid var(--ink); }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; }
#scene:active { cursor: grabbing; }

.sunbar { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); width: min(420px, calc(100% - 32px)); text-align: center; pointer-events: none; z-index: 3; }
.sun-track {
  position: relative; height: 18px; border: 2.5px solid var(--ink); border-radius: 999px;
  background: linear-gradient(90deg, #2b2f78, #ff9459 22%, #ffe58a 35%, #9fd8ff 50%, #ffe58a 65%, #ff9459 78%, #2b2f78);
  display: flex; justify-content: space-evenly; align-items: center; box-shadow: 0 3px 0 var(--ink);
}
.sun-track i { width: 2px; height: 8px; background: rgba(29, 22, 48, 0.45); border-radius: 2px; }
.sun-dot {
  position: absolute; top: 50%; width: 30px; height: 30px; margin-left: -15px; transform: translateY(-50%);
  border-radius: 50%; background: radial-gradient(circle at 40% 40%, #fff7c2, #ffd23f 55%, #ff9f1c);
  border: 2.5px solid var(--ink); box-shadow: 0 0 18px rgba(255, 210, 63, 0.9);
}
.day-label { margin: 8px 0 0; font: 700 15px var(--f-display); display: inline-block; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 12px; }
body.is-day .day-label { background: var(--yellow); }

.hero-copy { position: absolute; left: var(--gl); top: 84px; width: min(460px, 46%); z-index: 2; pointer-events: none; }
.kicker { margin: 0 0 10px; display: flex; align-items: center; gap: 6px; font: 700 15px var(--f-display); text-transform: uppercase; letter-spacing: 0.06em; }
.kicker .one { display: grid; place-items: center; width: 30px; height: 36px; border: 2.5px solid var(--ink); border-radius: 10px 10px 14px 14px; background: var(--red); color: #fff; font-size: 20px; box-shadow: 0 3px 0 var(--ink); }
.kicker .one:nth-child(2) { background: var(--yellow); color: var(--ink); }
.kicker .one:nth-child(4) { background: var(--blue); margin-right: 8px; }
.kicker .dot { font-size: 26px; }
h1 { font-size: clamp(64px, 9vw, 128px); font-weight: 700; letter-spacing: -0.02em; color: var(--paper); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink); }
h1 em { font-style: normal; color: var(--yellow); }
.ticker { margin: 10px 0 8px; font: 700 26px var(--f-display); color: var(--leaf-d); }
.lede { margin: 0; max-width: 420px; font-weight: 700; background: rgba(255, 253, 246, 0.86); border: 2px solid var(--ink); border-radius: 16px; padding: 10px 14px; pointer-events: auto; }

.bag-label {
  position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; display: flex; flex-direction: column; align-items: center;
  font: 700 22px/1 var(--f-display); color: #fff; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; transition: opacity 0.2s;
}
.bag-label i { width: 28px; height: 3px; margin: 3px 0; background: #fff; border: 1px solid var(--ink); border-radius: 2px; }
.bag-label.go { color: #8fe3ff; }
.bag-label.go i { background: #8fe3ff; }
.bag-label.off { opacity: 0; }

.bubble {
  position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none; max-width: 220px; padding: 8px 12px; margin-top: -10px;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 16px; box-shadow: 0 3px 0 var(--ink);
  font: 700 15px/1.25 var(--f-display); opacity: 0; transition: opacity 0.18s; white-space: nowrap;
}
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -9px; width: 14px; height: 14px; margin-left: -7px; background: var(--paper); border: solid var(--ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.bubble.show { opacity: 1; }

.toast {
  position: absolute; left: 50%; top: 92px; z-index: 5; transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  padding: 8px 18px; background: var(--yellow); border: 2.5px solid var(--ink); border-radius: 999px; box-shadow: var(--shadow);
  font: 700 18px var(--f-display); white-space: nowrap; transition: opacity 0.2s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.mode-badge {
  position: absolute; right: var(--gr); top: 18px; z-index: 3; padding: 4px 10px; border: 2px solid var(--ink); border-radius: 8px;
  background: var(--paper); font: 700 12px var(--f-mono); letter-spacing: 0.08em;
}
body[data-mode="live"] .mode-badge { background: var(--leaf); color: #fff; }
.stage-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0; z-index: 2; pointer-events: none; padding: 4px 12px; border-radius: 999px; background: rgba(255, 253, 246, 0.85); border: 2px solid var(--ink); font: 600 14px var(--f-display); white-space: nowrap; }

/* ---- deck under the stage */
.deck { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; margin-top: -54px; position: relative; z-index: 6; padding-bottom: 56px; }
.stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--paper); border: 2.5px solid var(--ink); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.stats div { padding: 12px 16px; border-left: 2px dashed rgba(29, 22, 48, 0.25); }
.stats div:first-child { border-left: 0; }
.stats span { display: block; font: 700 12px var(--f-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stats b { font: 700 28px var(--f-display); }
.sim, .ca-card { background: var(--paper); border: 2.5px solid var(--ink); border-radius: 20px; box-shadow: var(--shadow); padding: 16px; }
.sim-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sim-head p { margin: 0; font-size: 15px; color: var(--muted); }
.sim-head b { color: var(--ink); font-family: var(--f-display); font-size: 18px; margin-right: 6px; }
.sim-row { display: flex; align-items: center; gap: 12px; margin: 10px 0 12px; }
.sim-row output { min-width: 84px; text-align: right; font: 700 20px var(--f-display); }
input[type="range"] { flex: 1; accent-color: var(--leaf); height: 28px; }
.sim-btns, .sim-chips, .actions { display: flex; flex-wrap: wrap; gap: 10px; }
.sim-chips { margin-top: 12px; gap: 8px; }
.ca { display: flex; align-items: center; gap: 10px; border: 2px solid var(--ink); border-radius: 14px; padding: 6px 6px 6px 12px; background: var(--cream); margin-bottom: 14px; }
.ca span { font: 700 14px var(--f-mono); color: var(--leaf-d); }
.ca code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 14px var(--f-mono); }
.ca button { border: 2px solid var(--ink); border-radius: 10px; background: var(--yellow); font: 700 14px var(--f-display); padding: 6px 12px; cursor: pointer; }
.ca button:disabled { opacity: 0.45; cursor: default; }

/* ---- sections */
section.news, section.math, section.dandori, section.buy { padding: 72px 0; border-top: 2.5px solid var(--ink); }
.eyebrow { margin: 0 0 8px; font: 700 14px var(--f-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--leaf-d); }
h2 { font-size: clamp(34px, 5vw, 56px); margin-bottom: 18px; }
.intro { max-width: 720px; font-size: 19px; margin: 0 0 30px; }

.news { background: #e9f7ff; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.timeline li { background: var(--paper); border: 2.5px solid var(--ink); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.timeline li.hot { background: #fff3c4; }
.timeline time { display: inline-block; font: 700 13px var(--f-mono); background: var(--ink); color: #fff; border-radius: 6px; padding: 2px 8px; margin-bottom: 10px; }
.timeline h3 { font-size: 22px; margin-bottom: 6px; }
.timeline p { margin: 0; font-size: 16px; }
.sources { margin: 24px 0 0; font-size: 14px; color: var(--muted); }

.math { background: #effbe6; }
.formula { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; margin-bottom: 30px; }
.formula code { font: 700 clamp(16px, 2.2vw, 22px) var(--f-mono); background: var(--ink); color: #c8ff9e; padding: 16px 20px; border-radius: 16px; box-shadow: 0 4px 0 var(--leaf-d); }
.formula p { margin: 0; max-width: 560px; }
.ladder { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.ladder li { position: relative; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); transition: background 0.3s, transform 0.3s; }
.ladder li.on { background: #d9f7c4; }
.ladder .lv { font-size: 30px; }
.ladder h3 { font-size: 20px; margin: 6px 0 2px; }
.ladder .mc { margin: 0 0 6px; font: 700 13px var(--f-mono); color: var(--leaf-d); }
.ladder p { font-size: 15px; margin: 0 0 12px; }

.dandori { background: var(--cream); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.steps li { background: var(--paper); border: 2.5px solid var(--ink); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.steps li > span { display: grid; place-items: center; width: 40px; height: 40px; border: 2.5px solid var(--ink); border-radius: 50%; font: 700 20px var(--f-display); margin-bottom: 10px; background: var(--yellow); }
.steps li:nth-child(1) > span { background: var(--red); color: #fff; }
.steps li:nth-child(3) > span { background: var(--blue); color: #fff; }
.steps li:nth-child(4) > span { background: var(--purple); color: #fff; }
.steps h3 { font-size: 22px; margin-bottom: 6px; }
.steps p { margin: 0; font-size: 16px; }
.buy { background: #fff1f6; }

.foot { padding: 40px 0 56px; background: var(--ink); color: #e9e4f5; font-size: 14px; }
.foot p { max-width: 820px; }
.foot a { color: var(--yellow); }

/* ---- responsive */
@media (max-width: 980px) {
  .timeline { grid-template-columns: repeat(2, 1fr); }
  .ladder { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .deck { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .links { display: none; }
  .nav .btn { margin-left: auto; }
  .stage { height: 86svh; min-height: 560px; }
  .hero-copy { top: 96px; width: calc(100% - 32px); }
  h1 { font-size: 64px; -webkit-text-stroke: 2.5px var(--ink); text-shadow: 0 4px 0 var(--ink); }
  h1 br { display: none; }
  .ticker { font-size: 22px; margin: 6px 0; }
  .lede { font-size: 14px; padding: 8px 12px; }
  .sunbar { top: 12px; }
  .toast { top: 300px; font-size: 16px; }
  .stage-hint { font-size: 12px; bottom: 64px; white-space: normal; text-align: center; width: max-content; max-width: calc(100% - 32px); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div:nth-child(3) { border-left: 0; }
  .stats div:nth-child(n + 3) { border-top: 2px dashed rgba(29, 22, 48, 0.25); }
  .stats b { font-size: 22px; }
  .formula { grid-template-columns: 1fr; }
  .formula code { font-size: 14px; padding: 12px 14px; overflow-wrap: anywhere; }
  .timeline, .ladder, .steps { grid-template-columns: 1fr; }
  .sim-btns .btn { flex: 1 1 calc(50% - 10px); }
  .mode-badge { top: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .toast { transition: none; }
}
