:root {
  color-scheme: dark;
  --bg: #080a0c;
  --gold: #d9b977;
  --text: #f0eee8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, canvas:focus-visible { outline: 2px solid var(--gold); outline-offset: -3px; }
[hidden] { display: none !important; }
.header { height: 76px; padding: 0 36px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-size: 16px; font-weight: 500; color: #c1bcb3; }
.header-controls { display: flex; align-items: center; gap: 18px; }
.timer { font: 15px ui-monospace, SFMono-Regular, Consolas, monospace; font-variant-numeric: tabular-nums; color: #898b8e; }
.sound-button { width: 44px; height: 44px; display: grid; place-items: center; background: transparent; border: 0; border-radius: 50%; color: var(--gold); }
.sound-button:hover { background: #d9b97712; }
.sound-off { display: none; }
.sound-button[aria-pressed="false"] .sound-on { display: none; }
.sound-button[aria-pressed="false"] .sound-off { display: block; color: #85878b; }
.field { position: relative; width: 100%; height: calc(100svh - 76px); min-height: 280px; overflow: hidden; isolation: isolate; }
#gameCanvas { display: block; width: 100%; height: 100%; touch-action: none; }
.field.is-playing { cursor: none; }
.intro { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 24px 76px; text-align: center; background: radial-gradient(ellipse at 50% 45%, #191915 0, #080a0c 50%); }
h1 { font-size: clamp(48px, 7vw, 86px); letter-spacing: -3px; line-height: 1.07; font-weight: 500; margin: 0 0 40px; }
h1 em { font-family: Georgia, "Times New Roman", serif; color: var(--gold); font-weight: 400; }
.primary-button { min-width: 140px; min-height: 48px; padding: 13px 28px; border: 1px solid #8e774d; border-radius: 30px; background: #d9b977; color: #151515; font-size: 16px; font-weight: 500; transition: background .2s; }
.primary-button:hover { background: #f0d39a; }
.reward-circle { position: absolute; border-radius: 50%; overflow: hidden; border: 1px solid var(--gold); background: #161713; box-shadow: 0 0 55px #d9b97712; }
#rewardVideo { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-placeholder { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: #c9bb9e; font-size: 14px; background: radial-gradient(circle, #25251c, #10120e); }
.video-action { position: absolute; bottom: 22%; left: 50%; transform: translateX(-50%); border: 1px solid #d9b97788; border-radius: 50%; width: 44px; height: 44px; background: #080a0ce0; color: var(--gold); font-size: 17px; }
 .result { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 24px 68px; text-align: center; background: radial-gradient(ellipse at 50% 45%, #191915 0, #05070a 65%); }
.result h2 { color: var(--gold); font-size: clamp(44px, 8vw, 104px); line-height: 1.12; font-weight: 600; letter-spacing: -2px; margin: 0 0 30px; max-width: 1100px; }
.result h2 span { display: block; }
.result p { margin: 0 0 24px; white-space: nowrap; }
.result strong { font: 32px ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--text); }
.result p span { font-size: 14px; color: #979895; margin-left: 9px; }
.result.is-fallback { inset: auto 0 max(28px, env(safe-area-inset-bottom)); background: none; padding: 0; }
.result.is-fallback h2 { display: none; }
.sr-only { position: absolute; top: 0; left: 0; margin: 0; height: 1px; width: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.no-script { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); padding: 24px; }
@media (max-width: 600px) {
  .header { height: 64px; padding: 0 18px; gap: 10px; }
  .brand { font-size: 14px; }
  .header-controls { gap: 8px; }
  .timer { font-size: 13px; }
  .field { height: calc(100svh - 64px); }
  .intro { padding-bottom: 64px; }
  h1 { font-size: clamp(49px, 15vw, 68px); letter-spacing: -2px; }
  .result { padding: 24px 16px 58px; }
  .result h2 { font-size: clamp(33px, 10vw, 58px); letter-spacing: -1px; }
}
@media (max-height: 480px) {
  .header { height: 56px; }
  .field { height: calc(100svh - 56px); min-height: 200px; }
  .intro { padding: 12px; }
  h1 { font-size: 40px; margin-bottom: 20px; }
  .result { padding: 16px; }
  .result h2 { font-size: clamp(32px, 7vh, 48px); margin-bottom: 18px; }
  .result p { margin-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }


/* На финальном экране праздник намеренно вышел из-под контроля. */
.celebration-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.result > h2, .result > p, .result > button { position: relative; z-index: 2; }
.result:not(.is-fallback)::before { content: ""; position: absolute; left: 50%; top: 50%; width: 200vmax; height: 200vmax; background: repeating-conic-gradient(from 0deg, #ff69c912 0deg 12deg, transparent 12deg 24deg, #69ffed10 24deg 36deg, transparent 36deg 48deg); transform: translate(-50%, -50%); animation: party-rays 36s linear infinite; pointer-events: none; }
.result:not(.is-fallback) h2 { background: linear-gradient(100deg, #ff89db, #ffe898, #90ffe8, #c2aeff, #ff89db); background-size: 300% 100%; background-clip: text; -webkit-background-clip: text; color: transparent; -webkit-text-stroke: .5px #ffffff60; filter: drop-shadow(0 0 20px #ff5dca80); animation: birthday-colors 4s linear infinite, birthday-hype 1.7s ease-in-out infinite; }
.result:not(.is-fallback) strong { text-shadow: 0 0 20px #ffe898; }
.result:not(.is-fallback) .primary-button { animation: party-button 1.5s ease-in-out infinite; }
@keyframes party-rays { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes birthday-colors { to { background-position: 300% 0; } }
@keyframes birthday-hype { 0%,100% { transform: rotate(-1.5deg) scale(1); } 50% { transform: rotate(1.5deg) scale(1.035); } }
@keyframes party-button { 0%,100% { box-shadow: 0 0 14px #ff77cd70, 0 0 28px #90ffe830; } 50% { box-shadow: 0 0 24px #ff77cd90, 0 0 48px #90ffe850; } }
@media (prefers-reduced-motion: reduce) { .result:not(.is-fallback)::before, .result:not(.is-fallback) h2, .result:not(.is-fallback) .primary-button { animation: none !important; } }

.result:not(.is-fallback) p { padding: 10px 20px; border-radius: 32px; background: #05070ad9; box-shadow: 0 0 24px #05070a88; }
