:root {
  color-scheme: light;
  --cream: #f9ecd0;
  --paper: #fff8e7;
  --red: #af302c;
  --ink: #193e3d;
  --teal: #174c48;
  --mint: #b9d9c4;
  --stroke: #50645d;
  --gold: #ffe095;
  --sans: "DM Sans", "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  --display: "DM Serif Text", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--cream);
  background-image: radial-gradient(#8165491a .7px, transparent .85px);
  background-size: 5px 5px;
  color: var(--ink);
  font: 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, p { margin: 0; }
button, input, summary { font: inherit; }
button, summary { cursor: pointer; touch-action: manipulation; }
button { color: inherit; }
button:disabled, input:disabled { cursor: not-allowed; opacity: .6; }
:focus-visible { outline: 3px solid #087092; outline-offset: 4px; }
::selection { color: var(--paper); background: var(--teal); }
.diner {
  width: min(100%, 1024px);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(26px, env(safe-area-inset-right)) max(26px, env(safe-area-inset-bottom)) max(26px, env(safe-area-inset-left));
}
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 3px 4px clamp(16px, 2.3vw, 25px);
}
.identity { min-width: 0; }
.identity h1 {
  color: var(--red);
  font: italic 900 clamp(42px, 7.4vw, 82px)/1 var(--display);
  letter-spacing: -.085em;
  text-shadow: 1px 2px var(--cream), 2px 3px #d0ad77;
}
.identity p { margin-top: 6px; font-size: clamp(13px, 1.7vw, 16px); font-weight: 650; }
.text-button {
  padding: 6px 1px;
  min-height: 44px;
  border: none;
  background: none;
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: .24em;
  text-decoration-thickness: 1px;
  font-size: 14px;
  font-weight: 720;
}
.text-button:hover { color: var(--red); }
.masthead > button { flex: none; }
.cabinet {
  position: relative;
  border: 2px solid var(--ink);
  border-radius: 17px;
  background: var(--paper);
  box-shadow: 0 3px 0 #9ca797, 0 5px 0 var(--ink), 0 11px 20px -15px #17342cd9;
}
.scoreboard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 8px clamp(15px, 2.4vw, 26px);
  color: var(--paper);
  background: var(--teal);
  border-radius: 14px 14px 0 0;
  border-bottom: 3px double #e7e1be;
}
.status { font-size: clamp(15px, 2vw, 19px); line-height: 1.28; font-weight: 720; }
.scores { flex: none; display: flex; align-items: stretch; gap: 15px; }
.meter { display: grid; justify-items: end; align-content: center; gap: 2px; }
.friend-meter:has(#target-score[hidden]) { display: none; }
.meter-label { color: #d4ece0; font-size: 11px; font-weight: 700; line-height: 1.2; }
.meter strong { color: var(--gold); font: 700 clamp(14px, 2.2vw, 20px)/1.1 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
#stage {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 1.7;
  max-height: 64svh;
  min-height: 265px;
  background: #84afa3;
  overflow: hidden;
}
#lane { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#lane:active { cursor: grabbing; }
#lane:focus-visible { outline-offset: -5px; }
.control-deck {
  position: relative;
  padding: 3px clamp(15px, 2.4vw, 26px);
  border-top: 3px double var(--stroke);
  border-radius: 0 0 14px 14px;
  background: var(--paper);
}
.control-deck > .text-button { position: absolute; top: 3px; right: clamp(15px, 2.4vw, 26px); }
.manual-controls { min-width: 0; }
.manual-controls > summary {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  list-style: none;
  font-size: 14px;
  font-weight: 760;
}
.manual-controls > summary::-webkit-details-marker { display: none; }
.manual-controls > summary::before {
  content: "";
  width: 8px; height: 8px;
  border-right: 2px solid;
  border-bottom: 2px solid;
  transform: translateY(-2px) rotate(45deg);
}
.manual-controls[open] > summary::before { transform: translateY(2px) rotate(225deg); }
.slider-panel { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: end; padding: 3px 0 13px; }
.slider-panel label { flex: 1 1 135px; max-width: 240px; min-width: 0; font-size: 13px; font-weight: 750; }
input[type=range] { display: block; width: 100%; margin: 0; height: 40px; accent-color: var(--teal); }
.button {
  display: inline-flex; justify-content: center; align-items: center;
  min-height: 44px; padding: 9px 15px;
  border: 2px solid var(--ink); border-radius: 8px;
  font-size: 14px; font-weight: 780; line-height: 1.2;
}
.primary { background: var(--red); color: #fff9ef; box-shadow: 0 2px var(--ink); }
.secondary { background: var(--paper); color: var(--teal); }
.button:enabled:hover { filter: brightness(.95); }
.button:enabled:active { transform: translateY(1px); }
.ticket {
  position: absolute; z-index: 1;
  left: 50%; bottom: clamp(10px, 2vw, 22px);
  transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 24px);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 19px;
  padding: 12px 16px;
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-top: 5px solid var(--red); border-radius: 8px;
  box-shadow: 2px 3px var(--ink);
}
.result-copy { min-width: 0; max-width: 34ch; }
.ticket h2, dialog h2 {
  font: italic 800 clamp(23px, 3vw, 33px)/1 var(--display);
  letter-spacing: -.045em;
}
.ticket p { font-size: 14px; line-height: 1.4; margin-top: 4px; }
.ticket-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; }
#copy-link { min-width: 0; width: 100%; padding: 7px; border: 1px solid var(--stroke); border-radius: 4px; font-size: 16px; }
#footer-ad {
  width: min(100%, 760px);
  margin: 32px auto 0;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
}
#footer-ad[data-kind="adsense"] { margin-top: 156px; }
#footer-ad:has(.adsbygoogle[data-ad-status="unfilled"]) { display: none; }
.ad-label { margin-bottom: 5px; font-size: 12px; color: var(--teal); }
.ad-content { width: 100%; min-width: 0; }
.ad-sponsor {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px 20px; padding: 6px 0; overflow-wrap: anywhere;
}
.ad-copy { min-width: 0; }
.ad-copy strong { display: block; font-size: 17px; }
.ad-copy p { margin-top: 2px; color: var(--stroke); font-size: 14px; }
.ad-cta { max-width: 100%; color: var(--teal); font-size: 14px; font-weight: 700; }
a.ad-cta { display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: 3px; }
.site-footer { margin-top: 24px; text-align: center; }
.site-footer a, .privacy-page > a { display: inline-flex; align-items: center; }
.privacy-page { width: min(100%, 66ch); margin: 0 auto; padding: 24px 20px 48px; }
.privacy-page h1 { margin-top: 12px; color: var(--red); font: italic bold clamp(40px, 7vw, 60px)/1.05 var(--display); }
.privacy-page h2 { margin-top: 28px; font: bold 23px/1.25 var(--display); }
.privacy-page p { margin-top: 12px; line-height: 1.6; }
.privacy-page p a { color: var(--teal); text-underline-offset: .18em; }
dialog { width: min(410px, calc(100% - 32px)); padding: 22px; color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 3px 4px var(--teal); }
dialog::backdrop { background: #13342bbc; }
dialog p { margin-top: 13px; }
dialog form { margin-top: 19px; }
@media (max-width: 550px) {
  .ad-sponsor { flex-direction: column; align-items: flex-start; }
  .diner { padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  .masthead { align-items: center; padding: 2px 3px 14px; gap: 8px; }
  .identity h1 { font-size: clamp(35px, 9.6vw, 52px); }
  .identity p { font-size: 12px; margin-top: 4px; }
  .masthead > button { font-size: 13px; }
  #stage { aspect-ratio: .92; min-height: 280px; max-height: 67svh; }
  .scoreboard { min-height: 52px; gap: 8px; padding: 6px 11px; }
  .scores { gap: 9px; }
  .meter-label { font-size: 10px; }
  .ticket { width: calc(100% - 20px); gap: 9px; padding: 9px; text-align: center; }
  .result-copy { flex-basis: 100%; max-width: none; }
  .ticket .button { padding: 8px 10px; font-size: 13px; }
  .slider-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
