:root {
  --bingo-ink: #263449;
  --bingo-muted: #68758a;
  --bingo-border: #dce3ec;
  --bingo-blue: #2764bd;
}

body {
  min-width: 0;
  color: var(--bingo-ink);
  background: #f6f8fc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  padding-bottom: 32px;
}

h1, h2, h3, h4 { color: inherit; font-weight: 650; line-height: 1.2; }
h1 { font-size: clamp(28px, 4vw, 38px); letter-spacing: -.025em; }
a { color: var(--bingo-blue); }
br { user-select: none; }
.glyphicon { font-family: "Glyphicons Halflings"; }
.btn, .form-control, .input-group-addon { border-color: var(--bingo-border); }
.btn { border-radius: 8px; font-weight: 600; min-height: 40px; padding: 8px 15px; }
.btn-link { color: var(--bingo-blue); }
.btn-primary { background: var(--bingo-blue); border-color: var(--bingo-blue); }
.btn-default { background: white; color: var(--bingo-ink); }
.btn-info { background: #eaf2ff; border-color: #cbdcf6; color: #235697; }
.btn-info:hover, .btn-info:focus { background: #dbeaff; color: #17437c; border-color: #afc9ee; }
.btn:disabled { opacity: .55; }
.btn-group .btn { min-height: 36px; }
.form-control { height: 44px; border-radius: 8px; box-shadow: none; font-size: 16px; }
.form-control:focus { border-color: #5686ce; box-shadow: 0 0 0 3px #2764bd1a; }
.input-group-addon { background: #f2f5fa; color: var(--bingo-muted); }
:is(a, button, input, [tabindex]):focus-visible { outline: 3px solid #6598ec; outline-offset: 3px; }
.site-nav { background: white; border-bottom: 1px solid var(--bingo-border); padding: 12px 20px; margin-bottom: 28px; }
.site-nav .row { margin-top: 0 !important; }
.site-nav .text-right .btn { margin-left: 4px; }
.site-nav .col-xs-6:first-child { width: 25%; }
.site-nav .col-xs-6:last-child { width: 75%; }
.dropdown-menu { padding: 6px; border-color: var(--bingo-border); border-radius: 10px; box-shadow: 0 10px 30px #25344c1a; }
.dropdown-menu > li > a { padding: 9px 12px; border-radius: 5px; }
.modal-content { border: 1px solid var(--bingo-border); border-radius: 14px; box-shadow: 0 16px 55px #16284426; }
.modal-header, .modal-body { padding: 22px; }
.modal-header { border-color: var(--bingo-border); }
.modal-title { font-size: 21px; }
.close { min-width: 32px; min-height: 32px; }
.modal-body { overflow-x: auto; }
.table > tbody > tr > td, .table > thead > tr > th { padding: 12px 10px; border-color: var(--bingo-border); vertical-align: middle; }
.table > thead > tr > th { color: var(--bingo-muted); font-size: 13px; }
.badge { margin: 2px 0; padding: 6px 9px; background: #e6edf8; color: #355174; }
.home-hero { text-align: center; padding: 25px 0 30px; }
.bingo-logo { display: block; width: min(100%, 390px); height: auto; margin: 0 auto 24px; }
.home-hero .lead { max-width: 570px; margin: 0 auto; color: var(--bingo-muted); font-size: 18px; }
.home-actions { max-width: 520px; margin: 0 auto 60px; padding: 26px; border: 1px solid var(--bingo-border); border-radius: 16px; background: white; box-shadow: 0 8px 30px #25344c06; }
.home-actions > * + * { margin-top: 20px; }
.home-actions .btn-block { min-height: 50px; }
.home-actions label { display: block; color: var(--bingo-muted); margin-bottom: 8px; }
.home-actions #num { height: 46px; }
.home-actions .input-group-btn .btn { height: 46px; }
.home-actions .input-group-addon { padding: 8px 12px; }
.how-to { padding: 0 12px 30px; }
.how-to h2 { font-size: 27px; }
.how-to h3 { font-size: 20px; margin-top: 24px; }
.how-to p { color: #536177; }
.site-footer { color: var(--bingo-muted); text-align: center; padding: 30px 15px 0; font-size: 13px; }
.key { font-weight: 600; }
.join-panel { width: min(100%, 440px); margin: 50px auto; padding: 30px; border: 1px solid var(--bingo-border); border-radius: 16px; background: white; box-shadow: 0 8px 30px #25344c06; }
.join-panel h1 { margin-top: 0; }
.join-panel > p { color: var(--bingo-muted); margin-bottom: 26px; }
.join-panel label { display: block; margin: 18px 0 6px; }
.join-panel #code { font-weight: 650; letter-spacing: .12em; }
.join-panel .btn { width: 100%; }
.join-panel #join-error { min-height: 24px; margin: 14px 0; color: #b42335; }
.board-scroll { overflow-x: auto; overscroll-behavior-x: contain; padding: 12px 16px; }
.board-section { background: #edf1f7; padding: 12px 0; border-block: 1px solid var(--bingo-border); }
#grid { margin: 0 auto; background: white; border: 1px solid #b9c5d5; box-shadow: 0 6px 24px #25344c0d; border-collapse: collapse; }
#grid .square { display: flex; align-items: center; justify-content: center; width: clamp(44px, 5.7vw, 76px); height: clamp(44px, 5.7vw, 76px); border: 1px solid #d6dfeb; user-select: none; }
#grid .square h2 { margin: 0; font-size: clamp(20px, 2.9vw, 36px); font-weight: 600; }
#grid [light="0"] { color: #33445c; background: white; }
#grid [light="1"] { color: white; background: #566b88; }
#grid .clickable { cursor: pointer; touch-action: manipulation; }
#grid .clickable:hover { box-shadow: inset 0 0 0 3px #2764bd66; }
#grid :is(#B, .B) { background: #cf3547; color: white; }
#grid :is(#I, .I) { background: #c97715; color: white; }
#grid :is(#N, .N) { background: #328451; color: white; }
#grid :is(#G, .G) { background: #306abe; color: white; }
#grid :is(#O, .O) { background: #8650b2; color: white; }
.board-hint { display: none; text-align: center; font-size: 12px; color: var(--bingo-muted); margin: 4px 0 0; }
#last { font-size: clamp(64px, 10vw, 112px); font-variant-numeric: tabular-nums; margin: 22px 0; min-height: 1.2em; }
.board-actions .btn { margin-bottom: 12px; }
.board-actions #draw { background: var(--bingo-blue); color: white; border-color: var(--bingo-blue); }
.caller-heading { margin: 0 0 20px; text-align: center; }
.player-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.player-actions .input-group { width: 135px !important; }
#num-cards { margin-bottom: 0 !important; height: 40px; }
.material-switch > input[type="checkbox"] { display: block; position: absolute; opacity: 0; width: 40px; height: 28px; }
.material-switch > input:focus-visible + label { outline: 3px solid #6598ec; outline-offset: 8px; }
.player-row[checked="true"] { background: #e6effd; }
.player-row[checked="true"]:hover { background: #dae7fa; }
#qrcode { max-width: calc(100% - 32px); height: auto !important; aspect-ratio: 1; padding: 10px; border-color: var(--bingo-border) !important; }
#qrcode img, #qrcode canvas { max-width: 100%; height: auto; }
.waiting-for-cards { text-align: center; padding: 40px 20px; color: var(--bingo-muted); background: white; border: 1px dashed #bfcddd; border-radius: 12px; }
#cards:has(.bingo-card) .waiting-for-cards { display: none; }

@media (max-width: 767px) {
  .site-nav { padding: 10px 12px; margin-bottom: 22px; }
  .site-nav .btn { padding-inline: 10px; }
  .home-hero { padding-top: 16px; }
  .home-actions { padding: 22px; margin-bottom: 38px; }
  .join-panel { margin: 24px auto; padding: 24px; }
  .board-scroll { padding-inline: 12px; }
  .board-hint { display: block; }
  .board-actions { padding-top: 6px; }
  .player-actions { justify-content: flex-start; margin-bottom: 16px; }
  .table { font-size: 13px; }
  .table > tbody > tr > td, .table > thead > tr > th { padding: 10px 6px; }
  .modal-dialog { margin: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  body { background: white; padding: 0; color: black; }
  .site-nav, .board-hint { display: none; }
}
