@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-latin-CUoBjw-S.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-BdFMQyLy.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Nunito Sans";
  src: url("fonts/nunitosans-BWQ3gi2K.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --forest: #092318;
  --card: #0c2d1e;
  --cream: #f5ebdb;
  --gold: #d7bd87;
  --light-gold: #f9d189;
  --serif: "Cormorant Garamond", Georgia, serif;
  --numbers: "Fraunces", Georgia, serif;
  font: 400 16px/1.4 "Nunito Sans", system-ui, sans-serif;
  color: var(--cream);
  background: var(--forest);
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { display: grid; place-items: center; }
img { display: block; max-width: 100%; height: auto; -webkit-user-drag: none; user-select: none; }
p, h1, h2, ul { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { color: inherit; font: inherit; }
:where(button, a):focus-visible { outline: 3px solid var(--light-gold); outline-offset: 3px; }
button:disabled { cursor: wait; }
[hidden] { display: none !important; }
.phone {
  position: relative;
  isolation: isolate;
  width: min(100%, 430px);
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--forest) center / cover no-repeat;
  container-type: size;
  user-select: none;
  -webkit-user-select: none;
}
@media (min-width: 431px) {
  body { background: var(--forest) url("art/shared/desktop-night.webp") center / cover no-repeat; }
  .phone { box-shadow: 0 0 0 1px #d7bd8770, 0 12px 50px #04120ec9; }
}
.brand {
  flex-shrink: 0;
  margin: 0;
  color: var(--gold);
  font: 600 clamp(17px, 4.8cqw, 22px)/1.15 var(--serif);
  letter-spacing: .06em;
  white-space: nowrap;
  text-shadow: 0 1px 2px #04150eaa;
}

.hub { display: flex; flex-direction: column; }
.hub-cover {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top)) 5% clamp(18px, 3cqh, 30px);
  background: var(--forest) url("art/shared/village.webp") center 27% / cover no-repeat;
}
.hub-title { width: min(63%, 31cqh); }
.hub-title img, .wordmark img, .result-title img, .game-card img, .art-button img { width: 100%; }
.hub-menu {
  padding: clamp(12px, 2.2cqh, 22px) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  color: #302419;
  background: var(--cream);
  border-top: 1px solid var(--gold);
}
.choose {
  display: flex;
  align-items: center;
  gap: 14px;
  font: 600 clamp(27px, 8.6cqw, 38px)/1.12 var(--serif);
}
.choose::after { content: ""; flex: 1; border-top: 1px solid #89795f; }
.hub-foot { margin: 4px 0 clamp(10px, 1.65cqh, 17px); font-size: 14px; line-height: 1.4; color: #584b39; }
.cards { display: grid; gap: clamp(7px, 1.25cqh, 13px); }
.game-card, .art-button { min-width: 48px; min-height: 48px; cursor: pointer; transition: transform .13s ease; }
.game-card {
  display: grid;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid #bca36c;
  border-radius: 21px;
  background: var(--card);
  box-shadow: 0 4px 11px #30261925;
}
.game-card:nth-child(2) { background-color: #f5d59c; }
.game-card:nth-child(3) { background-color: #082436; }
.game-card:focus-visible { outline-color: var(--card); }
@media (hover: hover) {
  .game-card:hover, .art-button:hover { transform: translateY(-2px); }
}
.game-card:active, .art-button:active { transform: scale(.98); }

.reindeer { background-image: url("art/reindeer/scene.webp"); }
.slice { background-image: url("art/slice/scene.webp"); }
.bowling { background-image: url("art/bowling/scene.webp"); }
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: max(13px, env(safe-area-inset-top)) max(15px, env(safe-area-inset-right))
    max(13px, env(safe-area-inset-bottom)) max(15px, env(safe-area-inset-left));
}
.title-screen, .result-screen { gap: clamp(8px, 1.8cqh, 19px); }
.wordmark { width: min(95%, 43cqh); }
.hero { position: relative; width: min(84%, 39cqh); height: min(21cqh, 49cqw); flex-shrink: 1; }
.hero img { position: absolute; width: auto; height: 100%; object-fit: contain; }
.hero .lead { width: 81%; left: 8%; z-index: 1; }
.hero .glint { height: 36%; top: 43%; left: 4%; }
.hero .small-glint { height: 25%; right: 1%; top: 10%; }
.slice .hero .lead { width: 49%; left: 18%; transform: rotate(-15deg); }
.hero .gift { width: 42%; height: 65%; right: 5%; top: 30%; transform: rotate(11deg); z-index: 2; }
.hero .snow { width: 27%; height: 40%; left: 1%; top: 5%; }
.hero .pin-a { left: 32%; top: 9%; height: 85%; transform: rotate(-11deg); }
.hero .pin-b { left: 51%; height: 92%; transform: rotate(5deg); }
.hero .pin-c { left: 65%; height: 75%; top: 18%; transform: rotate(13deg); }
.hero .ball { left: 13%; height: 55%; bottom: 0; }

.instruction {
  width: min(100%, 380px);
  padding: 12px 9px;
  text-align: center;
  background: var(--card);
  border: 1px solid #aa9365;
  border-radius: 20px;
}
.instruction p { font-size: clamp(14px, 3.9cqw, 17px); line-height: 1.35; font-weight: 650; }
.guide { display: flex; justify-content: center; gap: clamp(12px, 4cqw, 20px); list-style: none; padding: 0; margin: 8px 0 0; }
.guide li { display: flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 750; color: var(--light-gold); }
.guide img { width: 29px; height: 29px; object-fit: contain; }
.actions { display: flex; align-items: center; flex-direction: column; gap: clamp(5px, 1cqh, 10px); }
.art-button { display: grid; place-items: center; border-radius: 999px; background: transparent; border: 0; padding: 0; }
.play, .play-again { width: clamp(145px, 20cqh, 178px); }
.back-to-games { width: clamp(138px, 18cqh, 158px); }
.loading { position: absolute; bottom: 1cqh; padding: 2px 10px; border-radius: 12px; background: var(--forest); }
.countdown-screen { gap: 14px; }
.eyeline, .readout span, .score-label { text-transform: uppercase; font-weight: 800; letter-spacing: .13em; color: var(--light-gold); }
.eyeline { font-size: 15px; text-shadow: 0 1px 3px var(--forest); }
.countdown {
  display: grid; place-items: center; width: 128px; height: 128px;
  background: url("art/shared/countdown.webp") center / contain no-repeat;
  font: 600 68px/1 var(--numbers);
}
.play-screen { padding: 0; touch-action: none; }
.arena { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
.hud {
  position: absolute; z-index: 4; top: max(13px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right));
  display: flex; justify-content: space-between; pointer-events: none;
}
.readout {
  width: 98px; height: 56px;
  background: url("art/shared/hud.webp") center / 100% 100% no-repeat;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.readout span, .score-label { font-size: 11px; }
.readout strong { font: 600 24px/1.08 var(--numbers); font-variant-numeric: tabular-nums; }
.play-hint, .roll-status {
  position: absolute;
  pointer-events: none;
  text-align: center;
  background: var(--card);
  border: 1px solid #ab9365;
  border-radius: 20px;
  padding: 5px 16px;
  line-height: 1.25;
}
.play-hint { bottom: max(4.8%, env(safe-area-inset-bottom)); font-size: 15px; font-weight: 700; }
.play-hint:empty { display: none; }
.roll-status {
  top: max(13%, calc(env(safe-area-inset-top) + 70px)); left: 50%; transform: translateX(-50%);
  white-space: nowrap; font: 650 21px/1.15 var(--serif);
}
.sprite, .target, .point-pop, .strike-burst { position: absolute; top: 0; left: 0; transform-origin: center; pointer-events: none; }
.sprite, .target { will-change: transform; }
.target { background: transparent; border: 0; padding: 0; height: auto; cursor: pointer; pointer-events: auto; touch-action: none; }
.target img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.point-pop { z-index: 4; font: 700 25px/1 var(--numbers); color: var(--light-gold); text-shadow: 0 2px 3px var(--forest), 0 0 5px var(--forest); }
.fx-burst { position: absolute; width: 77px; height: 77px; object-fit: contain; pointer-events: none; }
.trail { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.effects { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.bowling .arena { cursor: grab; }
.bowling .arena:active { cursor: grabbing; }
.bowling .arena canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background: url("art/bowling/scene.webp") center / cover no-repeat;
}
.strike-burst { width: 45%; left: 27.5%; top: 22%; }
.result-title { width: min(80%, 36cqh); }
.result-card {
  width: min(95%, 45cqh); min-height: min(33cqh, 78cqw);
  background: url("art/shared/result-frame.webp") center / 100% 100% no-repeat;
  padding: clamp(14px, 3cqh, 30px) 6%;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center;
}
.result-star { width: clamp(26px, 4.4cqh, 40px); margin-bottom: 6px; }
#final-score { font: 600 clamp(42px, 7.8cqh, 70px)/1.08 var(--numbers); color: var(--cream); }
.prize { margin: 4px 0 8px; }
#prize-tier { font: 650 clamp(24px, 3.6cqh, 32px)/1.15 var(--serif); color: var(--light-gold); }
.prize-detail { display: block; font-size: 14px; margin-top: 2px; }
.result-card small { font-size: 12px; }
.result-card small + small { margin-top: .5em; }

@container (max-height: 710px) {
  .hub-menu {
    padding-block: 10px;
    padding-inline: max(16px, calc((100% - 48cqh) / 2));
  }
  .hub-foot { margin-bottom: 8px; }
  .instruction { padding-block: 8px; }
}
@container (max-height: 580px) {
  .hub-cover { flex-direction: row; align-items: center; }
  .hub-title { width: min(54%, 35cqh); }
  .title-screen, .result-screen { gap: 5px; }
  .title-screen .brand, .result-screen .brand { font-size: 16px; }
  .hero { height: 15cqh; }
  .result-star { display: none; }
  .actions { flex-direction: row; gap: 8px; }
  .actions .art-button { width: min(37cqw, 140px); }
  .guide { margin: 4px 0 0; }
}
@container (max-height: 450px) {
  .title-screen .hero { display: none; }
  .instruction { padding-block: 5px; }
  .choose { font-size: 23px; }
  .hub-cover { padding-block: 5px; }
}
@media (max-height: 450px) {
  .hub { overflow-y: auto; }
  .hub-cover { min-height: 64px; }
  .hub-menu { flex-shrink: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
  .game-card:hover, .art-button:hover, .game-card:active, .art-button:active { transform: none; }
}
