:root {
  --gold: #e9b54d;
  --gold-light: #ffe9ae;
  --cream: #f6ead0;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%;
  overflow: hidden;
  background: #1b0e06;
  color: var(--cream);
  font-family: Georgia, "Noto Serif", "Times New Roman", serif;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}
#table { display: block; width: 100%; height: 100%; touch-action: none; }

#pauseBtn {
  position: fixed;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: rgba(20, 9, 3, 0.85);
  color: var(--gold-light);
  font-size: 12px;
  letter-spacing: -1px;
  cursor: pointer;
  display: none;
}
#pauseBtn.on { display: block; }

.screen {
  position: fixed;
  inset: 0;
  display: none;
  overflow-y: auto;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgba(6, 10, 28, 0.35), rgba(4, 4, 12, 0.8));
}
.screen.on { display: flex; }

.card {
  margin: auto;
  width: min(360px, 100%);
  padding: 22px 20px;
  text-align: center;
  border-radius: 22px;
  border: 2px solid #b98430;
  background: linear-gradient(180deg, rgba(74, 39, 18, 0.96), rgba(30, 14, 7, 0.97));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.65), inset 0 0 0 4px rgba(20, 8, 3, 0.7), inset 0 0 0 5px rgba(233, 181, 77, 0.45);
}
.kicker { font-style: italic; color: #b9ded8; font-size: 14px; }
h1 {
  margin: 4px 0 14px;
  font-size: 40px;
  line-height: 1;
  background: linear-gradient(180deg, #fff6cc, #e9b54d 55%, #a56c22);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 1px rgba(0, 0, 0, 0.8));
}
h1 small { display: block; margin-top: 4px; font-size: 19px; letter-spacing: 10px; text-indent: 10px; text-transform: uppercase; }
h2 { margin: 16px 0 6px; font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--gold); }
h2.title { margin: 0 0 14px; font-size: 24px; color: var(--gold-light); }

button { font-family: inherit; cursor: pointer; color: inherit; }
button:focus-visible { outline: 3px solid #9fe3ff; outline-offset: 2px; }
.big {
  width: 100%;
  margin-top: 6px;
  padding: 14px;
  border-radius: 40px;
  border: 2px solid var(--gold-light);
  background: linear-gradient(180deg, #d9492f, #8c1d12);
  color: #fff6dd;
  font-size: 23px;
  font-weight: bold;
  letter-spacing: 2px;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
  box-shadow: 0 6px 0 #3e0b06, 0 10px 18px rgba(0, 0, 0, 0.5);
}
.big:active { transform: translateY(4px); box-shadow: 0 2px 0 #3e0b06; }
.row { display: grid; gap: 8px; margin-top: 16px; }
.two { grid-template-columns: 1fr 1fr; }
.three { grid-template-columns: 1fr 1fr 1fr; }
.pick, .toggle {
  border-radius: 12px;
  border: 2px solid rgba(233, 181, 77, 0.35);
  background: rgba(10, 5, 2, 0.55);
  padding: 9px 6px;
  color: #cbb994;
}
.pick b { display: block; font-size: 17px; }
.pick span { font-size: 12px; }
.pick.sel { border-color: var(--gold-light); color: var(--cream); background: rgba(20, 70, 80, 0.55); box-shadow: 0 0 12px rgba(233, 181, 77, 0.45); }
.toggle { font-size: 14px; }
.toggle::after { content: " off"; opacity: 0.7; }
.toggle.sel { border-color: var(--gold); color: var(--cream); }
.toggle.sel::after { content: " on"; color: #8fe8a0; }
.plain { margin-top: 14px; border: 0; background: none; text-decoration: underline; font-size: 15px; color: #d9c391; padding: 6px; }

.scores { list-style: none; font-size: 15px; }
.scores li { display: grid; grid-template-columns: 26px 1fr 62px; padding: 3px 8px; border-bottom: 1px solid rgba(233, 181, 77, 0.2); text-align: right; font-variant-numeric: tabular-nums; }
.scores li span:first-child { text-align: left; color: var(--gold); }
.scores li span:last-child { color: #a8957a; font-size: 13px; }
.scores li.new { background: rgba(233, 181, 77, 0.2); }
.scores li.none { display: block; text-align: center; color: #a8957a; font-style: italic; }
.final { font-family: "Courier New", monospace; font-size: 42px; font-weight: bold; color: #ffb83d; text-shadow: 0 0 14px rgba(255, 150, 30, 0.7); }
#over .scores { margin: 12px 0 14px; }

dl { text-align: left; font-size: 14px; line-height: 1.4; margin-bottom: 14px; }
dt { color: var(--gold); font-weight: bold; margin-top: 9px; }

@media (max-height: 640px) {
  .card { padding: 14px 16px; }
  h1 { font-size: 30px; margin-bottom: 8px; }
  .row { margin-top: 10px; }
}

/* ---------- first-time welcome ---------- */
#intro {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, #2a1650, #07040f 75%);
  text-align: center;
  font-family: "Comic Sans MS", "Comic Neue", casual, cursive;
  transition: opacity 0.45s;
}
#intro.on { display: block; }
#intro.bye { opacity: 0; pointer-events: none; }
#introRoll { position: relative; padding: 14px 12px 30px; transition: transform 0.9s ease-in-out; }
#introPhoto {
  display: block;
  margin: 0 auto 10px;
  width: auto;
  height: auto;
  max-width: min(94%, 420px);
  max-height: 52vh;
  border: 5px solid #ffe14d;
  border-radius: 18px;
  box-shadow: 0 0 30px rgba(255, 210, 60, 0.55);
  transform: translateY(-120vh);
}
#introPhoto.go { animation: scrollDown 3s cubic-bezier(0.25, 0.8, 0.35, 1) forwards; }
@keyframes scrollDown { to { transform: translateY(0); } }

.say { margin: 7px auto; max-width: 420px; font-size: clamp(21px, 6.4vw, 29px); font-weight: bold; line-height: 1.15; color: #fff; }
.say b {
  display: inline-block;
  opacity: 0;
  -webkit-text-stroke: 5px #12061f;
  paint-order: stroke fill;
}
.say.go b { animation: boing 0.5s var(--d) cubic-bezier(0.3, 1.7, 0.5, 1) forwards, wiggle 0.7s calc(var(--d) + 0.5s) ease-in-out infinite alternate; }
.hello { font-size: clamp(30px, 9.5vw, 42px); }
.hot b { color: #ff5ca8; }
.gold b { color: #ffd93b; font-size: 1.18em; }
.cool b { color: #4dffb4; }
@keyframes boing {
  0% { opacity: 0; transform: scale(0.1) rotate(-40deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes wiggle {
  from { opacity: 1; transform: rotate(0); }
  to { opacity: 1; transform: rotate(var(--tilt)) translateY(-2px); }
}

#bird { width: max-content; margin: 0 auto; font-size: 66px; line-height: 1.2; opacity: 0; position: relative; z-index: 2; }
#bird.go { animation: birdPop 1.9s ease-in-out forwards, birdThrob 0.8s 1.9s ease-in-out infinite alternate; }
@keyframes birdPop {
  0% { opacity: 0; transform: translateY(0) scale(0.1); }
  22% { opacity: 1; transform: translateY(-28vh) scale(4.6) rotate(-12deg); }
  38% { opacity: 1; transform: translateY(-28vh) scale(2.2) rotate(10deg); }
  56% { opacity: 1; transform: translateY(-28vh) scale(5) rotate(-8deg); }
  72% { opacity: 1; transform: translateY(-28vh) scale(3.6) rotate(6deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}
@keyframes birdThrob {
  from { opacity: 1; transform: scale(0.85) rotate(-8deg); }
  to { opacity: 1; transform: scale(1.35) rotate(8deg); }
}

#introGo { display: block; max-width: 280px; margin: 22px auto 0; visibility: hidden; font-family: inherit; }
#introGo.go { visibility: visible; animation: boing 0.5s cubic-bezier(0.3, 1.7, 0.5, 1); }
#introSkip {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
}
