:root {
  color-scheme: dark;
  --ink: #0a1624;
  --panel: #13263a;
  --text: #f5f8fc;
  --muted: #b8cbdc;
  --gold: #ffdb93;
  --frost: #a9ddf1;
  --line: #9bc9e43b;
  --edge: clamp(16px, 4.1vw, 54px);
  --body: "Segoe UI", Arial, sans-serif;
  --display: Georgia, "Times New Roman", serif;
  font-family: var(--body);
  background: var(--ink);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 75% 0%, #153951 0%, transparent 56%), var(--ink);
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
img { display: block; max-width: 100%; }
a, button, .board { -webkit-tap-highlight-color: transparent; }
a, button { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.shell { width: min(100% - var(--edge) * 2, 1170px); margin-inline: auto; }
.site-header { border-bottom: 1px solid #a0ccdb22; background: #0a1826b2; }
.header-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font: 700 18px/1.2 var(--display);
}
.wordmark-symbol {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #8bd4f219;
  color: var(--frost);
  font: 26px/1 var(--body);
}
.sound-toggle, .button-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 14px;
  background: #1d354a99;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-weight: 600;
  font-size: .88rem;
  white-space: nowrap;
}
.sound-toggle:hover, .button-subtle:hover { background: #29465d; }
.sound-icon { display: flex; gap: 3px; align-items: center; width: 14px; height: 14px; color: var(--frost); }
.sound-icon i { width: 2px; height: 7px; border-radius: 9px; background: currentColor; }
.sound-icon i:nth-child(2) { height: 13px; }
.sound-toggle[aria-pressed="false"] .sound-icon i { height: 2px; }

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: clamp(320px, 34vw, 425px);
  padding: clamp(27px, 5.6vw, 76px);
  margin-block: 28px 30px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #102c42 url("./assets/fireworks-bg.webp") center 63% / cover no-repeat;
  box-shadow: 0 20px 60px #01091266;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, #091a2bee, #0a1c2b99 49%, #0b25350c 79%), linear-gradient(0deg, #0c1e2f75, transparent 42%);
}
.hero-copy { position: relative; z-index: 1; max-width: 100%; }
.hero-title {
  max-width: 620px;
  margin: 0 0 24px;
  font: 700 clamp(3rem, 7.5vw, 6.2rem)/.96 var(--display);
  letter-spacing: -.065em;
  text-shadow: 0 6px 40px #00152a9c;
}
.hero-title span { color: var(--gold); }
.hero-art { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.hero-spark { position: absolute; width: var(--size); top: var(--top); right: var(--right); opacity: var(--opacity, .93); mix-blend-mode: screen; filter: drop-shadow(0 0 14px #ffcb6e28); }
.hero-gold { --size: 35%; --top: -13%; --right: 8%; }
.hero-rose { --size: 22%; --top: 35%; --right: 0%; --opacity: .82; }
.hero-blue { --size: 19%; --top: 43%; --right: 35%; --opacity: .82; }
.hero-white { --size: 11%; --top: 2%; --right: 36%; --opacity: .64; }
.button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 11px 19px;
  border: 1px solid #ffe5ae;
  border-radius: 12px;
  background: var(--gold);
  color: #241c18;
  text-decoration: none;
  font-weight: 750;
  box-shadow: 0 4px 22px #faab3b27;
}
.button-primary:hover { background: #ffe7bb; }
.games-heading { margin: 0 0 16px; font: 700 clamp(1.45rem, 3vw, 2rem)/1.2 var(--display); }
.games { margin-bottom: 42px; scroll-margin-top: 18px; }
.game-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.game-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(155deg, #203b51, #122337 68%);
  text-decoration: none;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.game-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.game-card--ice { --accent: #b4eafa; }
.game-card--gifts { --accent: #ffdf9c; }
.game-card--fireworks { --accent: #ffbfe1; }
.game-preview { position: relative; aspect-ratio: 2.24; overflow: hidden; border-bottom: 1px solid var(--line); background-position: center; background-size: cover; }
.game-preview--ice { background-image: url("./assets/memories-1.webp"); }
.game-preview--gifts { background-image: url("./assets/gifts-bg.webp"); }
.game-preview--fireworks { background-image: url("./assets/fireworks-bg.webp"); }
.game-preview img { position: absolute; width: var(--w); left: var(--l); top: var(--t); transform: rotate(var(--angle, 0deg)); filter: drop-shadow(0 7px 10px #010912af); }
.preview-ice { --w: 27%; --l: 37%; --t: 24%; --angle: -9deg; }
.preview-gift-a { --w: 23%; --l: 25%; --t: 24%; --angle: -14deg; }
.preview-gift-b { --w: 26%; --l: 50%; --t: 22%; --angle: 12deg; }
.preview-fire-a { --w: 33%; --l: 27%; --t: 4%; mix-blend-mode: screen; }
.preview-fire-b { --w: 22%; --l: 56%; --t: 33%; mix-blend-mode: screen; }
.card-body { display: grid; gap: 8px; flex: 1; padding: 15px 17px 17px; }
.card-title { margin: 0; font: 700 clamp(1.24rem, 2.15vw, 1.58rem)/1.16 var(--display); }
.card-description { margin: 0; color: var(--muted); font-size: .94rem; line-height: 1.42; }
.card-action { color: var(--accent); margin-top: 4px; font-size: .92rem; font-weight: 750; }

.game-page { margin-block: 23px 34px; }
.game-top { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 13px 24px; margin-bottom: 17px; }
.game-heading { flex: 1 1 280px; min-width: 0; }
.back-link { display: inline-flex; gap: 8px; align-items: center; min-height: 34px; color: var(--frost); text-decoration: none; font-size: .9rem; font-weight: 650; }
.back-link:hover { text-decoration: underline; }
.game-title { margin: 2px 0 5px; font: 700 clamp(1.9rem, 5vw, 3.1rem)/1 var(--display); letter-spacing: -.037em; }
.game-hint { margin: 0; color: var(--muted); font-size: .93rem; line-height: 1.4; }
.game-tools { display: flex; gap: 11px; align-items: center; }
.game-hud { min-width: min(185px, 45vw); color: var(--text); }
.meter-label { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; font-size: .84rem; color: var(--muted); }
.meter-label output { color: var(--text); font-variant-numeric: tabular-nums; font-size: 1rem; font-weight: 750; white-space: nowrap; }
.meter {
  display: block;
  width: 100%;
  height: 8px;
  margin-top: 6px;
  overflow: hidden;
  appearance: none;
  border: 0;
  border-radius: 99px;
  background: #0d1d2b;
  color: var(--gold);
  accent-color: var(--gold);
}
.meter::-webkit-progress-bar { background: #0d1d2b; border-radius: 99px; }
.meter::-webkit-progress-value { background: linear-gradient(90deg, #ffe4a5, #fac36b); border-radius: 99px; transition: width .16s ease; }
.meter::-moz-progress-bar { background: #ffd88b; border-radius: 99px; }
.button-subtle { min-height: 40px; }

.stage {
  overflow: hidden;
  border: 1px solid #a7d8f459;
  border-radius: 20px;
  background: #132c45;
  box-shadow: 0 15px 45px #0008;
}
.board {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 2752 / 1536;
  background-size: cover;
  background-position: center;
  user-select: none;
}
.board--ice { background: #315e79; }
.ice-background { position: absolute; inset: 0; width: 100%; height: 100%; }
.ice-tile {
  position: absolute;
  left: calc(5.84% + 31.33% * var(--column));
  top: calc(7.63% + 30.39% * var(--row));
  width: 24.8%;
  height: 27.45%;
  padding: 0;
  border: 0;
  border-radius: 7% / 11%;
  background: transparent;
  touch-action: manipulation;
}
.ice-tile img { width: 100%; height: 100%; object-fit: fill; filter: drop-shadow(0 3px 4px #002d46a1); }
.ice-tile:not(:disabled):hover img { filter: brightness(1.1) drop-shadow(0 0 8px #b5eaff77); }
.ice-tile.is-cracking img { animation: ice-crack .22s ease-out; }
.ice-tile.is-broken img { animation: ice-break .46s ease-out both; }
.ice-tile.is-broken { pointer-events: none; }
.round-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse, #fbe3aa88, #b7e8ee33 52%, transparent 77%);
  box-shadow: inset 0 0 85px #ffe4ac9d;
}
.board.is-glowing .round-glow { animation: round-glow .86s ease-in-out both; }
@keyframes ice-crack { 0% { transform: scale(1.035) rotate(-1deg); } 38% { transform: scale(.983) rotate(1deg); } }
@keyframes ice-break { 20% { transform: scale(1.043); opacity: 1; filter: brightness(1.35); } 100% { transform: scale(1.12); opacity: 0; } }
@keyframes round-glow { 0%, 100% { opacity: 0; } 51% { opacity: 1; } }

.board--gifts { background-image: linear-gradient(180deg, #0d233c24, #0e213963), url("./assets/gifts-bg.webp"); touch-action: none; }
.gift-field, .fire-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.gift-piece {
  position: absolute;
  width: clamp(38px, 8.2%, 103px);
  height: 15%;
  object-fit: contain;
  transform: translate(-50%, -50%) rotate(var(--tilt));
  filter: drop-shadow(0 5px 6px #0009);
}
.basket {
  position: absolute;
  left: var(--player, 50%);
  bottom: 4%;
  width: 22%;
  height: 10%;
  transform: translateX(-50%);
  filter: drop-shadow(0 5px 9px #000a);
}
.basket::before {
  content: "";
  position: absolute;
  inset: 12% 0 0;
  clip-path: polygon(0 0, 100% 0, 87% 100%, 13% 100%);
  background: repeating-linear-gradient(105deg, transparent 0 8%, #ffd67a50 9% 10%, transparent 11% 16%), linear-gradient(180deg, #e79a43 7%, #aa5d2d 83%);
}
.basket::after {
  content: "";
  position: absolute;
  inset: 2% 0 auto;
  height: 27%;
  border-radius: 99px;
  border: 1px solid #ffe0a0;
  background: linear-gradient(#ffe5a7, #d58742);
}
.basket.is-caught { animation: caught .19s ease-out; }
@keyframes caught { 50% { filter: drop-shadow(0 0 13px #ffe2a0); transform: translateX(-50%) scale(1.06); } }
.board--fireworks { background: #0f2a3f url("./assets/fireworks-bg.webp") center / cover; }
.fire-button {
  position: absolute;
  display: grid;
  place-content: center;
  inset: 0;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 18px;
  touch-action: manipulation;
}
.fire-button:focus-visible { outline-offset: -6px; }
.fire-button span {
  padding: 11px 17px;
  border: 1px solid #b6d7e485;
  border-radius: 99px;
  background: #102639da;
  box-shadow: 0 8px 22px #0005;
  font-weight: 750;
}
.fire-button:hover span { background: #24435a; }

.screen {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  background: #081b2a8d;
}
.screen-card {
  width: min(100%, 410px);
  padding: clamp(12px, 3vw, 30px);
  text-align: center;
  border: 1px solid #efcf8769;
  border-radius: 18px;
  background: linear-gradient(155deg, #1c3a50, #0e202f);
  box-shadow: 0 14px 40px #0008;
}
.screen-title { margin: 0 0 8px; color: #ffe4a7; font: 700 clamp(1.35rem, 4.5vw, 2.35rem)/1.12 var(--display); }
.screen-copy { margin: 0 0 15px; font-size: .94rem; color: #d5e2ed; }
.screen-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.screen-actions .button-primary, .screen-actions .button-subtle { min-height: 41px; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .header-inner { min-height: 61px; }
  .hero { margin-top: 16px; margin-bottom: 22px; min-height: 310px; }
  .hero-gold { --size: 48%; --top: 4%; --right: -3%; }
  .hero-rose { --size: 30%; --top: 46%; --right: 3%; }
  .hero-blue { --size: 28%; --top: 52%; --right: 21%; }
  .hero-white { --size: 15%; --right: 31%; --top: 13%; }
  .game-list { gap: 11px; }
  .card-body { padding: 11px; }
  .card-description { font-size: .86rem; }
  .game-top { align-items: flex-start; gap: 10px; }
  .game-tools { width: 100%; justify-content: space-between; }
  .game-hud { flex: 1; max-width: 260px; }
}
@media (max-width: 560px) {
  .wordmark { font-size: 1rem; gap: 8px; }
  .wordmark-symbol { width: 31px; height: 31px; font-size: 22px; }
  .sound-toggle { padding-inline: 10px; font-size: .8rem; }
  .hero { min-height: 276px; border-radius: 17px; }
  .hero-title { font-size: clamp(2.15rem, 11.3vw, 4.1rem); }
  .hero::after { background: linear-gradient(90deg, #0a1d2dbb, #1026375a 67%, transparent); z-index: 1; }
  .hero-copy { z-index: 2; }
  .game-list { grid-template-columns: 1fr; }
  .game-card { display: grid; grid-template-columns: 38% minmax(0, 1fr); min-height: 115px; }
  .game-preview { height: 100%; aspect-ratio: auto; border-bottom: none; border-right: 1px solid var(--line); }
  .game-preview img { width: calc(var(--w) * 1.4); }
  .card-title { font-size: 1.19rem; }
  .card-body { gap: 5px; }
  .card-action { margin-top: 0; }
  .game-page { margin-top: 12px; }
  .stage { border-radius: 13px; }
  .board--gifts, .board--fireworks { aspect-ratio: 5 / 6; }
  .board--gifts .gift-piece { width: 12%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; }
  .board.is-glowing .round-glow { animation: none; }
  .ice-tile.is-broken img { animation: none; opacity: 0; }
  .ice-tile.is-cracking img, .basket.is-caught { animation: none; }
}
