/* Nonogram Game Styles */

/* Moving Title Display */
.moving-title-display {
    position: fixed;
    top: 64px; /* Position right below navbar */
    left: 0;
    right: 0;
    height: 40px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    z-index: 100;
    display: flex;
    align-items: center;
}

.moving-title-track {
    display: flex;
    align-items: center;
    white-space: nowrap;
    animation: moveTitle 60s linear infinite;
    gap: 3rem;
}

.moving-title-item {
    font-family: 'Courier New', 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    flex-shrink: 0;
    text-transform: uppercase;
}

@keyframes moveTitle {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* Game Container */
.game-container {
    /* Layout positioning handled by layout-game.css */
    padding: 1rem 0;
    overflow: hidden;
    /* Height and centering handled by layout-game.css for mobile */
}

/* Animated Background Elements */
.game-bg-element {
    position: absolute;
    border-radius: 20px;
    opacity: 0.15;
    animation: rotateAndShift 20s ease-in-out infinite;
    z-index: -1;
}

.game-bg-element-1 {
    top: 10%;
    left: 5%;
    width: 180px;
    height: 180px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    background-size: 400% 400%;
    animation-delay: 0s;
}

.game-bg-element-2 {
    top: 60%;
    right: 10%;
    width: 140px;
    height: 140px;
    background: linear-gradient(45deg, #feca57, #ff9ff3, #54a0ff, #5f27cd);
    background-size: 400% 400%;
    animation-delay: -7s;
    animation-direction: reverse;
}

.game-bg-element-3 {
    bottom: 15%;
    left: 15%;
    width: 120px;
    height: 120px;
    background: linear-gradient(45deg, #00d2d3, #ff9f43, #10ac84, #ee5a24);
    background-size: 400% 400%;
    animation-delay: -14s;
}

.game-bg-element-4 {
    top: 30%;
    right: 25%;
    width: 100px;
    height: 100px;
    background: linear-gradient(45deg, #ff3838, #ff6348, #ff4757, #ff3742);
    background-size: 400% 400%;
    animation-delay: -3s;
}

@keyframes rotateAndShift {
    0% {
        transform: rotate(0deg) scale(1);
        background-position: 0% 50%;
    }
    25% {
        transform: rotate(90deg) scale(1.1);
        background-position: 100% 50%;
    }
    50% {
        transform: rotate(180deg) scale(0.9);
        background-position: 100% 100%;
    }
    75% {
        transform: rotate(270deg) scale(1.05);
        background-position: 0% 100%;
    }
    100% {
        transform: rotate(360deg) scale(1);
        background-position: 0% 50%;
    }
}

.game-wrapper {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

/* Allow wider wrapper for hard mode on desktop */
@media (min-width: 1024px) {
    .game-wrapper {
        max-width: 900px;
    }
}

/* Game Board Frame */
.game-board-frame {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px var(--shadow);
    overflow: hidden;
    width: 100%;
    max-width: 600px;
}

/* Board Header */
.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1.5rem;
    background: var(--neutral-50);
    border-bottom: 1px solid var(--border);
}

/* Easy Board - Make it bigger on desktop to fill more screen space */
@media (min-width: 1025px) {
    .difficulty-easy .game-board-frame {
        max-width: 800px; /* Much larger for easy 10x5 boards */
    }
    
    .difficulty-easy .game-board-container {
        padding: 2.5rem; /* More generous padding */
    }
    
    .difficulty-easy .grid-cell {
        width: 56px; /* Larger cells for better visibility */
        height: 56px;
    }
    
    .difficulty-easy .column-clues .clue-cell {
        width: 56px;
        height: 32px;
        min-width: 56px;
        min-height: 32px;
        font-size: 1.1rem; /* Larger text */
    }
    
    .difficulty-easy .row-clues .clue-cell {
        width: 32px;
        height: 56px;
        min-width: 32px;
        min-height: 56px;
        font-size: 1.1rem;
    }
    
    .difficulty-easy .corner-cell {
        width: 112px; /* Large corner cell */
        height: 64px;
    }
    
    /* Medium Board - Make it bigger on desktop (but not as big as easy) */
    .difficulty-medium .game-board-frame {
        max-width: 580px; /* Smaller size for better balance */
    }
    
    .difficulty-medium .game-board-container {
        padding: 1.5rem; /* Reduced padding for more compact feel */
    }
    
    .difficulty-medium .grid-cell {
        width: 42px; /* Smaller cells for better proportions */
        height: 42px;
    }
    
    .difficulty-medium .column-clues .clue-cell {
        width: 42px;
        height: 24px;
        min-width: 42px;
        min-height: 24px;
        font-size: 0.95rem; /* Slightly smaller text */
    }
    
    .difficulty-medium .row-clues .clue-cell {
        width: 24px;
        height: 42px;
        min-width: 24px;
        min-height: 42px;
        font-size: 0.95rem;
    }
    
    .difficulty-medium .corner-cell {
        width: 84px; /* Proportionally smaller corner cell */
        height: 48px;
    }
}

.board-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    flex: 1;
}

.board-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    justify-content: flex-end;
}

/* Difficulty display now only in footer stats - no header section needed */

/* Ensure controls are visible on desktop */
@media (min-width: 1024px) {
    .board-controls,
    .board-actions {
        gap: 1.5rem;
    }
}

.game-btn {
    background: var(--primary-600);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px; /* Equal width for all game buttons */
}

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

.game-btn.primary {
    background: var(--accent-600);
}

.game-btn.primary:hover {
    background: var(--accent-700);
}

.game-btn:disabled {
    background: var(--neutral-300);
    color: var(--neutral-500);
    cursor: not-allowed;
    transform: none;
}

.game-btn:disabled:hover {
    background: var(--neutral-300);
    transform: none;
}

/* Undo Button - Neutral Color (matching 2048 game) */
#undo-btn {
    background: var(--neutral-600);
    color: var(--white);
    border-color: var(--neutral-600);
    min-width: 100px;
    white-space: nowrap;
}

#undo-btn:hover {
    background: var(--neutral-700);
    border-color: var(--neutral-700);
    transform: translateY(-1px);
}

#undo-btn:disabled {
    background: var(--neutral-300);
    color: var(--neutral-500);
    border-color: var(--neutral-300);
    cursor: not-allowed;
    transform: none;
}

#undo-btn:disabled:hover {
    background: var(--neutral-300);
    border-color: var(--neutral-300);
    transform: none;
}



/* Game Board Container */
.game-board-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
}

/* More compact padding for larger boards on desktop */
@media (min-width: 1024px) {
    .game-board-container {
        padding: 0.5rem;
    }
}

/* Nonogram Board - CSS Grid Layout */
.nonogram-board {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr;
    gap: 0;
    align-items: end;
    justify-items: center;
}

/* Corner cell (top-left) */
.corner-cell {
    width: 80px;
    height: 40px;
    grid-column: 1;
    grid-row: 1;
}

/* Larger corner cell for hard difficulty on desktop */
@media (min-width: 1024px) {
    .corner-cell {
        width: 54px;
        height: 27px;
    }
}

/* Column clues (top) */
.column-clues {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    align-items: end;
    justify-content: end;
    /* Account for game-grid border and padding offset */
    padding-left: 4px; /* 2px border + 2px padding of game-grid */
}

/* Row clues (left) */
.row-clues {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 1px;
    align-items: end;
    justify-content: start; /* Align to start to match grid alignment */
    margin-bottom: 1px; /* Account for game grid bottom spacing */
}

/* Fine-tune first row clue alignment */
.row-clues .clue-row:first-child {
    margin-top: 2px; /* Account for game-grid border and padding */
}

/* Clue rows */
.clue-row {
    display: flex;
    gap: 1px;
}

/* Game grid */
.game-grid {
    grid-column: 2;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 1px;
    background: var(--border);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 2px;
    position: relative;
}

/* Clue cells */
.clue-cell {
    background: var(--surface-variant);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    transition: all 0.2s ease;
    /* Ensure no default margins affect alignment */
    margin: 0;
    box-sizing: border-box;
}

/* Hide empty clue cells */
.clue-cell:empty {
    visibility: hidden;
}

/* Completed clue styling (green) */
.clue-cell.clue-completed {
    background: var(--success-100);
    border-color: var(--success-500);
    color: var(--success-700);
    font-weight: 700;
}

/* Incorrect clue styling (red) */
.clue-cell.clue-incorrect {
    background: var(--error-100);
    border-color: var(--error-500);
    color: var(--error-700);
    font-weight: 700;
}

/* Column clue cells (top) */
.column-clues .clue-cell {
    width: 32px;
    height: 20px;
    min-width: 32px;
    min-height: 20px;
}

/* Row clue cells (left) */
.row-clues .clue-cell {
    width: 20px;
    height: 32px;
    min-width: 20px;
    min-height: 32px;
}

/* Larger clue cells for hard difficulty on desktop - scaled down for viewport fit */
@media (min-width: 1024px) {
    .column-clues .clue-cell {
        width: 24px;
        height: 16px;
        min-width: 24px;
        min-height: 16px;
    }
    
    .row-clues .clue-cell {
        width: 16px;
        height: 24px;
        min-width: 16px;
        min-height: 24px;
    }
}

/* Game Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 1px;
    background: var(--border);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 2px;
    background: var(--border);
}

.grid-cell {
    width: 32px;
    height: 32px;
    background: var(--surface);
    border: none;
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Larger cells for hard difficulty on desktop - scaled down for viewport fit */
@media (min-width: 1024px) {
    .grid-cell {
        width: 24px;
        height: 24px;
    }
}

.grid-cell:hover {
    background: var(--surface-hover);
    transform: scale(1.05);
}

.grid-cell.filled {
    background: var(--primary-600);
    color: white;
}

.grid-cell.solution {
    background: rgba(255, 255, 0, 0.3); /* Light yellow overlay for solution */
    border: 2px solid #ffeb3b;
}

.grid-cell.crossed {
    background: var(--surface);
    color: var(--text-secondary);
}

.grid-cell.crossed::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 80%;
    background: var(--error-500);
    transform: translate(-50%, -50%) rotate(45deg);
}

.grid-cell.crossed::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 80%;
    background: var(--error-500);
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Darker dividing lines - dynamically positioned by JavaScript */
.game-grid .divider-vertical {
    position: absolute;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--border);
    z-index: 1;
    pointer-events: none;
}

.game-grid .divider-horizontal {
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--border);
    z-index: 1;
    pointer-events: none;
}

/* Board Footer */
.board-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

/* Game Controls */
.game-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mouse-icon {
    width: 20px;
    height: 20px;
    opacity: 0.6;
    filter: grayscale(1);
    transition: all 0.2s ease;
}

.mouse-icon:hover {
    opacity: 0.8;
    filter: grayscale(0.5);
}

/* Desktop only - hide on mobile/tablet */
.desktop-only {
    display: block;
}

@media (max-width: 1024px) {
    .desktop-only {
        display: none;
    }
    
    .control-group {
        gap: 0.25rem;
    }
    
    .game-controls {
        gap: 0.75rem;
    }
    
    /* Better touch interaction */
    .grid-cell {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
    
    .control-btn {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
}

.control-btn {
    background: var(--surface-variant);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.control-btn.active {
    background: var(--primary-100);
    border-color: var(--primary-500);
    color: var(--primary-700);
}

/* Fill button - looks like a filled grid cell */
#fill-btn {
    background: var(--primary-600);
    color: white;
    border-color: var(--primary-700);
}

#fill-btn:hover {
    background: var(--primary-700);
    transform: translateY(-1px);
}

#fill-btn.active {
    background: var(--primary-800);
    border-color: var(--primary-900);
    box-shadow: 0 0 0 2px var(--primary-300);
}

/* Cross button - looks like crossed grid cell with X pattern */
#cross-btn {
    background: var(--surface);
    color: var(--text-secondary);
    border-color: var(--border);
    position: relative;
}

#cross-btn:hover {
    background: var(--surface-hover);
    transform: translateY(-1px);
}

#cross-btn.active {
    background: var(--surface);
    border-color: var(--error-500);
    box-shadow: 0 0 0 2px var(--error-200);
}

/* Cross button X pattern - matches grid-cell.crossed */
#cross-btn::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 80%;
    background: var(--error-500);
    transform: translate(-50%, -50%) rotate(45deg);
}

#cross-btn::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 80%;
    background: var(--error-500);
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Hide the text icon for cross button since we're using CSS X */
#cross-btn .control-icon {
    opacity: 0;
}

.control-icon {
    font-size: 1.2rem;
    font-weight: bold;
}

/* Game Stats */
.game-stats {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.stat-item {
    text-align: center;
    background: var(--surface);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 80px;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0;
}

.stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}



/* Game Overlay Modal */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.game-overlay.active {
    display: flex;
}

.overlay-content {
    background: var(--surface);
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px var(--shadow);
    border: 1px solid var(--border);
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.overlay-content h2 {
    margin: 0 0 1.5rem 0;
    color: var(--text-primary);
    font-size: 1.8rem;
    text-align: center;
}

/* Congratulations message styling */
#overlay-message {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-600);
    text-align: center;
    margin-bottom: 1rem;
}

.congratulations-message {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

/* Modal buttons container */
.modal-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}



.points-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.points-1 { background: var(--success-500); }
.points-2 { background: var(--warning-500); }
.points-3 { background: var(--error-500); }

/* Points Explanation */
.points-explanation {
    background: var(--surface-variant);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.points-explanation h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.points-explanation ul {
    margin: 0;
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.points-explanation li {
    margin-bottom: 0.5rem;
}

/* Score Breakdown */
.score-breakdown { margin: 1rem 0 1.5rem 0; text-align: left; }
.score-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.score-item { 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 0.5rem 0.75rem; 
    border: 1px solid var(--border); 
    border-radius: 8px; 
    background: var(--surface); 
    width: 100%;
}
.score-item .label { 
    color: var(--text-primary); 
    font-weight: 600; 
    flex: 1;
    text-align: left;
}
.score-item .value { 
    color: var(--accent-700); 
    font-weight: 700; 
    text-align: right; 
    flex-shrink: 0;
    margin-left: auto;
}
.score-item.bonus { 
    background: var(--accent-50); 
    border-color: var(--accent-200); 
}
.score-item.bonus .label {
    color: var(--text-primary); 
    font-weight: 600; 
    flex: 1;
    text-align: left;
}
.score-item.bonus .value { 
    color: var(--accent-700); 
    font-weight: 700; 
    text-align: right; 
    flex-shrink: 0;
    margin-left: auto;
}

/* Force flex display for bonus items to override any inline styles */
.score-item.bonus[style*="display: flex"],
.score-item.bonus {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

/* Ensure hidden elements are properly hidden */
.score-item.hidden,
.score-item[hidden] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Additional specificity for bonus items */
.score-item.bonus.hidden,
.score-item.bonus[hidden] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}



/* Difficulty Selection Modal */
.difficulty-selection {
    margin-bottom: 1.5rem;
}

.difficulty-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.difficulty-card {
    background: var(--neutral-50);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    position: relative;
}

.difficulty-card:hover {
    background: var(--primary-50);
    border-color: var(--primary-300);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.difficulty-card:active,
.difficulty-card.selected {
    background: var(--primary-100);
    border-color: var(--primary-500);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(0);
}

.difficulty-info {
    flex: 1;
    text-align: left;
}

.difficulty-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.difficulty-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.3;
}

.difficulty-mobile-warning {
    font-size: 0.75rem;
    color: var(--warning-600);
    font-weight: 600;
    margin-top: 0.25rem;
    display: none; /* Hidden by default, shown on mobile via JS */
}

.difficulty-card.mobile-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.difficulty-card.mobile-disabled:hover {
    background: var(--neutral-50);
    border-color: var(--border);
    transform: none;
    box-shadow: none;
}

/* Hide mobile warning on desktop */
@media (min-width: 1025px) {
    .difficulty-mobile-warning {
        display: none !important;
    }
}

.difficulty-points {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--white);
    flex-shrink: 0;
    transition: transform 0.2s ease;
    margin-right: 1rem;
}

.difficulty-card:hover .difficulty-points {
    transform: scale(1.1);
}

.points-1 {
    background: linear-gradient(135deg, #4ade80, #22c55e);
}

.points-2 {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.points-3 {
    background: linear-gradient(135deg, #f87171, #ef4444);
}

/* Bonus Points Info */
.bonus-info {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    margin-top: 0.5rem;
}

.bonus-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.bonus-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary-100);
}

.bonus-icon svg {
    color: var(--primary-600);
}

.bonus-header h3 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.bonus-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bonus-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--neutral-50);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.bonus-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.bonus-value {
    color: var(--accent-700);
    font-size: 0.875rem;
    font-weight: 700;
    background: var(--accent-100);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    min-width: 32px;
    text-align: center;
}

/* Modal Header */
.modal-header {
    margin-bottom: 1.5rem;
}

.modal-title {
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    font-weight: 700;
    text-shadow: 0 1px 2px var(--text-shadow);
    text-align: center;
}

.modal-subtitle {
    color: var(--text-secondary);
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    text-align: center;
}

/* Game Stats Section */
.game-stats-section {
    margin-bottom: 1.5rem;
}

.main-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--neutral-50);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.stat-card.primary {
    background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
    border-color: var(--primary-200);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.25rem;
}

.stat-icon svg {
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.stat-icon svg[fill="currentColor"] {
    fill: var(--text-secondary);
}

.stat-card.primary .stat-icon svg {
    color: var(--primary-600);
}

.stat-card.primary .stat-icon svg[fill="currentColor"] {
    fill: var(--primary-600);
}

.stat-card:hover .stat-icon svg {
    color: var(--primary-500);
}

.stat-card:hover .stat-icon svg[fill="currentColor"] {
    fill: var(--primary-500);
}

.stat-content {
    text-align: center;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
}

.modal-actions .game-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.modal-actions .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-actions .btn-icon img {
    filter: brightness(0) invert(0.7);
    transition: filter 0.2s ease;
}

.modal-actions .btn-icon svg {
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.modal-actions .game-btn.primary .btn-icon img {
    filter: brightness(0) invert(1);
}

.modal-actions .game-btn.primary .btn-icon svg {
    color: var(--white);
}

.modal-actions .game-btn:hover .btn-icon img {
    filter: brightness(0) invert(1);
}

.modal-actions .game-btn:hover .btn-icon svg {
    color: var(--white);
}

.modal-actions .btn-text {
    font-weight: 600;
}

.game-btn.secondary {
    background: var(--neutral-600);
    color: var(--white);
    border-color: var(--neutral-600);
}

.game-btn.secondary:hover {
    background: var(--neutral-700);
    border-color: var(--neutral-700);
    transform: translateY(-1px);
}

/* Login Prompt */
.login-prompt {
    margin-bottom: 1.5rem;
}

.login-prompt-content {
    background: var(--warm-50);
    border: 1px solid var(--warm-200);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.login-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}

.login-icon svg {
    color: var(--text-secondary);
}

.login-text {
    text-align: left;
    flex: 1;
}

.login-text h3 {
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.login-text p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Modal Close Button */
.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--neutral-200);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close-btn:hover {
    background: var(--neutral-300);
    color: var(--text-primary);
    transform: scale(1.1);
}

.modal-close-btn:active {
    transform: scale(0.95);
}

/* Responsive Design */
@media (max-width: 768px) {
    .moving-title-display {
        height: 32px;
        top: 64px; /* Still below navbar on mobile */
    }
    
    .moving-title-item {
        font-size: 0.875rem;
    }
    
    /* Overall layout adjustments */
    .game-container {
        padding: 0.5rem 0;
        /* Height and centering handled by layout-game.css */
    }
    
    .game-wrapper {
        max-width: 100%;
        gap: 1rem;
    }
    
    .game-board-frame {
        padding: 0.75rem;
        max-width: 100%;
        margin: 0 auto; /* Bottom margin removed - handled by layout-game.css height calculations */
    }
    
    /* Compact board container */
    .game-board-container {
        padding: 0.75rem 0.5rem;
    }
    
    /* Tightly packed, compact clue cells */
    .clue-cell {
        min-width: 14px;
        min-height: 14px;
        font-size: 0.55rem;
        padding: 0.1rem 0.15rem;
        border: 1px solid var(--border);
        border-radius: 2px;
        font-weight: 600;
    }
    
    /* Specific sizing for column clues */
    .column-clues .clue-cell {
        width: 28px;
        height: 14px;
        min-width: 28px;
        min-height: 14px;
    }
    
    /* Specific sizing for row clues - exact match with grid cells */
    .row-clues .clue-cell {
        width: 14px;
        height: 28px;
        min-width: 14px;
        min-height: 28px;
        /* Ensure exact alignment with grid cells */
        box-sizing: border-box;
    }
    
    /* Clue row spacing - match grid gap */
    .clue-row {
        gap: 1px; /* Match game-grid gap */
    }
    
    /* Adjust corner cell for mobile */
    .corner-cell {
        width: 42px;
        height: 28px;
    }
    
    /* Column clues container - match grid gap exactly */
    .column-clues {
        gap: 1px; /* Match game-grid gap */
    }
    
    /* Row clues container - match grid gap exactly */
    .row-clues {
        gap: 1px; /* Match game-grid gap */
        margin-bottom: 1px; /* Account for game grid bottom spacing */
    }
    
    /* Fine-tune first row clue alignment on mobile */
    .row-clues .clue-row:first-child {
        margin-top: 1px;
    }
    
    /* Keep same grid cell size as requested */
    .grid-cell {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
    
    /* Header adjustments */
    .board-header {
        padding: 0.5rem 1rem;
        margin-bottom: 0.75rem;
    }
    
    .board-controls,
    .board-actions {
        flex: none;
    }
    
    /* Difficulty section removed from template - no need to hide */
    
    /* Footer and controls */
    .board-footer {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .game-controls {
        justify-content: center;
        gap: 1rem;
    }
    
    /* Game stats on mobile */
    .game-stats {
        gap: 1rem;
        width: 100%;
        justify-content: center;
    }
    
    .game-stats .stat-item {
        flex: 1;
        min-width: 0; /* Allow text to wrap if needed */
    }
    
    /* Control buttons - better touch targets */
    .control-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0.6rem;
    }
    
    /* Game buttons */
    .game-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }
    
    /* Mouse icons - hide on mobile */
    .mouse-icon {
        display: none;
    }
    
    /* Game title */
    .game-title {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    /* Even more compact for small phones */
    .game-container {
        padding: 0.25rem 0;
        /* Height and centering handled by layout-game.css */
    }
    
    .game-wrapper {
        padding: 0;
        gap: 0.75rem;
    }
    
    .game-board-frame {
        padding: 0.5rem;
    }
    
    .game-board-container {
        padding: 0.5rem 0.25rem;
    }
    
    /* Ultra-compact clue cells */
    .clue-cell {
        min-width: 12px;
        min-height: 12px;
        font-size: 0.5rem;
        padding: 0.05rem 0.1rem;
        font-weight: 700;
    }
    
    /* Column clues for small screens */
    .column-clues .clue-cell {
        width: 24px;
        height: 12px;
        min-width: 24px;
        min-height: 12px;
    }
    
    /* Row clues for small screens - exact match with grid cells */
    .row-clues .clue-cell {
        width: 12px;
        height: 24px;
        min-width: 12px;
        min-height: 24px;
        /* Ensure exact alignment with grid cells */
        box-sizing: border-box;
    }
    
    /* Match grid spacing exactly */
    .clue-row {
        gap: 1px; /* Match game-grid gap */
    }
    
    .column-clues,
    .row-clues {
        gap: 1.25px; /* Match game-grid gap */
    }
    
    /* Ensure bottom spacing on small mobile */
    .row-clues {
        margin-bottom: 1px;
    }
    
    /* Fine-tune first row clue alignment on small mobile */
    .row-clues .clue-row:first-child {
        margin-top: 0.5px;
    }
    
    /* Adjust corner cell */
    .corner-cell {
        width: 36px;
        height: 24px;
    }
    
    /* Keep grid cells as requested */
    .grid-cell {
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
    }
    
    /* Compact header */
    .board-header {
        padding: 0.4rem 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    /* Difficulty section removed from template - no longer needed */
    
    /* Compact footer */
    .board-footer {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    
    .game-controls {
        gap: 0.75rem;
    }
    
    /* Game stats equal width on small mobile */
    .game-stats .stat-item {
        flex: 1;
        min-width: 0;
    }
    
    /* Smaller control buttons for tiny screens */
    .control-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 0.5rem;
    }
    
    .game-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    /* Modal adjustments */
    .overlay-content {
        padding: 1.25rem;
        margin: 0.75rem;
    }
    
    .game-title {
        font-size: 1.5rem;
    }
    
    .modal-title {
        font-size: 1.5rem;
    }
    
    .main-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.75rem 0.5rem;
    }
    
    .stat-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .stat-card .stat-value {
        font-size: 1rem;
    }
    
    .stat-card .stat-label {
        font-size: 0.7rem;
    }
    
    .modal-actions {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .modal-actions .game-btn {
        flex: 1;
        justify-content: center;
    }
    
    /* Change "Points Earned" to just "Points" on mobile */
    .stat-card.primary .stat-label {
        font-size: 0;
    }
    
    .stat-card.primary .stat-label::after {
        content: "Points";
        font-size: 0.7rem;
    }
    
    /* Change "View Leaderboard" to just "Leaderboard" on mobile */
    #leaderboard-btn .btn-text {
        font-size: 0;
    }
    
    #leaderboard-btn .btn-text::after {
        content: "Leaderboard";
        font-size: 0.875rem;
        font-weight: 600;
    }
    
    .login-prompt-content {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .login-icon svg {
        width: 24px;
        height: 24px;
    }
    
    /* Mobile difficulty modal adjustments */
    .difficulty-grid {
        gap: 0.5rem;
    }
    
    .difficulty-card {
        padding: 0.875rem 1rem;
        gap: 0.75rem;
    }
    
    .difficulty-name {
        font-size: 1rem;
    }
    
    .difficulty-desc {
        font-size: 0.8rem;
    }
    
    .difficulty-points {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
        margin-right: 0.75rem;
    }
    
    .bonus-info {
        padding: 1rem;
        margin-top: 0.75rem;
    }
    
    .bonus-header {
        margin-bottom: 0.75rem;
    }
    
    .bonus-icon {
        width: 28px;
        height: 28px;
    }
    
    .bonus-icon svg {
        width: 16px;
        height: 16px;
    }
    
    .bonus-header h3 {
        font-size: 0.9rem;
    }
    
    .bonus-item {
        padding: 0.5rem 0.75rem;
    }
    
    .bonus-label {
        font-size: 0.8rem;
    }
    
    .bonus-value {
        font-size: 0.8rem;
        padding: 0.2rem 0.4rem;
        min-width: 28px;
    }
}
