:root {
    --bg-color: #F5F5F5;
    --card-bg: #FFFFFF;
    --primary: #11585F;
    --primary-hover: #0c4349;
    --accent: #FF9200;
    --danger: #ef4444;
    --text-main: #11585F;
    --text-muted: #8A9FA2;
    --font-main: 'Sora', sans-serif;
    --radius: 16px;
    --radius-sm: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    overflow-x: hidden;
}

/* === NAVBAR === */
.navbar {
    background-color: var(--primary);
    box-shadow: 0 4px 15px rgba(17, 88, 95, 0.15);
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.8rem 24px; /* Align perfectly with app-container padding */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
}

.nav-center {
    display: flex;
    align-items: center;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 16px;
}

.mobile-only {
    display: none !important;
}

.nav-link {
    text-decoration: none;
    color: #A3C2C5;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
    padding: 8px 16px;
    border-radius: 8px;
}

.nav-link:hover {
    color: white;
}

.nav-link.active {
    color: var(--accent);
    font-weight: 800;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    line-height: 1;
    border-radius: 8px;
    transition: background 0.2s;
}

.mobile-menu-toggle:hover {
    background: rgba(255,255,255,0.1);
}

/* Mobile menu backdrop overlay */
.mobile-menu-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 90;
}

.nav-link-icon {
    text-decoration: none;
    color: #A3C2C5;
    transition: all 0.2s;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
}

.nav-link-icon:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.08);
}

.app-container {
    width: 100%;
    max-width: 1200px;
    flex: 1;
    min-height: 0;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

/* === SETUP VIEW === */
.setup-view {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fadeIn 0.3s ease;
    margin-top: 20px;
    padding-bottom: 40px;
}

.setup-card {
    background: var(--card-bg);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(17, 88, 95, 0.05);
}

.setup-card h2 {
    margin-bottom: 24px;
    color: var(--primary);
    text-align: center;
    font-size: 1.8rem;
    font-weight: 800;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input, .form-group select {
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(17, 88, 95, 0.15);
    background: white;
    color: var(--primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--primary);
}

.btn {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    border-radius: 999px;
    margin-top: 10px;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #E6EEF0;
    color: var(--primary);
}

.btn-secondary:hover {
    background-color: #D1DFE2;
}

/* === GAME VIEW === */
.game-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.btn-text-action {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.btn-text-action:hover {
    color: var(--primary);
}

.game-meta-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
}

.meta-mode {
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 800;
}

.meta-separator {
    color: var(--text-muted);
    opacity: 0.5;
}

.meta-legs {
    color: var(--text-muted);
}

.score-boards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    flex: 1;
    min-height: 0;
    align-items: stretch;
}

/* 4-team layout: active player full-width top, 3 inactive side-by-side below */
.score-boards.compact {
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.inactive-players-scroll-wrapper {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 6px 20px 6px;
}

/* Custom scrollbar styling for compact scoreboard container */
.inactive-players-scroll-wrapper::-webkit-scrollbar {
    width: 6px;
}
.inactive-players-scroll-wrapper::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}
.inactive-players-scroll-wrapper::-webkit-scrollbar-thumb {
    background: #CBDDDF;
    border-radius: 4px;
}
.inactive-players-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: #8A9FA2;
}

.inactive-players-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    align-items: stretch;
}

.score-boards.compact .player-column {
    height: 100%;
}

.player-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    min-height: 0;
}

.player-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    border: 1px solid rgba(17, 88, 95, 0.05);
    transition: all 0.3s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    flex: 1;
    min-height: 421px;
}

.player-card.active {
    background: linear-gradient(45deg, #ff8400 0%, #ffb249 50%, #ffe0be 100%);
    border: none;
    box-shadow: 0 12px 40px rgba(255, 132, 0, 0.25);
}

/* === NO-CHECKOUT STATE — active card when score > 170 === */

/* Hide checkout, center score for both standard + compact */
.player-card.no-checkout .checkout-hint-wrapper {
    display: none;
}

.player-card.active.no-checkout .score-display {
    font-size: 9rem;
    letter-spacing: -4px;
    margin: 24px 0;
}

/* Flatten stats into a single 4-item horizontal row, centered (4 players only) */
.player-card.compact.active.no-checkout .stats-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: flex-start !important;
    width: 100% !important;
    gap: 60px !important;
    border-top: 1px solid rgba(17, 88, 95, 0.12) !important;
}

/* Each col: transparent row wrapper for its 2 fields */
.player-card.compact.active.no-checkout .stats-col {
    display: flex !important;
    flex-direction: row !important;
    gap: 60px !important;
    width: auto !important;
}

/* Hide the vertical divider */
.player-card.compact.active.no-checkout .stats-divider-line {
    display: none !important;
}

/* Each stat field: label on top, value below, centered */
.player-card.compact.active.no-checkout .stats-field {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    text-align: center !important;
}

.player-card.compact.active.no-checkout .stats-label {
    font-size: 0.78rem !important;
}

.player-card.compact.active.no-checkout .stats-val {
    font-size: 1.1rem !important;
    font-weight: 800 !important;
}

/* Compact active card (4 players): switch from grid to centered flex */
.player-card.compact.active.no-checkout {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.player-card.compact.active.no-checkout .team-names-capsule {
    justify-self: unset;
    width: calc(100% - 16px);
    margin-bottom: 16px;
}

.player-card.compact.active.no-checkout .score-display {
    font-size: 6.5rem;
    letter-spacing: -4px;
    margin: 12px 0;
    grid-area: unset;
    text-align: center;
}

.player-card.compact.active.no-checkout .stats-row {
    grid-area: unset;
    width: 100%;
}

.active-indicator-dot {
    display: inline-block;
    width: 29px;
    height: 29px;
    background-image: url('../assets/bolletje-actief.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

.team-names-capsule {
    background: #F0F4F5;
    padding: 10px 28px;
    border-radius: 19px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 20px;
    width: calc(100% - 16px); /* Stretch full width of card */
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.03);
}

.active .team-names-capsule {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
}

.player-name-item {
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.2s;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.player-name-item.is-turn {
    color: var(--primary);
    font-weight: 800;
}

.name-separator {
    color: var(--text-muted);
    opacity: 0.5;
}

.score-display {
    font-size: 7.5rem;
    font-weight: 800;
    line-height: 1;
    margin: 16px 0;
    color: var(--primary);
    letter-spacing: -2px;
}

.checkout-hint-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90px;
    margin-bottom: 8px;
    width: 100%;
}

.checkout-hint {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    text-align: center;
}

.checkout-label {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    align-self: flex-end;
    padding-bottom: 12px;
    gap: 4px;
    flex-shrink: 0;
    white-space: nowrap;
}

.checkout-value {
    color: #B1B1B1;
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1;
}

/* 1 dart needed — bijv. D20 */
.checkout-value.co-xl,
.checkout-value.co-xl .checkout-token {
    font-size: 5.5rem;
    letter-spacing: -2px;
}

/* 2 darts needed — bijv. T20 / D18 */
.checkout-value.co-lg,
.checkout-value.co-lg .checkout-token {
    font-size: 4.2rem;
    letter-spacing: -1.5px;
}

/* 3 darts needed — bijv. T20 / T20 / D18 */
.checkout-value.co-md,
.checkout-value.co-md .checkout-token {
    font-size: 2.8rem;
    letter-spacing: -1px;
}

.checkout-token {
    font-weight: 800;
    line-height: 1;
}

.active .checkout-value,
.active .checkout-token {
    color: #B96F00;
}

.active .checkout-label {
    color: #B96F00;
}

.stats-row {
    display: flex;
    width: 100%;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(17, 88, 95, 0.08);
    justify-content: space-between;
    align-items: center;
}

.active .stats-row {
    border-top: 1px solid rgba(17, 88, 95, 0.12);
}

.stats-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 46%;
}

.stats-divider-line {
    width: 1px;
    height: 52px;
    background-color: rgba(17, 88, 95, 0.08);
}

.active .stats-divider-line {
    background-color: rgba(17, 88, 95, 0.12);
}

.stats-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
}

.stats-label {
    color: var(--text-muted);
    font-weight: 500;
}

.active .stats-label {
    color: rgba(17, 88, 95, 0.7);
}

.stats-val {
    color: var(--primary);
    font-weight: 700;
}

/* === COMPACT LAYOUT (4+ teams on desktop) ===
   Active player: full-width card, normal/large treatment
   Inactive players: horizontal compact cards in a row below
*/

/* Active card in 4-team mode — full-width, generous, centered flex layout */
.player-card.compact.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px 24px;
    min-height: auto;
}

.player-card.compact.active .team-names-capsule {
    width: calc(100% - 16px);
    margin-bottom: 12px;
    justify-content: center;
}

.player-card.compact.active .score-display {
    font-size: 5.5rem;
    margin: 8px 0;
    letter-spacing: -3px;
    line-height: 1;
    text-align: center;
}

.player-card.compact.active .checkout-hint-wrapper {
    min-height: 0;
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.player-card.compact.active .checkout-hint {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.player-card.compact.active .checkout-label {
    font-size: 1.2rem;
    font-weight: 700;
    padding-bottom: 0;
    align-self: center;
    flex-shrink: 0;
}

/* Large checkout token sizes inside the full-width compact active card */
.player-card.compact.active .checkout-value.co-xl,
.player-card.compact.active .checkout-value.co-xl .checkout-token,
.player-card.compact.active .checkout-value.co-lg,
.player-card.compact.active .checkout-value.co-lg .checkout-token,
.player-card.compact.active .checkout-value.co-md,
.player-card.compact.active .checkout-value.co-md .checkout-token {
    font-size: 4.8rem;
    letter-spacing: -1.5px;
}

/* Flatten stats into a single 4-item horizontal row, centered */
.player-card.compact.active .stats-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    gap: 60px;
    border-top: 1px solid rgba(17, 88, 95, 0.12);
    margin-top: 16px;
    padding-top: 16px;
}

.player-card.compact.active .stats-col {
    display: flex;
    flex-direction: row;
    gap: 60px;
    width: auto;
}

.player-card.compact.active .stats-divider-line {
    display: none;
}

.player-card.compact.active .stats-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    text-align: center;
}

.player-card.compact.active .stats-label {
    font-size: 0.78rem;
    color: rgba(17, 88, 95, 0.7);
}

.player-card.compact.active .stats-val {
    font-size: 1.1rem;
    font-weight: 800;
}

/* Inactive cards in 4-team mode — compact horizontal rows */
.player-card.compact:not(.active) {
    padding: 18px 22px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 180px;
}

.player-card.compact:not(.active) .team-names-capsule {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

.player-card.compact:not(.active) .score-display {
    font-size: 4rem;
    margin: 0;
    letter-spacing: -1px;
    line-height: 1;
}

.player-card.compact:not(.active) .checkout-hint-wrapper {
    min-height: 0;
    margin-top: 8px;
    margin-bottom: 4px;
    flex-shrink: 0;
    width: 100%;
    display: flex;
    justify-content: center;
}

.player-card.compact:not(.active) .checkout-hint {
    flex-direction: row;
    gap: 6px;
    align-items: center;
    justify-content: center;
}

.player-card.compact:not(.active) .checkout-value.co-xl,
.player-card.compact:not(.active) .checkout-value.co-lg,
.player-card.compact:not(.active) .checkout-value.co-md,
.player-card.compact:not(.active) .checkout-value {
    font-size: 1.2rem;
    letter-spacing: -0.5px;
}

.player-card.compact:not(.active) .checkout-token {
    font-size: 1.2rem;
}

.player-card.compact:not(.active) .checkout-label {
    font-size: 0.72rem;
    padding-bottom: 0;
    align-self: center;
}

.player-card.compact:not(.active) .stats-row {
    width: 100%;
    margin-top: 12px;
    padding-top: 12px;
    justify-content: space-between;
}

.stats-row.compact {
    margin-top: 12px;
    padding-top: 12px;
}

.player-card.compact .stats-field {
    font-size: 0.78rem;
}

.player-card.compact .stats-col {
    gap: 6px;
}

.player-card.compact .stats-divider-line {
    height: 36px;
}

.recent-throws-card.compact {
    display: none; /* hide throws in 4-team compact mode to save space */
}

.recent-throw-row.compact {
    font-size: 0.82rem;
    padding-bottom: 6px;
}

.recent-throw-row.compact .throw-num {
    width: 26px;
    font-size: 0.75rem;
}

.recent-throw-row.compact .throw-score {
    width: 28px;
}

.recent-throw-row.compact .throw-remaining {
    width: 36px;
}

/* === RECENT THROWS === */
.recent-throws-card {
    background: #EFEFEF;
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(17, 88, 95, 0.04);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.recent-throws-card::-webkit-scrollbar {
    width: 6px;
}
.recent-throws-card::-webkit-scrollbar-track {
    background: #EFEFEF;
    border-radius: 4px;
}
.recent-throws-card::-webkit-scrollbar-thumb {
    background: #CBDDDF;
    border-radius: 4px;
}
.recent-throws-card::-webkit-scrollbar-thumb:hover {
    background: #8A9FA2;
}

.recent-throw-row {
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(17, 88, 95, 0.04);
    color: var(--primary);
}

.recent-throw-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.throw-num {
    color: var(--text-muted);
    font-size: 0.85rem;
    width: 32px;
    flex-shrink: 0;
}

.throw-player {
    font-weight: 500;
    color: var(--text-muted);
    flex: 1;
    text-align: right;
    margin-right: 12px;
}

.arrow-sep {
    color: var(--text-muted);
    opacity: 0.5;
    font-size: 0.8rem;
    margin: 0 4px;
    flex-shrink: 0;
}

.throw-score {
    font-weight: 700;
    width: 36px;
    text-align: center;
    flex-shrink: 0;
}

.throw-score.is-bust {
    color: var(--danger);
}

.throw-remaining {
    font-weight: 700;
    width: 50px;
    text-align: right;
    color: var(--primary);
    flex-shrink: 0;
}

/* === INPUT SECTION === */
.input-section {
    display: flex;
    justify-content: center;
    margin-top: 24px;
    margin-bottom: 40px;
    width: 100%;
}

.score-input-container {
    display: flex;
    align-items: center;
    background: #FFFFFF;
    border-radius: 999px;
    padding: 6px 12px 6px 24px;
    box-shadow: 0 8px 30px rgba(17, 88, 95, 0.08);
    border: 1px solid rgba(17, 88, 95, 0.08);
    width: 100%;
}

.score-input-field {
    border: none;
    background: transparent;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--primary);
    outline: none;
    flex: 1;
    padding: 8px 0;
    font-family: inherit;
}

.score-input-field::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.score-input-field::-webkit-outer-spin-button,
.score-input-field::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.score-input-field[type=number] {
    -moz-appearance: textfield;
}

.mobile-numpad {
    display: none;
}

.score-submit-btn {
    background: var(--primary);
    color: var(--accent);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.3rem;
    box-shadow: 0 4px 10px rgba(17, 88, 95, 0.2);
}

.score-submit-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.04);
}

.score-submit-btn:active {
    transform: scale(0.96);
}

/* === BUST OVERLAY === */
.bust-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(239, 68, 68, 0.95);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    font-weight: 800;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 10;
}

.bust-overlay.show {
    opacity: 1;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === MODALS === */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(17, 88, 95, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius);
    text-align: center;
    animation: fadeIn 0.3s;
    border: 1px solid rgba(17, 88, 95, 0.08);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.12);
    max-width: 90%;
    position: relative;
}

.modal-fav-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    background: #F0F4F5;
    border: 1px solid rgba(17, 88, 95, 0.08);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
}

.modal-fav-btn:hover {
    transform: scale(1.15);
    background: #E6EEF0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border-color: rgba(17, 88, 95, 0.15);
}

.modal-fav-btn.active {
    background: rgba(255, 179, 0, 0.08);
    border-color: rgba(255, 179, 0, 0.25);
}

.modal-fav-btn.active:hover {
    background: rgba(255, 179, 0, 0.15);
    border-color: rgba(255, 179, 0, 0.4);
    box-shadow: 0 4px 12px rgba(255, 179, 0, 0.15);
}

.modal-fav-btn i {
    font-size: 1.4rem;
    color: var(--text-muted);
    transition: transform 0.2s ease, color 0.2s ease;
}

.modal-fav-btn:active i {
    transform: scale(0.85);
}

.modal-fav-btn i.ph-fill {
    color: #FFB300;
    filter: drop-shadow(0 1px 3px rgba(255, 179, 0, 0.4));
}

.filter-fav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 999px;
    border: 1px solid rgba(255, 179, 0, 0.3);
    background: rgba(255, 179, 0, 0.05);
    color: var(--text-muted);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.filter-fav-btn:hover {
    background: rgba(255, 179, 0, 0.1);
    border-color: rgba(255, 179, 0, 0.5);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 179, 0, 0.12);
}

.filter-fav-btn:active {
    transform: translateY(0);
}

.filter-fav-btn.active {
    background: linear-gradient(135deg, #FFB300, #FF9200);
    border-color: #FF9200;
    color: white !important;
    box-shadow: 0 4px 12px rgba(255, 146, 0, 0.25);
}

.filter-fav-btn.active:hover {
    background: linear-gradient(135deg, #FFC107, #FF9E0D);
    box-shadow: 0 6px 16px rgba(255, 146, 0, 0.35);
    transform: translateY(-2px);
}

.filter-fav-btn.active:active {
    transform: translateY(0);
}

.filter-fav-btn.active i {
    color: white !important;
}

.filter-fav-btn i {
    font-size: 1.1rem;
    color: #FFB300;
    transition: color 0.2s ease;
}

.modal h2 {
    font-size: 2.2rem;
    margin-bottom: 24px;
    color: var(--primary);
    font-weight: 800;
}

/* === SOUNDS VIEW === */
.sounds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 8px;
    margin-top: 20px;
}

.sounds-grid::-webkit-scrollbar {
    width: 6px;
}
.sounds-grid::-webkit-scrollbar-track {
    background: #F0F4F5;
    border-radius: 4px;
}
.sounds-grid::-webkit-scrollbar-thumb {
    background: #CBDDDF;
    border-radius: 4px;
}
.sounds-grid::-webkit-scrollbar-thumb:hover {
    background: #8A9FA2;
}

.sound-card {
    background: white;
    border: 1px solid rgba(17, 88, 95, 0.12);
    border-radius: var(--radius-sm);
    padding: 18px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.sound-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(17, 88, 95, 0.08);
}

.sound-card.recorded {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.04);
}

.sound-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
}

.sound-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.sound-card.gold-card {
    border-color: rgba(255, 215, 0, 0.6);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.03) 0%, rgba(218, 165, 32, 0.06) 100%);
}

.sound-card.gold-card:hover {
    border-color: gold;
    box-shadow: 0 6px 15px rgba(218, 165, 32, 0.15);
    transform: translateY(-2px);
}

.sound-card.gold-card .sound-title {
    color: #d4af37;
}

.sound-card.gold-card.recorded {
    border-color: #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, rgba(16, 185, 129, 0.02) 100%);
}

.sound-card.impossible-card {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.02);
    animation: redPulse 2.5s infinite ease-in-out;
}

@keyframes redPulse {
    0% { border-color: rgba(239, 68, 68, 0.3); }
    50% { border-color: rgba(239, 68, 68, 0.8); }
    100% { border-color: rgba(239, 68, 68, 0.3); }
}

.sound-card.impossible-card .sound-title {
    color: #ef4444;
}

@keyframes rgbGlow {
    0% { border-color: #ff0000; }
    33% { border-color: #0000ff; }
    66% { border-color: #00ff00; }
    100% { border-color: #ff0000; }
}

.sound-card.magic-card {
    animation: rgbGlow 6s infinite linear;
    background: white;
}

.sound-card.magic-card:hover {
    transform: translateY(-2px);
    animation: rgbGlow 3s infinite linear;
}

/* === STATS VIEW === */
.stat-badges {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.stat-badge {
    flex: 1;
    min-width: 180px;
    background: var(--card-bg);
    border: 1px solid rgba(17, 88, 95, 0.1);
    border-radius: var(--radius);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.01);
}

.stat-badge:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(17, 88, 95, 0.05);
}

.stat-badge-val {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-badge-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stats-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 12px;
}

@media (max-width: 768px) {
    .stats-charts-row { grid-template-columns: 1fr; }
}

.stats-chart-card {
    background: white;
    border: 1px solid rgba(17, 88, 95, 0.08);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.01);
}

.stats-chart-card h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-chart-card canvas {
    max-width: 100% !important;
}

.stats-table-card {
    background: white;
    border: 1px solid rgba(17, 88, 95, 0.08);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.01);
}

.stats-table-card h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.stats-table th {
    text-align: left;
    padding: 12px;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--primary);
    background-color: #E6EEF0;
    white-space: nowrap;
}

.stats-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(17, 88, 95, 0.08);
    color: var(--primary);
    white-space: nowrap;
}

.stats-table tbody tr:last-child td {
    border-bottom: none;
}

.stats-table tbody tr:hover td {
    background: rgba(17, 88, 95, 0.02);
}

.rgb-cell {
    font-weight: 700;
}

@media (min-width: 769px) {
    /* --- 2-Player (Non-Compact) Grid Layout --- */
    .score-boards:not(.compact) {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
        grid-template-rows: auto 1fr !important;
        row-gap: 16px !important;
        column-gap: 24px !important;
        height: 100% !important;
        align-items: stretch !important;
    }

    .score-boards:not(.compact) .player-column {
        display: contents !important;
    }

    .score-boards:not(.compact) .player-column:nth-child(1) .player-card {
        grid-column: 1 !important;
        grid-row: 1 !important;
    }
    .score-boards:not(.compact) .player-column:nth-child(1) .recent-throws-card {
        grid-column: 1 !important;
        grid-row: 2 !important;
    }

    .score-boards:not(.compact) .player-column:nth-child(2) .player-card {
        grid-column: 2 !important;
        grid-row: 1 !important;
    }
    .score-boards:not(.compact) .player-column:nth-child(2) .recent-throws-card {
        grid-column: 2 !important;
        grid-row: 2 !important;
    }

    .score-boards:not(.compact) .player-column:nth-child(3) .player-card {
        grid-column: 3 !important;
        grid-row: 1 !important;
    }
    .score-boards:not(.compact) .player-column:nth-child(3) .recent-throws-card {
        grid-column: 3 !important;
        grid-row: 2 !important;
    }

    /* --- Spacing Optimizations for 2-Player Cards --- */
    .score-boards:not(.compact) .player-card {
        min-height: unset !important;
        height: 100% !important;
        flex: none !important;
        padding: 24px 20px !important;
    }

    .score-boards:not(.compact) .team-names-capsule {
        padding: 8px 20px !important;
        margin-bottom: 12px !important;
    }

    .score-boards:not(.compact) .score-display {
        font-size: 6rem !important;
        margin: 12px 0 !important;
    }

    .score-boards:not(.compact) .checkout-hint-wrapper {
        min-height: 64px !important;
        margin-bottom: 4px !important;
    }

    .score-boards:not(.compact) .checkout-value.co-xl,
    .score-boards:not(.compact) .checkout-value.co-xl .checkout-token {
        font-size: 4.2rem !important;
    }

    .score-boards:not(.compact) .checkout-value.co-lg,
    .score-boards:not(.compact) .checkout-value.co-lg .checkout-token {
        font-size: 3.2rem !important;
    }

    .score-boards:not(.compact) .checkout-value.co-md,
    .score-boards:not(.compact) .checkout-value.co-md .checkout-token {
        font-size: 2.2rem !important;
    }

    .score-boards:not(.compact) .checkout-label {
        font-size: 0.85rem !important;
        padding-bottom: 8px !important;
    }

    .score-boards:not(.compact) .stats-row {
        margin-top: auto !important;
        padding-top: 14px !important;
    }
}

.new-player-input-wrapper {
    max-width: 50%;
}

@media (max-width: 768px) {
    .new-player-input-wrapper {
        max-width: 100%;
    }

    #addNewPlayerBtn {
        padding: 12px 16px;
    }
    #addNewPlayerBtn span {
        display: none;
    }

    body {
        overflow: hidden !important;
    }

    .active-player-column-wrapper,
    .inactive-players-scroll-wrapper,
    .inactive-players-grid {
        display: contents !important;
    }

    /* ─── Navbar ─── */
    .mobile-only {
        display: block !important;
    }

    .mobile-menu-toggle {
        display: flex !important;
    }

    .nav-center {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--primary);
        z-index: 200;
        flex-direction: column;
        align-items: center;
        padding: 16px 24px 20px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.18);
        border-bottom: 2px solid var(--accent);
    }

    .navbar.menu-open .nav-center {
        display: flex !important;
    }

    .navbar.menu-open .nav-links {
        display: flex !important;
        flex-direction: column;
        gap: 4px;
        align-items: stretch;
        width: 100%;
    }

    .navbar.menu-open .nav-link {
        width: 100%;
        text-align: center;
        font-size: 1.1rem;
        padding: 12px 16px;
        border-radius: 10px;
    }

    .navbar.menu-open .nav-link:hover {
        background: rgba(255,255,255,0.08);
    }

    .nav-right .nav-link-icon {
        display: none;
    }

    .logo-subtitle {
        display: none !important;
    }

    /* ─── App container ─── */
    .app-container {
        padding: 12px !important;
        overflow-y: auto !important;
        flex: 1 !important;
        min-height: 0 !important;
        width: 100% !important;
        overflow-x: hidden !important;
    }

    .setup-view {
        padding-bottom: 120px !important;
    }

    .setup-card {
        padding: 20px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* ─── Game view ─── */
    .game-view {
        height: auto !important;
        display: flex;
        flex-direction: column;
        overflow: visible !important;
        /* Reserve space: input bar (~70px) + numpad (4 × 60px = 240px) + a little breathing room */
        padding: 8px 0 330px 0 !important;
        gap: 10px !important;
    }

    /* Header actions – icon-only */
    .header-actions {
        padding: 6px 4px !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 12px !important;
    }

    .header-actions .btn-text-action {
        font-size: 0 !important;
        padding: 9px 13px !important;
        background: #FFFFFF;
        border-radius: var(--radius-sm);
        border: 1px solid rgba(17, 88, 95, 0.08);
        box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    }

    .header-actions .btn-text-action i {
        font-size: 1.2rem !important;
        margin: 0 !important;
    }

    /* ─── Score boards ─── */
    .score-boards {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        flex: none !important;
    }

    .player-column {
        height: auto !important;
        min-height: 0 !important;
        flex: none !important;
        width: 100% !important;
        order: 1 !important;
    }

    .player-column.active {
        order: -1 !important;
    }

    .player-card {
        height: auto !important;
        min-height: 0 !important;
        flex: none !important;
    }

    /* Hide recent throws on mobile */
    .recent-throws-card {
        display: none !important;
    }

    /* ─── Active player card (large, top) ─── */
    .player-card.active {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px 12px !important;
        min-height: 0 !important;
        height: auto !important;
        flex: none !important;
        border-radius: var(--radius) !important;
    }

    .player-card.active .team-names-capsule {
        margin: 0 0 4px 0 !important;
        width: calc(100% - 16px) !important;
        max-width: 100% !important;
        padding: 6px 16px !important;
        justify-content: center !important;
    }

    .player-card.active .score-display {
        font-size: 4.2rem !important;
        margin: 2px 0 !important;
        line-height: 1 !important;
        letter-spacing: -2px !important;
        text-align: center !important;
        width: 100% !important;
    }

    .player-card.active.no-checkout .score-display {
        font-size: 4.2rem !important;
        margin: 2px 0 !important;
    }

    .player-card.active .checkout-hint-wrapper {
        margin: 0 0 4px 0 !important;
        min-height: 0 !important;
        justify-content: center !important;
        align-items: center !important;
        padding-left: 0 !important;
        width: 100% !important;
    }

    .player-card.active .checkout-hint {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        text-align: center !important;
        width: 100% !important;
    }

    .player-card.active .checkout-label {
        font-size: 0.8rem !important;
        padding-bottom: 0 !important;
        align-self: center !important;
        opacity: 0.85;
        margin: 0 !important;
    }

    .player-card.active .checkout-value,
    .player-card.active .checkout-value.co-xl,
    .player-card.active .checkout-value.co-lg,
    .player-card.active .checkout-value.co-md {
        font-size: 1.8rem !important;
        letter-spacing: -0.5px !important;
        align-self: center !important;
        line-height: 1.1 !important;
    }

    .player-card.active .checkout-token {
        font-size: 1.8rem !important;
    }

    .player-card.active .stats-row {
        margin-top: 4px !important;
        padding-top: 4px !important;
        border-top: 1px solid rgba(17, 88, 95, 0.08) !important;
        width: 100% !important;
        display: flex !important;
        justify-content: space-around !important;
    }

    .player-card.active .stats-divider-line {
        height: 30px !important;
    }

    .player-card.active .stats-field {
        font-size: 0.78rem !important;
    }

    .player-card.active.no-checkout .stats-row {
        gap: 16px !important;
        justify-content: space-around !important;
    }

    .player-card.active.no-checkout .stats-col {
        gap: 16px !important;
    }

    /* ─── Inactive player rows (compact) ─── */
    .player-card:not(.active) {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 16px 28px !important;
        background: #FFFFFF !important;
        min-height: 0 !important;
        height: auto !important;
        border-radius: 29px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03) !important;
        border: 1px solid rgba(17, 88, 95, 0.04) !important;
        margin-bottom: 8px !important;
    }

    .player-card:not(.active) .active-indicator-dot,
    .player-card:not(.active) .checkout-hint-wrapper,
    .player-card:not(.active) .stats-row,
    .player-card:not(.active) .bust-overlay {
        display: none !important;
    }

    .player-card:not(.active) .team-names-capsule {
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        display: inline-flex !important;
        align-items: center !important;
    }

    .player-card:not(.active) .player-name-item {
        color: #A2B3B6 !important;
        font-size: 1.4rem !important;
        font-weight: 700 !important;
    }

    .player-card:not(.active) .player-name-item.is-turn {
        color: #A2B3B6 !important;
        font-weight: 700 !important;
    }

    .player-card:not(.active) .name-separator {
        color: #A2B3B6 !important;
        opacity: 1 !important;
        font-weight: 700 !important;
        font-size: 1.4rem !important;
        margin: 0 4px !important;
    }

    .player-card:not(.active) .score-display {
        font-size: 2.8rem !important;
        color: var(--primary) !important;
        font-weight: 800 !important;
        margin: 0 !important;
        line-height: 1 !important;
        letter-spacing: -1px !important;
    }

    /* ─── Score input bar (fixed above numpad) ─── */
    .input-section {
        position: fixed !important;
        bottom: 240px !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 500 !important;
        background: var(--bg-color) !important;
        margin: 0 !important;
        padding: 10px 16px !important;
        border-top: none !important;
        box-shadow: none !important;
        flex-direction: row !important;
        width: 100% !important;
    }

    .score-input-container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        background: #FFFFFF !important;
        border-radius: 999px !important;
        box-shadow: 0 2px 12px rgba(17, 88, 95, 0.08) !important;
    }

    /* ─── Numpad (fixed bottom, blends with page bg) ─── */
    .mobile-numpad {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        /* 4 rows × 60px = 240px */
        grid-template-rows: repeat(4, 60px) !important;
        background: var(--bg-color) !important;
        border-top: 1px solid rgba(177, 177, 177, 0.35) !important;
        width: 100% !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 500 !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: hidden !important;
    }

    .numpad-btn {
        background: transparent !important;
        border: none !important;
        border-bottom: 1px solid rgba(177, 177, 177, 0.3) !important;
        border-right: 1px solid rgba(177, 177, 177, 0.3) !important;
        font-size: 1.8rem !important;
        font-weight: 800 !important;
        color: #B1B1B1 !important;
        font-family: var(--font-main) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        outline: none !important;
        height: 60px !important;
        padding: 0 !important;
        transition: background 0.12s ease !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    .numpad-btn:nth-child(3n) {
        border-right: none !important;
    }

    .numpad-btn:nth-child(n+10) {
        border-bottom: none !important;
    }

    .numpad-btn:active {
        background: rgba(177, 177, 177, 0.12) !important;
    }

    .numpad-btn.empty-btn {
        cursor: default !important;
    }

    .numpad-btn.backspace-btn {
        color: #B1B1B1 !important;
    }

    .numpad-btn.backspace-btn i {
        background: #B1B1B1 !important;
        color: var(--bg-color) !important;
        padding: 5px 11px !important;
        border-radius: 6px !important;
        font-size: 1.3rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .numpad-btn.backspace-btn:active i {
        background: #999999 !important;
    }
}

/* === SETTINGS TABS === */
.settings-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(17, 88, 95, 0.1);
    padding-bottom: 12px;
    overflow-x: auto;
    width: 100%;
}

.settings-tab-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.settings-tab-btn:hover {
    color: var(--primary);
    background-color: rgba(17, 88, 95, 0.05);
}

.settings-tab-btn.active {
    background-color: var(--primary) !important;
    color: white !important;
}

.settings-tab-btn.active:hover {
    background-color: var(--primary-hover) !important;
    color: white !important;
}

/* === GAME MANAGEMENT ITEM === */
.game-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    border-color: rgba(17, 88, 95, 0.1) !important;
}

.filter-games-btn {
    transition: all 0.2s ease;
}

.filter-games-btn:hover {
    background-color: rgba(17, 88, 95, 0.05) !important;
}

.filter-games-btn.active {
    background-color: white !important;
    color: var(--primary) !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 6px rgba(17, 88, 95, 0.08) !important;
}

