/* The approved Jukebox Bingo game-show system, adapted for the player's hand. */
@font-face { font-family: Anton; src: url('/assets/home/fonts/anton.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: Barlow; src: url('/assets/home/fonts/barlow-regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: Barlow; src: url('/assets/home/fonts/barlow-semibold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: Barlow; src: url('/assets/home/fonts/barlow-bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
:root {
    color-scheme: dark;
    --ink: #211747;
    --stage: #6e50df;
    --rail: #302359;
    --paper: #fff9ed;
    --yellow: #ffda46;
    --pink: #ff81b5;
    --muted: #cec3e9;
    --line: #68568f;
    --tile: #e7e0f2;
    --available: #fff0b5;
    --available-line: #a27810;
    --primary: #ffda46;
    --success: #ffda46;
    --error: #ffb8d4;
    --gutter: clamp(12px, 3.8vw, 24px);
    font-family: Barlow, Arial, sans-serif;
    font-size: 16px;
    font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ink); scroll-padding-top: 16px; }
body { margin: 0; min-width: 280px; min-height: 100vh; min-height: 100dvh; background: var(--ink); color: var(--paper); line-height: 1.4; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; }
button, input, summary { -webkit-tap-highlight-color: transparent; }
button, summary { touch-action: manipulation; }
button { cursor: pointer; }
svg { display: block; flex-shrink: 0; }
::selection { background: var(--yellow); color: var(--ink); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 4px; }
input { caret-color: var(--ink); }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.container { width: min(100%, 1040px); margin-inline: auto; padding: max(12px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left)); }
.hidden, [hidden] { display: none !important; }
.game-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; margin-bottom: 18px; }
.logo-image { display: block; width: 132px; height: auto; }
.connection-status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; text-align: right; max-width: 45%; }
.connection-status i { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: currentColor; }
.connection-status i::before { content: none; }
.connection-status[data-status='connected'] { color: var(--yellow); }
.connection-status[data-status='disconnected'] { color: var(--error); }
.connection-status[data-status='reconnecting'] { color: var(--yellow); }
.join-game { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; padding: 22px 18px 18px; border-radius: 18px; background: var(--stage); }
.join-intro { position: relative; min-width: 0; }
.join-intro h1 { font: 400 clamp(38px, 10.7vw, 54px)/1.08 Anton, sans-serif; text-transform: uppercase; }
.join-intro h1 em { color: var(--yellow); font-style: normal; }
.join-intro > p { max-width: 29em; margin-top: 14px; font-size: 16px; }
.join-art { position: absolute; top: 8px; right: 2px; width: 23%; max-width: 94px; pointer-events: none; }
.mini-card { display: grid; grid-template-columns: repeat(3, 1fr); aspect-ratio: .8; gap: 3px; padding: 5px; background: var(--paper); border-radius: 6px; transform: rotate(9deg); }
.mini-card span { background: var(--tile); border-radius: 2px; }
.mini-card span:nth-child(3n + 1) { background: var(--pink); }
.mini-card span:nth-child(5) { display: grid; place-items: center; color: var(--ink); background: var(--yellow); font: 400 7px Anton, sans-serif; }
.join-form { min-width: 0; display: flex; flex-direction: column; gap: 19px; padding: 22px 18px; border-radius: 12px; color: var(--ink); background: var(--paper); }
.join-form h2 { font: 400 30px/1.1 Anton, sans-serif; text-transform: uppercase; }
.input-group { display: flex; flex-direction: column; gap: 7px; }
.input-group label { font-weight: 700; font-size: 16px; }
input { width: 100%; min-width: 0; min-height: 52px; border: 2px solid #c8bddc; border-radius: 8px; padding: 12px; background: #fffdf8; color: var(--ink); font-size: 17px; line-height: 1.3; }
input::placeholder { color: #75698a; opacity: 1; }
input:focus-visible { outline-color: var(--stage); outline-offset: 2px; border-color: var(--stage); }
#game-code { font-size: 23px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.field-hint { color: #625578; font-size: 13px; }
#join-button, .btn, .player-win-modal__btn { min-height: 52px; border: 2px solid transparent; border-radius: 8px; background: var(--yellow); color: var(--ink); font-size: 18px; font-weight: 700; padding: 12px 16px; transition: background-color 150ms ease, transform 150ms ease; }
#join-button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; margin-top: 1px; }
#join-button svg { width: 22px; height: 22px; }
#join-button:hover, .btn-primary:hover, .player-win-modal__btn:hover { background: #ffe77d; }
#join-button:active, .btn:active, .player-win-modal__btn:active { transform: translateY(2px); }
.join-form #join-button:focus-visible { outline-color: var(--stage); }
.join-reminder { font-size: 13px; text-align: center; color: #625578; }
button:disabled { cursor: not-allowed; }
.game-content { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.player-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.player-heading h1 { font: 400 clamp(24px, 6.6vw, 32px)/1.15 Anton, sans-serif; text-transform: uppercase; overflow-wrap: anywhere; min-width: 0; }
.game-code-label { font-size: 11px; text-align: right; color: var(--muted); flex-shrink: 0; }
.game-code-label strong { display: block; color: var(--paper); font-size: 13px; letter-spacing: .04em; }
.round-guide { background: var(--yellow); color: var(--ink); border-radius: 9px; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 9px 12px; font: 400 17px/1.2 Anton, sans-serif; text-transform: uppercase; }
.round-guide svg { width: 19px; height: 19px; }
#current-song { background: var(--pink); color: var(--ink); display: flex; align-items: center; gap: 12px; border-radius: 10px; padding: 11px 14px; min-height: 68px; }
.music-symbol { width: 28px; height: 32px; }
.current-song-label { display: block; font-size: 11px; font-weight: 700; }
#current-song-text { display: block; font-size: 18px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.bingo-card-container { min-width: 0; padding: 10px 8px 9px; background: var(--paper); color: var(--ink); border-radius: 13px; }
.card-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 1px 4px 10px; }
.card-heading h2 { font: 400 24px/1.1 Anton, sans-serif; text-transform: uppercase; }
#card-instruction { font-size: 11px; font-weight: 600; text-align: right; }
.bingo-card { min-width: 0; width: 100%; container-type: inline-size; }
.bingo-grid { display: grid; grid-template-rows: repeat(5, minmax(78px, auto)); gap: 4px; }
.bingo-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.bingo-cell { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 78px; position: relative; padding: 5px 3px; border: 2px solid transparent; border-radius: 6px; background: var(--tile); color: var(--ink); font-weight: 600; text-align: center; cursor: pointer; overflow: hidden; transition: background-color 140ms ease, border-color 140ms ease; }
.bingo-cell:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }
.bingo-cell .song-name { display: block; width: 100%; min-width: 0; font-size: clamp(12px, 3.45cqw, 18px); font-weight: 600; line-height: 1.15; text-align: center; overflow-wrap: anywhere; word-break: normal; hyphens: none; }
.song-word-part { white-space: nowrap; }
.bingo-cell.matched { background: var(--pink); }
.bingo-cell.matched::after { content: ''; position: absolute; width: 5px; height: 8px; right: 5px; bottom: 4px; border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(40deg); }
.bingo-cell.missed:not(.matched):not(.free-space), .bingo-cell.played:not(.matched):not(.free-space), .bingo-cell.available:not(.matched):not(.free-space) { background: var(--available); border-color: var(--available-line); }
.bingo-cell.current-song:not(.matched):not(.free-space) { background: var(--yellow); border-color: var(--ink); }
.bingo-cell.free-space { background: var(--yellow); cursor: default; }
.bingo-cell.free-space .song-name { font-family: Anton, sans-serif; font-size: clamp(14px, 4.7cqw, 22px); font-weight: 400; max-width: 5em; }
.bingo-cell.game-not-started { cursor: default; }
.bingo-cell.game-not-started:not(.free-space) { background: var(--tile); border-color: transparent; }
.card-key { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 3px 1px; font-size: 10px; color: #625578; }
.card-key > span { display: flex; align-items: center; gap: 5px; }
.card-key i { width: 10px; height: 10px; border-radius: 3px; }
.key-marked { background: var(--pink); }
.key-available { background: var(--available); border: 1px solid var(--available-line); }
.info-sidebar { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.player-stats { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; padding-inline: 4px; }
#songs-played { color: var(--muted); }
#matches-found { color: var(--yellow); }
.song-history { border: 1px solid var(--line); border-radius: 11px; padding: 0 15px; background: var(--rail); }
.song-history summary { min-height: 48px; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 700; cursor: pointer; list-style: none; }
.song-history summary::-webkit-details-marker { display: none; }
.song-history summary svg { width: 18px; height: 18px; transition: transform 160ms ease; }
.song-history[open] summary svg { transform: rotate(180deg); }
.song-history ul { list-style: none; margin: 0; padding: 0 0 8px; }
.song-history li { padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.song-history li:first-child { color: var(--yellow); }
.song-history .song-title { font: inherit; }
.history-empty { font-size: 14px; color: var(--muted); padding: 0 0 14px; }
.song-history:has(li) .history-empty { display: none; }
.play-tip { font-size: 13px; line-height: 1.45; text-align: center; color: var(--muted); }
.status { margin-top: 14px; border: 1px solid var(--line); background: var(--rail); color: var(--paper); border-radius: 9px; padding: 12px 14px; font-size: 14px; overflow-wrap: anywhere; }
.status:empty { display: none; }
.status.error { border-color: var(--pink); color: var(--error); }
.status.success { border-color: var(--yellow); }
.join-form .status { margin: 0; background: var(--tile); color: var(--ink); border-color: #9d8eb9; }
.bingo-card-container > .status { margin: 0 0 10px; padding: 9px 10px; background: #eee6ff; color: var(--ink); border-color: #c8bddc; font-size: 13px; }
.join-form .status.error, .bingo-card-container > .status.error { background: #ffddea; border-color: #ba4676; color: #742348; }
.player-footer { margin-top: 22px; text-align: center; font-size: 12px; color: var(--muted); }
.player-footer span { color: var(--pink); margin-left: .3em; }
.player-footer strong { color: var(--yellow); margin-left: .3em; }
.loading-spinner { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 16px; min-height: 350px; padding: 32px 20px; border-radius: 16px; background: var(--stage); text-align: center; }
.loading-spinner h2 { font: 400 34px/1.15 Anton, sans-serif; }
.loading-spinner p { font-size: 16px; }
.spinner { width: 42px; height: 42px; border: 4px solid #ad95f2; border-top-color: var(--yellow); border-radius: 50%; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.player-win-modal, .modal-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; justify-content: center; align-items: center; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); overflow-y: auto; }
.player-win-modal__backdrop { position: absolute; inset: 0; background: #160d36ed; }
.player-win-modal__panel { position: relative; width: min(100%, 440px); max-height: calc(100dvh - 48px); overflow: auto; border: 3px solid var(--yellow); border-radius: 18px; background: var(--stage); color: var(--paper); text-align: center; padding: 28px 23px; }
.winner-symbol { width: 64px; height: 64px; color: var(--yellow); margin: 0 auto 14px; }
.player-win-modal__badge { display: none; }
.player-win-modal__title { font: 400 clamp(32px, 8vw, 45px)/1.08 Anton, sans-serif; text-transform: uppercase; overflow-wrap: anywhere; }
.player-win-modal__subtitle { margin-top: 18px; font-size: 16px; white-space: pre-line; }
.player-win-modal__btn { width: 100%; margin-top: 24px; }
.player-win-modal:not(.hidden) .player-win-modal__panel { animation: winner-arrive 350ms cubic-bezier(.16, 1, .3, 1); }
@keyframes winner-arrive { from { transform: translateY(14px) scale(.97); } to { transform: translateY(0) scale(1); } }
.modal-overlay { background: #160d36ed; }
.modal-content { width: min(100%, 420px); max-height: calc(100dvh - 48px); overflow-y: auto; padding: 24px; background: var(--paper); color: var(--ink); border-radius: 16px; box-shadow: 0 14px 50px #10092050; }
.modal-content h3 { font: 400 31px/1.1 Anton, sans-serif; text-transform: uppercase; margin-bottom: 16px; }
.modal-content p { margin-bottom: 16px; overflow-wrap: anywhere; }
.name-conflict-options, #new-name-input { display: flex; flex-direction: column; gap: 12px; }
#new-name-input { margin-top: 16px; }
.btn-secondary { color: var(--ink); background: var(--paper); border-color: #8c7ca6; }
.modal-content :focus-visible { outline-color: var(--stage); }
@media (max-width: 599px) {
    .container:has(#game-content:not(.hidden)) .game-header { min-height: 54px; margin-bottom: 12px; }
    .container:has(#game-content:not(.hidden)) .logo-image { width: 100px; }
    .bingo-cell { padding-inline: 1px; border-width: 1px; }
    .bingo-cell .song-name { font-size: 12px; letter-spacing: -.02em; }
}
@media (min-width: 600px) and (max-height: 600px) {
    .player-win-modal__panel { width: min(100%, 760px); padding: 18px 24px; }
    .winner-symbol { display: none; }
    .player-win-modal__title { font-size: 28px; }
    .player-win-modal__subtitle { margin-top: 12px; font-size: 14px; }
    .player-win-modal__btn { margin-top: 16px; }
}
@media (min-width: 600px) {
    .game-header { min-height: 82px; margin-bottom: 24px; }
    .logo-image { width: 158px; }
    .connection-status { font-size: 14px; }
    .join-game { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 30px; gap: 30px; align-items: center; }
    .join-intro h1 { font-size: clamp(43px, 6vw, 68px); }
    .join-intro > p { font-size: 18px; max-width: 26ch; }
    .join-art { position: relative; width: 110px; max-width: none; top: auto; right: auto; margin: 36px 0 0 20px; }
    .mini-card { gap: 5px; padding: 7px; }
    .mini-card span:nth-child(5) { font-size: 10px; }
    .join-form { padding: 28px; gap: 23px; }
    .game-content { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: start; }
    .player-heading { grid-column: 1 / -1; }
    .round-guide { grid-column: 1; grid-row: 2; min-height: 68px; font-size: 22px; }
    #current-song { grid-column: 2; grid-row: 2; align-self: stretch; }
    .bingo-card-container { grid-column: 1; grid-row: 3; }
    .info-sidebar { grid-column: 2; grid-row: 3; }
    .bingo-grid { grid-template-rows: repeat(5, minmax(90px, auto)); }
    .bingo-cell { min-height: 90px; padding: 7px 4px; }
    .card-heading { padding-bottom: 14px; }
    .card-heading h2 { font-size: 28px; }
    .player-stats { flex-direction: column; align-items: flex-start; gap: 5px; padding: 16px; border-radius: 10px; background: var(--rail); }
    .song-history li { font-size: 15px; }
    .play-tip { text-align: left; padding-inline: 3px; }
}
@media (min-width: 600px) and (max-width: 850px) {
    .game-content { grid-template-columns: minmax(0, 1fr) 210px; gap: 12px; }
    .bingo-grid { grid-template-rows: repeat(5, minmax(84px, auto)); }
    .bingo-cell { min-height: 84px; }
    .round-guide { font-size: 18px; gap: 10px; }
    .join-game { padding: 22px; gap: 22px; }
    .join-form { padding: 20px; }
}
@media (max-width: 359px) {
    .container { padding-inline: max(10px, env(safe-area-inset-left)); }
    .game-header { min-height: 60px; margin-bottom: 12px; }
    .logo-image { width: 116px; }
    .join-game { padding: 18px 12px 12px; }
    .join-intro h1 { font-size: 36px; }
    .join-art { width: 22%; right: 2px; }
    .join-intro > p { font-size: 14px; }
    .join-form { padding: 18px 14px; }
    .player-heading h1 { font-size: 24px; }
    .bingo-card-container { padding-inline: 6px; }
    .bingo-grid, .bingo-row { gap: 3px; }
    .bingo-cell { min-height: 80px; padding-inline: 2px; }
    .bingo-cell .song-name { font-size: 12px; }
    .card-key { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
    button, .bingo-cell, .song-history summary svg { transition: none; }
    .player-win-modal:not(.hidden) .player-win-modal__panel { animation: none; }
    .spinner { animation: none; border-color: var(--yellow); }
}
