:root {
  color-scheme: light;
  --paper: #f5eee1;
  --cream: #fbf6eb;
  --ink: #281c15;
  --muted: #6c594b;
  --line: #ddcfbd;
  --accent: #873e29;
  --accent-dark: #682b1d;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100svh; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); font-family: var(--sans); }
button { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--accent-dark); }
:focus-visible { outline: 2px solid #944322; outline-offset: 4px; }
img { max-width: 100%; }
.wrap { width: min(1200px, calc(100% - 104px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.masthead { position: sticky; z-index: 3; top: 0; background: var(--paper); border-bottom: 1px solid var(--line); }
.masthead-inner { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.masthead-controls { display: flex; align-items: center; gap: 12px; }
.wordmark { display: flex; align-items: center; gap: 13px; font-weight: 720; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.seal { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid #b48772; border-radius: 50%; color: var(--accent); font-size: 22px; line-height: 1; }

main { flex: 1; }
.intro { padding-block: clamp(44px, 7vw, 95px) clamp(48px, 7vw, 90px); }
.hero { min-height: 570px; display: grid; grid-template-columns: 1fr .94fr; align-items: center; gap: clamp(35px, 6vw, 96px); }
.hero-copy { padding: 0 0 0 clamp(0px, 1.8vw, 28px); }
.place { margin: 0 0 22px; color: var(--accent); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .19em; display: flex; align-items: center; gap: 13px; }
.place span { width: 24px; height: 1px; background: #a86046; }
.hero h1 { margin: 0; font: 500 clamp(70px, 9.4vw, 138px)/.95 var(--serif); letter-spacing: -.068em; }
.synopsis { max-width: 440px; margin: 29px 0 30px; font: 400 clamp(19px, 2vw, 24px)/1.48 var(--serif); color: #513f33; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 22px; min-height: 49px; padding: 12px 20px; border: 1px solid transparent; border-radius: 5px; font-size: 14px; font-weight: 690; text-decoration: none; transition: background-color .15s, border-color .15s; }
.button span { font-size: 20px; line-height: 1; }
.primary { background: var(--accent); color: #fff8ed; }
.primary:hover { background: var(--accent-dark); }
.secondary { color: var(--accent-dark); border-color: #bc9584; background: transparent; }
.secondary:hover { background: #f3e0d4; }
.start { min-height: 54px; padding-inline: 24px; }
.details { display: flex; flex-wrap: wrap; gap: 10px 0; margin: 34px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.details li + li { margin-left: 15px; padding-left: 15px; border-left: 1px solid #cdbca8; }
.hero-image { position: relative; align-self: stretch; min-height: 540px; margin: 0; overflow: hidden; border: 1px solid #96785d; border-radius: 240px 240px 8px 8px / 145px 145px 8px 8px; background: #34251d; box-shadow: 0 18px 36px #37241824; }
.hero-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 42%; }
.hero-image::after { position: absolute; content: ''; inset: 11px; border: 1px solid #f7d8a86b; border-radius: inherit; pointer-events: none; }

.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 9px 20px; padding: 22px 0 25px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.tools { min-width: 172px; padding-block: 10px; }
.counter { display: grid; grid-template-columns: 13px 1fr; gap: 3px 9px; align-items: center; }
.counter-copy { display: flex; align-items: baseline; justify-content: space-between; gap: 9px; font-size: 11px; color: var(--muted); }
.count { white-space: nowrap; }
.count strong { font: 600 23px/1 var(--serif); color: var(--accent-dark); }
.candle { display: block; position: relative; width: 7px; height: 9px; margin: 5px auto 0; border-radius: 1px; background: var(--accent); }
.candle::before { position: absolute; content: ''; width: 5px; height: 6px; left: 1px; bottom: 11px; border-radius: 4px 0 4px 4px; background: var(--accent); transform: rotate(-18deg); }
progress { grid-column: 1/-1; appearance: none; width: 100%; height: 3px; border: 0; border-radius: 4px; background: #e0d0bd; color: var(--accent); overflow: hidden; }
progress::-webkit-progress-bar { background: #e0d0bd; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.rules-button { display: flex; align-items: center; gap: 6px; margin: 5px 0 0 auto; padding: 3px 0 2px 8px; border: 0; background: none; font-size: 11px; font-weight: 680; color: var(--accent-dark); }
.rules-button span { display: grid; place-items: center; width: 17px; height: 17px; border: 1px solid #ab7a64; border-radius: 50%; font-size: 10px; }
.rules-button:hover { text-decoration: underline; }

.board { padding-block: 47px 60px; }
.board-heading { margin-bottom: 32px; }
.board-heading h1 { margin: 0 0 8px; font: 500 clamp(47px, 6.5vw, 74px)/1 var(--serif); letter-spacing: -.055em; }
.board-heading p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.decks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; align-items: start; }
.deck { min-width: 0; scroll-margin-top: 104px; }
.deck.expanded { grid-column: 1/-1; padding: 19px; border: 1px solid var(--line); background: #faf4e8; border-radius: 8px; }
.deck-button { width: 100%; min-height: 76px; display: flex; align-items: center; text-align: left; gap: 11px; padding: 11px; background: #faf4e8; border: 1px solid var(--line); border-radius: 7px; transition: background-color .15s, border-color .15s; }
.deck-button:hover:not(:disabled) { background: #fdf8ef; border-color: #a6755d; }
.deck-button:disabled { background: transparent; }
.deck-button:disabled .deck-index { color: #716356; background: #ece1d1; }
.deck-index { flex: 0 0 41px; min-height: 47px; display: grid; place-items: center; background: #eddfcc; color: var(--accent-dark); border-radius: 4px; font: 600 24px/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.deck:last-child .deck-button:not(:disabled) .deck-index { background: var(--accent); color: #fff8ed; }
.deck-label { flex: 1; font-size: 12px; font-weight: 690; }
.deck-arrow { color: var(--accent); font-size: 17px; }
.deck-heading { margin: 0 0 16px; display: flex; align-items: baseline; gap: 12px; }
.deck-heading h2 { margin: 0; font: 600 26px/1.15 var(--serif); letter-spacing: -.025em; }
.deck-heading small { color: var(--muted); font-size: 11px; }
.card-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 17px 12px; }
.game-card { min-width: 0; margin: 0; }
.card-face { display: block; width: 100%; padding: 0; border: 0; background: #31261e; border-radius: 8px; line-height: 0; transition: box-shadow .15s; }
.card-face:hover:not([aria-disabled="true"]) { box-shadow: 0 0 0 2px #994b32, 0 7px 14px #3c27192c; }
.card-face[aria-disabled="true"] { cursor: default; }
.card-face img { display: block; width: 100%; height: auto; aspect-ratio: 570/852; border-radius: inherit; }
.card-meta { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding-top: 6px; font-size: 11px; color: var(--muted); }
.card-number { font-weight: 700; white-space: nowrap; color: var(--ink); }
.card-status { flex: 1; text-align: right; line-height: 1.2; }
.card-status.paid { color: var(--accent-dark); }
.icon-button, .zoom-button { display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--accent-dark); }
.icon-button:hover, .zoom-button:hover { background: #f1e5d6; border-color: #b78a72; }
.icon-button { width: 35px; height: 35px; font-size: 24px; line-height: 1; }
.sound-button { position: relative; flex-shrink: 0; border-color: #b48772; font-size: 21px; }
.sound-button[aria-pressed="false"]::after { position: absolute; content: ''; width: 20px; height: 2px; border-radius: 2px; background: currentColor; box-shadow: 0 0 0 1px var(--paper); transform: rotate(-45deg); }
.zoom-button { flex: 0 0 30px; min-height: 30px; font-size: 17px; }
.final-link { display: inline-block; margin-top: 7px; font-size: 13px; line-height: 1.35; font-weight: 700; text-underline-offset: 3px; }
.finish-banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; padding: 16px 18px; border: 1px solid #cda38f; border-radius: 6px; background: #f5e4da; }
.finish-banner h2 { margin: 0 0 5px; font: 600 23px/1.15 var(--serif); }
.finish-banner p { margin: 0; font-size: 13px; line-height: 1.4; color: #62483d; }

dialog { max-height: min(86svh, 900px); padding: 0; border: 1px solid #b4937d; border-radius: 9px; background: var(--cream); color: var(--ink); box-shadow: 0 22px 70px #21130d50; }
dialog::backdrop { background: #261b14a8; }
body:has(dialog[open]) { overflow: hidden; }
.dialog-heading { position: sticky; z-index: 1; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 16px 22px; background: var(--cream); border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 0; font: 600 clamp(22px, 5vw, 31px)/1.15 var(--serif); }
.rules-dialog { width: min(710px, calc(100% - 28px)); }
.rules-body { padding: 17px 24px 24px; font-size: 14px; line-height: 1.6; }
.rules-body h3 { margin: 22px 0 6px; font: 600 21px/1.15 var(--serif); }
.rules-body p, .rules-body ul { margin: 8px 0; }
.rules-body ul { padding-left: 20px; }
.rules-body li + li { margin-top: 3px; }
.rule-meta { color: var(--accent-dark); font-weight: 650; font-size: 12px; }
.scores { margin: 13px 0 20px; }
.scores div { display: grid; grid-template-columns: 88px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.scores dt { font-weight: 700; }
.scores dd { margin: 0; }
.scans { padding-top: 7px; }
.scans summary { color: var(--accent-dark); font-weight: 700; }
.scans div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.scans img { display: block; width: 100%; height: auto; }
.zoom-dialog { width: min(570px, calc(100% - 20px)); }
.zoom-dialog .dialog-heading { padding: 10px 15px; }
.zoom-dialog .dialog-heading h2 { font-size: 21px; }
.zoom-dialog img { display: block; width: 100%; height: auto; }

@media (min-width: 1550px) {
  .hero { min-height: 625px; }
}
@media (max-width: 980px) {
  .wrap { width: calc(100% - 56px); }
  .hero { min-height: 490px; }
  .hero-image { min-height: 450px; }
  .decks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .wrap { width: calc(100% - 32px); }
  .masthead-inner { min-height: 67px; }
  .masthead-controls { gap: 7px; }
  .wordmark { gap: 7px; letter-spacing: .08em; font-size: 9px; }
  .seal { width: 29px; height: 29px; flex-shrink: 0; font-size: 17px; }
  .tools { min-width: 142px; }
  .counter { column-gap: 4px; }
  .counter-copy { gap: 6px; font-size: 10px; }
  .count strong { font-size: 20px; }
  .intro { padding-block: 40px 30px; }
  .hero { grid-template-columns: 1fr; gap: 29px; }
  .hero-copy { padding: 0 4px; }
  .hero h1 { font-size: clamp(64px, 16vw, 100px); }
  .hero-image { min-height: clamp(290px, 87vw, 425px); border-radius: 200px 200px 7px 7px / 107px 107px 7px 7px; }
  .synopsis { margin: 20px 0 24px; }
  .place { margin-bottom: 16px; }
  .details { margin-top: 21px; }
  .board { padding-block: 30px 38px; }
  .board-heading { margin-bottom: 21px; }
  .decks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .deck-button { min-height: 61px; gap: 7px; padding: 7px; }
  .deck-index { flex-basis: 31px; min-height: 39px; font-size: 20px; }
  .deck-label { font-size: 11px; }
  .deck-arrow { display: none; }
  .deck.expanded { padding: 10px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 8px; }
  .card-meta { font-size: 10px; gap: 4px; }
  .finish-banner { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

.intro-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.text-button { border: 0; padding: 7px 0; background: none; color: var(--accent-dark); font-size: 13px; font-weight: 680; text-decoration: underline; text-underline-offset: 3px; }
.hero .text-button { margin-top: 12px; }
.masthead-brand { min-width: 0; }
#player-count { margin: 4px 0 0; color: var(--muted); font-size: 11px; font-weight: 650; }
.room-wrap { padding-top: clamp(27px, 6vw, 65px); }
.room-panel { max-width: 750px; padding: clamp(17px, 3vw, 27px); border: 1px solid var(--line); border-radius: 8px; background: var(--cream); }
.room-heading, .roster { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 17px; flex-wrap: wrap; }
.room-heading h2 { margin: 0; overflow-wrap: anywhere; font: 600 clamp(26px, 5vw, 40px)/1.1 var(--serif); }
.room-heading p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.roster { margin-block: 15px; color: var(--muted); font-size: 13px; }
.roster ul { display: flex; gap: 6px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.roster li { padding: 5px 9px; border-radius: 4px; background: #eddfcc; color: var(--ink); }
#room-count { white-space: nowrap; font-weight: 700; }
.room-panel .button { margin-top: 3px; }

.online-dialog { width: min(510px, calc(100% - 28px)); }
.online-dialog h2 { overflow-wrap: anywhere; }
.online-body { padding: 18px 22px 22px; }
.online-form { display: grid; gap: 8px; }
.online-form label { font-size: 13px; font-weight: 700; }
.online-form input { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid #b9a38e; border-radius: 4px; background: #fffaf1; color: var(--ink); font: inherit; }
.online-form input + label { margin-top: 6px; }
.online-form small { color: var(--muted); }
.online-form .button { justify-self: start; margin-top: 6px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.online-form button:disabled { opacity: .65; }
.room-list { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.room-choice { width: 100%; display: grid; gap: 5px; text-align: left; padding: 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); overflow-wrap: anywhere; }
.room-choice:hover:not(:disabled) { border-color: var(--accent); }
.room-choice span { font-size: 12px; color: var(--muted); }
#online-status { margin: 12px 0 0; color: var(--accent-dark); font-size: 13px; line-height: 1.45; }
#online-status:empty { display: none; }

@media (max-width: 680px) {
  .intro-actions .start { min-height: 48px; padding-inline: 14px; gap: 9px; }
  .online-body { padding-inline: 15px; }
}
