:root { color-scheme: dark; font-family: system-ui, sans-serif; color: #fff1d2; background: #102438; }
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; }
[hidden] { display: none !important; }
#game { position: relative; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; isolation: isolate; background: #102438 url('art/winter_background.svg') center / cover no-repeat; }
#game, #game * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#game.market { background-image: url('art/market_background.svg'); }
#scene, #effects, #popups { position: absolute; inset: 0; width: 100%; height: 100%; }
#scene { touch-action: none; }
#effects, #popups { pointer-events: none; }
.hud { position: absolute; z-index: 1; inset: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) auto max(12px, env(safe-area-inset-left)); display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.card { display: grid; grid-template-columns: minmax(50px, 1fr) auto; align-items: center; gap: 4px 14px; min-width: min(250px, 55vw); padding: 8px 13px; background: #142f30ed; border: 1px solid #d5ab61; border-radius: 14px; }
#heart-announcer { position: absolute; z-index: 3; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); pointer-events: none; }
#heart-announcement { min-width: 185px; padding: 8px 18px; border: 2px solid #ffd783; border-radius: 14px; background: #193e35f7; text-align: center; box-shadow: 0 2px 24px #f4ba5566; animation: heart-pop .3s ease-out both; }
#heart-announcement strong { display: block; color: #ffe2a0; font-size: clamp(20px, 4vw, 29px); line-height: 1.15; white-space: nowrap; }
#heart-milestone { display: block; margin-top: 3px; font-size: 13px; font-weight: 700; }
@media (max-width: 760px) { #heart-announcer { top: max(83px, calc(env(safe-area-inset-top) + 71px)); } }
@keyframes heart-pop { from { transform: translateY(-10px) scale(.83); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #heart-announcement { animation: none; } }
.score-label, #combo { font-weight: 750; color: #ffd483; font-size: clamp(11px, 2.8vw, 14px); }
#score { grid-row: 2; font-size: clamp(24px, 5vw, 38px); line-height: 1; }
#hearts { color: #ff8293; font-size: clamp(17px, 4vw, 26px); }
#combo { grid-row: 2; grid-column: 2; }
nav { display: flex; align-items: flex-start; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
button, #audio-controls summary { pointer-events: auto; touch-action: manipulation; cursor: pointer; border: 1px solid #cba563; border-radius: 10px; padding: 7px 10px; background: #233d3d; color: inherit; font: 650 clamp(11px, 2.7vw, 15px)/1.2 system-ui, sans-serif; }
button:hover, button:focus-visible, #audio-controls summary:hover, #audio-controls summary:focus-visible { background: #365954; outline: 2px solid #ffe3a7; }
.hud:has(#audio-controls[open]) { z-index: 4; }
#audio-controls { position: relative; pointer-events: auto; }
#audio-controls summary { list-style: none; }
#audio-controls summary::-webkit-details-marker { display: none; }
#audio-controls[open] summary { background: #426253; }
.audio-panel { position: absolute; top: calc(100% + 6px); right: 0; width: min(230px, calc(100vw - 28px)); display: grid; gap: 5px; padding: 12px; background: #152c2df7; border: 1px solid #cba563; border-radius: 12px; box-shadow: 0 6px 24px #0b1528aa; }
.audio-panel label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 750; }
.audio-panel output { color: #ffd483; }
.audio-panel input[type='range'] { width: 100%; margin: 0 0 4px; height: 24px; accent-color: #eabe77; cursor: pointer; touch-action: none; }
.center { position: absolute; z-index: 2; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(91%, 850px); max-height: 92dvh; display: grid; grid-template-columns: minmax(0, 1.24fr) minmax(0, 1fr); align-items: center; overflow: auto; text-align: center; border: 2px solid #cba563; border-radius: 18px; background: #102833fa; box-shadow: 0 18px 70px #080f17a8; }
.welcome-art { display: block; width: 100%; height: auto; max-height: 72dvh; object-fit: contain; background: #f0eeea; }
.welcome-copy { padding: clamp(16px, 4vw, 42px); }
h1 { margin: 0; font-size: clamp(32px, 6vw, 57px); line-height: 1.02; color: #ffe2a0; }
#start { font-size: 19px; }
.difficulty { display: flex; justify-content: center; gap: 5px; border: 0; margin: 0 0 15px; padding: 0; }
.difficulty legend { margin: 0 auto 6px; color: #efcf8e; font-size: .79rem; font-weight: 750; }
.difficulty label { position: relative; cursor: pointer; touch-action: manipulation; }
.difficulty input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.difficulty span { display: block; min-width: 46px; border: 1px solid #71897f; border-radius: 8px; padding: 6px 9px; font-size: .85rem; background: #193435; }
.difficulty input:checked + span { background: #426253; border-color: #e5bf74; color: #fff2cc; }
.difficulty input:focus-visible + span { outline: 2px solid #ffe3a7; outline-offset: 2px; }
@media (max-width: 600px) and (orientation: portrait) {
  .center { grid-template-columns: minmax(0, 1fr); width: min(90%, 420px); }
  .welcome-art { max-height: 48dvh; }
}
#status { pointer-events: none; position: absolute; margin: 0; inset: auto 16px max(16px, env(safe-area-inset-bottom)) 16px; text-align: center; text-shadow: 0 2px 6px black; }
.credits { position: absolute; z-index: 1; right: max(14px, env(safe-area-inset-right)); bottom: max(9px, env(safe-area-inset-bottom)); max-width: calc(100% - 28px); text-align: right; color: #ebdec4; font-size: clamp(10px, 2.7vw, 13px); line-height: 1.25; text-shadow: 0 1px 5px #07111b, 0 1px 2px #07111b; pointer-events: none; }
.credits::before { content: ''; display: block; height: 20px; margin-bottom: 1px; background: url('art/credits-lights.svg') center bottom / 100% auto no-repeat; }
#replay-actions { position: absolute; z-index: 1; bottom: max(50px, calc(env(safe-area-inset-bottom) + 32px)); left: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 720px) {
  #status { bottom: max(49px, calc(env(safe-area-inset-bottom) + 40px)); }
  #replay-actions { bottom: max(80px, calc(env(safe-area-inset-bottom) + 68px)); }
}
#leaderboard { width: min(94vw, 525px); max-height: 90dvh; padding: 18px; color: #fff1d2; background: #102b30; border: 2px solid #d5ab61; border-radius: 17px; box-shadow: 0 16px 70px #080f17bc; }
#leaderboard::backdrop { background: #07151bc4; }
.leaderboard-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.leaderboard-heading h2 { margin: 0; font-size: clamp(24px, 6vw, 34px); color: #ffd483; }
.leaderboard-periods { display: flex; gap: 6px; margin-top: 12px; }
.leaderboard-periods button[aria-pressed='true'] { background: #496959; border-color: #ffe2a0; }
#score-form small { color: #c3d6ca; font-size: 12px; }
#score-form { display: grid; gap: 5px; margin-top: 12px; }
.score-entry { display: flex; align-items: stretch; gap: 6px; }
#game #score-name { min-width: 0; width: 100%; padding: 6px 9px; color: #fff1d2; background: #183e42; border: 1px solid #cba563; border-radius: 8px; font-size: 16px; -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
#score-feedback { margin: 8px 0; font-weight: 700; }
#score-table { width: 100%; border-collapse: collapse; font-size: clamp(12px, 3.3vw, 15px); }
#score-table th, #score-table td { text-align: left; padding: 6px 4px; border-bottom: 1px solid #375858; }
#score-table th:last-child, #score-table td:last-child { text-align: right; }
#score-table td:nth-child(2) { overflow-wrap: anywhere; }
#score-table td:nth-child(3) { text-transform: capitalize; }
#score-table td:nth-child(4) { color: #c3d6ca; white-space: nowrap; }
#score-table td:last-child { font-variant-numeric: tabular-nums; color: #ffda92; font-weight: 750; }
.star-hint { position: absolute; transform: translate(-50%, -50%); width: max-content; max-width: min(185px, 26vw); text-align: center; font-size: clamp(13px, 3vw, 21px); font-weight: 850; text-shadow: 0 2px 6px black; }
.settings-hint { color: #ff9a9d; }
.splash { position: absolute; width: clamp(110px, 17vw, 166px); aspect-ratio: 256 / 104; display: grid; place-items: center; background: url('art/combo_splash.svg') center / contain no-repeat; color: #fff2ca; font-weight: 850; font-size: clamp(13px, 2vw, 19px); text-shadow: 0 1px 2px #1a2e14; animation: float 660ms both; }
@keyframes float { 0% { transform: translate(-50%, -45%) scale(.68); } 25% { transform: translate(-50%, -65%) scale(1.08); } 72% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -115%); } }
