:root {
  --gold: #ffc83c;
  --green: #4cd964;
  --red: #ff4b3e;
  --fg: #f0f0f0;
  --dim: #8a8a8a;
  --panel: rgba(18, 18, 20, 0.94);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--fg);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

#video, #overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
}
#video { object-fit: contain; background: #000; }
#overlay { touch-action: none; }

button, select {
  font: inherit;
  color: var(--fg);
  background: #2a2a2e;
  border: 1px solid #444;
  border-radius: 10px;
  padding: 10px 14px;
  min-height: 44px;
}
button.primary { background: var(--gold); color: #000; border-color: var(--gold); font-weight: 600; }
button:active { filter: brightness(1.3); }
button:disabled { opacity: 0.4; }

.small { font-size: 13px; color: var(--dim); }

.screen {
  position: fixed;
  inset: 0;
  overflow-y: auto;
}

/* --- winter: the start screen and the Drink! screen ------------------------ */
.winter {
  --navy: #1d3557;
  --berry: #c62a3a;
  background: linear-gradient(180deg, #eef6fc 0%, #d6e8f7 50%, #b9d4ee 100%);
  color: var(--navy);
  overflow: hidden;
}
.winter .small { color: #4a6382; }
.winter button { background: #fff; color: var(--navy); border-color: #b9cfe6; }
.winter button.primary { background: var(--berry); border-color: var(--berry); color: #fff; }
.winter .tag {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.25); border-radius: 6px; padding: 2px 6px; margin-left: 6px;
  vertical-align: 2px;
}
.ground {
  position: absolute;
  left: -20%; right: -20%; bottom: -12vh;
  height: 26vh;
  background: #f8fbff;
  border-radius: 50% 50% 0 0;
  box-shadow: 0 -4px 18px rgba(110, 150, 200, 0.25);
}
.snow { position: absolute; inset: 0; pointer-events: none; }
.flake {
  position: absolute;
  top: -12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 3px rgba(150, 185, 220, 0.6);
  animation: fall linear infinite;
}
@keyframes fall { to { transform: translate3d(var(--drift), 110vh, 0); } }

.start-inner {
  position: relative;
  min-height: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.start-art { width: min(52vw, 230px); aspect-ratio: 1; }
.start-text { max-width: 480px; width: 100%; }
.start-text h1 { color: var(--berry); margin: 0 0 8px; font-size: 34px; }
.start-text ol { padding-left: 1.2em; margin: 0 0 12px; }
.start-text li { margin-bottom: 6px; }
.actions { display: flex; flex-direction: column; gap: 10px; }
.actions .primary { font-size: 19px; padding: 14px; }
.actions .small { margin: 0; text-align: center; }
@media (orientation: landscape) and (max-height: 520px) {
  .start-inner { flex-direction: row; gap: 24px; }
  .start-art { width: min(34vw, 240px); flex: none; }
  .start-text h1 { font-size: 26px; }
  .start-text li { font-size: 14px; margin-bottom: 3px; }
  .actions .primary { padding: 10px; }
}

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85) 30%);
}
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row select { max-width: 40vw; }
.instructions { margin: 0 0 8px; text-shadow: 0 1px 3px #000; }
#zoom-wrap { display: flex; gap: 6px; align-items: center; color: var(--dim); }
#zoom { width: 110px; }

#blackout {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
/* Dim on purpose: this is on all evening, next to a TV, in a dark room. */
#blackout .count { font-size: 64px; font-weight: 700; color: #5a1a16; }
#blackout .status { color: #3c3c3c; display: flex; gap: 8px; align-items: center; }
#blackout .hint { color: #262626; font-size: 13px; }
/* Big enough to hit in the dark, dim enough not to light the room. */
#blackout-miss-btn { margin-top: 24px; padding: 14px 28px; background: #111; color: #4a4a4a; border-color: #222; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #333; }
.dot.holding { background: #7a5a10; }
.dot.cooldown { background: #1d5a26; }
.dot.problem { background: #6a1a14; }

.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  overflow-y: auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: var(--panel);
  -webkit-user-select: auto;
  user-select: auto;
}
.panel header { display: flex; justify-content: space-between; align-items: center; }
.panel h2 { margin: 0; }
.panel h3 { margin: 20px 0 6px; }
.slider { margin: 14px 0; }
.slider .label { display: flex; justify-content: space-between; }
.slider .value { color: var(--gold); font-variant-numeric: tabular-nums; }
.slider input { width: 100%; }
.slider .help { font-size: 12px; color: var(--dim); }
#hits, #misses { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
#hits figure, #misses figure { margin: 0; }
#hits img, #misses img { width: 100%; border-radius: 6px; display: block; }
#hits figcaption, #misses figcaption { font-size: 12px; color: var(--dim); }

#flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  animation: flash-in 0.25s ease-out;
}
.flash-inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}
.flash-title {
  font-size: min(18vmin, 120px);
  font-weight: 900;
  line-height: 1;
  color: var(--berry);
  text-shadow: 0 3px 0 #fff, 0 6px 20px rgba(29, 53, 87, 0.25);
}
.flash-art { width: min(62vmin, 420px); aspect-ratio: 1; }
.flash-sub { font-size: min(5vmin, 26px); font-weight: 600; min-height: 1.3em; text-align: center; }
@media (orientation: landscape) and (max-height: 520px) {
  .flash-inner { flex-direction: row; gap: 4vw; }
  .flash-art { width: min(80vh, 420px); order: -1; }
  .flash-sub { position: absolute; bottom: max(12px, env(safe-area-inset-bottom)); left: 0; right: 0; }
}
@keyframes flash-in { from { opacity: 0; transform: scale(1.04); } }

#toast {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid #444;
  text-align: center;
}
