@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --ink: #172b26;
  --ink-2: #374941;
  --muted: #7c887f;
  --line: #e1e5da;
  --cream: #f5f6ef;
  --white: #fff;
  --lime: #dcfa80;
  --lime-deep: #bdeb54;
  --salmon: #f9bd9e;
  --font-ui: 'DM Sans', system-ui, -apple-system, Segoe UI, sans-serif;
  --font-display: 'Space Grotesk', system-ui, -apple-system, Segoe UI, sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--font-ui); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
button:focus-visible, input:focus-visible, .board-scroller:focus-visible { outline: 3px solid #7ead31; outline-offset: 3px; }
.visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
[hidden] { display: none !important; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

/* Global header */
.site-header { min-height: 112px; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 20px max(3.4vw, 24px); color: #fff; background: var(--ink); }
.brand-lockup { display:flex; align-items:center; gap:18px; }
.brand-mark { width:58px; height:58px; display:grid; grid-template-columns:repeat(2,1fr); gap:3px; padding:7px; border:1.5px solid #66766a; border-radius:13px; transform:rotate(-8deg); flex:none; }
.brand-mark span { display:grid; place-items:center; font-family:var(--font-display); font-weight:700; font-size:14px; line-height:1; border-radius:3px; color:var(--ink); background:#e4f2bf; }
.brand-mark span:nth-child(2) { background:var(--lime); font-size:18px; }
.brand-mark span:nth-child(3) { background:#f9ba9c; }
.brand-eyebrow { color:#b6c6b7; letter-spacing:.24em; font-size:9px; font-weight:800; margin-bottom:3px; }
.brand-title { font-family:var(--font-display); font-size:32px; line-height:1; font-weight:700; letter-spacing:-.065em; }
.brand-title em { color:var(--lime); font-style:normal; }
.brand-dot { color:var(--salmon); }
.header-right { display:flex; align-items:center; gap:12px; font-family:var(--font-display); font-size:10px; letter-spacing:.18em; font-weight:700; color:#bdc9c1; white-space:nowrap; }
.online-indicator { display:block; width:7px; height:7px; border-radius:50%; background:var(--lime); box-shadow:0 0 0 4px #38553e; }
.header-divider { height:22px; width:1px; background:#4e665a; margin-inline:12px; }

/* Two-column workspace */
.workspace { width:100%; max-width:1680px; margin:0 auto; padding:28px max(3.4vw, 24px) 36px; display:grid; grid-template-columns:minmax(285px, 330px) minmax(0,1fr); align-items:start; gap:27px; flex:1; }
.controls-panel { background:var(--white); border:1px solid var(--line); border-radius:23px; box-shadow:0 8px 30px #20362808; overflow:hidden; }
.panel-heading { padding:29px 27px 22px; background:linear-gradient(135deg, #fff 50%, #f6f9ec); border-bottom:1px solid var(--line); }
.section-number { font-family:var(--font-display); font-size:10px; letter-spacing:.14em; font-weight:700; color:#67806c; }
.panel-heading h1, .game-toolbar h2 { font-family:var(--font-display); letter-spacing:-.055em; line-height:1.07; font-size:29px; margin:11px 0 8px; }
.panel-heading h1 span, .game-toolbar h2 span { color:#93c737; }
.panel-heading p, .game-toolbar p { font-size:12px; color:#758077; line-height:1.55; margin:0; }
.setup-section { padding:22px 26px 19px; border-bottom:1px solid var(--line); }
.section-title-row { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:15px; }
.section-title-row h2, .stat-label { font-size:10px; letter-spacing:.135em; font-weight:800; margin:0; }
.subtle-label { font-size:9px; letter-spacing:.1em; color:#9aa59d; font-weight:800; }
.preset-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.preset-button { height:45px; display:flex; align-items:center; justify-content:flex-start; padding:0 13px; gap:10px; color:#4d5e54; border:1px solid #e3e8dd; background:#fcfcf9; border-radius:10px; font-size:11px; font-weight:700; transition:background .16s,border-color .16s,transform .16s; }
.preset-button:hover { border-color:#a8c96d; transform:translateY(-1px); }
.preset-button.active { background:#eafaaf; color:var(--ink); border-color:#b9db70; box-shadow:inset 0 0 0 1px #d4e992; }
.preset-button::first-letter { font-size:17px; }
.text-button { border:0; padding:2px 0; background:transparent; color:#598b3e; font-size:10px; font-weight:800; text-decoration:underline; text-underline-offset:3px; }
.categories-section { padding-bottom:14px; }
.category-list { max-height:352px; overflow-y:auto; padding-right:5px; scrollbar-width:thin; scrollbar-color:#d0d8c7 transparent; }
.category-group-label { font-size:9px; color:#92a094; letter-spacing:.15em; font-weight:800; margin:16px 0 8px; }
.category-group-label:first-child { margin-top:0; }
.category-item { display:flex; align-items:center; gap:10px; min-height:36px; padding:6px 4px; border-radius:8px; cursor:pointer; }
.category-item:hover { background:#f7f9f2; }
.category-item input { width:15px; height:15px; accent-color:#3f7441; margin:0; flex:none; cursor:pointer; }
.category-name { font-size:11px; font-weight:600; flex:1; line-height:1.3; }
.category-count { font-size:10px; color:#a1aaa1; font-variant-numeric:tabular-nums; }
.selection-footer { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:10px; padding-top:12px; }
.selection-footer > span { font-size:10px; color:#758379; font-weight:700; }
.import-button { color:#467a3f; font-size:10px; font-weight:800; background:transparent; border:0; padding:2px 0; }
.loading-state { font-size:12px; color:var(--muted); padding:20px 4px; }
.sidebar-bottom { padding:20px 26px 25px; }
.primary-button { width:100%; min-height:50px; border:0; border-radius:10px; background:var(--ink); color:#fff; padding:12px 17px; display:flex; align-items:center; justify-content:space-between; font-family:var(--font-display); font-weight:700; font-size:13px; transition:transform .15s,background .15s; }
.primary-button:hover:not(:disabled) { background:#2c5142; transform:translateY(-1px); }
.primary-button span:last-child { font-size:19px; }
.selection-hint { color:#758578; font-size:10px; margin-top:9px; min-height:15px; }
.selection-hint.dirty { color:#7b8037; font-weight:700; }
.selection-hint.warning { color:#ab663f; }
.sidebar-note { display:flex; gap:10px; align-items:flex-start; color:#809084; font-size:10px; line-height:1.5; padding-top:17px; margin-top:15px; border-top:1px dashed #dae0d4; }
.note-icon { font-size:20px; color:#aac95c; line-height:1; }

/* Game / card */
.game-panel { min-width:0; }
.game-toolbar { display:flex; justify-content:space-between; align-items:flex-end; gap:18px; padding:17px 0 23px; }
.game-toolbar h2 { font-size:clamp(25px,2.5vw,38px); margin-top:8px; }
.game-toolbar p { font-size:12px; }
.toolbar-actions { display:flex; gap:9px; flex:none; }
.secondary-button { display:flex; align-items:center; justify-content:center; gap:8px; border:1px solid #d6ded3; border-radius:9px; background:#fff; color:#344b3d; padding:10px 14px; font-size:11px; font-weight:800; min-height:40px; transition:background .15s,border-color .15s; }
.secondary-button:hover:not(:disabled) { background:#edf6de; border-color:#b3cf84; }
.win-banner { margin-bottom:12px; display:flex; align-items:center; gap:14px; background:#dff5a5; border:1px solid #b7d86a; border-radius:13px; padding:13px 20px; box-shadow:0 4px 15px #708d421c; }
.win-icon { font-size:29px; color:#315534; }
.win-banner div { display:flex; flex-direction:column; gap:3px; flex:1; }
.win-banner strong { font-family:var(--font-display); font-size:21px; letter-spacing:-.04em; }
.win-banner div span { font-size:11px; color:#56734a; }
.win-confetti { letter-spacing:.2em; font-size:20px; color:#639647; }
.board-frame { background:#fff; padding:26px 28px 20px; border:1px solid #dce3d4; border-radius:22px; box-shadow:0 10px 35px #2c45300c; }
.board-topline, .board-bottomline { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.board-topline { margin-bottom:14px; }
.board-title-wrap { display:flex; flex-direction:column; gap:3px; }
.board-kicker { color:#98a494; letter-spacing:.17em; font-size:9px; font-weight:800; }
.board-title-wrap strong { font-family:var(--font-display); font-size:17px; letter-spacing:-.035em; line-height:1.25; }
.card-serial { font-family:var(--font-display); color:#7e8d81; letter-spacing:.09em; white-space:nowrap; font-size:10px; font-weight:800; }
.board-scroller { max-width:100%; overflow-x:auto; scrollbar-width:thin; scrollbar-color:#cbd9bf transparent; }
.bingo-board { display:grid; grid-template-columns:repeat(5, minmax(0, 1fr)); gap:6px; min-width:630px; }
.board-letter { height:49px; border-radius:9px; display:grid; place-items:center; background:var(--ink); color:var(--lime); font-family:var(--font-display); font-size:29px; line-height:1; letter-spacing:-.06em; font-weight:700; }
.board-cell { min-height:116px; padding:10px 7px; border:1px solid #dfe6d8; background:#f9faf5; color:#324438; border-radius:8px; display:flex; flex-direction:column; gap:8px; align-items:center; justify-content:center; text-align:center; overflow-wrap:anywhere; word-break:normal; font-size:clamp(11px,1.05vw,14px); line-height:1.25; font-weight:700; position:relative; transition:background .13s,border-color .13s,transform .13s; }
.board-cell:not(.free-cell):hover { background:#eef6dd; border-color:#b5d586; transform:translateY(-1px); }
.board-cell.marked { background:#dbf4a0; border-color:#b6d47e; color:#284434; }
.board-cell.marked::after { content:'✓'; position:absolute; top:5px; right:7px; font-size:15px; line-height:1; color:#51763b; font-weight:900; }
.board-cell.winning { background:#b7ee73; border-color:#7faf38; box-shadow:inset 0 0 0 2px #92cc46; }
.board-cell.free-cell { background:var(--ink); color:#fff; border-color:var(--ink); cursor:default; }
.board-cell.free-cell:disabled { opacity:1; }
.free-star { font-size:28px; color:var(--lime); line-height:1; }
.free-cell strong { font-family:var(--font-display); font-size:18px; letter-spacing:.02em; }
.free-cell small { font-size:9px; letter-spacing:.13em; color:#c0d1bd; font-weight:800; }
.board-placeholder { grid-column:1/-1; min-height:420px; display:grid; place-items:center; color:#8b988d; }
.board-bottomline { font-size:9px; color:#95a196; letter-spacing:.11em; font-weight:800; margin-top:16px; }
.board-bottomline span:last-child { color:#637b62; }
.game-bottom-row { display:grid; grid-template-columns:1fr 1fr 1.15fr; gap:12px; margin-top:17px; }
.stat-card, .info-card { background:#fff; border:1px solid #e0e5da; border-radius:13px; padding:20px; min-height:118px; }
.stat-label { color:#758877; }
.stat-value { display:flex; gap:8px; align-items:baseline; margin:7px 0 9px; }
.stat-value strong { font-family:var(--font-display); font-size:34px; line-height:1; letter-spacing:-.055em; }
.stat-value span { font-size:11px; color:#89978b; font-weight:600; }
.progress-track { height:5px; background:#e9eddf; border-radius:9px; overflow:hidden; }
.progress-fill { height:100%; width:0; border-radius:9px; background:#8bc04e; transition:width .25s ease; }
.stat-footnote { color:#89978b; font-size:10px; margin-top:7px; }
.bingo-stat { background:#eff7df; }
.info-card { display:flex; gap:12px; align-items:flex-start; background:#f1f2e9; }
.info-icon { flex:none; width:21px; height:21px; display:grid; place-items:center; border:1.5px solid #aab8a6; border-radius:50%; font-family:Georgia,serif; font-size:13px; font-style:italic; font-weight:bold; color:#657d66; }
.info-card div:last-child { display:flex; flex-direction:column; gap:7px; }
.info-card strong { font-size:12px; }
.info-card span { font-size:10px; line-height:1.5; color:#819082; }
.mobile-hint { display:none; text-align:center; color:#829282; font-size:11px; margin-top:12px; }
.site-footer { padding:21px max(3.4vw,24px); display:flex; justify-content:space-between; gap:15px; border-top:1px solid #e1e7dc; color:#8fa08e; font-size:9px; font-weight:800; letter-spacing:.09em; }
.toast { position:fixed; bottom:22px; left:50%; transform:translate(-50%, 15px); color:#fff; background:#263e32; padding:13px 18px; border-radius:11px; box-shadow:0 12px 35px #15261b44; max-width:min(90vw,500px); font-size:12px; line-height:1.4; text-align:center; opacity:0; pointer-events:none; transition:opacity .22s,transform .22s; z-index:10; }
.toast.visible { opacity:1; transform:translate(-50%,0); }

@media (min-width:1450px) {
  .workspace { grid-template-columns:345px minmax(0,1fr); }
  .board-cell { min-height:124px; }
}
@media (max-width:1160px) {
  .workspace { grid-template-columns:286px minmax(0,1fr); gap:18px; padding-inline:22px; }
  .setup-section, .sidebar-bottom { padding-left:19px; padding-right:19px; }
  .panel-heading { padding-left:20px; padding-right:20px; }
  .board-frame { padding:19px; }
  .board-cell { min-height:110px; font-size:12px; }
  .game-bottom-row { grid-template-columns:1fr 1fr; }
  .info-card { grid-column:1/-1; min-height:unset; }
}
@media (max-width:900px) {
  .header-right { display:none; }
  .site-header { min-height:88px; }
  .workspace { display:flex; flex-direction:column; gap:23px; }
  .controls-panel, .game-panel { width:100%; }
  .category-list { max-height:220px; }
  .game-toolbar { padding-top:4px; }
  .game-toolbar h2 { font-size:31px; }
  .mobile-hint { display:block; }
}
@media (max-width:620px) {
  .site-header { padding:17px 18px; min-height:79px; }
  .brand-mark { width:47px; height:47px; }
  .brand-title { font-size:26px; }
  .brand-eyebrow { font-size:8px; }
  .workspace { padding:17px 13px 28px; }
  .panel-heading { padding:21px; }
  .panel-heading h1 { font-size:26px; }
  .game-toolbar { display:block; }
  .game-toolbar h2 { font-size:27px; }
  .toolbar-actions { margin-top:16px; }
  .board-frame { padding:14px 11px 13px; border-radius:15px; }
  .board-title-wrap strong { font-size:14px; }
  .board-kicker, .card-serial { font-size:8px; }
  .bingo-board { min-width:600px; gap:4px; }
  .board-cell { min-height:103px; font-size:11.5px; padding:7px; }
  .board-letter { height:42px; font-size:25px; }
  .board-bottomline { font-size:8px; }
  .game-bottom-row { gap:8px; }
  .stat-card, .info-card { padding:15px; }
  .stat-value strong { font-size:29px; }
  .site-footer { flex-direction:column; align-items:center; text-align:center; font-size:8px; padding:16px; }
  .win-confetti { display:none; }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { scroll-behavior:auto !important; transition:none !important; animation:none !important; }
}
@media print {
  @page { margin:12mm; }
  body { background:#fff; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  .site-header, .controls-panel, .toolbar-actions, .game-bottom-row, .mobile-hint, .site-footer, .toast, .win-banner { display:none !important; }
  .workspace { display:block; padding:0; }
  .game-toolbar { padding:0 0 12px; }
  .game-toolbar h2 { font-size:26px; }
  .board-frame { box-shadow:none; border:1px solid #bfc9b5; padding:16px; break-inside:avoid; }
  .board-scroller { overflow:visible; }
  .bingo-board { min-width:0; }
  .board-cell { min-height:105px; font-size:10px; }
}
