.pin-btn {
    padding: 4px !important;
    border-radius: 4px !important;
    transition: all 0.2s !important;
}

.pin-btn:hover {
    transform: scale(1.1) !important;
}

.pin-btn.selected svg circle {
    fill: #9ca3af !important;
    stroke: #6b7280 !important;
}

.pin-btn.selected svg text {
    fill: #374151 !important;
}

.pin-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

.pin-btn:disabled:hover {
    transform: none !important;
}

/* Quick scoring buttons - sizing is handled by the grid layout in score-tracker/index.html */
button#gutter-btn.quick-scoring-btn {
    border: 3px solid #991b1b !important;
}

button#spare-btn.quick-scoring-btn {
    border: 3px solid #1e3a8a !important;
}

button#strike-btn.quick-scoring-btn {
    border: 3px solid #166534 !important;
}

/* Action and game control buttons */
#clear-pins,
#confirm-throws,
#new-game,
#undo-last {
    border: 3px solid #374151 !important;
}

#new-game {
    border: 3px solid #1e3a8a !important;
}

#undo-last {
    border: 3px solid #991b1b !important;
}

/* COMPREHENSIVE CSS RESET FOR SCOREBOARD */
body, html {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    overflow-x: hidden !important;
}

* {
    box-sizing: border-box !important;
}

/* SCOREBOARD - FLUID RESPONSIVE DESIGN */
#scorecard {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 280px !important;
    height: auto !important;
    padding: 1vw !important;
    margin: 0 auto !important;
    overflow-x: visible !important;
    box-sizing: border-box !important;
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    float: none !important;
    display: block !important;
}

/* Force centering of all containers */
body > div, body > header, body > main, body > section {
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* Override any flex or grid layouts that could cause misalignment */
body > div[class*="flex"], 
body > div[class*="grid"],
body > section[class*="flex"],
body > section[class*="grid"] {
    justify-content: center !important;
    align-items: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Force centering for dynamically created elements */
#scorecard .flex,
#scorecard > div,
.frame-box,
.frame-box[data-frame-number] {
    margin-left: auto !important;
    margin-right: auto !important;
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    float: none !important;
    display: flex !important;
    justify-content: center !important;
}

/* Override any JavaScript-applied styles */
.frame-box[style],
.throw-box[style],
.score-box[style] {
    left: auto !important;
    right: auto !important;
    transform: none !important;
    position: relative !important;
    margin: 0 auto !important;
}

/* Override Tailwind classes with higher specificity */
div#scorecard.bg-gray-800.rounded-lg.p-4.overflow-x-auto {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 280px !important;
    height: auto !important;
    padding: 1vw !important;
    overflow-x: visible !important;
    box-sizing: border-box !important;
}

/* Frame container */
#scorecard .flex {
    width: 100% !important;
    gap: 0.5vw !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}

/* Frame labels */
.frame-box .text-sm,
.frame-box div:first-child {
    font-size: 12px !important;
    font-weight: 600 !important;
    margin-bottom: 2px !important;
    color: #9ca3af !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

/* Medium screens */
@media (max-width: 768px) {
    .frame-box .text-sm,
    .frame-box div:first-child {
        font-size: 10px !important;
        margin-bottom: 1px !important;
    }
}

/* Small screens */
@media (max-width: 425px) {
    .frame-box .text-sm,
    .frame-box div:first-child {
        font-size: 8px !important;
        margin-bottom: 1px !important;
    }
}

/* Extra small screens */
@media (max-width: 375px) {
    .frame-box .text-sm,
    .frame-box div:first-child {
        font-size: 7px !important;
        margin-bottom: 1px !important;
    }
}

/* Tiny screens */
@media (max-width: 320px) {
    .frame-box .text-sm,
    .frame-box div:first-child {
        font-size: 6px !important;
        margin-bottom: 0px !important;
    }
}

/* Score boxes */
.score-box {
    font-size: 14px !important;
    font-weight: bold !important;
    color: #34d399 !important;
    position: absolute !important;
    bottom: 2px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: calc(100% - 4px) !important;
    line-height: 1 !important;
}

/* Medium screens */
@media (max-width: 768px) {
    .score-box {
        font-size: 12px !important;
    }
}

/* Small screens */
@media (max-width: 425px) {
    .score-box {
        font-size: 10px !important;
    }
}

/* Extra small screens */
@media (max-width: 375px) {
    .score-box {
        font-size: 8px !important;
    }
}

/* Tiny screens */
@media (max-width: 320px) {
    .score-box {
        font-size: 7px !important;
    }
}

/* Frame states */
.frame-box.current {
    border-color: #3b82f6 !important;
    background-color: #4b5563 !important;
}

.frame-box.completed {
    border-color: #059669 !important;
}

/* ==========================================================================
   SCORE TRACKER - authoritative responsive styles
   (previously lived inline in score-tracker/index.html)
   ========================================================================== */

/* Custom flex utility used by desktop layout */
.flex-2 {
    flex: 2 1 0%;
}

/* --- Scoreboard fluid sizing (frame + throw boxes) --- */
html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box {
    background-color: #374151 !important;
    border: 2px solid #4b5563 !important;
    border-radius: 0.5rem !important;
    padding: calc(0.3vw + 3px) !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    margin: 0 calc(0.2vw + 2px) !important;
    position: relative !important;
    overflow: hidden !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    flex: 1 1 calc(10vw + 30px) !important;
    height: calc(10vw + 30px) !important;
    min-width: calc(4vw + 30px) !important;
    min-height: calc(4vw + 30px) !important;
}

html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box:nth-child(10) {
    flex: 1 1 calc(15vw + 45px) !important;
    height: calc(10vw + 30px) !important;
    min-width: calc(6vw + 45px) !important;
    min-height: calc(4vw + 30px) !important;
}

html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box .throw-box {
    background-color: #1f2937 !important;
    border-radius: 0.25rem !important;
    padding: calc(0.2vw + 2px) !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace !important;
    text-align: center !important;
    color: #f3f4f6 !important;
    width: calc(2.5vw + 18px) !important;
    height: calc(2.5vw + 18px) !important;
    font-size: calc(1.2vw + 10px) !important;
    line-height: 1 !important;
}


/* Throw-box size caps - width/height capped to match frame caps (80/120px) but
   let font-size scale naturally with viewport. Score-box also scales to stay balanced. */
html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box .throw-box {
    max-width: 34px !important;
    max-height: 34px !important;
}
html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box:nth-child(10) .throw-box {
    max-width: 34px !important;
    max-height: 34px !important;
}
/* Score-box scales with viewport on desktop, matching throw-box font scaling */
@media (min-width: 769px) {
    html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box .score-box {
        font-size: calc(1vw + 8px) !important;
    }
}

/* Frame/throw caps - all 10 frames must fit horizontally at any viewport.
   10 frames = 9 regular + 1 wider (10th ~1.5x) = ~10.5 equivalent widths.
   Using fluid vw-based caps below 768px so frames shrink continuously
   rather than stepping. */
html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box {
    max-width: 80px !important;
    max-height: 80px !important;
}
html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box:nth-child(10) {
    max-width: 120px !important;
    max-height: 80px !important;
}
@media (max-width: 768px) {
    /* Full-bleed scoreboard on mobile: no container padding, no rounded corners,
       no margins between frames - frames touch each other and the screen edges */
    html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto {
        padding: 0 !important;
        border-radius: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center {
        gap: 0 !important;
        width: 100% !important;
    }
    html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        max-width: none !important;
        height: calc(9vw + 10px) !important;
        min-height: 0 !important;
        margin: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: calc(0.2vw + 1px) !important;
        border-radius: 0 !important;
        border: none !important;
        border-right: 1px solid #4b5563 !important;
    }
    html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box:last-child {
        border-right: none !important;
    }
    html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box:nth-child(10) {
        flex: 1.5 1.5 0 !important;
        min-width: 0 !important;
        max-width: none !important;
        height: calc(10vw + 12px) !important;
    }
    html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box {
        height: calc(10vw + 12px) !important;
    }
    /* Throws container inside frame - fill full frame width, no gaps */
    html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box > .flex {
        width: 100% !important;
        gap: 0 !important;
        justify-content: space-between !important;
    }
    /* Throws - frames 1-9 have 2 throws @ ~4.5vw each; frame 10 has 3 throws @ ~4.5vw each.
       Same width rule works for both since frame 10 is 1.5x wider with 1.5x more throws. */
    html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box .throw-box {
        width: calc(4.3vw) !important;
        height: calc(4.3vw) !important;
        min-width: 0 !important;
        max-width: none !important;
        font-size: calc(1.5vw + 7px) !important;
        padding: 0 !important;
        flex-shrink: 1 !important;
    }
    html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box:nth-child(10) .throw-box {
        width: calc(4.3vw) !important;
        height: calc(4.3vw) !important;
        font-size: calc(1.4vw + 7px) !important;
    }
    /* Override the Tailwind space-x-1 on throws container (was adding 4px gaps) */
    html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box .throw-box + .throw-box {
        margin-left: 0 !important;
    }
    /* Bigger score-box for readability on mobile */
    html body div#scorecard.bg-gray-800.rounded-lg.p-2.mx-auto .flex.justify-center .frame-box .score-box {
        font-size: calc(1.2vw + 8px) !important;
    }
}

/* --- Mobile pin / quick-scoring / action buttons --- */

/* Both 3-button top row and 2-button pairs share this max-width so they line up */
html body div.bg-gray-800.rounded-lg.p-6.mb-6.max-w-4xl.mx-auto .action-row {
    max-width: calc(30vw + 272px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

html body div.bg-gray-800.rounded-lg.p-6.mb-6.max-w-4xl.mx-auto .quick-scoring-container .quick-scoring-btn {
    padding: 1.25rem 0 !important;
    border-radius: 0.5rem !important;
    font-weight: bold !important;
    transition: background-color 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 2.25rem !important;
    line-height: 1 !important;
}

/* Quick-scoring button colors (mobile scoped - desktop layout uses the same IDs, sizing by grid) */
html body div.bg-gray-800.rounded-lg.p-6.mb-6.max-w-4xl.mx-auto .quick-scoring-container #gutter-btn.quick-scoring-btn {
    background-color: #dc2626 !important;
    border: 3px solid #991b1b !important;
    color: white !important;
}
html body div.bg-gray-800.rounded-lg.p-6.mb-6.max-w-4xl.mx-auto .quick-scoring-container #spare-btn.quick-scoring-btn {
    background-color: #2563eb !important;
    border: 3px solid #1e3a8a !important;
    color: white !important;
}
html body div.bg-gray-800.rounded-lg.p-6.mb-6.max-w-4xl.mx-auto .quick-scoring-container #strike-btn.quick-scoring-btn {
    background-color: #16a34a !important;
    border: 3px solid #166534 !important;
    color: white !important;
}

/* --- Desktop quick-scoring buttons (right column) --- */
html body div.bg-gray-800.rounded-lg.p-6.max-w-6xl.mx-auto .quick-scoring-container {
    width: 100% !important;
    gap: 1rem !important;
}
html body div.bg-gray-800.rounded-lg.p-6.max-w-6xl.mx-auto .quick-scoring-container .quick-scoring-btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    padding: 1.25rem 0 !important;
    border-radius: 0.5rem !important;
    font-weight: bold !important;
    font-size: 2.25rem !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background-color 0.2s !important;
}
html body div.bg-gray-800.rounded-lg.p-6.max-w-6xl.mx-auto .quick-scoring-container .gutter-btn.quick-scoring-btn {
    background-color: #dc2626 !important;
    border: 3px solid #991b1b !important;
    color: white !important;
}
html body div.bg-gray-800.rounded-lg.p-6.max-w-6xl.mx-auto .quick-scoring-container .spare-btn.quick-scoring-btn {
    background-color: #2563eb !important;
    border: 3px solid #1e3a8a !important;
    color: white !important;
}
html body div.bg-gray-800.rounded-lg.p-6.max-w-6xl.mx-auto .quick-scoring-container .strike-btn.quick-scoring-btn {
    background-color: #16a34a !important;
    border: 3px solid #166534 !important;
    color: white !important;
}

/* Mobile pin button sizing + appearance */
html body div.bg-gray-800.rounded-lg.p-6.mb-6.max-w-4xl.mx-auto .pin-btn {
    width: calc(4vw + 30px) !important;
    height: calc(4vw + 30px) !important;
    max-width: 80px !important;
    max-height: 80px !important;
    min-width: calc(3vw + 20px) !important;
    min-height: calc(3vw + 20px) !important;
    font-size: calc(1.5vw + 12px) !important;
    border-radius: 0.5rem !important;
    border: none !important;
    background-color: #1f2937 !important;
    color: #f3f4f6 !important;
    transition: all 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    font-weight: bold !important;
    padding: 0 !important;
    margin: 0 !important;
}
html body div.bg-gray-800.rounded-lg.p-6.mb-6.max-w-4xl.mx-auto .pin-btn:hover {
    background-color: #374151 !important;
    transform: scale(1.05) !important;
}
html body div.bg-gray-800.rounded-lg.p-6.mb-6.max-w-4xl.mx-auto .pin-btn.selected svg circle {
    fill: rgba(251, 191, 36, 0.5) !important;
}

/* Pin container spacing */
html body div.bg-gray-800.rounded-lg.p-6.mb-6.max-w-4xl.mx-auto #pin-container {
    max-width: 320px !important;
}
html body div.bg-gray-800.rounded-lg.p-6.mb-6.max-w-4xl.mx-auto #pin-container .flex {
    gap: calc(0.2vw + 8px) !important;
}
html body div.bg-gray-800.rounded-lg.p-6.mb-6.max-w-4xl.mx-auto #pin-container .flex.flex-col {
    gap: calc(0.25vw + 10px) !important;
}

/* Pin SVG */
html body div.bg-gray-800.rounded-lg.p-6.mb-6.max-w-4xl.mx-auto .pin-btn svg {
    width: 100% !important;
    height: 100% !important;
}
html body div.bg-gray-800.rounded-lg.p-6.mb-6.max-w-4xl.mx-auto .pin-btn svg circle {
    fill: #fbbf24 !important;
    stroke: #f59e0b !important;
    stroke-width: 2 !important;
}
html body div.bg-gray-800.rounded-lg.p-6.mb-6.max-w-4xl.mx-auto .pin-btn svg text {
    fill: #92400e !important;
    font-weight: bold !important;
    dominant-baseline: middle !important;
    text-anchor: middle !important;
}

/* --- Desktop layout (>=768px): larger pins, side-by-side layout --- */
@media (min-width: 768px) {
    html body div.bg-gray-800.rounded-lg.p-6.max-w-6xl.mx-auto .flex-2 #pin-container .pin-btn {
        width: calc(5.1vw + 42.5px) !important;
        height: calc(5.1vw + 42.5px) !important;
        max-width: 102px !important;
        max-height: 102px !important;
        min-width: calc(3.4vw + 29.75px) !important;
        min-height: calc(3.4vw + 29.75px) !important;
    }
    html body div.bg-gray-800.rounded-lg.p-6.max-w-6xl.mx-auto .flex-2 #pin-container .flex {
        gap: calc(0.4vw + 12px) !important;
    }
    html body div.bg-gray-800.rounded-lg.p-6.max-w-6xl.mx-auto .flex-2 #pin-container .flex.flex-col {
        gap: calc(0.5vw + 15px) !important;
    }
    html body div.bg-gray-800.rounded-lg.p-6.max-w-6xl.mx-auto .flex-2 #pin-container .pin-btn svg {
        width: 100% !important;
        height: 100% !important;
    }
    html body div.bg-gray-800.rounded-lg.p-6.max-w-6xl.mx-auto .flex-2 #pin-container .pin-btn svg circle {
        fill: #fbbf24 !important;
        stroke: #f59e0b !important;
        stroke-width: 2 !important;
    }
    html body div.bg-gray-800.rounded-lg.p-6.max-w-6xl.mx-auto .flex-2 #pin-container .pin-btn.selected svg circle {
        fill: rgba(251, 191, 36, 0.5) !important;
    }
    html body div.bg-gray-800.rounded-lg.p-6.max-w-6xl.mx-auto .flex-2 #pin-container .pin-btn svg text {
        dominant-baseline: middle !important;
        text-anchor: middle !important;
    }
}

/* --- Smallest screens: pin-btn minimum size --- */
@media (max-width: 320px) {
    html body div.bg-gray-800.rounded-lg.p-6.mb-6.max-w-4xl.mx-auto .pin-btn {
        width: 30px !important;
        height: 30px !important;
        font-size: 14px !important;
    }
}
