:root {
  --bg: #07080C;
  --panel: #12141B;
  --panel-2: #1A1D27;
  --line: #232633;
  --line-2: #2A2E3B;
  --text: #F2F3F7;
  --muted: #A3A8B8;
  --dim: #8A90A2;
  --faint: #7D8396;
  --accent: #FF7A3D;
  --accent-bg: #241510;
  --accent-bg-2: #140C08;
  --bad: #FF5D73;
  --sans: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

.app {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

/* ---------- header ---------- */
.top { display: flex; justify-content: space-between; align-items: center; }
.brand { font-size: 18px; font-weight: 700; letter-spacing: 0.32em; }
.top-right { display: flex; align-items: center; gap: 4px; }
.top-right .mono { font-size: 13px; margin-right: 6px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent;
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:hover, .icon-btn:focus-visible { color: var(--text); background: var(--panel); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- game layout ---------- */
.game {
  flex: 1; display: flex; flex-direction: column; gap: 16px; min-height: 0;
  user-select: none; -webkit-user-select: none;
}
.hud { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hud-cell { display: flex; flex-direction: column; gap: 3px; }
.hud-cell.center { align-items: center; }
.hud-cell.end { align-items: flex-end; }
.label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.hud-num { font-size: 26px; font-weight: 600; height: 30px; line-height: 30px; }
.hud-place { font-size: 24px; font-weight: 500; height: 30px; line-height: 30px; white-space: nowrap; }
.hud-place.long { font-size: 18px; }
#timer.urgent { color: var(--accent); animation: pulse 1s ease-in-out infinite; }
#score.bump { animation: bump 0.35s ease-out; }
#reached.lit { color: var(--accent); }

/* ---------- route ---------- */
.route-block { display: flex; flex-direction: column; gap: 10px; }
.route-caption { position: relative; display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); height: 16px; line-height: 16px; }
.route-caption b { font-family: var(--mono); font-weight: 400; color: var(--text); }
.route-caption > span:not(.route-note) { transition: opacity 0.2s; }
.route-caption.noted > span:not(.route-note) { opacity: 0; }
.route-note {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.9); opacity: 0;
  background: var(--text); color: var(--bg); font-weight: 700; font-size: 12.5px; white-space: nowrap;
  padding: 3px 11px 3px 8px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px;
  transition: opacity 0.2s, transform 0.25s; pointer-events: none;
}
.route-caption.noted .route-note { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.route { position: relative; }
.route .track, .route .progress { position: absolute; top: 11px; height: 2px; }
.route .track { left: 6.25%; right: 6.25%; background: var(--line); }
.route .progress { left: 6.25%; background: var(--accent); transition: width 0.6s cubic-bezier(.2,.8,.2,1); }
.route .probe { position: absolute; top: 7px; width: 10px; height: 10px; transition: left 0.6s cubic-bezier(.2,.8,.2,1); color: var(--text); }
.stations { position: relative; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.station { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.station .dot {
  width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px solid var(--line-2); color: var(--faint); position: relative;
}
.station .name { font-size: 11px; line-height: 1.2; text-align: center; color: var(--faint); }
.station.passed .dot { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.station.passed .name { color: var(--muted); }
.station.next .dot { border-color: var(--text); color: var(--text); }
.station.next .name { color: var(--text); }
.station.current .dot { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.station.current .name { color: var(--text); font-weight: 700; }
.station.pop .dot { animation: pop 0.9s ease-out; }
.station.pop .dot::after {
  content: ''; position: absolute; inset: -1px; border-radius: 50%; border: 2px solid var(--accent);
  animation: ring 1s ease-out forwards;
}

/* ---------- play area ---------- */
.play-area { position: relative; display: flex; flex-direction: column; gap: 16px; flex: 1; min-height: 0; }

.feedback {
  position: relative; overflow: hidden; height: 62px; flex: none; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.fb-hint { color: var(--dim); font-size: 15px; }
.fb-word { font-size: 23px; font-weight: 700; letter-spacing: 0.08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-word.building { color: var(--text); }
.fb-word.dim { color: var(--dim); }
.fb-tier { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); font-weight: 500; white-space: nowrap; }
.fb-tier b { font-family: var(--mono); font-weight: 600; }
.fb-error { color: var(--muted); font-size: 14px; white-space: nowrap; }
.feedback.shake { animation: shake 0.35s ease-in-out; }
.feedback.win { border-color: var(--accent); }
.feedback.banner { border-color: var(--accent); background: var(--accent-bg-2); justify-content: flex-start; gap: 14px; animation: slidein 0.35s ease-out; }
.banner .b-icon {
  position: relative; flex: none; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: var(--accent); color: var(--bg);
  animation: pop 0.7s ease-out;
}
.banner .b-icon::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent);
  animation: ring 1s ease-out forwards;
}
.banner .b-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.banner .b-text b { font-size: 18px; line-height: 1.15; }
.banner .b-text small { font-size: 12.5px; line-height: 1.2; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner .streak { position: absolute; left: 0; height: 1px; background: var(--accent); opacity: 0; animation: streak 0.9s ease-in forwards; }

.board-wrap { position: relative; width: 100%; max-width: min(100%, calc(100dvh - 420px)); min-width: 260px; margin: 0 auto; }
.play-area.intro .feedback, .play-area.intro .found, .play-area.intro .nova { visibility: hidden; }

/* time bonus pop */
.hud-cell { position: relative; }
.t-pop { position: absolute; left: 64px; top: 22px; font-size: 15px; font-weight: 600; color: var(--accent); opacity: 0; pointer-events: none; }
.t-pop.show { animation: tpop 1s ease-out forwards; }
@keyframes tpop { 0% { opacity: 0; transform: translateY(6px); } 20% { opacity: 1; transform: none; } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }

/* Supernova clue row */
.nova {
  height: 28px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  border: 1px dashed var(--line-2); border-radius: 999px; font-size: 13px; color: var(--muted); margin-bottom: -6px;
}
.nova svg { color: var(--accent); flex: none; }
.nova-label { text-transform: uppercase; letter-spacing: 0.12em; font-size: 11px; }
.nova-clue { font-family: var(--mono); color: var(--text); font-weight: 600; letter-spacing: 0.08em; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nova-bonus { font-family: var(--mono); color: var(--accent); font-weight: 600; }
.nova.lit { border-style: solid; border-color: var(--accent); background: var(--accent-bg); }
.nova.lit .nova-label { color: var(--accent); }
.feedback.nova-banner { background: linear-gradient(90deg, #3A1A0C, var(--accent-bg-2)); }
.nova-chip { border-color: var(--accent); color: var(--accent); }
.nova-chip svg { align-self: center; }
.nova-flash {
  position: fixed; inset: 0; z-index: 25; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255, 180, 120, 0.55), rgba(255, 122, 61, 0.18) 35%, rgba(7, 8, 12, 0) 70%);
}
.nova-flash.go { animation: novaflash 1.1s ease-out; }
@keyframes novaflash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
.tier-pill .ts { font-family: var(--mono); font-size: 10.5px; color: var(--accent); }
.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; touch-action: none; }
.tile {
  aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line); background: var(--panel);
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(22px, 7.4vw, 30px); font-weight: 700; cursor: pointer; transition: transform 0.08s ease-out;
}
.tile .qu { font-size: 0.82em; letter-spacing: -0.02em; }
.tile.sel { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.tile.sel.last { transform: scale(1.04); }
.tile.ok { animation: okflash 0.35s ease-out; }
.tile.bad { border-color: var(--bad); color: var(--bad); }
.board.blurred { filter: blur(3.5px); opacity: 0.9; pointer-events: none; }
.overlay.intro-overlay {
  inset: 0 auto 0 50%; transform: translateX(-50%); width: min(calc(100vw - 40px), 380px);
  padding: 0; align-items: center; overflow: visible;
}
.intro-overlay .intro-card { padding: 18px 18px 14px; gap: 12px; }
.intro-overlay .howto { list-style: none; padding: 0; gap: 6px; }
.intro-overlay .howto li { padding-left: 16px; position: relative; }
.intro-overlay .howto li::before {
  content: ''; position: absolute; left: 0; top: 0.55em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.board.locked { pointer-events: none; opacity: 0.6; }
.trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.trail polyline { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.35; }

.found { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
.found-head { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.chips {
  display: flex; flex-wrap: wrap; gap: 8px; overflow: hidden; min-height: 34px; max-height: 120px; align-content: flex-start;
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
  mask-image: linear-gradient(to bottom, #000 70%, transparent);
}
.chip {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); font-size: 14px; font-weight: 500;
}
.chip .mono { font-size: 12px; color: var(--muted); }
.chip.new { animation: chipin 0.3s ease-out; }

/* ---------- overlays ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: flex-start; justify-content: center;
  padding: 18px 14px 8px; overflow-y: auto;
}
.intro-card {
  width: 100%; background: rgba(7, 8, 12, 0.62); border: 1px solid var(--line-2); border-radius: 16px;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  padding: 20px 20px 16px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.intro-card h1 { margin: 0; font-size: 24px; }
.howto { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.4; color: var(--muted); }
.howto b { color: var(--text); font-weight: 600; }
.tier-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.tier-pill {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--accent);
}
.tier-pill .tn { font-size: 10px; color: var(--muted); letter-spacing: -0.01em; }
.intro-tiers { display: flex; flex-direction: column; gap: 6px; }
.tier-scale { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--dim); }
.tier-scale i { flex: 1; height: 2px; background: linear-gradient(to right, var(--line-2), var(--accent)); position: relative; }
.tier-scale i::after {
  content: ''; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left: 7px solid var(--accent); border-right: 0;
}
.tier-scale span:last-child { color: var(--accent); font-weight: 600; }
.modal-card .tier-strip { margin-top: 4px; }
.modal-card .tier-scale { margin-bottom: 8px; }
.tier-pill .tp { font-family: var(--mono); font-size: 13px; color: var(--text); font-weight: 600; }
.primary {
  height: 52px; border-radius: 12px; border: 0; background: var(--accent); color: var(--bg);
  font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer;
}
.primary:active { transform: scale(0.98); }
.secondary {
  height: 46px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg);
  font-size: 15px; font-weight: 500; cursor: pointer;
}
.fine { margin: 0; font-size: 12px; color: var(--dim); text-align: center; }
.ending-card { margin-top: 60px; text-align: center; align-items: center; }
.ending-card h1 { font-size: 26px; }
.ending-card p { margin: 0; }


/* ---------- results ---------- */
.results { display: flex; flex-direction: column; gap: 26px; padding-bottom: 32px; }
.r-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding-top: 6px; }
.r-planet {
  width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--bg); animation: pop 0.8s ease-out;
}
.r-planet.earth { background: var(--panel); color: var(--muted); border: 1px solid var(--line-2); }
.r-hero h1 { margin: 0; font-size: 30px; line-height: 1.15; }
.r-hero p { margin: 0; font-size: 15px; }
.card.special { flex-direction: row; align-items: center; gap: 14px; padding: 14px 16px; }
.special > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.special b { font-size: 20px; letter-spacing: 0.05em; overflow-wrap: anywhere; }
.special .sub { font-size: 12.5px; color: var(--muted); }
.card.special.lit { border-color: var(--accent); background: var(--accent-bg-2); }
.badge {
  flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--faint);
  border: 1.5px dashed var(--line-2); border-radius: 30%; transform: rotate(45deg);
}
.badge svg { transform: rotate(-45deg); }
.badge.on { color: var(--bg); background: var(--accent); border: 1.5px solid var(--accent); }
.rank-row { display: flex; align-items: center; gap: 22px; padding: 10px 0 14px 10px; }
.rank-text { display: flex; flex-direction: column; gap: 1px; }
.rank-text b { font-size: 22px; }
.rank-text .sub { font-size: 12.5px; color: var(--muted); }
.rank-bar { height: 6px; }
.bar.rank-bar span { background: var(--accent); }
.career.promoted { border-color: var(--accent); }
.career.promoted .label { color: var(--accent); }
.new-patches { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px 8px; }
.patch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px 8px; }
.patch { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.patch .pn { font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.2; }
.patch .pd { font-size: 10.5px; color: var(--faint); line-height: 1.25; }
.patch.on .pn { color: var(--text); }
.patch.new .badge { animation: badgepop 0.8s ease-out; }
@keyframes badgepop { 0% { transform: rotate(45deg) scale(0.4); opacity: 0; } 50% { transform: rotate(45deg) scale(1.2); opacity: 1; } 100% { transform: rotate(45deg) scale(1); } }
.patch .badge { margin: 6px 0 2px; }
.sn-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--accent); letter-spacing: 0; font-weight: 600; vertical-align: 1px; }
.r-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; margin-top: 6px; }
.r-stats > div { border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; display: flex; flex-direction: column; gap: 3px; align-items: center; }
.r-stats .n { font-family: var(--mono); font-size: 24px; font-weight: 600; line-height: 1.1; }
.r-stats .n small { font-size: 14px; color: var(--muted); font-weight: 400; }
.r-stats .l { font-size: 11.5px; color: var(--dim); line-height: 1.25; }
.jump {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 2px; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500;
}
.jump svg { color: var(--accent); }
.words-sec { scroll-margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.words-head { display: flex; justify-content: space-between; align-items: baseline; }
.words-head .sec-title { margin: 0; }
.words-head span { font-size: 12px; color: var(--muted); }
.words-sec .note { margin: 0; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; }
.seg button { height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; }
.seg button.on { background: var(--panel-2); color: var(--text); }
.words-list[data-f="found"] .wrow.miss, .words-list[data-f="miss"] .wrow.found,
.words-list[data-f="found"] .wgroup:not(.has-found), .words-list[data-f="miss"] .wgroup:not(.has-miss) { display: none; }
.wgroup-head span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.wgroup-head svg { color: var(--accent); }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { margin: 0; font-size: 17px; font-weight: 500; }
.card h2 b { color: var(--accent); }
.curve-svg { width: 100%; height: auto; display: block; overflow: visible; }
.curve-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--dim); }
.note { font-size: 12px; color: var(--dim); margin: 0; line-height: 1.4; }
.r-share { display: flex; flex-direction: column; gap: 10px; }
.share-nudge { margin: 0; text-align: center; font-size: 15px; font-weight: 500; color: var(--text); line-height: 1.35; }
.share-preview {
  margin: 0; border: 1px dashed var(--line-2); border-radius: 10px; padding: 12px 14px;
  font-family: var(--mono); font-size: 13px; line-height: 1.6; white-space: pre-wrap; color: var(--muted);
}
.countdown { text-align: center; font-size: 12px; color: var(--dim); }
.countdown b { font-family: var(--mono); font-weight: 400; color: var(--text); }
.hl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hl .card { padding: 14px; gap: 6px; }
.hl .word { font-size: 19px; font-weight: 700; letter-spacing: 0.04em; overflow-wrap: anywhere; }
.hl .word.miss { color: var(--muted); }
.hl .sub { font-size: 12px; color: var(--muted); }
.hl .sub b { color: var(--accent); }
.sec-title, .card h2.sec-title { margin: 0 0 8px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); font-weight: 500; }
.trow {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) 40px 48px; gap: 10px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #161922; font-size: 15px;
}
.trow .mono { font-size: 14px; text-align: right; }
.trow .pv { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.trow.zero { color: var(--faint); }
.trow .ic { color: var(--accent); display: flex; }
.trow.zero .ic { color: var(--faint); }
.wgroup-head {
  display: flex; justify-content: space-between; padding: 12px 0 6px; font-size: 13px; font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.wgroup-head span:last-child { font-family: var(--mono); font-weight: 400; color: var(--dim); }
.wrow {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) 92px 42px; gap: 10px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #161922;
}
.wrow .w { font-size: 15px; letter-spacing: 0.04em; }
.wrow.found .w { font-weight: 500; }
.wrow.miss .w { color: var(--dim); }
.wrow .tick { color: var(--accent); display: flex; }
.wrow .miss-dot { width: 6px; height: 6px; border-radius: 50%; background: #4A5063; justify-self: center; }
.bar { height: 4px; border-radius: 2px; background: var(--panel-2); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 2px; background: #4A5063; }
.wrow.found .bar span { background: var(--accent); }
.wrow .pc { font-family: var(--mono); font-size: 12px; text-align: right; color: var(--muted); }
.words-list.collapsed .extra { display: none; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; text-align: center; }
.stat-grid .n { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.stat-grid .l { font-size: 11px; color: var(--dim); }
.dest-bars { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.dest-bar { display: grid; grid-template-columns: 84px minmax(0, 1fr) 24px; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.dest-bar .bar { height: 8px; }
.dest-bar .bar span { background: var(--accent); }
.dest-bar .mono { font-size: 12px; text-align: right; }
.error-box { margin-top: 40px; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.7);
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
}
.modal-card {
  position: relative; width: 100%; max-width: 440px; max-height: 88dvh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 16px; padding: 20px;
}
.modal-card h2 { margin: 0 0 12px; font-size: 22px; }
.modal-card p { color: var(--muted); line-height: 1.45; }
.modal-close { position: absolute; top: 10px; right: 10px; }
@media (min-width: 600px) { .modal { align-items: center; } }

/* ---------- animation ---------- */
@keyframes pulse { 50% { opacity: 0.55; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); color: var(--accent); } 100% { transform: scale(1); } }
@keyframes pop { 0% { transform: scale(0.4); opacity: 0; } 45% { transform: scale(1.25); opacity: 1; } 70% { transform: scale(0.95); } 100% { transform: scale(1); } }
@keyframes ring { 0% { transform: scale(0.8); opacity: 0.9; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes streak { 0% { transform: translateX(-100px); opacity: 0; } 15% { opacity: 0.9; } 100% { transform: translateX(440px); opacity: 0; } }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes okflash { 0% { background: var(--accent); color: var(--bg); } 100% { background: var(--panel); } }
@keyframes chipin { from { transform: scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }

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

@media (max-height: 700px) {
  .app { gap: 12px; }
  .game, .play-area { gap: 12px; }
  .hud-num { font-size: 22px; height: 26px; line-height: 26px; }
  .hud-place { font-size: 20px; height: 26px; line-height: 26px; }
  .feedback { height: 54px; }
  .fb-word { font-size: 20px; }
}
