/* ============================================================================
   YAHTZEE - MAIN STYLESHEET
   Modern, responsive design for Yahtzee dice game
   ============================================================================ */

/* Game Menu Customization */
:root {
    --game-primary: #007bff;
    --game-primary-dark: #0056b3;
    --game-secondary: #FACC15;
}

/* Background image set via PHP template - no CSS override needed */

/* Menu styles are handled by shared game-menu.css */
/* Only minimal game-specific overrides below */

/* Use shared hero; hide custom title block */
.yahtzee-title { display: none; }

.yahtzee-word {
    color: var(--game-secondary);
}

.yahtzee-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.75), rgba(0, 86, 179, 0.9));
    box-shadow: 0 16px 36px rgba(0, 123, 255, 0.35);
    color: #fff;
    font-size: 1.75rem;
}

/* Restore shared hero title visibility and alignment */
.yahtzee-menu .game-menu-hero__title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--menu-spacing-sm);
}
.yahtzee-menu .game-menu-hero__title h1 {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    clip: auto;
    border: none;
}

/* Hero subtitle - allow shared mobile styles to override */
.yahtzee-menu .game-menu-hero__subtitle {
    margin: 0 auto;
    max-width: 620px;
    font-size: 1.1rem;
    color: rgba(248, 250, 252, 0.85);
}

/* Hero meta - allow shared mobile styles to hide on mobile */
.yahtzee-menu .game-menu-hero__meta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.yahtzee-menu .game-menu-hero__meta div {
    background: rgba(15, 23, 42, 0.65);
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #e2e8f0;
}

.yahtzee-menu .game-menu-hero__meta dt {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: rgba(148, 163, 184, 0.85);
}

.yahtzee-menu .game-menu-hero__meta dd {
    margin: 0;
    font-weight: 600;
}

/* Mobile: Ensure shared mobile styles take precedence */
@media (max-width: 768px) {
    /* Let shared CSS handle mobile layout - only override colors if needed */
    .yahtzee-menu .game-menu-hero__subtitle,
    .yahtzee-menu .game-menu-hero__meta {
        display: none !important; /* Shared CSS hides these on mobile */
    }
    
    /* Stats should be horizontal on mobile per shared CSS */
    .yahtzee-menu .game-menu-stats {
        display: flex !important;
        flex-direction: row !important;
        grid-template-columns: none !important;
    }
    
    /* Actions should be single column on mobile per shared CSS */
    .yahtzee-menu .game-menu-actions {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
    }
    
    /* Preview hidden on mobile per shared CSS */
    .yahtzee-menu .game-menu-preview {
        display: none !important;
    }
}

.yahtzee-menu .game-menu-stats .stat-card {
    background: rgba(15, 23, 42, 0.78);
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.5);
}

.yahtzee-menu .game-menu-stats .stat-value {
    color: var(--game-secondary);
}

.yahtzee-menu .game-menu-preview {
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.2) 0%, rgba(250, 204, 21, 0.16) 100%);
    border: 1px solid rgba(37, 99, 235, 0.4);
    box-shadow: 0 24px 52px rgba(15, 23, 42, 0.55);
}

.yahtzee-menu .game-menu-preview__badge {
    background: rgba(0, 123, 255, 0.8);
    color: #fff;
    box-shadow: 0 14px 30px rgba(0, 123, 255, 0.35);
}

.yahtzee-menu .game-menu-preview__date {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.yahtzee-menu .game-menu-preview__countdown,
.yahtzee-menu .game-menu-preview__extras li {
    color: rgba(226, 232, 240, 0.82);
}

.yahtzee-menu .game-menu-preview__extras li strong {
    color: rgba(250, 204, 21, 0.95);
}

.yahtzee-menu .game-menu-preview__status {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.18);
    border: 1px solid rgba(56, 189, 248, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Button styles handled by shared game-menu.css */
/* Mobile responsive styles handled by shared game-menu.css */

/* Game-specific variables */
:root {
    --primary-color: #C90C0F;
    --primary-hover: #a00a0c;
    --success-color: #28a745;
    --success-hover: #218838;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --gold-color: #FAB719;
    --text-dark: #333;
    --text-light: #666;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Rockwell', 'Rockwell Nova', 'Roboto Slab', serif;
    color: var(--text-dark);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Background for game (when not in menu) */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    background-attachment: fixed;
    z-index: -100;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('/interactive/yahtzee/images/background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.35;
    z-index: -99;
    pointer-events: none;
}

/* Game menu styles handled by /interactive/shared/game-menu.css */

/* Game header visibility control */
.game-top-bar {
    z-index: 1000 !important;
}

/* Hide header when in menu mode */
.yahtzee-page.game-menu-active .game-top-bar {
    display: none !important;
}

/* Show header when game is active */
body.with-game-header .game-top-bar {
    display: flex !important;
}

/* ============================================================================
   GAME CONTAINER
   ============================================================================ */

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: 70px; /* Space for fixed grand total bar */
    background: transparent;
}

body.with-game-header .game-container {
    padding-top: 1rem;
}

body.with-game-header {
    padding-top: 80px;
}

/* ============================================================================
   GAME INFO IN HEADER
   ============================================================================ */

.game-info-btn {
    background: rgba(250, 183, 25, 0.2) !important;
    border-color: rgba(250, 183, 25, 0.5) !important;
    cursor: default !important;
    pointer-events: none !important;
}

.game-info-btn:hover {
    background: rgba(250, 183, 25, 0.2) !important;
    transform: none !important;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

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

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.2rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--text-dark);
}

.btn-icon:hover {
    background: var(--border-color);
}

/* ============================================================================
   MAIN GAME AREA
   ============================================================================ */

.game-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Desktop: 3-column layout (Upper Scorecard | Dice | Lower Scorecard) */
@media (min-width: 1201px) {
    .game-main {
        grid-template-columns: 1fr 1.5fr 1fr !important;
        gap: 1rem;
    }
    
    /* Hide tabs on desktop */
    .scorecard-tabs {
        display: none !important;
    }
    
    /* Show both scorecard sections on desktop */
    .scorecard-upper .scorecard-sections,
    .scorecard-lower .scorecard-sections {
        display: block !important;
    }
    
    .scorecard-upper #upper-section,
    .scorecard-lower #lower-section {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* On desktop, show lower section in right column */
    .scorecard-lower .scorecard-sections {
        display: block !important;
    }
    
    .scorecard-lower #lower-section-desktop {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Hide lower section in upper wrapper on desktop (it's shown in right column) */
    .scorecard-upper #lower-section {
        display: none !important;
    }
}

/* Mobile/Tablet: Keep tabbed interface */
@media (max-width: 1200px) {
    .game-main {
        grid-template-columns: 1fr !important;
    }
    
    /* Show tabs on mobile */
    .scorecard-tabs {
        display: flex !important;
    }
    
    /* Hide lower scorecard section on mobile (use tabs instead) */
    .scorecard-lower {
        display: none !important;
    }
    
    /* Show upper section with tabs */
    .scorecard-upper {
        display: block !important;
    }
    
    /* Tab content visibility - only show active tab */
    .scorecard-tab-content {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    
    /* Show only active tab content */
    .scorecard-tab-content.active {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Maximum specificity for active sections */
    #lower-section.active,
    #upper-section.active {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 200px !important;
        position: relative !important;
    }
    
    /* Ensure all children are visible */
    #lower-section.active *,
    #upper-section.active * {
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    #lower-section.active .scorecard-category-group,
    #upper-section.active .scorecard-category-group {
        display: block !important;
        width: 100% !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    #lower-section.active .scorecard-table,
    #upper-section.active .scorecard-table {
        display: flex !important;
        visibility: visible !important;
        width: 100% !important;
    }
    
    #lower-section.active .scorecard-row,
    #upper-section.active .scorecard-row {
        display: grid !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* ============================================================================
   DICE SECTION
   ============================================================================ */

.dice-section {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dice-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
    width: 100%;
    max-width: 500px;
    align-items: center;
}

/* Top row: black, white, black */
.dice-row-top {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    width: 100%;
    justify-items: center;
}

/* Bottom row: red, red (centered) */
.dice-row-bottom {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 66.666%; /* 2/3 width to match 2 columns of 3-column grid */
    justify-items: center;
    margin-left: auto;
    margin-right: auto;
}

.dice-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.dice-container-game {
    position: relative;
    perspective: 1000px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.dice-container-game:hover {
    transform: scale(1.05);
}

.dice-container-game.held {
    cursor: pointer;
}

.dice-container-game.held::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 3px solid var(--primary-color);
    border-radius: 15px;
    pointer-events: none;
    z-index: 10;
}

.lock-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 123, 255, 0.9);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    pointer-events: none;
    z-index: 11;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hold-indicator {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Adjust dice size for Yahtzee */
.dice-container-game .dice {
    width: 100px;
    height: 100px;
}

.dice-container-game .dice .face {
    width: 100px;
    height: 100px;
}

/* Fix dice face positioning for 100px dice (half of 200px) */
.dice-container-game .dice .front {
    transform: translateZ(50px);
}

.dice-container-game .dice .right {
    transform: rotateY(90deg) translateZ(50px);
}

.dice-container-game .dice .top {
    transform: rotateX(90deg) translateZ(50px);
}

.dice-container-game .dice .bottom {
    transform: rotateX(-90deg) translateZ(50px);
}

.dice-container-game .dice .left {
    transform: rotateY(-90deg) translateZ(50px);
}

.dice-container-game .dice .back {
    transform: translateZ(-50px) rotateY(180deg);
}

.dice-container-game .dice .dot {
    width: 15px;
    height: 15px;
}

/* Fix dot layouts for 100px dice (half of 200px original) */
.dice-container-game .dice .right {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 10px;
    padding: 15px;
}

.dice-container-game .dice .top {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 7.5px;
    padding: 12.5px;
}

.dice-container-game .dice .bottom {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 10px;
    padding: 15px;
}

.dice-container-game .dice .left {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 7.5px;
    padding: 12.5px;
}

.dice-container-game .dice .back {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 10px;
    padding: 15px;
}

.dice-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
}

.control-buttons {
    display: flex;
    gap: 0.5rem;
}

.control-buttons .btn {
    flex: 1;
}

.game-message {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    color: var(--text-dark);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-message.highlight {
    background: #fff3cd;
    color: #856404;
    border: 2px solid #ffc107;
}

.game-message.success {
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.game-message.yahtzee {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #fff;
    font-size: 1.3rem;
    animation: pulse 0.5s ease-in-out;
}

@media (max-width: 768px) {
    .game-message.yahtzee {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .game-message.yahtzee {
        font-size: 0.9rem;
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.daily-challenge-target {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.15) 0%, rgba(250, 204, 21, 0.15) 100%);
    border: 2px solid rgba(0, 123, 255, 0.4);
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.daily-challenge-target i {
    color: var(--primary-color);
}

.daily-challenge-target.target-met {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.2) 0%, rgba(40, 167, 69, 0.15) 100%);
    border-color: var(--success-color);
    color: #155724;
}

.daily-challenge-target.target-met i {
    color: var(--success-color);
}

@media (max-width: 768px) {
    .daily-challenge-target {
        padding: 0.6rem 0.75rem;
        font-size: 0.9rem;
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .daily-challenge-target {
        padding: 0.5rem 0.6rem;
        font-size: 0.85rem;
        margin-top: 0.4rem;
    }
}

/* ============================================================================
   SCORECARD SECTION
   ============================================================================ */

.scorecard-section {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow);
    overflow: visible !important;
}

.scorecard-wrapper {
    width: 100%;
    overflow: visible !important;
    position: relative;
}

.scorecard-title {
    margin: 0 0 0.75rem 0;
    font-size: 1.5rem;
    color: var(--primary-color);
    text-align: center;
}

.scorecard-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.scorecard-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.scorecard-tab:hover {
    color: var(--primary-color);
    background: rgba(0, 123, 255, 0.05);
}

.scorecard-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(0, 123, 255, 0.1);
}

.scorecard-tab i {
    font-size: 0.9rem;
}

.scorecard-sections {
    position: relative;
    min-height: 400px;
    width: 100%;
    overflow: visible !important;
}

/* Grand Total Bar - Fixed at bottom like Numero Uno */
.scorecard-grand-total-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    color: white;
    border-top: 3px solid var(--primary-color);
    z-index: 998;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
}

.scorecard-grand-total-bar .grand-total-label {
    font-size: 1rem;
    font-weight: 700;
}

.scorecard-grand-total-bar .grand-total-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

/* Remove old grand total styling */
.scorecard-grand-total {
    display: none;
}

.scorecard-category-group {
    margin-bottom: 0.75rem;
    display: block !important;
    width: 100% !important;
    min-height: 200px !important;
}

.category-group-title {
    background: var(--bg-light);
    padding: 0.4rem 0.75rem;
    margin: 0 0 0.35rem 0;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.scorecard-table {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.scorecard-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 2px solid transparent;
    border-radius: 6px;
    transition: all 0.2s ease;
    align-items: center;
    background: var(--bg-light);
}

.scorecard-row:hover:not(.used) {
    background: #e7f3ff;
    border-color: var(--primary-color);
    cursor: pointer;
}

.scorecard-row.used {
    opacity: 0.6;
    background: #f8f9fa;
}

.scorecard-row.used .category-name {
    text-decoration: line-through;
}

.scorecard-row.clickable {
    cursor: pointer;
    border-color: var(--success-color);
    background: #d4edda;
}

.scorecard-row.clickable:hover {
    background: #c3e6cb;
    transform: translateX(5px);
}

.scorecard-row.optimal {
    border-color: var(--gold-color);
    background: #fff9e6;
    border-left: 4px solid var(--gold-color);
}

.scorecard-row.special-row {
    background: linear-gradient(135deg, #fff9e6 0%, #ffe6cc 100%);
    border: 2px solid var(--gold-color);
}

.category-name {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-weight: 600;
}

.category-name i {
    margin-right: 0.5rem;
}

.category-hint {
    font-size: 0.7rem;
    color: var(--text-light);
    font-weight: 400;
}

.category-score {
    font-weight: 700;
    font-size: 1rem;
    min-width: 40px;
    text-align: center;
    font-family: 'Courier New', monospace;
}

.category-potential {
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    color: var(--success-color);
    font-size: 0.85rem;
}

.scorecard-subtotal {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-light);
    border-radius: 6px;
}

.subtotal-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-weight: 600;
    font-size: 0.9rem;
}

.subtotal-row.bonus-row {
    color: var(--gold-color);
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

.bonus-progress {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-left: 0.5rem;
}

.subtotal-value {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
}

.scorecard-grand-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    color: white;
    border-radius: 8px;
    margin-top: 0.75rem;
}

.grand-total-label {
    font-size: 1.1rem;
    font-weight: 700;
}

.grand-total-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

/* ============================================================================
   MODALS
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-light);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.modal-content h2 {
    margin: 0 0 1.5rem 0;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-content h3 {
    margin: 1.5rem 0 0.75rem 0;
    color: var(--text-dark);
}

.modal-content h4 {
    margin: 1rem 0 0.5rem 0;
    color: var(--text-dark);
}

.modal-body {
    color: var(--text-dark);
}

.modal-body ul {
    padding-left: 1.5rem;
}

.modal-body li {
    margin-bottom: 0.5rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    font-weight: 600;
}

/* Game Over Modal */
.game-over-score {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--gold-color) 0%, #F59E0B 100%);
    border-radius: 12px;
    color: white;
}

.final-score-label {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.final-score-value {
    font-size: 4rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.game-over-details {
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.game-over-buttons .btn {
    width: 100%;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

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

@keyframes celebrationPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.celebration {
    animation: celebrationPulse 0.6s ease-in-out;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 1200px) {
    .game-main {
        grid-template-columns: 1fr;
    }
    
    .scorecard-section {
        max-height: none;
    }
    
    /* Tabbed interface already handled above */
}

/* Landscape mobile optimization */
@media (max-width: 1200px) and (orientation: landscape) {
    .scorecard-sections {
        display: block !important;
        grid-template-columns: none !important;
        gap: 0;
    }
    
    .game-main {
        gap: 0.75rem;
    }
}

@media (max-width: 768px) {
    body.with-game-header {
        padding-top: 60px;
    }
    
    .game-container {
        padding: 0.5rem;
    }
    
    .dice-section {
        padding: 0.75rem;
    }
    
    .dice-area {
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .dice-row-top {
        gap: 0.5rem;
    }
    
    .dice-row-bottom {
        gap: 0.5rem;
        width: 66.666%;
    }
    
    .dice-container-game .dice {
        width: 55px;
        height: 55px;
    }
    
    .dice-container-game .dice .face {
        width: 55px;
        height: 55px;
    }
    
    .dice-container-game .dice .front {
        transform: translateZ(27.5px);
    }
    
    .dice-container-game .dice .right {
        transform: rotateY(90deg) translateZ(27.5px);
    }
    
    .dice-container-game .dice .top {
        transform: rotateX(90deg) translateZ(27.5px);
    }
    
    .dice-container-game .dice .bottom {
        transform: rotateX(-90deg) translateZ(27.5px);
    }
    
    .dice-container-game .dice .left {
        transform: rotateY(-90deg) translateZ(27.5px);
    }
    
    .dice-container-game .dice .back {
        transform: translateZ(-27.5px) rotateY(180deg);
    }
    
    .dice-container-game .dice .dot {
        width: 8px;
        height: 8px;
    }
    
    /* Fix dot layouts for 55px dice on mobile */
    /* Face 2 - Two dots (right) */
    .dice-container-game .dice .right {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 5px;
        padding: 8px;
    }
    
    .dice-container-game .dice .right .dot:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }
    
    .dice-container-game .dice .right .dot:nth-child(2) {
        grid-column: 2;
        grid-row: 2;
    }
    
    /* Face 3 - Three dots (top) */
    .dice-container-game .dice .top {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-rows: 1fr 1fr 1fr;
        gap: 4px;
        padding: 7px;
    }
    
    .dice-container-game .dice .top .dot:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }
    
    .dice-container-game .dice .top .dot:nth-child(2) {
        grid-column: 2;
        grid-row: 2;
    }
    
    .dice-container-game .dice .top .dot:nth-child(3) {
        grid-column: 3;
        grid-row: 3;
    }
    
    /* Face 4 - Four dots (bottom) */
    .dice-container-game .dice .bottom {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 5px;
        padding: 8px;
    }
    
    .dice-container-game .dice .bottom .dot:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }
    
    .dice-container-game .dice .bottom .dot:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
    }
    
    .dice-container-game .dice .bottom .dot:nth-child(3) {
        grid-column: 1;
        grid-row: 2;
    }
    
    .dice-container-game .dice .bottom .dot:nth-child(4) {
        grid-column: 2;
        grid-row: 2;
    }
    
    /* Face 5 - Five dots (left) */
    .dice-container-game .dice .left {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-rows: 1fr 1fr 1fr;
        gap: 4px;
        padding: 7px;
    }
    
    .dice-container-game .dice .left .dot:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }
    
    .dice-container-game .dice .left .dot:nth-child(2) {
        grid-column: 3;
        grid-row: 1;
    }
    
    .dice-container-game .dice .left .dot:nth-child(3) {
        grid-column: 2;
        grid-row: 2;
    }
    
    .dice-container-game .dice .left .dot:nth-child(4) {
        grid-column: 1;
        grid-row: 3;
    }
    
    .dice-container-game .dice .left .dot:nth-child(5) {
        grid-column: 3;
        grid-row: 3;
    }
    
    /* Face 6 - Six dots (back) - 2 columns, 3 rows */
    .dice-container-game .dice .back {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr 1fr;
        gap: 5px;
        padding: 8px;
    }
    
    .dice-container-game .dice .back .dot:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }
    
    .dice-container-game .dice .back .dot:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
    }
    
    .dice-container-game .dice .back .dot:nth-child(3) {
        grid-column: 1;
        grid-row: 2;
    }
    
    .dice-container-game .dice .back .dot:nth-child(4) {
        grid-column: 2;
        grid-row: 2;
    }
    
    .dice-container-game .dice .back .dot:nth-child(5) {
        grid-column: 1;
        grid-row: 3;
    }
    
    .dice-container-game .dice .back .dot:nth-child(6) {
        grid-column: 2;
        grid-row: 3;
    }
    
    .lock-overlay {
        width: 25px;
        height: 25px;
        font-size: 0.9rem;
    }
    
    .hold-indicator {
        font-size: 0.7rem;
    }
    
    .dice-controls {
        gap: 0.5rem;
        max-width: 100%;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn-large {
        padding: 0.65rem 1.25rem;
        font-size: 1rem;
    }
    
    .control-buttons {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .control-buttons .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
    
    .game-message {
        margin-top: 0.5rem;
        padding: 0.6rem;
        font-size: 0.85rem;
        min-height: 36px;
    }
    
    .scorecard-section {
        padding: 0.75rem;
    }
    
    .scorecard-title {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }
    
    .scorecard-sections {
        display: block !important;
        grid-template-columns: none !important;
        gap: 0;
    }
    
    .scorecard-category-group {
        margin-bottom: 0.5rem;
    }
    
    .category-group-title {
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }
    
    .scorecard-table {
        gap: 0.2rem;
    }
    
    .scorecard-row {
        padding: 0.4rem 0.5rem;
        grid-template-columns: 1fr 35px 45px;
        gap: 0.3rem;
    }
    
    .category-name {
        font-size: 0.85rem;
        gap: 0.15rem;
    }
    
    .category-name i {
        margin-right: 0.3rem;
        font-size: 0.9rem;
    }
    
    .category-hint {
        font-size: 0.65rem;
    }
    
    .category-score {
        font-size: 0.9rem;
        min-width: 35px;
    }
    
    .category-potential {
        font-size: 0.75rem;
        min-width: 45px;
    }
    
    .scorecard-subtotal {
        padding: 0.4rem 0.5rem;
        margin-top: 0.3rem;
    }
    
    .subtotal-row {
        padding: 0.25rem 0;
        font-size: 0.8rem;
    }
    
    .subtotal-row.bonus-row {
        margin-top: 0.3rem;
        padding-top: 0.4rem;
    }
    
    .bonus-progress {
        font-size: 0.75rem;
    }
    
    .subtotal-value {
        font-size: 1rem;
    }
    
    .scorecard-grand-total {
        padding: 0.5rem 0.75rem;
        margin-top: 0.5rem;
    }
    
    .grand-total-label {
        font-size: 0.95rem;
    }
    
    .grand-total-value {
        font-size: 1.4rem;
    }
    
    .modal-content {
        padding: 1.5rem;
        max-height: 85vh;
    }
    
    .modal-content h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }
    
    /* Menu container styles handled by shared game-menu.css */
}

@media (max-width: 480px) {
    body.with-game-header {
        padding-top: 55px;
    }
    
    .game-container {
        padding: 0.4rem;
    }
    
    .dice-section {
        padding: 0.6rem;
    }
    
    .dice-area {
        gap: 0.4rem;
        margin-bottom: 0.6rem;
    }
    
    .dice-row-top {
        gap: 0.4rem;
    }
    
    .dice-row-bottom {
        gap: 0.4rem;
        width: 66.666%;
    }
    
    .dice-container-game .dice {
        width: 50px;
        height: 50px;
    }
    
    .dice-container-game .dice .face {
        width: 50px;
        height: 50px;
    }
    
    .dice-container-game .dice .front {
        transform: translateZ(25px);
    }
    
    .dice-container-game .dice .right {
        transform: rotateY(90deg) translateZ(25px);
    }
    
    .dice-container-game .dice .top {
        transform: rotateX(90deg) translateZ(25px);
    }
    
    .dice-container-game .dice .bottom {
        transform: rotateX(-90deg) translateZ(25px);
    }
    
    .dice-container-game .dice .left {
        transform: rotateY(-90deg) translateZ(25px);
    }
    
    .dice-container-game .dice .back {
        transform: translateZ(-25px) rotateY(180deg);
    }
    
    .dice-container-game .dice .dot {
        width: 7px;
        height: 7px;
    }
    
    .lock-overlay {
        width: 22px;
        height: 22px;
        font-size: 0.8rem;
    }
    
    .hold-indicator {
        font-size: 0.65rem;
    }
    
    .btn {
        padding: 0.45rem 0.85rem;
        font-size: 0.85rem;
    }
    
    .btn-large {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
    }
    
    .control-buttons .btn {
        font-size: 0.75rem;
        padding: 0.45rem 0.6rem;
    }
    
    .game-message {
        padding: 0.5rem;
        font-size: 0.8rem;
        min-height: 32px;
        margin-top: 0.4rem;
    }
    
    .scorecard-section {
        padding: 0.6rem;
    }
    
    .scorecard-title {
        font-size: 1.1rem;
        margin-bottom: 0.4rem;
    }
    
    .scorecard-tabs {
        gap: 0.25rem;
        margin-bottom: 0.75rem;
    }
    
    .scorecard-tab {
        padding: 0.6rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .scorecard-tab i {
        font-size: 0.8rem;
    }
    
    .scorecard-sections {
        min-height: 300px;
    }
    
    .scorecard-grand-total-bar {
        padding: 0.6rem 0.75rem;
    }
    
    .scorecard-grand-total-bar .grand-total-label {
        font-size: 0.9rem;
    }
    
    .scorecard-grand-total-bar .grand-total-value {
        font-size: 1.3rem;
    }
    
    .scorecard-category-group {
        margin-bottom: 0.4rem;
    }
    
    .category-group-title {
        padding: 0.25rem 0.4rem;
        font-size: 0.75rem;
        margin-bottom: 0.2rem;
    }
    
    .scorecard-table {
        gap: 0.15rem;
    }
    
    .scorecard-row {
        padding: 0.35rem 0.4rem;
        grid-template-columns: 1fr 32px 40px;
        gap: 0.25rem;
    }
    
    .category-name {
        font-size: 0.8rem;
    }
    
    .category-name i {
        margin-right: 0.25rem;
        font-size: 0.85rem;
    }
    
    .category-hint {
        display: none;
    }
    
    .category-score {
        font-size: 0.85rem;
        min-width: 32px;
    }
    
    .category-potential {
        font-size: 0.7rem;
        min-width: 40px;
    }
    
    .scorecard-subtotal {
        padding: 0.35rem 0.4rem;
        margin-top: 0.25rem;
    }
    
    .subtotal-row {
        padding: 0.2rem 0;
        font-size: 0.75rem;
    }
    
    .subtotal-row.bonus-row {
        margin-top: 0.25rem;
        padding-top: 0.35rem;
    }
    
    .bonus-progress {
        font-size: 0.7rem;
    }
    
    .subtotal-value {
        font-size: 0.95rem;
    }
    
    .scorecard-grand-total {
        padding: 0.45rem 0.6rem;
        margin-top: 0.4rem;
    }
    
    .grand-total-label {
        font-size: 0.9rem;
    }
    
    .grand-total-value {
        font-size: 1.3rem;
    }
    
    .modal-content {
        padding: 1.25rem;
    }
    
    .modal-content h2 {
        font-size: 1.2rem;
    }
    
    /* Menu title styles handled by shared game-menu.css */
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus,
.scorecard-row:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .scorecard-row {
        border: 2px solid var(--text-dark);
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* ============================================================================
   CHEAT CODE - LUCKY MODE
   ============================================================================ */

.cheat-code-letter {
    display: inline-block;
    user-select: none;
}

.cheat-code-letter:hover {
    cursor: pointer;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}
