/* Matchstick Equation — a warm wooden table, matchbox cards, cream paper.
   Light: daylight oak. Dark: walnut under a narrow, warm lamp.
   Motion: transform and opacity only; reduced motion gets short fades. */

:root {
  color-scheme: light;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Quicksand", "Arial Rounded MT Bold", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ink: #2a1a0f;
  --ink-2: #5a3d27;
  --on-wood: #2a1a0f;
  --on-wood-2: #3b2615;
  --wood-glow: 0 1px 0 rgba(255, 240, 212, 0.55), 0 0 12px rgba(255, 236, 200, 0.35);
  --paper: #fbf3e3;
  --paper-2: #f1e3c7;
  --paper-3: #e7d4b0;
  --line: rgba(90, 56, 26, 0.18);
  --line-strong: rgba(90, 56, 26, 0.32);
  --btn-bg: rgba(253, 247, 235, 0.92);
  --btn-hi: #fffaf0;
  --accent: #b8321f;
  --accent-ink: #ffffff;
  --ca-accent: #c4321f; /* the accounts SDK: white on it ≥ 4.5:1 */
  --good: #2c6f24;
  --good-bg: #e2f2d6;
  --warn: #7a4e06;
  --warn-bg: #fbecc8;
  --bad: #a3241b;
  --bad-bg: #fbe0d9;
  --focus: #ffc53d;
  --gold: #a87308;
  --label: #fbf3e3;
  --label-ink: #2a1a0f;
  --label-ink-2: #5a3d27;
  --label-line: rgba(90, 56, 26, 0.45);
  --cover: rgba(244, 230, 204, 0.94);
  --scrim: rgba(40, 20, 6, 0.28);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 -1px 0 rgba(120, 80, 40, 0.16) inset, 0 16px 34px -18px rgba(60, 30, 8, 0.55), 0 3px 8px rgba(60, 30, 8, 0.18);
  --shadow-btn: 0 1px 0 rgba(255, 255, 255, 0.85) inset, 0 -2px 0 rgba(120, 80, 40, 0.14) inset, 0 6px 14px -8px rgba(60, 30, 8, 0.6), 0 1px 3px rgba(60, 30, 8, 0.2);
  --grain: url("/img/grain.svg");
  --radius: 12px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.5, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f6ead6;
  --ink-2: #d8c4a4;
  --on-wood: #f8ecd8;
  --on-wood-2: #e6d2b2;
  --wood-glow: 0 1px 2px rgba(0, 0, 0, 0.7), 0 0 14px rgba(0, 0, 0, 0.45);
  --paper: #34251a;
  --paper-2: #3f2d20;
  --paper-3: #4c3726;
  --line: rgba(246, 222, 186, 0.16);
  --line-strong: rgba(246, 222, 186, 0.3);
  --btn-bg: rgba(52, 36, 24, 0.92);
  --btn-hi: #4a3424;
  --accent: #c9442e;
  --accent-ink: #ffffff;
  --good: #9be58a;
  --good-bg: rgba(110, 200, 90, 0.16);
  --warn: #f3c46f;
  --warn-bg: rgba(240, 176, 74, 0.16);
  --bad: #ff8f82;
  --bad-bg: rgba(255, 107, 91, 0.16);
  --gold: #f0c55a;
  --label: #e9dabd;
  --label-ink: #2a1a0f;
  --label-ink-2: #573b25;
  --label-line: rgba(80, 50, 22, 0.5);
  --cover: rgba(28, 18, 11, 0.95);
  --scrim: rgba(0, 0, 0, 0.45);
  --shadow-card: 0 1px 0 rgba(255, 230, 190, 0.08) inset, 0 18px 40px -18px rgba(0, 0, 0, 0.85), 0 3px 10px rgba(0, 0, 0, 0.4);
  --shadow-btn: 0 1px 0 rgba(255, 230, 190, 0.1) inset, 0 -2px 0 rgba(0, 0, 0, 0.3) inset, 0 6px 14px -8px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; background: #c99f68; }
:root[data-theme="dark"] { background: #20140c; }
/* the first paint, before the script knows the player's choice: the system's */
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { background: #20140c; color-scheme: dark; } }
body {
  margin: 0;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font: 500 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
a { color: var(--accent); font-weight: 700; text-underline-offset: 3px; }
:root[data-theme="dark"] a { color: #ffb08a; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { flex: none; }
[hidden] { display: none !important; }

/* the wooden table: two canvases cross-fading with the theme */
.table-bg { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; opacity: 0; transition: opacity 0.3s ease; pointer-events: none; }
.table-bg.on { opacity: 1; }
.theme-fade body, .theme-fade .card, .theme-fade .act, .theme-fade .icon-btn, .theme-fade .btn, .theme-fade .tile, .theme-fade .sheet, .theme-fade .status, .theme-fade .bar {
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease !important;
}

/* ------------------------------------------------------------------ the bar */
.bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 60px;
  padding: calc(var(--safe-t) + 8px) calc(var(--safe-r) + 12px) 6px calc(var(--safe-l) + 12px);
  color: var(--on-wood);
  position: relative;
  z-index: 3;
}
body[data-screen="landing"] .bar { display: none; }
.icon-btn {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--btn-bg);
  color: var(--ink);
  box-shadow: var(--shadow-btn);
  transition: transform 0.12s var(--ease-out), background-color 0.2s;
}
.icon-btn:hover { background: var(--btn-hi); }
.icon-btn:active { transform: scale(0.94); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; padding: 4px 6px 4px 2px; border: 0; background: none; text-align: left; color: var(--on-wood); border-radius: 14px; }
.brand img { filter: drop-shadow(0 2px 3px rgba(40, 18, 4, 0.35)); }
.brand-text { display: flex; flex-direction: column; min-width: 0; text-shadow: var(--wood-glow); }
.brand-text b { font-weight: 800; font-size: 18px; line-height: 1.15; }
.brand-text small { font-size: 14px; font-weight: 600; color: var(--on-wood-2); }
.bar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; text-shadow: var(--wood-glow); }
.bar-title b { font-weight: 800; font-size: clamp(15px, 4.2vw, 20px); line-height: 1.15; overflow-wrap: break-word; hyphens: auto; }
.bar-title small { font-size: 14px; font-weight: 600; color: var(--on-wood-2); }
.bar-extra { display: flex; align-items: center; gap: 8px; flex: none; }
.bar-extra:empty { display: none; }
.bar-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.chip-slot { display: flex; align-items: center; min-width: 40px; min-height: 40px; }
.bar-stars { display: flex; padding: 6px 8px; border-radius: 999px; background: var(--btn-bg); box-shadow: var(--shadow-btn); }
.bar-timer { font-variant-numeric: tabular-nums; font-weight: 800; padding: 6px 10px; border-radius: 999px; background: var(--btn-bg); box-shadow: var(--shadow-btn); color: var(--ink); font-size: 15px; }
.stars { display: inline-flex; gap: 1px; }
.stars .on { color: #e7a417; filter: drop-shadow(0 1px 0 rgba(120, 70, 0, 0.35)); }
.stars .off { color: var(--line-strong); }
:root[data-theme="dark"] .stars .on { color: #f6c445; }
.skip { min-height: 44px; }
@media (max-width: 420px) {
  .brand-text small { display: none; }
  .brand-text b { font-size: 16px; }
  .bar { gap: 6px; padding-left: calc(var(--safe-l) + 8px); padding-right: calc(var(--safe-r) + 8px); }
  .bar-tools { gap: 6px; }
}
@media (max-width: 359px) {
  #btn-help { display: none; }
  .bar-stars { padding: 5px 6px; }
}

/* ------------------------------------------------------------------ main */
.main {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0 calc(var(--safe-r) + 16px) calc(var(--safe-b) + 12px) calc(var(--safe-l) + 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
body[data-route="play"] .main, body[data-route="daily"] .main, body[data-route="blitz"] .main, body[data-route="tutorial"] .main { overflow: hidden; }
@media (max-width: 319px) { .main { padding-left: calc(var(--safe-l) + 8px); padding-right: calc(var(--safe-r) + 8px); } }
.main.enter > .screen { animation: screen-in 0.34s var(--ease-out) backwards; }
@keyframes screen-in { from { opacity: 0; transform: translateY(12px); } }
.screen { position: relative; }
.note { text-align: center; color: var(--on-wood); text-shadow: var(--wood-glow); font-weight: 600; margin: 6px auto 0; max-width: 46ch; }
.muted { color: var(--ink-2); }

/* paper cards */
.card { border-radius: 16px; box-shadow: var(--shadow-card); }
.paper { background: var(--paper) var(--grain); background-blend-mode: multiply; color: var(--ink); }
:root[data-theme="dark"] .paper { background-blend-mode: soft-light; }
.card-title { margin: 0 0 12px; font-size: 18px; font-weight: 800; }

/* buttons */
.btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--btn-bg);
  color: var(--ink);
  font-weight: 700;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-btn);
  transition: transform 0.12s var(--ease-out), background-color 0.2s, filter 0.2s;
  text-align: center;
}
.btn:hover { background: var(--btn-hi); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 -2px 0 rgba(0, 0, 0, 0.2) inset, 0 8px 18px -8px rgba(140, 30, 10, 0.75); }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn.big { min-height: 56px; padding: 0 24px; font-size: 17px; border-radius: 14px; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 15px; }
.btn.quiet { background: var(--btn-bg); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ------------------------------------------------------------------ home */
.screen.home { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 6px 0 12px; }
.boxes { display: grid; gap: 16px; width: min(100%, 560px); }
.matchbox {
  --box: #a52d1f;
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 116px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  text-align: left;
  color: var(--label-ink);
  background: var(--box) var(--grain);
  background-blend-mode: multiply;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -3px 0 rgba(0, 0, 0, 0.22), 0 18px 30px -16px rgba(40, 18, 4, 0.7), 0 3px 8px rgba(40, 18, 4, 0.3);
  transition: transform 0.2s var(--spring), box-shadow 0.2s;
}
.matchbox:hover { transform: translateY(-3px) rotate(-0.4deg); }
.matchbox:active { transform: translateY(1px) scale(0.985); transition-duration: 0.08s; }
.mb-red { --box: #a52d1f; }
.mb-blue { --box: #25467f; }
.mb-green { --box: #2d6a35; }
:root[data-theme="dark"] .mb-red { --box: #85251a; }
:root[data-theme="dark"] .mb-blue { --box: #1d3766; }
:root[data-theme="dark"] .mb-green { --box: #22512a; }
.striker {
  flex: none;
  width: 16px;
  border-radius: 14px 0 0 14px;
  background: #3a2213 var(--grain);
  background-size: 60px;
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.35), inset 1px 0 0 rgba(255, 255, 255, 0.08);
  position: relative;
}
.striker::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: repeating-linear-gradient(170deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 3px); }
.mb-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 8px 10px 10px;
  padding: 12px 14px;
  border-radius: 9px;
  background: var(--label) var(--grain);
  background-blend-mode: multiply;
  box-shadow: inset 0 0 0 1.5px var(--label-line), inset 0 0 0 4px var(--label), inset 0 0 0 5px var(--label-line);
  min-width: 0;
}
.mb-emblem { flex: none; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fffaf0, #efdfbf 70%); box-shadow: inset 0 0 0 1.5px var(--label-line), 0 2px 4px rgba(60, 30, 8, 0.15); color: #6b3f1d; --paper: #fbf3e3; }
.mb-emblem.big { width: 92px; height: 92px; margin: 0 auto 6px; }
.mb-emblem.small, .pk-emblem.small { width: 44px; height: 44px; }
.mb-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mb-title { font-weight: 800; font-size: 21px; line-height: 1.15; letter-spacing: 0.005em; overflow-wrap: anywhere; }
.mb-sub { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; color: var(--label-ink-2); }
.mb-sub .ic.on { color: #c78a06; }
.mb-sub.streak .ic { color: #a08a74; }
.mb-sub.streak.lit .ic { color: #d2541a; filter: drop-shadow(0 0 3px rgba(240, 120, 30, 0.6)); animation: flicker 2.4s ease-in-out infinite; }
.mb-note { font-size: 14px; font-weight: 600; color: var(--label-ink-2); opacity: 0.9; }
.mb-go { flex: none; display: grid; place-items: center; width: 34px; color: rgba(255, 245, 225, 0.92); }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(0); } 30% { transform: scale(1.08, 0.96) rotate(-3deg); } 60% { transform: scale(0.96, 1.06) rotate(2deg); } }
.board-btn { margin-top: 4px; min-width: 220px; }
@media (max-width: 400px) {
  .matchbox { min-height: 100px; }
  .striker { width: 12px; }
  .mb-label { gap: 10px; margin: 8px 6px 8px 8px; padding: 10px; }
  .mb-emblem { width: 46px; height: 46px; }
  .mb-emblem .ic { width: 34px; height: 34px; }
  .mb-title { font-size: 19px; }
  .mb-sub { font-size: 14px; }
  .mb-go { width: 24px; }
  .boxes { gap: 12px; }
}
@media (min-width: 960px) {
  .boxes { grid-template-columns: repeat(3, 1fr); width: min(100%, 1120px); gap: 22px; }
  .matchbox { min-height: 230px; }
  .mb-label { flex-direction: column; justify-content: center; text-align: center; }
  .mb-text { align-items: center; }
  .mb-sub { justify-content: center; }
  .mb-go { display: none; }
}
@media (min-width: 1200px) and (min-height: 760px) {
  .matchbox { min-height: 280px; }
  .mb-emblem { width: 84px; height: 84px; }
  .mb-emblem .ic { width: 58px; height: 58px; }
  .mb-title { font-size: 26px; }
  .mb-sub { font-size: 17px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .boxes { grid-template-columns: repeat(3, 1fr); width: 100%; gap: 12px; }
  .matchbox { min-height: 150px; }
  .mb-label { flex-direction: column; text-align: center; padding: 8px; }
  .mb-text { align-items: center; }
  .mb-sub { justify-content: center; }
  .mb-go { display: none; }
  .screen.home { gap: 10px; }
}

/* ----------------------------------------------------------------- packs */
.screen.packs { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 0 12px; }
.pack-rail { display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 26px max(8px, calc(50% - 130px)) 22px; margin: 0 -16px; scrollbar-width: none; }
.pack-rail::-webkit-scrollbar { display: none; }
@media (min-width: 1180px) { .pack-rail { display: grid; grid-template-columns: repeat(5, 1fr); overflow: visible; padding: 26px 0 22px; margin: 0 auto; width: min(100%, 1240px); } }
.pack-box { --box: #a52d1f; --head: #c4321f; flex: 0 0 min(70vw, 236px); scroll-snap-align: center; position: relative; display: block; padding: 0; border: 0; background: none; text-align: left; color: var(--label-ink); border-radius: 14px; }
.pk-kindling { --box: #a52d1f; --head: #c4321f; }
.pk-spark { --box: #25467f; --head: #29468c; }
.pk-flame { --box: #2d6a35; --head: #2f7e34; }
.pk-fireworks { --box: #8c2a3e; --head: #c4321f; }
.pk-traps { --box: #2f3a66; --head: #29468c; }
:root[data-theme="dark"] .pack-box { filter: brightness(0.9); }
/* the tray with the match heads, peeking out of the sleeve */
.pk-tray { position: absolute; left: 14px; right: 14px; top: 0; height: 34px; border-radius: 8px 8px 0 0; background: radial-gradient(circle at 50% 70%, var(--head) 0 4.4px, transparent 5px) 4px 2px / 15px 18px repeat-x, linear-gradient(#e9d3a7, #cfae78); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 -2px 6px rgba(40, 18, 4, 0.2); transform: translateY(-18px); transition: transform 0.5s var(--spring); }
.pack-box.locked .pk-tray { transform: translateY(6px); }
.pack-box.opening .pk-tray { animation: tray-out 0.5s var(--spring) both 0.15s; }
@keyframes tray-out { from { transform: translateY(6px); } }
.pk-sleeve { position: relative; display: flex; flex-direction: column; min-height: 286px; border-radius: 14px; background: var(--box) var(--grain); background-blend-mode: multiply; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -3px 0 rgba(0, 0, 0, 0.22), 0 18px 30px -16px rgba(40, 18, 4, 0.7), 0 3px 8px rgba(40, 18, 4, 0.3); transition: transform 0.2s var(--spring); }
.pk-sleeve .striker { width: auto; height: 14px; border-radius: 14px 14px 0 0; }
.pack-box:not(.locked):hover .pk-sleeve { transform: translateY(-3px); }
.pack-box:active .pk-sleeve { transform: scale(0.985); }
.pk-label { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; margin: 10px; padding: 16px 12px; text-align: center; border-radius: 9px; background: var(--label) var(--grain); background-blend-mode: multiply; box-shadow: inset 0 0 0 1.5px var(--label-line), inset 0 0 0 4px var(--label), inset 0 0 0 5px var(--label-line); }
.pk-emblem { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fffaf0, #efdfbf 70%); box-shadow: inset 0 0 0 1.5px var(--label-line); color: #6b3f1d; --paper: #fbf3e3; }
.pk-name { font-weight: 800; font-size: 21px; line-height: 1.15; overflow-wrap: anywhere; hyphens: auto; }
.pk-about { font-size: 14px; font-weight: 600; color: var(--label-ink-2); min-height: 2.6em; }
.pk-stars { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pk-stars .ic { color: #c78a06; }
.pk-badges { min-height: 28px; display: flex; align-items: center; }
.stamp { display: inline-block; padding: 3px 10px; border-radius: 6px; border: 2px solid currentColor; color: var(--good); font-weight: 800; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; transform: rotate(-4deg); }
.pk-label .stamp { color: #2c6f24; }
.stamp.gold { color: var(--gold); background: linear-gradient(135deg, rgba(255, 225, 140, 0.35), rgba(255, 245, 210, 0.1)); }
.pk-label .stamp.gold { color: #8a5d00; }
.stamp.big { font-size: 16px; padding: 5px 14px; }
.pack-box.locked .pk-label > :not(.pk-lock) { opacity: 0.42; filter: grayscale(0.6); }
.pack-box.locked .pk-sleeve { filter: saturate(0.55) brightness(0.92); cursor: default; }
.pk-lock { position: absolute; inset: auto 10px 18px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border-radius: 10px; background: rgba(42, 26, 15, 0.86); color: #fbefd8; font-weight: 700; font-size: 14px; text-align: center; }
.lock-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #fbefd8; color: #3a2213; }
.pack-box.opening .pk-lock { animation: lock-off 0.5s var(--ease-out) both; }
@keyframes lock-off { to { opacity: 0; transform: translateY(-24px) scale(1.15) rotate(-8deg); } }

/* ------------------------------------------------------------------ grid */
.screen.grid { width: min(100%, 600px); margin: 0 auto; display: flex; flex-direction: column; gap: 16px; padding: 4px 0 16px; }
@media (min-width: 760px) { .screen.grid { width: min(100%, 760px); } }
.grid-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: 14px; background: var(--btn-bg); box-shadow: var(--shadow-btn); color: var(--ink); }
.grid-about { flex: 1; min-width: 12ch; font-weight: 700; }
.grid-head .stamp { color: var(--good); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(5, 1fr); gap: 14px; } }
.tile { position: relative; aspect-ratio: 1 / 1; min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 14px; border: 0; background: var(--paper) var(--grain); background-blend-mode: multiply; color: var(--ink); box-shadow: var(--shadow-card); transition: transform 0.18s var(--spring); }
:root[data-theme="dark"] .tile { background-blend-mode: soft-light; }
.tile:hover { transform: translateY(-2px); }
.tile:active { transform: scale(0.96); }
.tile-n { font-weight: 800; font-size: clamp(20px, 6vw, 26px); line-height: 1; font-variant-numeric: tabular-nums; }
.tile-done { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--box, #a52d1f); color: #fff; }
.tiles.pk-spark .tile-done { background: #25467f; }
.tiles.pk-flame .tile-done { background: #2d6a35; }
.tiles.pk-fireworks .tile-done { background: #8c2a3e; }
.tiles.pk-traps .tile-done { background: #2f3a66; }
.tile.solved { box-shadow: var(--shadow-card), inset 0 0 0 2px rgba(199, 138, 6, 0.35); }

/* ------------------------------------------------------------------ play */
.screen.play { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: stretch; }
.board-host { position: relative; flex: 1; min-height: 160px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.board-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.board-canvas:active { cursor: grabbing; }
.board-proxies { position: absolute; inset: 0; pointer-events: none; }
.stick-proxy { position: absolute; left: var(--x); top: var(--y); width: calc(var(--len) + 10px); height: 24px; padding: 0; border: 0; background: transparent; opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)); pointer-events: none; }
.stick-proxy:focus, .stick-proxy:focus-visible { outline: none; }
.status { align-self: center; display: inline-flex; align-items: center; gap: 8px; margin: 2px auto 0; padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 15px; background: var(--btn-bg); color: var(--ink); box-shadow: var(--shadow-btn); text-align: center; max-width: 100%; transition: background-color 0.2s, color 0.2s; }
.status-ic { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; flex: none; }
.status[data-state="true"] { background: var(--good-bg); color: var(--good); }
.status[data-state="true"] .status-ic { background: #46a83a; color: #fff; }
.status[data-state="false"] { background: var(--warn-bg); color: var(--warn); }
.status[data-state="false"] .status-ic { background: #d9921f; color: #fff; }
.status[data-state="invalid"] { background: var(--bad-bg); color: var(--bad); }
.status[data-state="invalid"] .status-ic { background: #d23a2c; color: #fff; }
.status[data-state="start"] .status-ic { color: var(--accent); }
.actions { display: flex; justify-content: center; gap: 12px; padding: 12px 0 4px; }
.act { position: relative; flex: 0 1 180px; min-width: 0; min-height: 58px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--btn-bg); color: var(--ink); font-weight: 800; font-size: 16px; box-shadow: var(--shadow-btn); transition: transform 0.12s var(--ease-out), opacity 0.2s, background-color 0.2s; }
.act:hover { background: var(--btn-hi); }
.act:active { transform: translateY(1px) scale(0.97); }
.act:disabled { opacity: 0.45; cursor: default; transform: none; }
.act span { line-height: 1.15; hyphens: manual; }
@media (max-width: 400px) {
  .act { flex-direction: column; gap: 2px; min-height: 64px; padding: 6px 8px; font-size: 15px; }
  .act .hint-dots { top: 8px; right: 10px; bottom: auto; left: auto; transform: none; flex-direction: column; }
}
@media (max-width: 340px) { .act { font-size: 14px; } .status { font-size: 14px; } }
.hint-ic { position: relative; display: grid; place-items: center; width: 34px; height: 34px; flex: none; }
.ring { position: absolute; inset: -4px; width: 42px; height: 42px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 3; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset 0.25s linear, stroke 0.3s; }
.hint.ready .ring-fg { stroke: #e8a400; }
.hint.ready .hint-ic .ic { color: #b57b00; animation: bulb 1.2s ease-in-out infinite; }
:root[data-theme="dark"] .hint.ready .hint-ic .ic { color: var(--focus); }
.hint.spent { opacity: 0.55; }
@keyframes bulb { 50% { transform: scale(1.12); filter: drop-shadow(0 0 4px rgba(255, 200, 60, 0.9)); } }
.hint-dots { display: flex; gap: 3px; position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); }
.hint-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); }
.hint[data-used="1"] .hint-dots i:nth-child(-n + 1), .hint[data-used="2"] .hint-dots i:nth-child(-n + 2), .hint[data-used="3"] .hint-dots i { background: var(--accent); }

/* the result over the board */
.result-layer { position: fixed; inset: 0; z-index: 2; padding-top: calc(var(--safe-t) + 70px) !important; display: grid; place-items: center; padding: 12px; background: var(--scrim); opacity: 0; transition: opacity 0.25s ease; overflow-y: auto; }
.result-layer.in { opacity: 1; }
.result { width: min(100%, 420px); padding: 22px 20px 18px; text-align: center; transform: translateY(18px) scale(0.97); transition: transform 0.42s var(--spring); }
.result-layer.in .result { transform: none; }
.result h2 { margin: 0 0 8px; font-size: 26px; font-weight: 800; }
.big-stars { display: flex; justify-content: center; gap: 6px; margin: 4px 0 10px; }
.big-star { color: var(--line-strong); }
.big-star.on { color: #e7a417; filter: drop-shadow(0 2px 2px rgba(120, 70, 0, 0.35)); animation: star-pop 0.5s var(--spring) both; animation-delay: calc(var(--i) * 150ms + 120ms); }
:root[data-theme="dark"] .big-star.on { color: #f6c445; }
@keyframes star-pop { from { opacity: 0; transform: scale(0.2) rotate(-30deg); } 70% { opacity: 1; } }
.res-line { display: flex; justify-content: center; align-items: baseline; gap: 10px; margin: 4px 0; font-size: 16px; color: var(--ink-2); font-weight: 600; }
.res-line b { font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
.res-note { margin: 4px 0; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.res-flame { display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--warn); font-weight: 700; }
.res-flame .ic { color: #e0601d; animation: flicker 1.6s ease-in-out infinite; }
.res-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.res-actions .btn { flex: 1 1 120px; }
.res-friends { margin-top: 12px; text-align: left; }
.res-friends h3 { margin: 0 0 4px; font-size: 16px; font-weight: 800; }
.result.milestone h2 { color: var(--warn); }
.result.record .blitz-score b { color: var(--gold); }
.blitz-score { display: flex; flex-direction: column; align-items: center; margin: 2px 0 6px; }
.blitz-score b { font-size: 64px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.blitz-score span { font-weight: 700; color: var(--ink-2); }

/* the daily */
.screen.play.daily.replay .status::after { content: ""; }

/* Blitz */
.blitz-head { display: flex; align-items: center; gap: 10px; width: min(100%, 560px); margin: 0 auto 4px; padding: 6px 8px 6px 14px; border-radius: 999px; background: var(--btn-bg); box-shadow: var(--shadow-btn); color: var(--ink); }
.blitz-head .blitz-bar { flex: 1; width: auto; }
.blitz-head .blitz-time { color: var(--ink); text-shadow: none; font-size: 17px; }
.blitz-head .blitz-count { box-shadow: none; background: var(--paper-2); }
.blitz-bar { position: relative; display: block; width: clamp(64px, 22vw, 220px); height: 12px; border-radius: 6px; background: rgba(60, 30, 10, 0.25); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3); }
.blitz-bar i { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(var(--k, 1)); background: linear-gradient(90deg, #f7c04a, #ec7a24); transition: transform 0.12s linear; border-radius: inherit; }
.blitz-bar.low i { background: linear-gradient(90deg, #f08a4a, #d23a2c); }
.blitz-count { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 999px; background: var(--btn-bg); box-shadow: var(--shadow-btn); color: var(--ink); font-size: 17px; font-variant-numeric: tabular-nums; }
.blitz-count .ic { color: var(--good); }
.blitz-count.bump { animation: bump 0.4s var(--spring); }
@keyframes bump { 40% { transform: scale(1.25); } }
.blitz-time { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--on-wood); text-shadow: var(--wood-glow); min-width: 3.2ch; }
.blitz-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.blitz-stage.enter .board-host { animation: board-in 0.32s var(--ease-out) both; }
@keyframes board-in { from { opacity: 0; transform: translateX(24px); } }
.blitz-intro { margin: auto; width: min(100%, 440px); padding: 26px 22px; text-align: center; display: flex; flex-direction: column; gap: 8px; }
.blitz-intro h2 { margin: 0; font-size: 26px; font-weight: 800; }
.rules { text-align: left; margin: 8px 0; padding-left: 1.4em; display: grid; gap: 6px; }
.rules li::marker { font-weight: 800; color: var(--accent); }
.rules.big { font-size: 16px; font-weight: 600; }
.cover { position: fixed; inset: 0; z-index: 2; padding-top: calc(var(--safe-t) + 70px) !important; display: grid; place-items: center; padding: 16px; background: var(--cover); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: fade-in 0.2s ease both; }
.cover.out { animation: fade-out 0.2s ease both; }
.cover.counting { background: color-mix(in srgb, var(--cover) 70%, transparent); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.count { display: flex; flex-direction: column; align-items: center; color: var(--ink); }
.count span { font-weight: 700; font-size: 18px; color: var(--ink-2); }
.count-n { font-size: 108px; line-height: 1; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; animation: count-pop 0.6s var(--spring) both; }
.count-n.pop { animation: count-pop 0.6s var(--spring) both; }
@keyframes count-pop { from { opacity: 0; transform: scale(1.8); } }
.pause-card { width: min(100%, 380px); padding: 22px; text-align: center; }
.pause-card h2 { margin: 0 0 6px; font-size: 24px; font-weight: 800; }
.pause-card .res-actions .btn { flex: 1 1 100%; }

/* the tutorial */
.screen.tutorial { gap: 8px; }
.tut-card { width: min(100%, 560px); margin: 2px auto 0; padding: 14px 16px; }
.tut-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.tut-step { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.tut-dots { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tut-dots li { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); transition: background-color 0.3s, transform 0.3s var(--spring); }
.tut-dots li.on { background: var(--accent); transform: scale(1.1); }
.tut-text { margin: 0; font-size: 17px; font-weight: 700; min-height: 2.9em; }
.tut-text.flash { animation: text-in 0.35s var(--ease-out); }
@keyframes text-in { from { opacity: 0; transform: translateY(6px); } }
.tut-stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tut-done { margin: auto; width: min(100%, 420px); padding: 26px 22px; text-align: center; }
.tut-done h2 { margin: 6px 0; font-size: 26px; }
.tut-done p { margin: 0 0 18px; color: var(--ink-2); font-weight: 600; }

/* the ghost hand: its fingertip is the element's origin */
.ghost { position: absolute; left: 0; top: 0; z-index: 6; pointer-events: none; opacity: 0; will-change: transform, opacity; }
.ghost-art { position: absolute; left: -20px; top: -1px; overflow: visible; filter: drop-shadow(0 6px 10px rgba(40, 18, 4, 0.3)); }
.ghost-hand { fill: rgba(255, 252, 244, 0.74); stroke: rgba(70, 40, 16, 0.45); stroke-width: 1.6; }
:root[data-theme="dark"] .ghost-hand { fill: rgba(255, 240, 220, 0.5); stroke: rgba(255, 230, 200, 0.55); }
.ghost-press { fill: rgba(255, 214, 120, 0); transition: fill 0.15s; }
.ghost.down .ghost-press { fill: rgba(255, 214, 120, 0.5); }

/* ----------------------------------------------------------- leaderboard */
.screen.board { width: min(100%, 640px); margin: 0 auto; display: flex; flex-direction: column; gap: 16px; padding: 4px 0 18px; }
.screen.board .card { padding: 16px; }
.mine { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0; }
@media (min-width: 560px) { .mine { grid-template-columns: repeat(4, 1fr); } }
.mine div { padding: 10px 12px; border-radius: 12px; background: var(--paper-2); }
.mine dt { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.mine dd { margin: 2px 0 0; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--paper-2); margin-bottom: 10px; }
.tabs button { flex: 1; min-height: 44px; border: 0; border-radius: 9px; background: transparent; font-weight: 700; color: var(--ink-2); transition: background-color 0.2s, color 0.2s; }
.tabs button.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-btn); }
.fb-day { margin: 2px 4px 6px; font-weight: 700; color: var(--ink-2); }
.fb-host { min-height: 120px; }
.fb-host.compact { min-height: 60px; max-height: 32vh; overflow-y: auto; }
.fb-list { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 4px; transition: opacity 0.2s; }
.fb-list.loading { opacity: 0.6; }
.fb-row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; min-height: 46px; padding: 0 12px; border-radius: 12px; }
.fb-row:nth-child(odd):not(.me) { background: color-mix(in srgb, var(--paper-2) 60%, transparent); }
.fb-row.me { background: color-mix(in srgb, var(--accent) 12%, var(--paper)); box-shadow: inset 0 0 0 2px var(--accent); font-weight: 800; }
.fb-row.muted { color: var(--ink-2); }
.fb-rank { font-weight: 800; color: var(--ink-2); text-align: center; font-variant-numeric: tabular-nums; }
.fb-name { min-width: 0; overflow-wrap: anywhere; }
.fb-name small { font-weight: 600; color: var(--ink-2); }
.heart { color: #d94a5a; margin-left: 4px; }
.fb-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.fb-note { margin: 6px 4px 0; font-size: 14px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.fb-note:empty { display: none; }
.fb-offline { display: inline-flex; align-items: center; gap: 6px; }
.fb-friends { display: flex; align-items: center; gap: 8px; margin: 12px 4px 0; }

/* ----------------------------------------------------------------- sheet */
.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 100%; max-height: min(88dvh, 860px); border-radius: 22px 22px 0 0; background: var(--paper) var(--grain); background-blend-mode: multiply; color: var(--ink); box-shadow: 0 -18px 50px -20px rgba(0, 0, 0, 0.6); overflow: hidden; display: none; flex-direction: column; animation: sheet-up 0.32s var(--ease-out); }
:root[data-theme="dark"] .sheet { background-blend-mode: soft-light; }
.sheet[open] { display: flex; }
.sheet.closing { animation: sheet-down 0.18s ease-in both; }
.sheet::backdrop { background: rgba(20, 10, 3, 0.45); backdrop-filter: blur(3px); }
@media (min-width: 640px) { .sheet { margin: auto; width: min(560px, calc(100vw - 48px)); border-radius: 20px; animation-name: sheet-in; } .sheet.wide { width: min(720px, calc(100vw - 48px)); } .sheet.closing { animation-name: sheet-out; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(10px) scale(0.98); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 10px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.sheet-body { padding: 10px 20px calc(var(--safe-b) + 22px); overflow-y: auto; overscroll-behavior: contain; }
.sheet-body h3 { margin: 18px 0 6px; font-size: 17px; font-weight: 800; }
.sheet-body p { margin: 6px 0; }
.field { padding: 10px 0; border-bottom: 1px solid var(--line); }
.field-label { display: block; font-weight: 700; margin-bottom: 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--paper-2); }
.seg button { flex: 1 1 auto; min-height: 44px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font-weight: 700; font-size: 15px; transition: background-color 0.2s, color 0.2s; }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-btn); }
.seg.small button { min-height: 40px; padding: 0 10px; font-size: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 56px; padding: 6px 0; border-bottom: 1px solid var(--line); font-weight: 700; }
.row.off { opacity: 0.55; }
.row input[type="range"] { flex: 1; max-width: 240px; accent-color: var(--accent); min-height: 44px; }
.knob { display: none; }
input[type="checkbox"][role="switch"] { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 52px; height: 32px; margin: 0; border-radius: 16px; background: var(--line-strong); transition: background-color 0.2s; cursor: pointer; }
input[type="checkbox"][role="switch"]::before { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); transition: transform 0.22s var(--spring); }
input[type="checkbox"][role="switch"]:checked { background: var(--accent); }
input[type="checkbox"][role="switch"]:checked::before { transform: translateX(20px); }
.about { margin-top: 10px; }
.about-line { display: flex; align-items: center; gap: 12px; }
.about-line span { display: flex; flex-direction: column; }
.about-line small { color: var(--ink-2); font-weight: 600; }
.about-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.about-actions .btn { flex: 1 1 200px; }
.help .figs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 6px 0; }
.help .figs.signs { grid-template-columns: repeat(4, 1fr); max-width: 320px; }
.fig { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 4px; border-radius: 10px; background: color-mix(in srgb, #d9b27c 30%, var(--paper)); }
.fig figcaption { font-weight: 800; font-size: 15px; }
.fig .m-on .m-body { fill: #ecd3a2; stroke: #9a6f3e; stroke-width: 0.5; }
.fig .m-on .m-head { fill: #c4321f; }
.fig .m-off .m-body { fill: none; stroke: var(--line-strong); stroke-width: 0.6; stroke-dasharray: 1.4 1.4; }
.star-rules { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 8px; }
.star-rules li { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.keys { padding-left: 1.1em; display: grid; gap: 4px; margin: 6px 0 14px; }

/* ----------------------------------------------------------------- toast */
.toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 70px); z-index: 20; max-width: min(92vw, 460px); padding: 10px 16px; border-radius: 14px; background: rgba(36, 22, 12, 0.94); color: #fbefd8; font-weight: 700; font-size: 15px; text-align: center; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6); opacity: 0; transform: translate(-50%, -10px); transition: opacity 0.22s ease, transform 0.22s var(--ease-out); pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
:root[data-theme="dark"] .toast { background: rgba(250, 238, 216, 0.96); color: #2a1a0f; }

/* --------------------------------------------------------------- landing */
.screen.landing { width: min(100%, 1100px); margin: 0 auto; display: flex; flex-direction: column; gap: 22px; padding: calc(var(--safe-t) + 10px) 0 calc(var(--safe-b) + 24px); }
body[data-screen="landing"] .main { overflow-y: auto; }
.landing-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.landing-top .brand { flex: 0 1 auto; color: var(--on-wood); text-shadow: var(--wood-glow); font-size: 17px; }
.landing-top .brand b { font-weight: 800; }
.landing-tools { display: flex; align-items: center; gap: 8px; }
.landing-tools .seg { background: var(--btn-bg); box-shadow: var(--shadow-btn); }
.hero { display: grid; justify-items: center; gap: 12px; text-align: center; }
.display { margin: 0; font-size: clamp(32px, 7vw, 58px); line-height: 1.05; font-weight: 800; letter-spacing: -0.01em; color: var(--on-wood); text-shadow: var(--wood-glow); }
.hero-demo { margin: 0; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.demo-host { position: relative; width: min(100%, 560px); height: clamp(190px, 34vh, 320px); display: flex; flex-direction: column; transition: opacity 0.45s ease; }
.demo-host.fading { opacity: 0; }
.hero-demo figcaption { font-weight: 800; font-size: 19px; color: var(--on-wood); text-shadow: var(--wood-glow); }
.lead { margin: 0; max-width: 54ch; font-size: 17px; font-weight: 600; color: var(--on-wood); text-shadow: var(--wood-glow); }
.cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 4px; }
.cta .btn { min-width: 200px; }
.warn { margin: 0; max-width: 46ch; font-weight: 700; color: var(--on-wood); text-shadow: var(--wood-glow); }
.features { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.feature { padding: 18px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.feature h3 { margin: 4px 0 0; font-size: 18px; font-weight: 800; }
.feature p { margin: 0; color: var(--ink-2); font-weight: 600; }
.feature .mb-emblem .ic { animation: emblem 3.2s ease-in-out infinite; }
.f-2 .mb-emblem .ic { animation-delay: -1.1s; }
.f-3 .mb-emblem .ic { animation-delay: -2.2s; }
@keyframes emblem { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-3px) rotate(-4deg); } }
.facts { list-style: none; margin: 0; padding: 16px 18px; display: grid; gap: 10px; }
.facts li { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.facts .ic { color: var(--accent); }
:root[data-theme="dark"] .facts .ic { color: #ff9a74; }
.landing-foot { text-align: center; color: var(--on-wood-2); font-size: 14px; font-weight: 700; text-shadow: var(--wood-glow); margin: 0; }
@media (min-width: 980px) {
  .hero { grid-template-columns: 1fr 1.1fr; grid-template-areas: "title demo" "lead demo" "cta demo"; text-align: left; justify-items: start; align-items: center; column-gap: 32px; }
  .hero h1 { grid-area: title; align-self: end; }
  .hero .lead { grid-area: lead; }
  .hero .cta { grid-area: cta; justify-content: flex-start; align-self: start; }
  .hero-demo { grid-area: demo; }
}

/* --------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.12s !important; }
}
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.12s !important; }
:root[data-motion="reduce"] .main.enter > .screen { animation: fade-in 0.18s ease backwards !important; animation-duration: 0.18s !important; }
:root[data-motion="reduce"] .matchbox:hover, :root[data-motion="reduce"] .tile:hover, :root[data-motion="reduce"] .pack-box:hover .pk-sleeve { transform: none; }
:root[data-motion="full"] .main.enter > .screen { animation-duration: 0.34s; }
