/**
 * Games Styles - UVU Review Theme
 * Wordle, 2048, Sudoku, Crossword
 *
 * @package UVU_Review
 * @since 1.0.0
 */

/* ============================================
   Games Hub
   ============================================ */
.games-hub {
    padding: 2rem 0;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(var(--games-columns, 2), 1fr);
    gap: 1.5rem;
}

.game-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    transition: all 0.3s ease;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .game-card {
    background: #1e1e1e;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.game-card-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--theme-primary-color);
    border-radius: 16px;
    margin-bottom: 1.25rem;
}

.game-card-icon i {
    font-size: 2.5rem;
    color: #fff;
}

.game-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 0.5rem;
}

.game-card-desc {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    margin: 0 0 1rem;
    line-height: 1.5;
}

[data-theme="dark"] .game-card-desc {
    color: #999;
}

.game-card-cta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--theme-primary-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.game-card-cta i {
    transition: transform 0.3s ease;
}

.game-card:hover .game-card-cta i {
    transform: translateX(4px);
}

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

/* ============================================
   Common Game Styles
   ============================================ */
.game-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 1.5rem;
    /* background: #fff; */
    border-radius: 12px;
    /* box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); */
    position: relative;
}

/* [data-theme="dark"] .game-container {
    background: #1a1a1a;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
} */

.game-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.game-title-area {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.game-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

.game-title i {
    color: var(--theme-primary-color);
}

.game-scores {
    display: flex;
    gap: 0.75rem;
}

.score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--theme-primary-color);
    border-radius: 6px;
    color: #fff;
}

.score-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.score-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.game-controls {
    display: flex;
    gap: 0.5rem;
}

.game-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    background: var(--theme-secondary-color);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.game-btn:hover {
    background: var(--theme-dark-mode-accent-hover);
}

[data-theme="dark"] .game-btn:hover {
    background: hsl(from var(--theme-secondary-color) h s l / 0.5);
}

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

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

.game-btn.primary:hover {
    background: var(--theme-primary-hover-color);
}

.game-btn.share-btn {
    background: var(--theme-primary-color);
}

.game-btn.share-btn:hover {
    background: var(--theme-primary-hover-color);
}

.game-stats-bar {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.game-stats-bar .stat-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

[data-theme="dark"] .game-stats-bar {
    color: #999;
}

.game-instructions {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    font-size: 0.9rem;
    color: #666;
}

[data-theme="dark"] .game-instructions {
    background: rgba(255, 255, 255, 0.05);
    color: #999;
}

/* Game Toast */
.game-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 1rem 2rem;
    background: #1f2937;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.game-toast.visible {
    opacity: 1;
}

/* Game Modal */
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    position: relative;
    max-width: 400px;
    width: 100%;
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
}

[data-theme="dark"] .modal-content {
    background: #2a2a2a;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

[data-theme="dark"] .modal-close {
    color: #999;
}

[data-theme="dark"] .modal-close:hover {
    color: #fff;
}

.modal-title {
    font-size: 1.5rem;
    margin: 0 0 1rem;
    color: var(--text-color);
}

.modal-stats {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.modal-stats .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-stats .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
}

.modal-stats .stat-label {
    font-size: 0.75rem;
    color: #666;
}

[data-theme="dark"] .modal-stats .stat-label {
    color: #999;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Game Overlay */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 100;
}

.overlay-content {
    text-align: center;
    color: #fff;
    padding: 2rem;
}

.overlay-title {
    font-size: 2rem;
    margin: 0 0 0.5rem;
    color: var(--theme-primary-color);
}

.overlay-message {
    font-size: 1rem;
    margin: 0 0 1rem;
    opacity: 0.9;
}

.overlay-score {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

/* ============================================
   Wordle Specific Styles
   ============================================ */

/* Wordle Menu Screen - NYT Style */
.wordle-menu-screen {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.wordle-logo {
    text-align: center;
    margin-bottom: 2.5rem;
}

/* Logo tiles - classic Wordle style with UVU colors */
.logo-tiles {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.logo-tile {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    border-radius: 4px;
    text-transform: uppercase;
}

/* UVU Green - correct position */
.logo-tile.tile-green {
    background: var(--theme-primary-color, #275d38);
}

/* UVU Gold/Yellow - present but wrong position */
.logo-tile.tile-yellow {
    background: #c9b458;
}

/* Legacy classes for help modal */
.logo-tile.correct {
    background: #6aaa64;
}

.logo-tile.present {
    background: #c9b458;
}

.wordle-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1b;
    margin: 0 0 0.5rem;
}

.wordle-tagline {
    font-size: 0.9rem;
    color: #5a5a5c;
    margin: 0;
}

[data-theme="dark"] .wordle-title {
    color: #ffffff;
}

[data-theme="dark"] .wordle-tagline {
    color: #818384;
}

.wordle-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 350px;
}

.wordle-menu-btn {
    display: flex;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: #fff;
    border: 2px solid #d3d6da;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
}

.wordle-menu-btn:hover {
    border-color: var(--theme-primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wordle-menu-btn.completed {
    opacity: 0.6;
    cursor: not-allowed;
}

.wordle-menu-btn.completed:hover {
    transform: none;
    box-shadow: none;
    border-color: #d3d6da;
}

.wordle-menu-btn.completed .menu-btn-text small {
    color: #6aaa64;
}

[data-theme="dark"] .wordle-menu-btn {
    background: #2a2a2a;
    border-color: #3a3a3a;
}

[data-theme="dark"] .wordle-menu-btn:hover {
    border-color: var(--theme-primary-color);
}

[data-theme="dark"] .wordle-menu-btn.completed:hover {
    border-color: #3a3a3a;
}

.menu-btn-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--theme-primary-color);
    border-radius: 10px;
    margin-right: 1rem;
    flex-shrink: 0;
}

.menu-btn-icon i {
    font-size: 1.5rem;
    color: #fff;
}

.menu-btn-text {
    flex: 1;
}

.menu-btn-text strong {
    display: block;
    font-size: 1.1rem;
    color: #1a1a1b;
    margin-bottom: 0.25rem;
}

.menu-btn-text small {
    font-size: 0.85rem;
    color: #5a5a5c;
}

[data-theme="dark"] .menu-btn-text strong {
    color: #ffffff;
}

[data-theme="dark"] .menu-btn-text small {
    color: #818384;
}

/* Wordle Game Screen */
.wordle-game-screen .game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #d3d6da;
}

[data-theme="dark"] .wordle-game-screen .game-header {
    border-bottom-color: #3a3a3a;
}

.wordle-game-screen .back-to-menu-btn {
    background: none;
    border: 1px solid #d3d6da;
    color: var(--text-color);
}

.wordle-game-screen .back-to-menu-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .wordle-game-screen .back-to-menu-btn {
    border-color: #3a3a3a;
}

[data-theme="dark"] .wordle-game-screen .back-to-menu-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Legacy mode toggle (can be removed if not needed) */
.game-mode-toggle {
    display: flex;
    gap: 0.5rem;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    background: #e5e7eb;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.mode-btn.active {
    background: var(--theme-primary-color);
    color: #fff;
}

.mode-btn.completed {
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
}

.mode-btn.completed::after {
    content: '✓';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: #6aaa64;
}

[data-theme="dark"] .mode-btn {
    background: #3a3a3a;
    color: #ccc;
}

[data-theme="dark"] .mode-btn.active {
    background: var(--theme-primary-color);
    color: #fff;
}

[data-theme="dark"] .mode-btn.completed::after {
    color: #6aaa64;
}

.wordle-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 1.5rem;
}

.wordle-row {
    display: flex;
    gap: 6px;
}

.wordle-tile {
    width: 58px;
    height: 58px;
    border: 2px solid #d3d6da;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.1s ease;
    color: #1a1a1b;
    background: #fff;
}

[data-theme="dark"] .wordle-tile {
    border-color: #3a3a3a;
    color: #fff;
    background: #121213;
}

.wordle-tile.filled {
    border-color: #878a8c;
    animation: pop 0.1s ease;
}

.wordle-tile.correct {
    background: #6aaa64;
    border-color: #6aaa64;
    color: #fff;
}

.wordle-tile.present {
    background: #c9b458;
    border-color: #c9b458;
    color: #fff;
}

.wordle-tile.absent {
    background: #787c7e;
    border-color: #787c7e;
    color: #fff;
}

[data-theme="dark"] .wordle-tile.absent {
    background: #3a3a3c;
    border-color: #3a3a3c;
}

.wordle-tile.flip {
    animation: flip 0.5s ease forwards;
}

/* Ensure tile content is visible during transforms */
.wordle-board {
    perspective: 1000px;
}

.wordle-tile {
    transform-style: preserve-3d;
    backface-visibility: visible;
}

@keyframes pop {
    50% { transform: scale(1.1); }
}

@keyframes flip {
    0% { transform: rotateX(0deg); }
    50% { transform: rotateX(-90deg); }
    100% { transform: rotateX(0deg); }
}

/* Wordle Keyboard */
.wordle-keyboard {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.keyboard-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}

/* Wordle keyboard rows fill full width proportionally */
.wordle-keyboard .keyboard-row {
    width: 100%;
}

.wordle-keyboard .key-btn {
    flex: 1 1 0;
    min-width: 0;
}

.wordle-keyboard .key-btn.key-enter,
.wordle-keyboard .key-btn.key-back {
    flex: 1.5 1.5 0;
}

.spacer-half {
    flex: 0.5 0.5 0;
    pointer-events: none;
}

.key-btn {
    min-width: 43px;
    height: 58px;
    padding: 0 12px;
    font-size: 0.85rem;
    font-weight: 700;
    background: #d3d6da;
    color: #1a1a1b;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.1s ease;
    font-family: inherit;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

[data-theme="dark"] .key-btn {
    background: #818384;
    color: #fff;
}

.key-btn:hover {
    filter: brightness(0.9);
}

.key-btn.key-enter,
.key-btn.key-back {
    min-width: 65px;
    font-size: 0.75rem;
}

.key-btn.correct {
    background: #6aaa64;
    color: #fff;
}

.key-btn.present {
    background: #c9b458;
    color: #fff;
}

.key-btn.absent {
    background: #787c7e;
    color: #fff;
}

[data-theme="dark"] .key-btn.absent {
    background: #3a3a3c;
}

.spacer-half {
    width: 20px;
}

/* Help Examples */
.help-examples {
    margin-top: 1.5rem;
}

.help-examples h4 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: var(--text-color);
}

.help-examples p {
    margin: 0.5rem 0 1rem;
    font-size: 0.9rem;
    color: #666;
}

[data-theme="dark"] .help-examples p {
    color: #999;
}

.example-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin: 1rem 0 0.5rem;
}

/* Example tiles - explicit styles to ensure letters display */
.example-row .wordle-tile {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    border: 2px solid #d3d6da !important;
    background: #fff !important;
    color: #1a1a1b !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
}

[data-theme="dark"] .example-row .wordle-tile {
    border-color: #3a3a3a !important;
    background: #121213 !important;
    color: #fff !important;
}

/* Example tiles with color states - ensure white text */
.example-row .wordle-tile.correct {
    background: #6aaa64 !important;
    border-color: #6aaa64 !important;
    color: #fff !important;
}

.example-row .wordle-tile.present {
    background: #c9b458 !important;
    border-color: #c9b458 !important;
    color: #fff !important;
}

.example-row .wordle-tile.absent {
    background: #787c7e !important;
    border-color: #787c7e !important;
    color: #fff !important;
}

[data-theme="dark"] .example-row .wordle-tile.absent {
    background: #3a3a3c !important;
    border-color: #3a3a3c !important;
}

/* ============================================
   2048 Specific Styles
   ============================================ */
.game-2048 .game-title {
    background: var(--theme-primary-color);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 2rem;
}

.game-2048-board-container {
    padding: 10px;
    background: #e5e5e5;
    border-radius: 8px;
    margin-bottom: 1rem;
}

[data-theme="dark"] .game-2048-board-container {
    background: #1e1e1e;
}

.game-2048-board {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
}

.game-2048-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.game-2048-grid .grid-cell {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

[data-theme="dark"] .game-2048-grid .grid-cell {
    background: rgba(0, 0, 0, 0.25);
}

.game-2048-tiles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.tile-2048 {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    border-radius: 4px;
    transition: all 0.15s ease;
}

/* Original 2048 Light Theme Colors */
/* Custom UVU color scheme - exact match from original plugin */
.tile-2048[data-value="2"] { background: #c5d97a !important; color: #2d4a22 !important; }
.tile-2048[data-value="4"] { background: #c4d6c1 !important; color: #2d4a22 !important; }
.tile-2048[data-value="8"] { background: #78be3f !important; color: white !important; }
.tile-2048[data-value="16"] { background: #87c7ba !important; color: white !important; }
.tile-2048[data-value="32"] { background: #d2ac5f !important; color: white !important; }
.tile-2048[data-value="64"] { background: #b45336 !important; color: white !important; }
.tile-2048[data-value="128"] { background: linear-gradient(135deg, #78be3f, #87c7ba) !important; color: white !important; }
.tile-2048[data-value="256"] { background: linear-gradient(135deg, #87c7ba, #d2ac5f) !important; color: white !important; }
.tile-2048[data-value="512"] { background: linear-gradient(135deg, #d2ac5f, #b45336) !important; color: white !important; }
.tile-2048[data-value="1024"] { background: linear-gradient(135deg, #b45336, #78be3f) !important; color: white !important; }
.tile-2048[data-value="2048"] { background: linear-gradient(135deg, #78be3f, #d2ac5f) !important; color: white !important; box-shadow: 0 0 15px rgba(120, 190, 63, 0.5) !important; }
.tile-2048[data-value="4096"] { background: linear-gradient(135deg, #d2ac5f, #b45336, #78be3f) !important; color: white !important; }
.tile-2048[data-value="8192"] { background: linear-gradient(135deg, #78be3f, #87c7ba, #d2ac5f) !important; color: white !important; }

/* Dark theme tiles - exact match from original plugin */
[data-theme="dark"] .tile-2048[data-value="2"] { background: #3a3a39 !important; color: #d2ac5f !important; border: 1px solid #4a4a49 !important; }
[data-theme="dark"] .tile-2048[data-value="4"] { background: #4a4a49 !important; color: #e0c080 !important; border: 1px solid #5a5a59 !important; }
[data-theme="dark"] .tile-2048[data-value="8"] { background: #b45336 !important; color: white !important; }
[data-theme="dark"] .tile-2048[data-value="16"] { background: #87c7ba !important; color: white !important; }
[data-theme="dark"] .tile-2048[data-value="32"] { background: #d2ac5f !important; color: #1a1a19 !important; font-weight: 900 !important; }
[data-theme="dark"] .tile-2048[data-value="64"] { background: #78be3f !important; color: white !important; }
[data-theme="dark"] .tile-2048[data-value="128"] { background: linear-gradient(135deg, #b45336, #d2ac5f) !important; color: white !important; box-shadow: 0 0 10px rgba(180, 83, 54, 0.3) !important; }
[data-theme="dark"] .tile-2048[data-value="256"] { background: linear-gradient(135deg, #87c7ba, #b45336) !important; color: white !important; box-shadow: 0 0 10px rgba(135, 199, 186, 0.3) !important; }
[data-theme="dark"] .tile-2048[data-value="512"] { background: linear-gradient(135deg, #d2ac5f, #87c7ba) !important; color: white !important; box-shadow: 0 0 10px rgba(210, 172, 95, 0.3) !important; }
[data-theme="dark"] .tile-2048[data-value="1024"] { background: linear-gradient(135deg, #78be3f, #d2ac5f) !important; color: white !important; box-shadow: 0 0 12px rgba(120, 190, 63, 0.4) !important; }
[data-theme="dark"] .tile-2048[data-value="2048"] { background: linear-gradient(135deg, #d2ac5f, #78be3f, #87c7ba) !important; color: white !important; box-shadow: 0 0 20px rgba(210, 172, 95, 0.6) !important; border: 2px solid #d2ac5f !important; }
[data-theme="dark"] .tile-2048[data-value="4096"] { background: linear-gradient(135deg, #78be3f, #d2ac5f, #b45336) !important; color: white !important; box-shadow: 0 0 15px rgba(120, 190, 63, 0.4) !important; }
[data-theme="dark"] .tile-2048[data-value="8192"] { background: linear-gradient(135deg, #87c7ba, #78be3f, #d2ac5f) !important; color: white !important; box-shadow: 0 0 15px rgba(135, 199, 186, 0.4) !important; }

/* ============================================
   Sudoku Specific Styles
   ============================================ */
.difficulty-selector {
    display: flex;
    gap: 0.5rem;
}

.diff-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    background: #e5e7eb;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.diff-btn.active {
    background: var(--theme-primary-color);
    color: #fff;
}

[data-theme="dark"] .diff-btn {
    background: #3a3a3a;
    color: #ccc;
}

.sudoku-board-container {
    margin-bottom: 1rem;
}

.sudoku-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    background: #344861;
    padding: 3px;
    border-radius: 8px;
    max-width: 400px;
    margin: 0 auto;
}

[data-theme="dark"] .sudoku-board {
    background: #3a3a3a;
}

.sudoku-box {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: #bdc3c7;
}

[data-theme="dark"] .sudoku-box {
    background: #4a4a4a;
}

.sudoku-cell {
    aspect-ratio: 1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .sudoku-cell {
    background: #121211;
}

.sudoku-cell input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-color);
    caret-color: var(--theme-primary-color);
    /* Prevent global mobile input rules from stretching cells out of their aspect-ratio container */
    min-height: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
}

/* Override global dark input styles for sudoku cells */
[data-theme="dark"] .sudoku-cell input {
    background: transparent;
    border: none;
    color: #ccc;
}

.sudoku-cell input:focus {
    outline: none;
    background: rgba(0, 132, 61, 0.1);
}

[data-theme="dark"] .sudoku-cell input:focus {
    background: rgba(0, 132, 61, 0.25);
}

.sudoku-cell.fixed input {
    font-weight: 700;
    color: #1a1a1a;
}

[data-theme="dark"] .sudoku-cell.fixed input {
    color: #fff;
}

.sudoku-cell.selected {
    background: rgba(0, 132, 61, 0.25);
    box-shadow: inset 0 0 0 2px rgba(0, 132, 61, 0.85);
}

[data-theme="dark"] .sudoku-cell.selected {
    background: rgba(0, 132, 61, 0.35);
    box-shadow: inset 0 0 0 2px rgba(0, 200, 100, 0.9);
}

.sudoku-cell.error input {
    color: #ef4444;
}

.sudoku-cell.highlight {
    background: rgba(0, 132, 61, 0.08);
}

[data-theme="dark"] .sudoku-cell.highlight {
    background: rgba(0, 132, 61, 0.18);
}

/* Sudoku Number Pad */
.sudoku-numpad {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    max-width: 300px;
    margin: 0 auto;
}

.numpad-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    background: #d3d6da;
    color: #1a1a1b;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.numpad-btn:hover {
    background: #c4c7cb;
}

[data-theme="dark"] .numpad-btn {
    background: #3a3a3a;
    color: #fff;
}

[data-theme="dark"] .numpad-btn:hover {
    background: #4a4a4a;
}

.numpad-btn.erase-btn {
    background: #fee2e2;
    color: #dc2626;
}

.numpad-btn.erase-btn:hover {
    background: #fecaca;
}

/* ============================================
   Crossword Specific Styles
   ============================================ */
.crossword-game {
    max-width: 900px;
}

.crossword-game .game-header {
    flex-wrap: wrap;
    gap: 0.75rem;
}

.crossword-game .game-date {
    font-size: 0.9rem;
    color: #666;
}

[data-theme="dark"] .crossword-game .game-date {
    color: #999;
}

/* Hide game controls when loading or no puzzle */
.crossword-game:has(#crossword-loading:not([style*="none"])) .game-controls,
.crossword-game:has(#no-puzzle:not([style*="none"])) .game-controls,
.crossword-game:has(#crossword-loading:not([style*="none"])) .game-stats-bar,
.crossword-game:has(#no-puzzle:not([style*="none"])) .game-stats-bar {
    display: none;
}

.crossword-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #666;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--theme-primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.crossword-content {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 768px) {
    .crossword-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.crossword-grid-container {
    display: flex;
    justify-content: center;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.crossword-grid {
    display: inline-grid;
    gap: 1px;
    background: #1a1a1a;
    padding: 1px;
    border-radius: 4px;
    --cell-size: 40px;
}

.crossword-cell {
    width: var(--cell-size);
    height: var(--cell-size);
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.crossword-cell.blocked {
    background: #121211;
}

.crossword-cell:not(.blocked) {
    background: #fff;
}

[data-theme="dark"] .crossword-cell:not(.blocked) {
    background: #3a3a3a;
}

[data-theme="dark"] .crossword-cell input {
    color: #e5e5e5;
    background: transparent;
    border: none;
}

.crossword-cell input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    /* Input is invisible — letter display handled by .cell-letter span overlay.
       The input only exists to capture keyboard focus on mobile. */
    opacity: 0;
    caret-color: transparent;
}

.crossword-cell input:focus {
    outline: none;
}

/* Letter display overlay — positioned dead-center in cell, not subject to iOS input rendering bugs */
.crossword-cell .cell-letter {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: calc(var(--cell-size) * 0.58);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-color);
    pointer-events: none;
    z-index: 2;
    line-height: 1;
    user-select: none;
}

.crossword-cell.active .cell-letter {
    color: #1a1a1a;
}

[data-theme="dark"] .crossword-cell.active .cell-letter {
    color: #1a1a1a;
}

.crossword-cell .cell-number {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: 0.65rem;
    color: #666;
    pointer-events: none;
    line-height: 1;
    z-index: 1;
}

[data-theme="dark"] .crossword-cell .cell-number {
    color: #9f9f9f;
}

/* Selected word cells — light yellow tint */
.crossword-cell.highlight {
    background: #fef9c3;
}

[data-theme="dark"] .crossword-cell.highlight {
    background: rgba(234, 179, 8, 0.18);
}

/* Currently selected cell — vivid amber with inner ring to stand out */
.crossword-cell.active {
    background: #fbbf24;
    box-shadow: inset 0 0 0 2px #92400e;
}

.crossword-cell.active input {
    color: #1a1a1a;
}

[data-theme="dark"] .crossword-cell.active {
    background: rgba(251, 191, 36, 0.85);
    box-shadow: inset 0 0 0 2px rgba(146, 64, 14, 0.8);
}

[data-theme="dark"] .crossword-cell.active input {
    color: #1a1a1a;
}

/* Clues */
.crossword-clues {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
}

.clues-heading {
    font-size: 1rem;
    font-weight: 700;
    color: var(--theme-primary-color);
    border-bottom: 2px solid var(--theme-primary-color);
    margin: 0 0 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    background: var(--card-bg, #fff);
    padding: 0.25rem 0;
    z-index: 1;
}

[data-theme="dark"] .clues-heading {
    background: var(--card-bg, #121211);
}

.clues-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.clue-item {
    display: flex;
    gap: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.4;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.clue-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .clue-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.clue-item.active {
    background: rgba(59, 130, 246, 0.1);
}

.clue-number {
    font-weight: 600;
    color: var(--theme-primary-color);
    min-width: 20px;
}

.clue-text {
    color: var(--text-color);
}

/* Active Clue Banner — NYT-style strip shown on mobile between grid and keyboard */
.crossword-active-clue {
    display: none; /* hidden on desktop; shown on mobile via media query */
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: var(--theme-primary-color, #00843d);
    color: #fff;
    font-size: 0.875rem;
    line-height: 1.3;
    border-radius: 4px;
    margin: 0.5rem 0;
    min-height: 44px;
}

.active-clue-label {
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 0.85;
}

.active-clue-text {
    flex: 1;
}

/* Mobile Keyboard */
.crossword-keyboard {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* @media (max-width: 768px) {
    .crossword-keyboard {
        display: flex !important;
    }
} */

.crossword-keyboard .keyboard-row {
    gap: 4px;
}

.crossword-keyboard .key-btn {
    min-width: 30px;
    height: 44px;
    font-size: 0.8rem;
}

.crossword-keyboard .key-skip,
.crossword-keyboard .key-back {
    min-width: 50px;
}

/* No Puzzle Message */
.no-puzzle-message {
    text-align: center;
    padding: 3rem 2rem;
    color: #666;
}

.no-puzzle-message i {
    font-size: 4rem;
    color: var(--theme-primary-color);
    opacity: 0.3;
    margin-bottom: 1rem;
}

.no-puzzle-message h3 {
    margin: 0 0 0.5rem;
    color: var(--text-color);
}

/* ============================================
   CROSSWORD MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
    .crossword-game {
        padding: 0.5rem;
    }

    .crossword-grid {
        --cell-size: 28px;
    }

    .crossword-cell .cell-number {
        font-size: 0.5rem;
    }

    /* NYT-style mobile layout: show clue banner, hide full clue list */
    .crossword-active-clue {
        display: flex;
    }

    .crossword-clues {
        display: none;
    }
}

@media (max-width: 400px) {
    .crossword-grid {
        --cell-size: 24px;
    }

    .crossword-cell .cell-number {
        font-size: 0.45rem;
    }

    /* Crossword keyboard: flex: 1 handles width, keep height from 768px block */
    .crossword-keyboard .key-btn {
        height: 48px;
        font-size: 0.9rem;
    }
}

/* ============================================
   Leaderboard Styles
   ============================================ */
.leaderboard-wrapper {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

[data-theme="dark"] .leaderboard-wrapper {
    background: #1e1e1e;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.leaderboard-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--theme-primary-color);
    color: #fff;
}

.leaderboard-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    margin: 0;
    color: #fff;
}

.leaderboard-filters {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.filter-btn:hover,
.filter-btn.active {
    background: rgba(255, 255, 255, 0.3);
}

.leaderboard-content {
    padding: 0;
}

.leaderboard-empty {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.875rem 1rem;
    text-align: left;
}

.leaderboard-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .leaderboard-table th {
    color: #999;
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.1);
}

.leaderboard-table tbody tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.2s ease;
}

.leaderboard-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .leaderboard-table tbody tr {
    border-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .leaderboard-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.leaderboard-table .rank {
    font-weight: 600;
    color: #666;
}

.leaderboard-table .rank-medal {
    font-size: 1.25rem;
}

.leaderboard-table .player {
    font-weight: 500;
}

.leaderboard-table .score {
    font-weight: 700;
    color: var(--theme-primary-color);
}

.leaderboard-table .time,
.leaderboard-table .date {
    color: #666;
    font-size: 0.9rem;
}

[data-theme="dark"] .leaderboard-table .time,
[data-theme="dark"] .leaderboard-table .date {
    color: #999;
}

.leaderboard-table tr.top-1 .player {
    color: #fbbf24;
}

.leaderboard-table tr.top-2 .player {
    color: #9ca3af;
}

.leaderboard-table tr.top-3 .player {
    color: #d97706;
}

/* Leaderboard expand/collapse toggle */
.leaderboard-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--theme-primary-color, #00843d);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.leaderboard-toggle:hover {
    background: rgba(0, 132, 61, 0.05);
}

[data-theme="dark"] .leaderboard-toggle {
    border-top-color: rgba(255, 255, 255, 0.08);
    color: #22c55e;
}

[data-theme="dark"] .leaderboard-toggle:hover {
    background: rgba(34, 197, 94, 0.08);
}

.leaderboard-toggle .toggle-icon {
    font-size: 0.625rem;
    transition: transform 0.2s ease;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 480px) {
    .game-container {
        padding: 1rem;
    }

    .game-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .game-title {
        font-size: 1.25rem;
    }



    .key-btn {
        min-width: 28px;
        height: 48px;
        padding: 0 6px;
        font-size: 0.7rem;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }

    .key-btn.key-enter,
    .key-btn.key-back {
        min-width: 48px;
        font-size: 0.6rem;
        padding: 0 4px;
    }

    .keyboard-row {
        gap: 4px;
    }

    .sudoku-cell input {
        font-size: 1.25rem;
    }

    .numpad-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .leaderboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
}

/* Floating help button */
.game-btn.floating {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: var(--theme-primary-color);
}

.game-btn.floating:hover {
    background: var(--theme-primary-hover-color);
}

/* Crossword check/error states */
.crossword-cell.correct {
    background: #22c55e !important;
}

.crossword-cell.correct input {
    color: #fff !important;
}

.crossword-cell.error {
    background: #ef4444 !important;
}

.crossword-cell.error input {
    color: #fff !important;
}

/* Completion stats */
.completion-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1.5rem 0;
}

.completion-stats .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.completion-stats .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--theme-primary-color);
}

.completion-stats .stat-label {
    font-size: 0.85rem;
    color: #666;
}

[data-theme="dark"] .completion-stats .stat-label {
    color: #999;
}

/* ============================================
   USER GAME STATS STYLES
   ============================================ */
.user-game-stats {
    padding: 0.5rem 0;
}

.user-game-stats .stats-grid {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.user-game-stats .stat-box {
    flex: 1;
    min-width: 80px;
    text-align: center;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
}

[data-theme="dark"] .user-game-stats .stat-box {
    background: rgba(255, 255, 255, 0.05);
}

.user-game-stats .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--theme-primary-color);
}

.user-game-stats .stat-label {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.25rem;
}

[data-theme="dark"] .user-game-stats .stat-label {
    color: #999;
}

.user-game-stats .no-stats {
    color: #888;
    font-size: 0.9rem;
    margin: 0;
}

/* ============================================
   CROSSWORD KEYBOARD IMPROVED STYLES
   ============================================ */
.crossword-keyboard {
    display: none; /* Hidden by default on desktop */
    background: #f5f5f5;
    padding: 12px;
    border-radius: 12px;
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .crossword-keyboard {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
        padding: 8px;
        margin: 0.75rem 0 0;
    }

    .crossword-keyboard .keyboard-row {
        width: 100%;
        gap: 4px;
    }

    .crossword-keyboard .key-btn {
        flex: 1 1 0;
        min-width: 0;
        height: 52px;
        padding: 0;
        font-size: 1rem;
    }

    .crossword-keyboard .key-skip,
    .crossword-keyboard .key-back {
        flex: 1.5 1.5 0;
        min-width: 0;
        font-size: 0.75rem;
    }
}

[data-theme="dark"] .crossword-keyboard {
    background: #1a1a1a;
}

.crossword-keyboard .keyboard-row {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 5px;
}

.crossword-keyboard .keyboard-row:last-child {
    margin-bottom: 0;
}

.crossword-keyboard .key-btn {
    min-width: 28px;
    height: 40px;
    padding: 0 8px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .crossword-keyboard .key-btn {
    background: #333;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.crossword-keyboard .key-btn:hover {
    background: #e8e8e8;
}

[data-theme="dark"] .crossword-keyboard .key-btn:hover {
    background: #444;
}

.crossword-keyboard .key-btn:active {
    transform: scale(0.95);
}

.crossword-keyboard .key-skip,
.crossword-keyboard .key-back {
    min-width: 55px;
    font-size: 0.75rem;
    background: var(--theme-primary-color);
    color: #fff;
}

.crossword-keyboard .key-skip:hover,
.crossword-keyboard .key-back:hover {
    background: var(--theme-primary-hover-color);
}

/* ============================================
   SUDOKU MOBILE RESPONSIVE IMPROVEMENTS
   ============================================ */

/* Make Sudoku board responsive using CSS Grid */
.sudoku-game .game-container {
    max-width: 100%;
    padding: 1rem;
}

.sudoku-board-container {
    margin-bottom: 1rem;
    overflow-x: auto;
    display: flex;
    justify-content: center;
}

.sudoku-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    background: #344861;
    padding: 2px;
    border-radius: 6px;
    width: min(100%, 360px);
    aspect-ratio: 1;
}

[data-theme="dark"] .sudoku-board {
    background: #3a3a3a;
}

.sudoku-box {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: #bdc3c7;
}

[data-theme="dark"] .sudoku-box {
    background: #4a4a4a;
}

.sudoku-cell {
    aspect-ratio: 1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    touch-action: manipulation;
}

[data-theme="dark"] .sudoku-cell {
    background: #121211;
}

.sudoku-cell input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    /* min 16px prevents iOS from zooming when input is focused */
    font-size: clamp(1rem, 4vw, 1.5rem);
    font-weight: 600;
    color: var(--text-color);
    caret-color: var(--theme-primary-color);
    padding: 0;
    margin: 0;
    pointer-events: none; /* clicks handled on .sudoku-cell, not the input */
}

/* Override global dark input styles for sudoku cells */
[data-theme="dark"] .sudoku-cell input {
    background: transparent;
    border: none;
    color: #ccc;
}

.sudoku-cell input:focus {
    outline: none;
    background: rgba(0, 132, 61, 0.12);
}

[data-theme="dark"] .sudoku-cell input:focus {
    background: rgba(0, 132, 61, 0.28);
}

.sudoku-cell.fixed input {
    font-weight: 700;
    color: #1a1a1a;
}

[data-theme="dark"] .sudoku-cell.fixed input {
    color: #fff;
}

.sudoku-cell.selected {
    background: rgba(0, 132, 61, 0.25);
    box-shadow: inset 0 0 0 2px rgba(0, 132, 61, 0.85);
}

[data-theme="dark"] .sudoku-cell.selected {
    background: rgba(0, 132, 61, 0.35);
    box-shadow: inset 0 0 0 2px rgba(0, 200, 100, 0.9);
}

.sudoku-cell.error input {
    color: #ef4444 !important;
}

.sudoku-cell.highlight {
    background: rgba(0, 132, 61, 0.08);
}

[data-theme="dark"] .sudoku-cell.highlight {
    background: rgba(0, 132, 61, 0.2);
}

/* Sudoku Number Pad - Mobile Optimized */
.sudoku-numpad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    max-width: 360px;
    margin: 0 auto;
    padding: 0.5rem;
}

.numpad-btn {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    background: #e5e7eb;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-family: inherit;
    touch-action: manipulation;
}

.numpad-btn:hover {
    background: #d1d5db;
}

[data-theme="dark"] .numpad-btn {
    background: #3a3a3a;
    color: #fff;
}

[data-theme="dark"] .numpad-btn:hover {
    background: #4a4a4a;
}

.numpad-btn.erase-btn {
    background: #fee2e2;
    color: #dc2626;
}

.numpad-btn.erase-btn:hover {
    background: #fecaca;
}

@media (max-width: 480px) {
    .sudoku-game .game-container {
        padding: 0.75rem;
    }

    .sudoku-game .game-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
        padding: 0;
    }

    .sudoku-game .game-title-area {
        flex-direction: column;
        gap: 0.5rem;
    }

    .sudoku-game .game-title {
        font-size: 1.2rem;
        justify-content: center;
    }

    .sudoku-game .game-stats-bar {
        width: 100%;
        justify-content: center;
        gap: 1.5rem;
        font-size: 0.85rem;
    }

    .sudoku-game .difficulty-selector {
        width: 100%;
        justify-content: center;
    }

    .sudoku-game .diff-btn {
        flex: 1;
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }

    .sudoku-game .game-controls {
        width: 100%;
        justify-content: center;
    }

    .sudoku-board {
        width: 100%;
        max-width: 320px;
    }

    .sudoku-cell input {
        font-size: clamp(0.85rem, 5vw, 1.2rem);
    }

    .sudoku-numpad {
        gap: 6px;
        padding: 0.25rem;
        max-width: 320px;
    }

    .numpad-btn {
        height: 42px;
        font-size: 1rem;
        border-radius: 6px;
    }
}

@media (max-width: 360px) {
    .sudoku-game .game-container {
        padding: 0.5rem;
    }

    .sudoku-board {
        max-width: 280px;
    }

    .sudoku-cell input {
        font-size: clamp(0.875rem, 6vw, 1rem);
    }

    .sudoku-numpad {
        max-width: 280px;
        gap: 5px;
    }

    .numpad-btn {
        height: 36px;
        font-size: 0.9rem;
    }

    .sudoku-game .game-title {
        font-size: 1rem;
    }

    .sudoku-game .diff-btn {
        padding: 0.35rem 0.4rem;
        font-size: 0.7rem;
    }
}

/* ============================================
   2048 RESPONSIVE STYLES
   ============================================ */

/* Make 2048 container responsive */
.game-2048 {
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.game-2048-board-container {
    width: 100%;
    max-width: 100%;
    padding: clamp(6px, 2vw, 12px);
    background: #8b9298;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

[data-theme="dark"] .game-2048-board-container {
    background: #4a4e52;
}

.game-2048-board {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    max-width: 100%;
}

.game-2048-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(4px, 1.5vw, 10px);
    padding: 0;
}

.game-2048-tiles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0;
}

/* Responsive tile sizing */
.tile-2048 {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.2rem, 5vw, 2rem);
    font-weight: 700;
    border-radius: 4px;
    transition: all 0.15s ease;
}

/* Smaller font for larger numbers */
.tile-2048[data-value="128"],
.tile-2048[data-value="256"],
.tile-2048[data-value="512"] {
    font-size: clamp(1rem, 4vw, 1.75rem);
}

.tile-2048[data-value="1024"],
.tile-2048[data-value="2048"] {
    font-size: clamp(0.9rem, 3.5vw, 1.5rem);
}

.tile-2048[data-value="4096"],
.tile-2048[data-value="8192"] {
    font-size: clamp(0.8rem, 3vw, 1.25rem);
}

/* 2048 Mobile Responsive */
@media (max-width: 480px) {
    .game-2048 {
        padding: 0.75rem;
    }

    .game-2048 .game-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .game-2048 .game-title {
        font-size: 1.5rem;
        padding: 0.4rem 0.75rem;
    }

    .game-2048 .score-box {
        padding: 0.4rem 0.6rem;
    }

    .game-2048 .score-label {
        font-size: 0.6rem;
    }

    .game-2048 .score-value {
        font-size: 1rem;
    }

    .game-2048 .game-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 360px) {
    .game-2048 {
        padding: 0.5rem;
    }

    .game-2048 .game-title {
        font-size: 1.25rem;
    }

    .tile-2048 {
        font-size: clamp(0.9rem, 4vw, 1.5rem);
    }

    .tile-2048[data-value="128"],
    .tile-2048[data-value="256"],
    .tile-2048[data-value="512"] {
        font-size: clamp(0.8rem, 3.5vw, 1.25rem);
    }

    .tile-2048[data-value="1024"],
    .tile-2048[data-value="2048"] {
        font-size: clamp(0.7rem, 3vw, 1rem);
    }
}

/* ============================================
   WORDLE KEYBOARD LIGHT THEME IMPROVEMENTS
   ============================================ */

/* Wordle keyboard - better contrast on light theme */
.wordle-keyboard .key-btn {
    height: 58px;
    padding: 0;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
    background: #d3d6da;
    color: #1a1a1b;
    /* flex: 1 1 0 already set above */
}

.wordle-keyboard .key-btn:hover {
    background: #c4c7cb;
}

[data-theme="dark"] .wordle-keyboard .key-btn {
    background: #818384;
    color: #fff;
}

[data-theme="dark"] .wordle-keyboard .key-btn:hover {
    background: #9a9c9d;
}

/* Wordle keyboard color states */
.wordle-keyboard .key-btn.correct {
    background: #6aaa64;
    color: #fff;
}

.wordle-keyboard .key-btn.present {
    background: #c9b458;
    color: #fff;
}

.wordle-keyboard .key-btn.absent {
    background: #787c7e;
    color: #fff;
}

[data-theme="dark"] .wordle-keyboard .key-btn.absent {
    background: #3a3a3c;
}

/* Mobile keyboard alignment improvements */
@media (max-width: 480px) {
    .wordle-keyboard {
        gap: 4px;
        padding: 0 6px;
        /* Break out of all parent padding by centering to the viewport */
        width: 100vw;
        position: relative;
        left: 50%;
        transform: translateX(-50%);
        max-width: none;
        margin: 0;
        box-sizing: border-box;
    }

    .wordle-keyboard .keyboard-row {
        gap: 4px;
    }

    .wordle-keyboard .key-btn {
        flex: 1 1 0;
        min-width: 0;
        height: 62px;
        padding: 0;
        font-size: 0.9rem;
    }

    .wordle-keyboard .key-btn.key-enter,
    .wordle-keyboard .key-btn.key-back {
        flex: 1.5 1.5 0;
        font-size: 0.7rem;
    }
}

@media (max-width: 360px) {
    .wordle-keyboard .key-btn {
        height: 56px;
        font-size: 0.8rem;
    }
}

/* Stats modal — compact layout on mobile */
@media (max-width: 480px) {
    .modal-content {
        padding: 1.25rem 1rem;
    }

    /* Switch from single row to 2x2 grid — prevents overflow and clipping */
    .modal-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem 0.75rem;
        margin: 1rem 0;
    }

    .modal-stats .stat-value {
        font-size: 1.5rem;
    }

    .modal-stats .stat-label {
        font-size: 0.7rem;
    }
}
