:root {
  color-scheme: dark;
  --bg: #0b0a1a;
  --surface: #16142b;
  --raised: #211e3d;
  --text: #f5f3ff;
  --muted: #b1adcc;
  --border: #37304f;
  --gold: #f2c14e;
  --pink: #ff3d8b;
  --light-pink: #ff83b6;
  --cyan: #29e3e3;
  --green: #3ddc84;
  --violet: #ad9fff;
  --warn: #ffb020;
  --danger: #ff7d85;
  --display: Unbounded, "Arial Black", system-ui, sans-serif;
  --body: Inter, system-ui, -apple-system, sans-serif;
  --edge: clamp(1rem, 3.5vw, 2rem);
  --page: 67rem;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 17.5rem; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse 65rem 34rem at 50% 0, #1a102b 0%, transparent 76%), var(--bg);
  color: var(--text);
  font: 1rem/1.55 var(--body);
  -webkit-tap-highlight-color: transparent;
}
body:has(dialog[open]) { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
input, select, textarea { min-width: 0; }
button, a, summary, select, input[type="checkbox"] { touch-action: manipulation; }
button, select, summary { cursor: pointer; }
button:disabled { opacity: .6; cursor: wait; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
main:focus { outline: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.25; overflow-wrap: anywhere; }
h1, h2 { font-family: var(--display); }
h1 { font-size: clamp(1.6rem, 4vw, 2.65rem); font-weight: 750; letter-spacing: -.052em; }
h2 { font-size: clamp(1.025rem, 2.2vw, 1.33rem); font-weight: 650; letter-spacing: -.035em; }
strong, b { font-weight: 700; }
svg { display: block; flex-shrink: 0; }
.symbols { width: 0; height: 0; position: absolute; overflow: hidden; }
.icon, .brand svg, .dock svg, .icon-button svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus {
  position: fixed;
  z-index: 40;
  top: .75rem;
  left: .75rem;
  padding: .65rem 1rem;
  background: var(--cyan);
  color: var(--bg);
  border-radius: .7rem;
}

.topbar { border-bottom: 1px solid #29223d; background: #100d20dc; }
.topbar-inner {
  max-width: calc(var(--page) + 2 * var(--edge));
  padding: .55rem var(--edge);
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  font: 650 clamp(.82rem, 3.5vw, 1.02rem) var(--display);
  letter-spacing: -.035em;
}
.brand b { color: var(--gold); }
.brand-mark, .action-icon, .heading-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: .85rem;
  color: var(--accent, var(--gold));
  border: 1px solid var(--accent-border, #76513a);
  background: var(--accent-bg, #302239);
}
.brand-mark { width: 2.45rem; height: 2.45rem; }
.brand-mark svg { width: 1.38rem; height: 1.38rem; }
.icon-button {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: var(--surface);
  color: var(--text);
}
.icon-button:hover, .icon-button:active { border-color: var(--violet); }
main {
  max-width: calc(var(--page) + 2 * var(--edge));
  margin: 0 auto;
  padding: var(--edge) var(--edge) calc(6rem + env(safe-area-inset-bottom, 0px));
}
.narrow { max-width: 52rem; margin-inline: auto; }
.stack { display: grid; gap: 1rem; }
.section-stack { display: grid; gap: 1.65rem; }
.panel { border: 1px solid var(--border); border-radius: 1.1rem; background: var(--surface); padding: clamp(1rem, 2.7vw, 1.45rem); min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.group-title { margin: 0 0 .8rem; }
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .35rem .9rem;
  margin-block-end: .75rem;
}
.section-head a, .text-link { color: var(--cyan); font-weight: 650; }
.section-head a { min-height: 2.75rem; display: inline-flex; align-items: center; }
.text-link { text-decoration: underline; text-underline-offset: .19em; }
.copy a { color: var(--cyan); text-decoration: underline; text-underline-offset: .17em; overflow-wrap: anywhere; }
.copy { overflow-wrap: anywhere; }

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 20rem;
  overflow: hidden;
  border: 1px solid #663150;
  border-radius: 1.5rem;
  background:
    radial-gradient(ellipse at 100% 16%, #471b45 0%, transparent 67%),
    linear-gradient(120deg, #23142d, #20142e 53%, #371237);
  box-shadow: 0 12px 56px #05040e60, inset 0 0 28px #e43b8719;
}
.hero::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, #1f142c 4%, #1f142cec 31%, #1f142c47 60%, transparent 76%);
  pointer-events: none;
}
.hero-art { position: absolute; z-index: -2; inset: 0 0 0 auto; width: min(72%, 42rem); }
.river-scene { width: 100%; height: 100%; }
.hero-copy { padding: clamp(1.3rem, 4.6vw, 3.25rem); min-width: 0; }
.hero h1 {
  width: fit-content;
  text-transform: uppercase;
  font-size: clamp(2rem, 6.8vw, 4.55rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -.076em;
  text-shadow: 0 3px 25px #140c2f70;
}
.hero h1 span { display: block; color: var(--gold); }
.hero p { margin-top: 1.05rem; max-width: 23rem; color: #eae2f8; font-size: clamp(1rem, 2vw, 1.14rem); }
.score-grid, .home-actions { display: grid; gap: .75rem; }
.score-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mini-score {
  position: relative;
  display: grid;
  align-content: start;
  padding: 1rem;
  gap: .55rem;
  border: 1px solid var(--border);
  border-radius: 1.05rem;
  background: linear-gradient(145deg, #25203d 0, var(--surface) 78%);
}
.mini-score.leader { border-color: #886c3d; background: linear-gradient(145deg, #322437, var(--surface) 86%); }
.score-person { min-width: 0; display: flex; align-items: center; gap: .65rem; font-weight: 750; }
.avatar {
  width: 2.05rem;
  height: 2.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: .7rem;
  background: #1a1730;
  box-shadow: inset 0 0 0 1px var(--player-color);
  color: var(--player-color);
  font: 700 .8rem var(--display);
}
.mini-value { display: flex; align-items: baseline; gap: .35rem; }
.mini-value strong { font: 720 clamp(1.35rem, 4vw, 2rem) var(--display); letter-spacing: -.06em; }
.leader .mini-value strong, .leader-star { color: var(--gold); }
.leader-star { position: absolute; top: .8rem; right: .65rem; }
.leader-star .icon { width: 1rem; height: 1rem; fill: #f2c14e40; }
.score-caption { color: var(--muted); font-size: .875rem; }
.progress-wrap { display: grid; gap: .48rem; margin-top: .95rem; }
.progress-label { display: flex; flex-wrap: wrap; gap: .25rem .45rem; align-items: center; color: var(--muted); font-size: .875rem; }
.progress-label strong { color: var(--text); }
.progress-track { height: .36rem; border-radius: 99rem; background: #322947; overflow: hidden; }
.progress-meter { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--pink), var(--gold)); }
.home-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.action-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: start;
  gap: .8rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--accent-border);
  border-radius: 1.05rem;
  text-align: left;
  background: linear-gradient(135deg, var(--accent-bg), var(--surface) 70%);
}
.action-icon, .heading-icon { width: 2.65rem; height: 2.65rem; }
.action-tile strong { display: block; font: 650 .96rem/1.3 var(--display); letter-spacing: -.042em; }
.action-tile small { display: block; margin-top: .25rem; color: var(--muted); font: .875rem/1.35 var(--body); }
.action-tile:hover, .action-tile:active { border-color: var(--accent); box-shadow: 0 0 20px var(--accent-bg); }
.cyan { --accent: var(--cyan); --accent-bg: #13323f; --accent-border: #285461; }
.gold { --accent: var(--gold); --accent-bg: #3c2930; --accent-border: #644b36; }
.pink { --accent: var(--light-pink); --accent-bg: #391a36; --accent-border: #603450; }
.violet { --accent: var(--violet); --accent-bg: #28214a; --accent-border: #4a3d73; }
.green { --accent: var(--green); --accent-bg: #193333; --accent-border: #2f5853; }
.home-footer { color: var(--muted); font-size: .8125rem; text-align: center; }
.utility-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .1rem .9rem; margin-bottom: .45rem; }
.utility-links a { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.75rem; color: var(--text); font-size: .875rem; }
.utility-links a:hover { color: var(--cyan); }
.utility-links .icon { color: var(--violet); width: 1rem; height: 1rem; }

.dock {
  position: fixed;
  z-index: 12;
  inset: auto 50% calc(.75rem + env(safe-area-inset-bottom, 0px)) auto;
  transform: translateX(50%);
  width: min(35rem, calc(100% - 1.6rem));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .22rem;
  padding: .35rem;
  border: 1px solid #4c3b60;
  border-radius: 1.15rem;
  background: #171329f5;
  box-shadow: 0 10px 35px #070412ad, 0 0 24px #a241a51a;
  backdrop-filter: blur(16px);
}
.dock a {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: .15rem;
  min-height: 3.1rem;
  color: var(--muted);
  border-radius: .75rem;
  font-size: .8125rem;
  font-weight: 650;
  white-space: nowrap;
}
.dock a:hover { background: var(--raised); color: var(--text); }
.dock a[aria-current="page"] { background: #3c1d38; color: var(--light-pink); }
.dock a[aria-current="page"] svg { filter: drop-shadow(0 0 5px #ff3d8b66); }

.view-heading { display: grid; gap: .5rem; margin-bottom: 1.15rem; }
.view-heading p { color: var(--muted); }
.heading-line { display: flex; align-items: center; gap: .75rem; }
.view-heading .heading-icon { width: 2.85rem; height: 2.85rem; }
.up-link {
  display: inline-flex;
  width: fit-content;
  min-height: 2.75rem;
  align-items: center;
  gap: .3rem;
  color: var(--cyan);
  font-size: .875rem;
  font-weight: 700;
}
.up-link .icon { width: 1.05rem; height: 1.05rem; }
.button {
  display: inline-flex;
  min-height: 3.25rem;
  padding: .55rem 1rem;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: 1px solid #4a3d60;
  border-radius: .85rem;
  background: var(--raised);
  color: var(--text);
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
}
.button:hover { filter: brightness(1.15); border-color: var(--violet); }
.button:active, .action-tile:active { transform: translateY(1px); }
.button-primary { border-color: #ff8eb9; background: var(--pink); color: #170a1a; }
.button-cyan { border-color: #6cebea; background: var(--cyan); color: #0b2025; }
.button-ghost { background: transparent; }
.button-danger { background: #381d32; color: var(--danger); border-color: #69374d; }
.button-small { min-height: 2.75rem; padding: .45rem .75rem; font-size: .875rem; }
.button [class="icon"] { width: 1.15rem; height: 1.15rem; }
.button-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.button-row > * { flex: 1 1 11rem; }

.filter-panel { display: grid; gap: .7rem; }
.search-line { display: flex; align-items: stretch; gap: .55rem; }
.input, .select {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: .65rem .85rem;
  color: var(--text);
  background: #211c37;
  border: 1px solid #514469;
  border-radius: .75rem;
  font-size: 1rem;
}
.input::placeholder { color: #b5afd1; opacity: 1; }
.search-field { position: relative; flex: 1; min-width: 0; }
.search-field .icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input { padding-left: 2.6rem; height: 100%; }
.filter-toggle[aria-expanded="true"] { color: var(--cyan); border-color: #367078; }
.filters-detail { display: grid; gap: .8rem; padding: 1rem; }
.filter-line { display: grid; gap: .5rem; }
.filter-label { color: var(--muted); font-size: .875rem; font-weight: 650; }
.filters-detail fieldset { margin: 0; padding: 0; border: 0; }
.filters-detail legend { margin-bottom: .4rem; }
.filter-columns { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.select-wrap { position: relative; }
.select-wrap .icon { position: absolute; z-index: 1; right: .65rem; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); }
.select { appearance: none; padding-right: 2.15rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.chip {
  min-height: 2.75rem;
  border-radius: 99rem;
  padding: .35rem .75rem;
  border: 1px solid var(--border);
  background: #17152a;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
}
.chip:hover { color: var(--text); border-color: #776890; }
.chip[aria-pressed="true"] { color: var(--accent, var(--text)); background: var(--accent-bg, #322849); border-color: var(--accent-border, #776890); }
.filter-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.filter-tools label { display: inline-flex; min-height: 2.75rem; align-items: center; gap: .55rem; cursor: pointer; }
.filter-tools input { width: 1.125rem; height: 1.125rem; margin: 0; accent-color: var(--cyan); }
.results-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-block: .8rem .55rem; }
.results-heading p { font-size: .875rem; color: var(--muted); }
.task-grid, .bonus-grid, .phrase-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.tier-must { --accent: var(--gold); --accent-bg: #392f2e; --accent-border: #66513b; }
.tier-recommended { --accent: var(--light-pink); --accent-bg: #3b1f39; --accent-border: #63304f; }
.tier-iftime { --accent: var(--cyan); --accent-bg: #19373d; --accent-border: #2b5861; }
.tier-extra { --accent: var(--violet); --accent-bg: #2b254a; --accent-border: #4b3e70; }
.tier-bonus { --accent: var(--green); --accent-bg: #1b3533; --accent-border: #315651; }
.task-card {
  min-width: 0;
  position: relative;
  border: 1px solid var(--accent-border);
  border-radius: 1.1rem;
  background: linear-gradient(138deg, var(--accent-bg), var(--surface) 59%);
}
.task-card:hover, .task-card:focus-within { border-color: var(--accent); }
.task-card:active { box-shadow: 0 0 20px var(--accent-bg); }
.task-card.done { background: linear-gradient(140deg, #1c2c36, var(--surface) 65%); }
.task-open { display: grid; height: 100%; gap: .62rem; padding: .95rem 1rem; border-radius: inherit; }
.task-topline { display: flex; align-items: start; justify-content: space-between; gap: .6rem; min-width: 0; }
.task-labels { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .5rem; min-width: 0; }
.tier-badge, .points {
  display: inline-flex;
  border: 1px solid var(--accent-border);
  border-radius: 99rem;
  background: var(--accent-bg);
  color: var(--accent);
  padding: .2rem .55rem;
  white-space: nowrap;
  font-weight: 750;
  font-size: .8125rem;
  line-height: 1.2;
}
.points { font-family: var(--display); font-size: .72rem; padding: .4rem .55rem; }
.task-category, .task-day { color: var(--muted); font-size: .875rem; }
.task-open h2, .task-open h3 { font: 650 clamp(1rem, 2vw, 1.13rem)/1.4 var(--display); letter-spacing: -.044em; }
.task-meta, .task-status { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .7rem; font-size: .875rem; color: var(--muted); }
.task-status { justify-content: space-between; }
.meta-item, .warning-label, .distance { display: inline-flex; align-items: center; gap: .28rem; }
.meta-item .icon, .warning-label .icon, .distance .icon { width: .95rem; height: .95rem; }
.warning-label { color: #ffd080; font-size: .8125rem; font-weight: 650; }
.distance { color: var(--cyan); font-weight: 700; }
.task-status .avatars { display: inline-flex; gap: .25rem; align-items: center; }
.task-status .avatar { width: 1.4rem; height: 1.4rem; border-radius: .46rem; font-size: .65rem; }
.check-stamp { color: var(--green); }
.check-stamp .icon { width: 1.05rem; height: 1.05rem; }
.empty { text-align: center; color: var(--muted); padding: 1.35rem 1rem; }
.empty .button { margin-top: .7rem; }
.empty p { max-width: 30rem; margin-inline: auto; }

.detail-hero { background: linear-gradient(136deg, var(--accent-bg), var(--surface) 80%); border-color: var(--accent-border); }
.detail-hero h1 { margin: .85rem 0 .45rem; font-size: clamp(1.375rem, 4.6vw, 2.2rem); line-height: 1.28; }
.detail-hero .tagline { font-size: 1.05rem; color: var(--muted); }
.detail-hero .task-day { margin-top: .65rem; }
.detail-hero .up-link { margin-bottom: -.1rem; }
.detail-shortcuts { margin-top: .5rem; }
.detail-shortcuts .button { color: var(--green); }
.steps { padding-left: 1.4rem; margin: .75rem 0 0; }
.steps li { padding-left: .25rem; margin-bottom: .45rem; }
.steps li:last-child { margin-bottom: 0; }
.steps > li::marker { color: var(--accent, var(--gold)); font-weight: 800; }
.steps ul { margin: .35rem 0 .1rem; padding-left: 1.3rem; }
.icon-heading { display: flex; align-items: center; gap: .5rem; }
.icon-heading .icon { color: var(--accent, var(--cyan)); }
.proof { border-color: #375061; background: #152132; }
.proof p, .warning p, .fact p, .tips p { margin-top: .5rem; }
.place-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.place-grid > :first-child { grid-column: 1 / -1; }
.place { display: grid; align-content: start; gap: .35rem; padding: 1rem; }
.place h3 { font: 750 1.07rem/1.34 var(--body); }
.place .button-row { margin-top: .35rem; }
.place .button-row > :first-child { flex-basis: 13rem; }
.place .button-ghost { color: var(--cyan); }
.place-role { color: var(--muted); font-size: .8125rem; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.facts .fact:last-child:nth-child(3) { grid-column: 1 / -1; }
.warning { border-left: 4px solid var(--warn); background: #261b2b; --accent: var(--warn); }
.warning h2 { color: #ffd48d; }
.done-panel { border-color: #376152; background: linear-gradient(134deg, #193034, var(--surface) 80%); }
.done-panel .section-head { margin-bottom: .55rem; }
.done-panel .icon-heading .icon { color: var(--green); }
.player-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; }
.player-toggle {
  display: grid;
  grid-auto-flow: column;
  align-content: center;
  justify-content: center;
  align-items: center;
  gap: .35rem;
  min-height: 3rem;
  min-width: 0;
  padding: .36rem .25rem;
  border: 1px solid #4a4559;
  border-radius: .65rem;
  background: #211f33;
  font-size: .875rem;
  font-weight: 700;
}
.player-toggle .avatar { width: 1.35rem; height: 1.35rem; border-radius: .4rem; font-size: .66rem; }
.player-toggle .icon { width: 1.25rem; height: 1.25rem; color: var(--green); }
.player-toggle[aria-pressed="true"] { border-color: #478169; background: #21483d; color: #d6ffe5; }
.player-toggle:hover { border-color: var(--player-color); }
.all-done { width: 100%; margin-top: .5rem; }
.all-done[aria-pressed="true"] { border-color: #478169; color: #b2f9d1; background: #21483d; }
.task-pagination { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.task-pagination > :last-child { grid-column: 2; }

.location-card { --accent: var(--cyan); border-color: #365d6c; background: linear-gradient(130deg, #16303e, var(--surface) 77%); }
.location-card > p { margin-top: .5rem; }
.location-card .button-row { margin-top: .85rem; }
.location-name { color: var(--cyan); line-height: 1.3; }
.location-prompt { color: var(--muted); }
.location-error, .field-error { color: #ffc399; margin-top: .5rem; }
.distance-note { color: var(--muted); font-size: .8125rem; margin-top: .7rem; }
.near-group + .near-group { margin-top: 1.25rem; }
.near-group h2 { margin-bottom: .65rem; }
.near-list { display: grid; gap: .65rem; }
.area-list { display: grid; gap: .35rem; }
.area-list button { justify-content: start; text-align: left; }
.area-list .icon { color: var(--cyan); }

.bonus-card { display: grid; align-content: start; gap: .75rem; padding: 1rem; scroll-margin-top: .65rem; }
.bonus-card h2 { font-size: 1.08rem; }
.bonus-card .proof-inline { color: var(--muted); }
.compact-done { align-self: end; margin-top: .25rem; padding-top: .65rem; border-top: 1px solid #3a414d; }
.compact-done .section-head { margin-bottom: .5rem; }
.compact-done h3 { font-size: .875rem; }
.reveal-button { color: #f5d3ec; background: #36233f; }
.reveal-button .icon { color: var(--light-pink); }
.bonus-phrase-link { margin-bottom: .9rem; }

.score-table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: right; }
.score-table th, .score-table td { padding: .65rem .35rem; overflow-wrap: anywhere; }
.score-table th { color: var(--muted); font-size: .875rem; font-weight: 650; }
.score-table th:first-child, .score-table td:first-child, .score-table th:nth-child(2), .score-table td:nth-child(2) { text-align: left; }
.score-table tbody tr { border-top: 1px solid var(--border); }
.score-table .score-person { gap: .42rem; }
.score-table .leader { background: #382a364f; }
.score-table .leader-points { color: var(--gold); }
.score-table .score-number { font-family: var(--display); font-size: .9rem; font-weight: 650; }
.score-table .rank-col { width: 11%; }
.score-table .name-col { width: 37%; }
.tier-table th:first-child { text-align: left; width: 41%; }
.tier-table th:nth-child(2), .tier-table td:nth-child(2) { text-align: right; }
.tier-table .tier-badge { font-size: .8125rem; white-space: normal; }
.prize-panel { border-color: #654b3d; background: linear-gradient(135deg, #382735, var(--surface) 78%); }
.prize-panel .icon { color: var(--gold); }
.prize-panel p { margin-top: .45rem; overflow-wrap: anywhere; }
.timeline-list, .rules-list { padding: 0; margin: 0; list-style: none; }
.timeline-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .4rem .65rem; padding: .6rem 0; border-top: 1px solid var(--border); }
.timeline-list li:first-child { border-top: 0; }
.timeline-list .timeline-task { color: var(--muted); font-size: .875rem; }
.timeline-add { color: var(--green); font: 650 .82rem var(--display); white-space: nowrap; }
.rules-list { counter-reset: rule; display: grid; gap: .95rem; }
.rules-list li { position: relative; padding-left: 2.15rem; counter-increment: rule; }
.rules-list li::before {
  content: counter(rule);
  display: grid;
  place-items: center;
  position: absolute;
  top: .08rem;
  left: 0;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: .45rem;
  background: #372a43;
  color: var(--gold);
  font: 650 .74rem var(--display);
}
.rules-finish { margin-top: .9rem; color: var(--gold); font-weight: 700; }

.phrase-card { display: grid; align-content: start; gap: .55rem; }
.phrase-card h2 { color: var(--muted); font: 750 .92rem/1.35 var(--body); }
.phrase-card h2 span { color: var(--cyan); margin-right: .22rem; }
.thai-text { font-family: "Noto Sans Thai", Tahoma, system-ui, sans-serif; font-size: 1.55rem; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.phrase-card [lang="ar"] { font-size: 1.13rem; text-align: start; color: #e9e1fa; }
.phrase-card .button { margin-top: .18rem; color: var(--cyan); }
.settings-card { display: grid; gap: .65rem; }
.settings-card textarea { resize: vertical; }
.settings-card label { font-weight: 700; }
.code-input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.code-input[readonly] { user-select: all; }
.settings-note { color: var(--muted); font-size: .8125rem; text-align: center; }

.modal {
  width: min(30rem, calc(100% - 1.5rem));
  max-height: calc(100% - 2rem - env(safe-area-inset-bottom, 0px));
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--text);
  border: 1px solid #594771;
  border-radius: 1.2rem;
  background: #1b1730;
  padding: 1rem;
  box-shadow: 0 14px 65px #05040dd0;
}
.modal::backdrop { background: #060512bc; backdrop-filter: blur(6px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: .65rem; margin-bottom: .75rem; }
.modal .button-row { margin-top: .8rem; }
.modal .menu-list { display: grid; gap: .4rem; }
.menu-list a { justify-content: start; }
.menu-list .icon { color: var(--violet); }
.holding { margin-block: .7rem; }
.holding button { position: relative; isolation: isolate; width: 100%; overflow: hidden; justify-content: center; user-select: none; -webkit-touch-callout: none; touch-action: none; }
.holding button::before { content: ""; position: absolute; z-index: -1; inset: 0; background: #945181; transform: scaleX(0); transform-origin: left; }
.holding button.is-holding::before { transform: scaleX(1); transition: transform 1s linear; }
.secret-value { min-height: 3.4rem; display: grid; place-items: center; border: 1px solid #674767; border-radius: .75rem; padding: .6rem; text-align: center; font-size: 1.12rem; font-weight: 750; color: #ffd2ef; background: #271b35; overflow-wrap: anywhere; }
.secret-note { color: var(--muted); font-size: .875rem; margin-top: .6rem; }
.phrase-modal {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: max(1rem, env(safe-area-inset-top)) 1.25rem max(1rem, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at center, #342144, var(--bg) 76%);
}
.phrase-modal[open] { display: grid; grid-template-rows: auto 1fr; }
.phrase-full { display: grid; align-content: center; justify-items: center; gap: .8rem; text-align: center; }
.phrase-full .thai-text { font-size: clamp(2rem, 9vw, 5.5rem); max-width: 13ch; color: var(--gold); }
.phrase-full .muted { font-size: 1.125rem; }
.storage-note { max-width: var(--page); margin: .65rem auto 0; padding: .55rem var(--edge); color: #ffd49c; }
.toast {
  position: fixed;
  z-index: 15;
  bottom: calc(5.1rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translate(-50%, .5rem);
  min-width: min(18rem, calc(100% - 1.75rem));
  max-width: calc(100% - 1.75rem);
  width: max-content;
  padding: .58rem .9rem;
  border: 1px solid #538477;
  border-radius: .75rem;
  background: #182c36;
  color: #e6fff3;
  text-align: center;
  box-shadow: 0 .3rem 1.3rem #090711b3;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.celebration { position: fixed; inset: 0; z-index: 17; pointer-events: none; overflow: hidden; }
.spark { position: absolute; width: .44rem; height: .44rem; border-radius: 1px; background: var(--spark-color); box-shadow: 0 0 8px var(--spark-color); animation: spark .6s ease-out both; }
@keyframes spark {
  from { opacity: 1; transform: translate(-50%, -50%) scale(.75); }
  75% { opacity: 1; }
  to { opacity: 0; transform: translate(var(--spark-x), var(--spark-y)) rotate(var(--spark-rotation)) scale(.3); }
}
.card-enter { animation: card-in .28s both; animation-delay: var(--enter-delay, 0ms); }
@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.no-script { margin: 1rem; color: var(--warn); }

@media (max-width: 46rem) {
  .home-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { min-height: 17.3rem; }
  .hero-art { width: 86%; }
  .task-grid, .bonus-grid, .phrase-grid { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: clamp(2rem, 8vw, 3.8rem); }
}
@media (max-width: 33rem) {
  .topbar-inner { padding-block: .4rem; }
  main { padding-top: .9rem; }
  .section-stack { gap: 1.15rem; }
  .hero { display: block; min-height: 16.7rem; border-radius: 1.25rem; }
  .hero-copy { padding: 1.15rem 1.05rem; }
  .hero p { max-width: 13.8rem; margin-top: .55rem; font-size: .95rem; }
  .hero-art { width: 91%; height: 78%; top: auto; bottom: -1.05rem; right: -2rem; }
  .hero::after { background: linear-gradient(155deg, #20142d 7%, #20142df0 26%, #20142d57 51%, transparent 78%); }
  .score-grid, .home-actions { gap: .45rem; }
  .mini-score { padding: .7rem .52rem; gap: .35rem; }
  .mini-score .score-person { gap: .34rem; font-size: .875rem; }
  .mini-score .avatar { width: 1.42rem; height: 1.42rem; border-radius: .48rem; font-size: .66rem; }
  .leader-star { right: .4rem; top: .45rem; }
  .leader-star .icon { width: .75rem; height: .75rem; }
  .mini-score.leader .score-person { padding-right: .4rem; }
  .score-caption { font-size: .8125rem; }
  .action-tile { padding: .75rem; gap: .55rem; }
  .action-icon { width: 2.45rem; height: 2.45rem; }
  .place-grid, .facts { grid-template-columns: minmax(0, 1fr); }
  .filter-columns { grid-template-columns: minmax(0, 1fr); }
  .filters-detail { padding: .7rem; }
  .score-table .score-person { gap: .25rem; font-size: .875rem; }
  .score-table .avatar { width: 1.38rem; height: 1.38rem; border-radius: .45rem; font-size: .64rem; }
  .score-table th, .score-table td { padding-inline: .24rem; }
  .view-heading .heading-icon { width: 2.65rem; height: 2.65rem; }
  .score-table .rank-col { width: 12.5%; }
  .score-table .name-col { width: 34.5%; }
}
@media (max-width: 22rem) {
  .hero { min-height: 15.7rem; }
  .hero h1 { font-size: clamp(1.6rem, 8.5vw, 2rem); }
  .mini-score .score-person { flex-wrap: wrap; }
  .filter-toggle .icon { display: none; }
  .player-toggle { grid-auto-flow: row; justify-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .spark { display: none; }
}
