:root {
  color-scheme: dark;
  --ink: #11100e;
  --paper: #f1ead9;
  --paper-muted: #d9d1bf;
  --red: #e5382c;
  --red-dark: #bd251d;
  --yellow: #f4c84b;
  --white: #fffdf6;
  --line: rgba(241, 234, 217, 0.22);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", "Franklin Gothic Condensed", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--paper);
  background:
    radial-gradient(circle at 70% 5%, rgba(229, 56, 44, 0.14), transparent 24rem),
    repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0, rgba(255,255,255,.012) 1px, transparent 1px, transparent 3px),
    var(--ink);
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--yellow); outline-offset: 4px; }

.skip-link { position: fixed; top: .75rem; left: .75rem; z-index: 100; transform: translateY(-200%); padding: .7rem 1rem; background: var(--yellow); color: var(--ink); }
.skip-link:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.site-header, main, footer { width: min(100% - 2rem, 1060px); margin-inline: auto; }

.site-header { display: flex; align-items: center; justify-content: space-between; padding-block: 1.2rem; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .75rem; color: var(--paper); text-decoration: none; letter-spacing: .04em; line-height: .82; }
.brand-mark { display: grid; place-items: center; width: 3.15rem; height: 3.15rem; border: 2px solid var(--paper); border-radius: 50%; font-size: 1.05rem; letter-spacing: .02em; transform: rotate(-7deg); }
.brand-copy { font-size: .9rem; }
.brand-copy strong { color: var(--red); font-size: 1.3rem; }
.icon-button { width: 2.65rem; height: 2.65rem; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--paper); cursor: pointer; font-size: 1.25rem; }

.intro { padding: clamp(3rem, 8vw, 6.5rem) 0 2.2rem; }
.eyebrow, .kicker { margin: 0 0 .8rem; color: var(--red); text-transform: uppercase; letter-spacing: .16em; font: 700 .75rem/1.2 Arial, sans-serif; }
.live-dot { display: inline-block; width: .55rem; height: .55rem; margin-right: .45rem; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 .28rem rgba(229,56,44,.16); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 1.2rem; max-width: 850px; font-size: clamp(3.2rem, 10.5vw, 7.6rem); line-height: .83; text-transform: uppercase; letter-spacing: -.035em; }
h1 em { color: var(--red); font-style: normal; }
.lede { max-width: 35rem; color: var(--paper-muted); font: 400 clamp(1rem, 2.5vw, 1.2rem)/1.55 Arial, sans-serif; }

.show-meta { display: flex; align-items: stretch; gap: 1.5rem; margin-top: 2.3rem; padding: 1rem 0; border-block: 1px solid var(--line); }
.show-meta > div { display: flex; flex-direction: column; gap: .25rem; min-width: 7rem; }
.meta-label { color: #8e897e; font: 700 .64rem/1 Arial, sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.show-meta strong { font-size: 1rem; letter-spacing: .06em; text-transform: uppercase; }
.share-button { display: inline-flex; align-items: center; gap: .5rem; margin-left: auto; padding: 0 1rem; border: 0; border-left: 1px solid var(--line); color: var(--paper); background: transparent; text-transform: uppercase; letter-spacing: .07em; cursor: pointer; }
.share-button svg { width: 1rem; fill: currentColor; }

.party-panel { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 1.2rem; margin: 2rem 0; padding: 1.25rem; color: var(--ink); background: var(--yellow); transform: rotate(-.25deg); box-shadow: 8px 8px 0 var(--red-dark); }
.party-icon { display: flex; align-items: end; gap: .15rem; width: 4rem; height: 4rem; padding: .6rem; border: 2px solid var(--ink); border-radius: 50%; transform: rotate(-8deg); }
.party-icon span { display: block; width: .65rem; height: .65rem; color: var(--red); font-size: 1.2rem; }
.party-icon span:nth-child(2) { transform: translateY(-.5rem); }
.party-panel .kicker { margin-bottom: .35rem; color: var(--red-dark); }
.party-copy h2 { margin-bottom: .35rem; font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: .95; text-transform: uppercase; }
.party-copy > p:last-child { max-width: 38rem; margin: 0; font: .86rem/1.4 Arial, sans-serif; }
.party-actions { display: flex; align-items: center; gap: 1rem; }
.party-actions[hidden] { display: none; }
.primary-button.red { border-color: var(--red); color: var(--white); background: var(--red); }
.primary-button.red:hover { border-color: var(--ink); background: var(--ink); }
.text-button.dark { color: var(--ink); }
.party-active { grid-column: 3; min-width: 14rem; text-align: right; }
.party-active[hidden] { display: none; }
.party-active strong { display: block; margin: .25rem 0 .7rem; color: var(--red-dark); font-size: 1.35rem; letter-spacing: .05em; }
.party-active > div { display: flex; justify-content: end; align-items: center; gap: .8rem; }
.party-status { font: 700 .65rem Arial, sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.party-status .live-dot { width: .45rem; height: .45rem; box-shadow: none; }

.game-shell { position: relative; margin: 2rem 0 5rem; padding: clamp(1rem, 3vw, 2rem); color: var(--ink); background: var(--paper); box-shadow: var(--shadow); }
.game-shell::before { content: ""; position: absolute; inset: 7px; pointer-events: none; border: 1px solid rgba(17,16,14,.15); }
.board-topline { position: relative; display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.board-topline h2 { margin: 0; font-size: clamp(2rem, 6vw, 3.8rem); line-height: .85; text-transform: uppercase; }
.progress-wrap { display: flex; align-items: center; gap: .65rem; color: #5f5a50; font-size: .75rem; letter-spacing: .05em; }
.progress-track { width: clamp(4rem, 12vw, 7rem); height: .38rem; overflow: hidden; background: #d2c9b7; }
.progress-track span { display: block; height: 100%; width: 4%; background: var(--red); transition: width .25s ease; }
.bingo-letters { display: grid; grid-template-columns: repeat(5, 1fr); margin: 0 0 .3rem; color: var(--red); text-align: center; font-size: clamp(1.15rem, 3vw, 2rem); }
.bingo-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 2px solid var(--ink); border-left: 2px solid var(--ink); }
.square { position: relative; display: grid; place-items: center; aspect-ratio: 1; min-width: 0; padding: clamp(.15rem, 1.1vw, .7rem); border: 0; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); color: var(--ink); background: transparent; font-size: clamp(.52rem, 1.55vw, .88rem); line-height: 1.05; letter-spacing: .015em; text-align: center; text-transform: uppercase; cursor: pointer; transition: background .15s ease, color .15s ease, transform .1s ease; }
.square:hover { background: rgba(229,56,44,.08); }
.square:active { transform: scale(.96); }
.square[aria-pressed="true"] { color: var(--white); background: var(--red); }
.square[aria-pressed="true"]::after { content: "×"; position: absolute; inset: 50% auto auto 50%; color: rgba(255,255,255,.25); font-size: clamp(2rem, 7vw, 5.2rem); line-height: 1; transform: translate(-50%,-53%) rotate(-8deg); }
.square span { position: relative; z-index: 1; }
.square.free { background: var(--yellow); }
.square.free::before { content: "★"; display: block; position: absolute; top: 13%; font-size: clamp(.55rem, 1.4vw, 1rem); }
.square.winning { animation: winner-pulse .6s ease both; }
@keyframes winner-pulse { 50% { transform: scale(.88) rotate(-2deg); background: var(--yellow); color: var(--ink); } }
.tap-hint { margin: .7rem 0 0; color: #6e685d; font: 400 .72rem/1.3 Arial, sans-serif; text-align: center; }
.board-actions { position: relative; display: flex; align-items: center; justify-content: space-between; margin-top: 1.5rem; }
.secondary-button, .primary-button { display: inline-flex; align-items: center; gap: .55rem; padding: .85rem 1rem; border: 2px solid var(--ink); color: var(--ink); background: transparent; text-transform: uppercase; letter-spacing: .05em; cursor: pointer; }
.secondary-button:hover { color: var(--paper); background: var(--ink); }
.secondary-button svg { width: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.text-button { padding: .7rem .2rem; border: 0; border-bottom: 1px solid currentColor; color: #5f5a50; background: transparent; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; }

.rules { display: grid; grid-template-columns: auto 1fr auto 1fr auto 1fr; gap: 1rem; align-items: center; margin-bottom: 5rem; padding-block: 2rem; border-block: 1px solid var(--line); }
.rule-number { display: grid; place-items: center; width: 2.7rem; height: 2.7rem; border: 1px solid var(--red); border-radius: 50%; color: var(--red); font-size: .8rem; }
.rules strong, .rules span { display: block; }
.rules strong { color: var(--paper); text-transform: uppercase; letter-spacing: .06em; }
.rules span { margin-top: .2rem; color: #918b80; font: .8rem/1.3 Arial, sans-serif; }

footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.5rem 0 2.5rem; border-top: 1px solid var(--line); color: #8e897e; font: .75rem/1.4 Arial, sans-serif; }
footer p { margin: 0; }
.disclaimer { text-align: right; }

dialog { width: min(90vw, 32rem); padding: 2rem; border: 0; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.78); backdrop-filter: blur(3px); }
dialog h2 { font-size: 2.4rem; text-transform: uppercase; }
dialog ol, dialog > p:last-child { padding-left: 1.2rem; font: 1rem/1.5 Arial, sans-serif; }
.dialog-close { position: absolute; top: .75rem; right: .75rem; border: 0; color: var(--ink); background: transparent; font-size: 2rem; cursor: pointer; }
.party-dialog h2 { max-width: 24rem; margin-bottom: .6rem; font-size: clamp(2.2rem, 8vw, 4rem); line-height: .9; }
.dialog-intro { max-width: 26rem; margin-bottom: 1.4rem; padding: 0 !important; color: #5f5a50; font: .95rem/1.45 Arial, sans-serif !important; }
.generated-code { display: block; width: 100%; padding: 1.2rem .6rem; border: 3px dashed var(--red); color: var(--red-dark); background: rgba(229,56,44,.06); font-size: clamp(1.5rem, 6vw, 2.3rem); letter-spacing: .04em; cursor: pointer; }
.code-hint { margin: .5rem 0 1.2rem; color: #746e62; font: .72rem/1.4 Arial, sans-serif; text-align: center; }
.wide { justify-content: center; width: 100%; }
.dialog-switch { display: block; margin: 1rem auto 0; padding: .4rem; border: 0; border-bottom: 1px solid currentColor; color: #5f5a50; background: transparent; font: 700 .75rem Arial, sans-serif; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; }
.code-label { display: block; margin-bottom: .4rem; font: 700 .68rem Arial, sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.code-input { width: 100%; padding: .9rem; border: 2px solid var(--ink); border-radius: 0; color: var(--ink); background: var(--white); font: 1.2rem Impact, sans-serif; letter-spacing: .05em; text-transform: uppercase; }
.form-error { min-height: 1.2rem; margin: .4rem 0 .7rem; padding: 0 !important; color: var(--red-dark); font: 700 .75rem Arial, sans-serif !important; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 1.2rem; transform: translate(-50%, 150%); padding: .8rem 1rem; color: var(--ink); background: var(--yellow); box-shadow: var(--shadow); font: 700 .78rem Arial, sans-serif; text-transform: uppercase; letter-spacing: .05em; transition: transform .25s ease; }
.toast.show { transform: translate(-50%, 0); }
.win-overlay { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 1rem; visibility: hidden; opacity: 0; background: rgba(10,9,8,.9); transition: opacity .25s ease, visibility .25s; }
.win-overlay.show { visibility: visible; opacity: 1; }
.win-card { width: min(100%, 34rem); padding: 3rem 2rem; color: var(--ink); background: var(--yellow); text-align: center; transform: rotate(-1deg) scale(.94); transition: transform .3s ease; }
.win-overlay.show .win-card { transform: rotate(-1deg) scale(1); }
.stamp { display: inline-block; padding: .2rem .6rem; border: .25rem solid var(--red); color: var(--red); font-size: clamp(3rem, 14vw, 6.5rem); line-height: 1; transform: rotate(-5deg); }
.win-card h2 { margin: 1.5rem 0 .6rem; font-size: 2rem; text-transform: uppercase; }
.win-card p { font: 1rem/1.4 Arial, sans-serif; }
.win-actions { display: flex; justify-content: center; gap: 1rem; margin-top: 1.5rem; }
.primary-button { color: var(--paper); background: var(--ink); }
.light { color: var(--ink); }

@media (max-width: 680px) {
  .site-header, main, footer { width: min(100% - 1.25rem, 1060px); }
  .intro { padding-top: 3rem; }
  h1 { font-size: clamp(3.2rem, 16.5vw, 5rem); }
  .show-meta { gap: .8rem; }
  .show-meta > div { min-width: auto; }
  .show-meta > div:nth-child(2) { display: none; }
  .share-button { font-size: .75rem; }
  .game-shell { margin-inline: -.625rem; padding: 1rem .65rem 1.2rem; }
  .party-panel { grid-template-columns: 1fr; padding: 1.2rem; }
  .party-icon { display: none; }
  .party-actions { align-items: stretch; flex-direction: column; gap: .4rem; }
  .party-active { grid-column: 1; text-align: left; }
  .party-active > div { justify-content: start; }
  .square { min-height: 0; font-family: "Arial Narrow", Arial, sans-serif; font-weight: 800; }
  .rules { grid-template-columns: auto 1fr; }
  footer { display: block; }
  .disclaimer { margin-top: .5rem; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
