:root {
  color: #102a43;
  background: #f4f8fb;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #277da1; outline-offset: 3px; }

.setup-shell, .game-shell { width: min(100%, 880px); margin: 0 auto; padding: 24px 20px 44px; }
.setup-shell { min-height: 100svh; display: grid; align-content: center; gap: 28px; max-width: 570px; }
.hero { padding: 8px 4px; }
.hero-sprites { align-items: center; display: flex; height: 100px; justify-content: space-between; margin: -8px 0 2px; max-width: 300px; }
.hero-bowler, .hero-duck { display: block; height: 96px; image-rendering: pixelated; width: 96px; }
.hero-duck { transform: scaleX(-1); }
.eyebrow { color: #627d98; font-size: 12px; font-weight: 700; letter-spacing: .13em; margin: 0 0 6px; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(38px, 10vw, 56px); letter-spacing: -.065em; line-height: .97; margin-bottom: 16px; }
h2 { font-size: 26px; letter-spacing: -.045em; margin-bottom: 0; }
.hero-copy { color: #486581; font-size: 17px; line-height: 1.5; margin-bottom: 0; max-width: 440px; }
.setup-card, .entry-panel, .complete-card { background: #fff; border: 1px solid #d9e2ec; border-radius: 20px; box-shadow: 0 13px 35px rgba(16, 42, 67, .07); }
.setup-card { padding: 24px; }
.section-heading { align-items: center; display: flex; justify-content: space-between; margin-bottom: 22px; }
.player-count { background: #eaf2f8; border-radius: 99px; color: #486581; font-size: 13px; font-weight: 600; padding: 6px 10px; }
.player-fields { display: grid; gap: 10px; }
.player-input { align-items: center; background: #f8fafc; border: 1px solid #d9e2ec; border-radius: 12px; display: flex; gap: 12px; padding: 0 14px; }
.color-swatch, .player-dot { background: var(--player-color); border-radius: 50%; display: inline-block; flex: 0 0 auto; height: 12px; width: 12px; }
.player-input input { background: transparent; border: 0; color: #102a43; font-size: 16px; min-width: 0; outline: none; padding: 15px 0; width: 100%; }
.remove-player { align-items: center; background: #fff; border: 1px solid #d9e2ec; border-radius: 50%; color: #829ab1; display: inline-flex; flex: 0 0 auto; font-size: 18px; height: 24px; justify-content: center; line-height: 1; padding: 0 0 2px; transition: background .15s ease, color .15s ease, opacity .15s ease; width: 24px; }
.remove-player-label { display: none; }
.remove-player:hover { background: #fff5f5; border-color: #f8b4b4; color: #ba2525; }
@media (hover: hover) {
  .remove-player { opacity: 0; }
  .player-input:hover .remove-player, .player-input:focus-within .remove-player { opacity: 1; }
}
@media (hover: none), (pointer: coarse) {
  .remove-player { border-color: #f8b4b4; border-radius: 99px; color: #ba2525; font-size: 12px; font-weight: 700; gap: 3px; height: 31px; padding: 0 10px; width: auto; }
  .remove-player-label { display: inline; }
}
.add-player, .text-button, .logo-button, .shuffle-button { background: transparent; border: 0; color: #277da1; font-weight: 700; }
.setup-shortcuts { align-items: center; display: flex; gap: 18px; margin: 15px 0 24px; }
.add-player, .shuffle-button { padding: 3px 0; }
.shuffle-button { color: #486581; font-size: 13px; }
.primary-button { align-items: center; background: #102a43; border: 0; border-radius: 13px; color: #fff; display: flex; font-weight: 700; justify-content: space-between; padding: 16px 18px; width: 100%; }
.primary-button span { font-size: 21px; line-height: 0; }
.footer-note { color: #829ab1; font-size: 13px; margin: 0; text-align: center; }
.footer-link { background: transparent; border: 0; color: #277da1; font-size: 14px; font-weight: 700; justify-self: center; padding: 2px; }
.history-actions { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
.roster-section { margin-bottom: 20px; }
.field-label, .game-details label > span { color: #627d98; display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; margin: 0 0 7px; text-transform: uppercase; }
.game-details em { color: #9fb3c8; font-size: 10px; font-style: normal; letter-spacing: 0; }
.roster-list { display: flex; flex-wrap: wrap; gap: 7px; }
.roster-button { background: #eaf2f8; border: 1px solid #d9e2ec; border-radius: 99px; color: #334e68; font-size: 12px; font-weight: 600; padding: 7px 10px; }
.roster-button span { color: #277da1; font-size: 10px; letter-spacing: .04em; margin-right: 3px; text-transform: uppercase; }
.game-details { border-top: 1px solid #e8eef3; display: grid; gap: 12px; margin: 0 -1px 20px; padding-top: 20px; }
.game-details input { background: #f8fafc; border: 1px solid #d9e2ec; border-radius: 10px; color: #102a43; font-size: 14px; padding: 12px; width: 100%; }
.last-game-card { align-items: center; background: #eaf2f8; border: 1px solid #d9e2ec; border-radius: 15px; display: flex; gap: 16px; justify-content: space-between; padding: 15px 17px; }
.last-game-card .eyebrow { margin-bottom: 3px; }
.last-game-card strong { display: block; font-size: 14px; }
.last-game-card > div > span { color: #627d98; display: block; font-size: 12px; margin-top: 3px; }
.last-game-card .text-button { flex: 0 0 auto; font-size: 13px; }

.preferences-shell { align-content: start; max-width: 570px; }
.preferences-shell .score-header { margin: 44px 0 22px; }
.preferences-card { padding: 0 20px; }
.preference-row, .theme-select { align-items: center; border-bottom: 1px solid #e8eef3; display: flex; gap: 16px; justify-content: space-between; padding: 19px 0; }
.preference-row strong, .theme-select strong { display: block; font-size: 15px; }
.preference-row p, .theme-select small { color: #627d98; display: block; font-size: 12px; line-height: 1.35; margin: 4px 0 0; max-width: 340px; }
.theme-select { border-bottom: 0; }
.theme-select select { background: #f8fafc; border: 1px solid #d9e2ec; border-radius: 9px; color: #102a43; flex: 0 0 145px; font-size: 13px; padding: 9px; }
.switch { flex: 0 0 auto; position: relative; }
.switch input { height: 1px; opacity: 0; position: absolute; width: 1px; }
.switch > span:first-of-type { background: #bcccdc; border-radius: 99px; display: block; height: 28px; position: relative; transition: background .15s ease; width: 48px; }
.switch > span:first-of-type::after { background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(16, 42, 67, .3); content: ""; height: 22px; left: 3px; position: absolute; top: 3px; transition: transform .15s ease; width: 22px; }
.switch input:checked + span { background: #277da1; }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid #277da1; outline-offset: 3px; }
.sr-only { clip: rect(0, 0, 0, 0); clip-path: inset(50%); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }
.danger-zone { align-items: center; border: 1px solid #f8b4b4; border-radius: 15px; display: flex; gap: 16px; justify-content: space-between; padding: 17px; }
.danger-zone strong { color: #9b1c1c; display: block; font-size: 15px; }
.danger-zone p { color: #627d98; font-size: 12px; line-height: 1.35; margin: 4px 0 0; max-width: 330px; }
.clear-data-button { background: #fff5f5; border: 1px solid #f8b4b4; border-radius: 9px; color: #9b1c1c; flex: 0 0 auto; font-size: 13px; font-weight: 700; padding: 10px 12px; }
.clear-data-button:hover { background: #fee2e2; }
.saved-groups-manager { padding: 20px; }
.saved-groups-manager > .eyebrow { margin-bottom: 4px; }
.saved-groups-manager h2 { font-size: 21px; }
.saved-group-list { display: grid; gap: 8px; list-style: none; margin: 17px 0 0; padding: 0; }
.saved-group-list li { align-items: center; background: #f8fafc; border: 1px solid #d9e2ec; border-radius: 11px; display: flex; font-size: 13px; font-weight: 600; gap: 12px; justify-content: space-between; padding: 10px 11px; }
.saved-group-list li > span { min-width: 0; overflow-wrap: anywhere; }
.remove-roster { background: transparent; border: 0; color: #ba2525; flex: 0 0 auto; font-size: 12px; font-weight: 700; padding: 5px 1px; }
.empty-saved-groups { color: #627d98; font-size: 13px; line-height: 1.4; margin: 15px 0 0; }
.rules-shell { align-content: start; max-width: 570px; }
.rules-shell .score-header { margin: 44px 0 22px; }
.rules-card { display: grid; gap: 20px; }
.rules-intro strong { display: block; font-size: 17px; }
.rules-intro p { color: #627d98; font-size: 14px; line-height: 1.45; margin: 5px 0 0; }
.rules-list { display: grid; gap: 10px; list-style: none; margin: 0; padding: 0; }
.rules-list li { background: #f8fafc; border: 1px solid #d9e2ec; border-radius: 12px; padding: 13px; }
.rules-list strong { display: block; font-size: 14px; }
.rules-list span { color: #486581; display: block; font-size: 13px; line-height: 1.4; margin-top: 4px; }
.rules-list mark { background: #fef3c7; border-radius: 4px; color: #9c5d00; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; margin-left: 4px; padding: 1px 4px; }
.rules-tenth { border-bottom: 1px solid #e8eef3; border-top: 1px solid #e8eef3; padding: 16px 0; }
.rules-tenth .eyebrow { margin-bottom: 6px; }
.rules-tenth > p:last-child { color: #486581; font-size: 14px; line-height: 1.5; margin: 0; }
.rules-note { color: #627d98; font-size: 13px; margin: 0; text-align: center; }

.game-header { align-items: center; display: flex; justify-content: space-between; }
.logo-button { align-items: center; color: #102a43; display: flex; font-size: 18px; gap: 6px; padding: 4px 0; }
.header-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: flex-end; }
.header-actions .text-button { font-size: 13px; }
.logo-badge { align-items: center; background: #102a43; border-radius: 6px; color: #f8d66d; display: inline-flex; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 700; height: 23px; justify-content: center; width: 25px; }
.text-button { padding: 8px 0; }
.share-feedback { background: #e6fffa; border: 1px solid #8ee7d5; border-radius: 9px; color: #0c6b58; font-size: 13px; font-weight: 600; margin: 12px 0 -10px; padding: 9px 11px; }
.share-feedback.error { background: #fff5f5; border-color: #f8b4b4; color: #9b1c1c; }
.score-header { margin: 44px 0 22px; }
.score-header h1 { margin-bottom: 0; }
.game-venue { color: #627d98; font-size: 14px; margin: 8px 0 0; }
.player-tabs { display: flex; gap: 8px; margin: 0 -20px 20px; overflow-x: auto; padding: 3px 20px 8px; scrollbar-width: none; }
.player-tabs::-webkit-scrollbar { display: none; }
.player-tab { align-items: center; background: #fff; border: 1px solid #d9e2ec; border-radius: 99px; color: #486581; display: flex; flex: 0 0 auto; font-size: 14px; font-weight: 600; gap: 7px; padding: 9px 12px; }
.player-tab span { background: var(--player-color); border-radius: 50%; height: 8px; width: 8px; }
.player-tab b { color: #102a43; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.player-tab.selected { border-color: #102a43; box-shadow: 0 2px 0 #102a43; color: #102a43; }
.scorecards { display: grid; gap: 12px; }
.scorecard { background: #fff; border: 1px solid #d9e2ec; border-radius: 15px; overflow: hidden; }
.scorecard.active { border-color: #9fb3c8; box-shadow: 0 0 0 2px rgba(39, 125, 161, .16); }
.scorecard-title { align-items: center; border-bottom: 1px solid #e8eef3; display: flex; font-size: 15px; font-weight: 700; gap: 8px; padding: 10px 13px; }
.scorecard-title strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; margin-left: auto; }
.frames { display: grid; grid-template-columns: repeat(10, minmax(45px, 1fr)); min-width: 560px; }
.scorecard { overflow-x: auto; }
.frame { border-right: 1px solid #e8eef3; min-height: 70px; position: relative; }
.frame:last-child { border-right: 0; }
.frame-number { color: #829ab1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; padding: 4px 6px; }
.rolls { display: flex; height: 20px; justify-content: flex-end; }
.roll { align-items: center; border-left: 1px solid #e8eef3; display: flex; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; justify-content: center; width: 18px; }
.roll.mark { background: #fef3c7; color: #9c5d00; font-weight: 700; }
.cumulative { bottom: 7px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; font-weight: 500; position: absolute; right: 7px; }
.tenth { background: #f8fafc; }

.entry-panel { margin-top: 22px; padding: 18px; }
.entry-panel + .scorecards { margin-top: 22px; }
.turn-label { align-items: center; display: flex; gap: 10px; margin-bottom: 16px; }
.turn-label strong { display: block; font-size: 16px; }
.turn-label p { color: #627d98; font-size: 13px; margin: 1px 0 0; }
.keypad { display: grid; gap: 8px; grid-template-columns: repeat(6, 1fr); }
.pin-button { aspect-ratio: 1.12; background: #f4f8fb; border: 1px solid #d9e2ec; border-radius: 11px; color: #102a43; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; font-weight: 500; }
.pin-button:not(:disabled):active { background: #102a43; color: #fff; transform: translateY(1px); }
.pin-button.disabled { color: #bcccdc; cursor: default; }
.undo-button { background: transparent; border: 0; color: #627d98; font-size: 13px; font-weight: 600; grid-column: 1 / -1; padding: 7px; }
.undo-button:disabled { color: #bcccdc; cursor: default; }
.complete-card { align-items: center; display: grid; gap: 14px; grid-template-columns: auto 1fr; margin-top: 22px; padding: 18px; }
.complete-icon { align-items: center; background: #fef3c7; border-radius: 50%; color: #b7791f; display: flex; height: 38px; justify-content: center; width: 38px; }
.complete-card strong { display: block; font-size: 15px; }
.complete-card p { color: #627d98; font-size: 13px; margin: 2px 0 0; }
.compact { grid-column: 1 / -1; padding: 13px 15px; }
.final-rankings { background: #fff; border: 1px solid #d9e2ec; border-radius: 15px; margin-top: 22px; overflow: hidden; padding: 18px; }
.final-rankings-heading { align-items: end; display: flex; justify-content: space-between; }
.final-rankings-heading .eyebrow { margin-bottom: 4px; }
.final-rankings-heading h2 { font-size: 22px; }
.final-rankings-heading > span { color: #829ab1; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.winner-scottie { align-items: center; background: linear-gradient(120deg, #fff7d6, #e4f5ed); border: 1px solid #c6e6d5; border-radius: 12px; display: grid; gap: 11px; grid-template-columns: 66px 1fr; margin-top: 16px; padding: 8px 12px 8px 8px; }
.winner-scottie.tied { background: linear-gradient(120deg, #eef7ff, #f3edff); border-color: #d5c7ed; }
.winner-scottie img { display: block; height: 66px; image-rendering: pixelated; width: 66px; }
.winner-scottie strong { display: block; font-size: 14px; }
.winner-scottie span { color: #486581; display: block; font-size: 12px; font-weight: 600; line-height: 1.35; margin-top: 2px; }
.ranking-list { display: grid; gap: 8px; list-style: none; margin: 17px 0 0; padding: 0; }
.ranking-list li { align-items: center; background: #f8fafc; border: 1px solid #e8eef3; border-radius: 11px; display: flex; gap: 9px; padding: 10px; }
.ranking-place { align-items: center; background: #102a43; border-radius: 50%; color: #f8d66d; display: inline-flex; flex: 0 0 auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 700; height: 24px; justify-content: center; width: 24px; }
.ranking-list strong { font-size: 14px; }
.ranking-list b { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; margin-left: auto; }
.live-standings { margin-top: 22px; }
.at-least-score { align-items: end; display: grid; font-size: 15px !important; gap: 1px; text-align: right; }
.at-least-score span { color: #627d98; font-family: system-ui, sans-serif; font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.game-summary { background: #fff; border: 1px solid #d9e2ec; border-radius: 15px; margin-top: 22px; overflow: hidden; padding: 18px; }
.summary-heading { align-items: end; display: flex; gap: 16px; justify-content: space-between; }
.summary-heading .eyebrow { margin-bottom: 4px; }
.summary-heading h2 { font-size: 22px; }
.summary-score { color: #277da1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 30px; line-height: 1; }
.summary-stats { border-bottom: 1px solid #e8eef3; border-top: 1px solid #e8eef3; display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); margin: 18px 0; padding: 14px 0; }
.summary-stats div { min-width: 0; }
.summary-stats dt { color: #829ab1; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.summary-stats dd { color: #102a43; font-size: 13px; font-weight: 700; margin: 4px 0 0; overflow-wrap: anywhere; }
.progression-heading { align-items: baseline; display: flex; justify-content: space-between; margin-bottom: 12px; }
.progression-heading strong { font-size: 14px; }
.progression-heading span { color: #829ab1; font-size: 11px; }
.progression-chart { display: grid; gap: 14px; }
.progression-player { display: grid; gap: 8px; }
.progression-player-name { align-items: center; display: flex; font-size: 13px; gap: 7px; }
.progression-player-name > span:last-child { color: #829ab1; font-size: 11px; margin-left: auto; }
.progression-points { align-items: end; display: grid; gap: 3px; grid-template-columns: repeat(10, 1fr); height: 82px; list-style: none; margin: 0; padding: 0; }
.progression-points li { align-items: center; display: flex; flex-direction: column; height: 100%; justify-content: end; min-width: 0; position: relative; }
.progression-bar { background: var(--progress-color, #9fb3c8); border-radius: 3px 3px 0 0; height: var(--progress); max-width: 22px; width: 100%; }
.progression-points b { color: #486581; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; font-weight: 600; line-height: 1; margin-top: 3px; }
.progression-points small { color: #9fb3c8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; line-height: 1; margin-top: 3px; }

.history-shell { margin: 0 auto; max-width: 880px; min-height: 100svh; padding: 24px 20px 44px; }
.history-list { display: grid; gap: 12px; }
.history-game { background: #fff; border: 1px solid #d9e2ec; border-radius: 15px; overflow: hidden; }
.history-game summary { align-items: center; cursor: pointer; display: flex; gap: 12px; justify-content: space-between; list-style: none; padding: 16px; }
.history-game summary::-webkit-details-marker { display: none; }
.history-game summary strong { display: block; font-size: 15px; }
.history-game summary small { color: #627d98; display: block; font-size: 12px; margin-top: 3px; }
.history-total { color: #102a43; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; font-weight: 700; }
.history-game-body { border-top: 1px solid #e8eef3; padding: 14px; }
.history-game-body .game-summary { margin: 0 0 14px; }
.history-player-totals { display: grid; gap: 8px; list-style: none; margin: 0 0 14px; padding: 0; }
.history-player-totals li { align-items: center; color: #486581; display: flex; font-size: 14px; justify-content: space-between; }
.history-player-totals strong { color: #102a43; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.delete-history-button { background: transparent; border: 0; color: #ba2525; font-size: 13px; font-weight: 700; margin-top: 14px; padding: 4px 0; }
.empty-history { background: #fff; border: 1px dashed #bcccdc; border-radius: 16px; padding: 44px 22px; text-align: center; }
.empty-history > span { color: #9fb3c8; font-size: 34px; }
.empty-history h2 { font-size: 21px; margin: 10px 0 5px; }
.empty-history p { color: #627d98; font-size: 14px; margin: 0; }

:root[data-theme="dark"] { background: #081a2c; color: #f0f4f8; color-scheme: dark; }
:root[data-theme="dark"] body { background: #081a2c; }
:root[data-theme="dark"] .setup-card,
:root[data-theme="dark"] .entry-panel,
:root[data-theme="dark"] .complete-card,
:root[data-theme="dark"] .final-rankings,
:root[data-theme="dark"] .scorecard,
:root[data-theme="dark"] .game-summary,
:root[data-theme="dark"] .history-game,
:root[data-theme="dark"] .empty-history { background: #102a43; border-color: #334e68; box-shadow: 0 13px 35px rgba(0, 0, 0, .2); }
:root[data-theme="dark"] .winner-scottie { background: linear-gradient(120deg, #34441f, #16453d); border-color: #4d765a; }
:root[data-theme="dark"] .winner-scottie.tied { background: linear-gradient(120deg, #183d5a, #3b2858); border-color: #63518a; }
:root[data-theme="dark"] .winner-scottie span,
:root[data-theme="dark"] .at-least-score span { color: #b8c9d9; }
:root[data-theme="dark"] .player-input,
:root[data-theme="dark"] .game-details input,
:root[data-theme="dark"] .theme-select select,
:root[data-theme="dark"] .player-tab,
:root[data-theme="dark"] .pin-button,
:root[data-theme="dark"] .ranking-list li,
:root[data-theme="dark"] .saved-group-list li,
:root[data-theme="dark"] .rules-list li,
:root[data-theme="dark"] .tenth { background: #1d3a55; border-color: #486581; color: #f0f4f8; }
:root[data-theme="dark"] .player-input input,
:root[data-theme="dark"] .theme-select select,
:root[data-theme="dark"] .logo-button,
:root[data-theme="dark"] .summary-stats dd,
:root[data-theme="dark"] .history-total,
:root[data-theme="dark"] .history-player-totals strong { color: #f0f4f8; }
:root[data-theme="dark"] .last-game-card { background: #1d3a55; border-color: #486581; }
:root[data-theme="dark"] .danger-zone { border-color: #9b1c1c; }
:root[data-theme="dark"] .danger-zone strong { color: #fecaca; }
:root[data-theme="dark"] .danger-zone p { color: #9fb3c8; }
:root[data-theme="dark"] .clear-data-button { background: #4c1d1d; border-color: #9b1c1c; color: #fecaca; }
:root[data-theme="dark"] .clear-data-button:hover { background: #652020; }
:root[data-theme="dark"] .remove-roster { color: #f8b4b4; }
:root[data-theme="dark"] .player-count,
:root[data-theme="dark"] .roster-button { background: #243b53; border-color: #486581; color: #d9e2ec; }
:root[data-theme="dark"] .remove-player { background: #243b53; border-color: #486581; }
:root[data-theme="dark"] .scorecard-title,
:root[data-theme="dark"] .history-game-body,
:root[data-theme="dark"] .summary-stats,
:root[data-theme="dark"] .preference-row,
:root[data-theme="dark"] .theme-select,
:root[data-theme="dark"] .rules-tenth { border-color: #334e68; }
:root[data-theme="dark"] .frame,
:root[data-theme="dark"] .roll { border-color: #334e68; }
:root[data-theme="dark"] .roll.mark { background: #614700; color: #fde68a; }
:root[data-theme="dark"] .primary-button,
:root[data-theme="dark"] .logo-badge,
:root[data-theme="dark"] .pin-button:not(:disabled):active { background: #277da1; }
:root[data-theme="dark"] .pin-button.disabled { background: #102a43; border-color: #243b53; color: #627d98; cursor: default; opacity: .7; }
:root[data-theme="dark"] .empty-history > span,
:root[data-theme="dark"] .footer-note,
:root[data-theme="dark"] .game-venue,
:root[data-theme="dark"] .turn-label p,
:root[data-theme="dark"] .last-game-card > div > span,
:root[data-theme="dark"] .preference-row p,
:root[data-theme="dark"] .theme-select small,
:root[data-theme="dark"] .rules-intro p,
:root[data-theme="dark"] .rules-list span,
:root[data-theme="dark"] .rules-tenth > p:last-child,
:root[data-theme="dark"] .rules-note { color: #9fb3c8; }
:root[data-theme="dark"] .rules-list mark { background: #614700; color: #fde68a; }
:root[data-theme="dark"] .share-feedback { background: #103c39; border-color: #167d6b; color: #b8f5e7; }
:root[data-theme="dark"] .share-feedback.error { background: #4c1d1d; border-color: #9b1c1c; color: #fecaca; }

.celebration { align-items: center; animation: celebrate-in 5s ease-out forwards; background: #102a43; border-radius: 14px; box-shadow: 0 14px 30px rgba(16, 42, 67, .24); color: #fff; display: grid; gap: 10px; grid-template-columns: 70px 1fr; left: 20px; padding: 8px 14px 8px 8px; position: fixed; right: 20px; text-align: left; top: 16px; z-index: 10; }
.celebration.spare { background: #277da1; }
.celebration.streak-2 { background: #7a5195; }
.celebration.streak-3 { background: #167d6b; box-shadow: 0 14px 30px rgba(22, 125, 107, .32); }
.celebration.streak-4 { background: #4d347a; box-shadow: 0 14px 34px rgba(77, 52, 122, .4); }
.celebration.gutter { background: #eef4f8; border: 1px solid #c7d8e5; box-shadow: 0 14px 30px rgba(16, 42, 67, .14); color: #334e68; }
.celebration.gutter .celebration-copy > span:last-child { color: #627d98; }
.celebration.gutter .celebration-burst { color: #829ab1; }
.celebration-sprite { display: block; height: 70px; image-rendering: pixelated; width: 70px; }
.celebration-copy { display: grid; gap: 1px; }
.celebration strong { font-size: 18px; letter-spacing: -.025em; }
.celebration-copy > span:last-child { color: rgba(255, 255, 255, .76); font-size: 12px; font-weight: 600; }
.celebration-burst { color: #f8d66d; font-size: 13px; letter-spacing: .38em; }
@keyframes celebrate-in {
  0% { opacity: 0; transform: translateY(-18px) scale(.92); }
  6%, 88% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-8px) scale(1.02); }
}
:root[data-theme="dark"] .celebration.gutter { background: #243b53; border-color: #486581; color: #f0f4f8; }
:root[data-theme="dark"] .celebration.gutter .celebration-copy > span:last-child { color: #b8c9d9; }
:root[data-theme="dark"] .celebration.gutter .celebration-burst { color: #9fb3c8; }
@media (prefers-reduced-motion: reduce) {
  .celebration { animation: none; }
}

@media (min-width: 700px) {
  .game-shell { padding-top: 38px; }
  .score-header { margin-top: 55px; }
  .scorecards { grid-template-columns: repeat(2, 1fr); }
  .scorecard { min-width: 0; }
  .frames { min-width: 0; }
  .frame { min-width: 0; }
  .keypad { grid-template-columns: repeat(11, 1fr); }
  .pin-button { aspect-ratio: 1; }
  .undo-button { grid-column: auto; }
  .complete-card { grid-template-columns: auto 1fr auto; }
  .compact { grid-column: auto; width: auto; }
  .game-details { grid-template-columns: 1fr 1fr; }
  .celebration { left: 0; margin: 0 auto; max-width: 400px; right: 0; width: calc(100% - 40px); }
}
