/* ===================================
   Game Boards Styles - Dark Theme
   =================================== */

/* Base Board Styles */
.board {
    display: grid;
    gap: clamp(0.75rem, 2vw, 1.25rem);
    margin: 0 auto;
    padding: clamp(1rem, 3vw, 2rem);
    background: rgba(26, 31, 58, 0.6);
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-radius: clamp(1rem, 3vw, 1.5rem);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 0 30px rgba(0, 212, 255, 0.1);
    width: 100%;
    max-width: min(95vw, 90vh, 800px);
    max-height: fit-content;
    justify-items: stretch;
    backdrop-filter: blur(10px);
    box-sizing: border-box;
}

/* Board Size Variants - Fully Responsive */
.board.size-3 {
    grid-template-columns: repeat(3, 1fr);
}

.board.size-4 {
    grid-template-columns: repeat(4, 1fr);
}

.board.size-5 {
    grid-template-columns: repeat(5, 1fr);
}

.board.size-6 {
    grid-template-columns: repeat(6, 1fr);
}

.board.size-7 {
    grid-template-columns: repeat(7, 1fr);
}

.board.size-9 {
    grid-template-columns: repeat(9, 1fr);
}

/* ===================================
   Cell Styles - Dark Theme
   =================================== */
.cell {
    width: 100%;
    aspect-ratio: 1;
    background: rgba(37, 43, 74, 0.8);
    border: 2px solid rgba(124, 58, 237, 0.4);
    border-radius: clamp(0.5rem, 1.5vw, 0.75rem);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.25rem, 5vw, 2.5rem);
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    color: var(--text-primary, #ffffff);
}

/* Hover Effect */
.cell:hover:not(.occupied):not(.blocked) {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--accent-primary, #00d4ff);
    transform: scale(1.08);
    box-shadow: 
        0 0 20px rgba(0, 212, 255, 0.4),
        inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Occupied Cells */
.cell.occupied {
    cursor: not-allowed;
}

/* Player 1 (X) - Red */
.cell.X,
.cell.occupied.X {
    background: linear-gradient(135deg, var(--cell-bg, rgba(26, 31, 58, 0.6)), var(--player1-bg, rgba(233, 69, 96, 0.15)));
    border-color: var(--player1-color, #e94560);
    color: var(--player1-color, #e94560);
    box-shadow: 0 0 10px var(--player1-glow, rgba(233, 69, 96, 0.6));
    text-shadow: 0 0 10px var(--player1-glow, rgba(233, 69, 96, 0.6));
}

.cell.X:hover,
.cell.occupied.X.current-player-piece:hover {
    box-shadow: 0 0 20px var(--player1-glow, rgba(233, 69, 96, 0.6));
    border-color: var(--player1-color, #e94560);
}

/* Player 2 (O) - Blue/Purple */
.cell.O,
.cell.occupied.O {
    background: linear-gradient(135deg, var(--cell-bg, rgba(26, 31, 58, 0.6)), var(--player2-bg, rgba(95, 39, 205, 0.15)));
    border-color: var(--player2-color, #5f27cd);
    color: var(--player2-color, #5f27cd);
    box-shadow: 0 0 10px var(--player2-glow, rgba(95, 39, 205, 0.6));
    text-shadow: 0 0 10px var(--player2-glow, rgba(95, 39, 205, 0.6));
}

.cell.O:hover,
.cell.occupied.O.current-player-piece:hover {
    box-shadow: 0 0 20px var(--player2-glow, rgba(95, 39, 205, 0.6));
    border-color: var(--player2-color, #5f27cd);
}

/* Legacy support */
.cell.X {
    color: var(--player-x-color, var(--player1-color, #e94560));
    border-color: var(--player-x-color, var(--player1-color, #e94560));
}

.cell.O {
    color: var(--player-o-color, var(--player2-color, #5f27cd));
    border-color: var(--player-o-color, var(--player2-color, #5f27cd));
}

/* Blocked/Obstacle Cells */
.cell.blocked {
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    border-color: #444;
    cursor: not-allowed;
    opacity: 0.5;
}

.cell.blocked::before {
    content: '🚧';
    font-size: clamp(1rem, 4vw, 2rem);
    position: relative;
    z-index: 1;
}

/* Hidden Cell (Memory Game) */
.cell.hidden {
    color: var(--warning-color, #f59e0b);
    background: rgba(37, 43, 74, 0.8);
    border-color: var(--warning-color, #f59e0b);
}

.cell.hidden::after {
    content: '#';
    font-size: clamp(1.25rem, 5vw, 2.5rem);
}

/* ===================================
   Connect Four Board
   =================================== */

/* Column Buttons Container */
.column-buttons {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: clamp(3px, 1vw, 8px);
    justify-content: center;
    margin-bottom: 1rem;
    width: 100%;
    max-width: min(500px, 90vw);
    margin-left: auto;
    margin-right: auto;
    padding: 0 var(--spacing-sm, 0.5rem);
}

.column-btn {
    width: 100%;
    height: clamp(28px, 5vw, 40px);
    min-width: 35px;
    border: 2px solid var(--border-color, rgba(0, 234, 255, 0.3));
    background: var(--cell-bg, rgba(26, 31, 58, 0.6));
    color: var(--text-primary, #ffffff);
    border-radius: var(--radius-sm, 0.5rem);
    font-size: clamp(0.8rem, 2vw, 1.2rem);
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.column-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 234, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.column-btn:hover:not(:disabled)::before {
    width: 100%;
    height: 100%;
}

.column-btn:hover:not(:disabled) {
    background: var(--accent-primary, #00eaff);
    color: var(--bg-primary, #0a0e27);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 234, 255, 0.4);
    border-color: var(--accent-primary, #00eaff);
}

.column-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 234, 255, 0.3);
}

.column-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: var(--cell-bg, rgba(26, 31, 58, 0.3));
}

/* Connect 4 Board - Responsive like Diamond */
.board.connect4 {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: clamp(3px, 1vw, 8px);
    margin: 0 auto;
    padding: clamp(0.5rem, 2vw, 1.5rem);
    background: var(--bg-secondary, rgba(13, 18, 40, 0.8));
    border-radius: var(--radius-lg, 1.5rem);
    width: 100%;
    max-width: min(500px, 90vw);
    aspect-ratio: 7 / 6;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.board.connect4 .cell {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    background: var(--cell-bg, rgba(26, 31, 58, 0.6));
    border: 2px solid var(--border-color, rgba(0, 234, 255, 0.3));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 700;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.board.connect4 .cell::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at center, transparent 50%, rgba(0, 0, 0, 0.2) 100%);
    pointer-events: none;
}

/* Filled cells */
.board.connect4 .cell.filled {
    animation: dropIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes dropIn {
    0% {
        transform: translateY(-500%) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: translateY(20%) scale(1.1);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Player colors */
.board.connect4 .cell.X {
    background: radial-gradient(circle, var(--accent-x, #e94560) 0%, rgba(233, 69, 96, 0.7) 100%);
    border-color: var(--accent-x, #e94560);
    box-shadow: 0 0 15px rgba(233, 69, 96, 0.5);
    color: #ffffff;
}

.board.connect4 .cell.O {
    background: radial-gradient(circle, var(--accent-o, #533483) 0%, rgba(83, 52, 131, 0.7) 100%);
    border-color: var(--accent-o, #533483);
    box-shadow: 0 0 15px rgba(83, 52, 131, 0.5);
    color: #ffffff;
}

/* Winning cells highlight */
.board.connect4 .cell.winner {
    animation: winPulse 0.8s ease-in-out infinite;
    z-index: 10;
}

@keyframes winPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px currentColor;
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 40px currentColor;
    }
}

/* Tablet screens */
@media (max-width: 768px) {
    .column-buttons {
        max-width: min(450px, 95vw);
        gap: clamp(2px, 1vw, 6px);
    }
    
    .column-btn {
        height: clamp(26px, 4.5vw, 35px);
        font-size: clamp(0.75rem, 1.8vw, 1rem);
    }
    
    .board.connect4 {
        max-width: min(450px, 95vw);
        padding: clamp(0.4rem, 1.5vw, 1rem);
        gap: clamp(2px, 1vw, 6px);
    }
    
    .board.connect4 .cell {
        font-size: clamp(1rem, 2.5vw, 1.5rem);
        border-width: 1.5px;
    }
}

/* Mobile screens */
@media (max-width: 480px) {
    .column-buttons {
        max-width: 95vw;
        gap: 3px;
        padding: 0 0.25rem;
    }
    
    .column-btn {
        height: 30px;
        font-size: 0.85rem;
        min-width: 30px;
        border-width: 1.5px;
    }
    
    .board.connect4 {
        max-width: 95vw;
        gap: 3px;
        padding: 0.4rem;
        border-radius: 1rem;
    }
    
    .board.connect4 .cell {
        font-size: 1.2rem;
        border-width: 1.5px;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .column-buttons {
        gap: 2px;
        padding: 0 0.2rem;
    }
    
    .column-btn {
        height: 26px;
        font-size: 0.75rem;
        min-width: 28px;
    }
    
    .board.connect4 {
        gap: 2px;
        padding: 0.3rem;
    }
    
    .board.connect4 .cell {
        font-size: 1.1rem;
        border-width: 1px;
    }
}

/* Large screens - prevent board from getting too big */
@media (min-width: 1200px) {
    .column-buttons {
        max-width: 520px;
    }
    
    .board.connect4 {
        max-width: 520px;
    }
}

/* Legacy support for old column-selector class */
.column-selector {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 1rem;
}

/* Board wrapper for centering */
.board-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: var(--spacing-md, 1rem);
}

/* ===================================
   Diamond Board
   =================================== */
.board.diamond {
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(7, 1fr);
    max-width: min(95vw, 600px);
}

.board.diamond .cell {
    border-radius: var(--radius-sm, 0.5rem);
}

.board.diamond .cell.inactive {
    background: transparent;
    border: none;
    cursor: default;
    pointer-events: none;
}

.board.diamond .cell.active {
    background: var(--cell-bg, rgba(26, 31, 58, 0.6));
    border: 2px solid var(--cell-border, rgba(154, 77, 255, 0.4));
    cursor: pointer;
}

/* ===================================
   Four Board (4x4)
   =================================== */
   .board.four-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: clamp(5px, 1.5vw, 8px);
    margin: 0 auto;
    padding: clamp(0.75rem, 2vw, 1.5rem);
    background: var(--bg-secondary, rgba(13, 18, 40, 0.8));
    border-radius: var(--radius-lg, 1.5rem);
    width: 100%;
    max-width: min(380px, 90vw);
    aspect-ratio: 1 / 1;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Four Board - Base cell styles */
.board.four-board .cell {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    background: var(--cell-bg, rgba(26, 31, 58, 0.6));
    border: 2px solid var(--border-color, rgba(0, 234, 255, 0.3));
    border-radius: var(--radius-sm, 0.5rem);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Empty cells hover effect */
.board.four-board .cell:not(.occupied):hover {
    background: var(--cell-hover, rgba(0, 234, 255, 0.1));
    border-color: var(--accent-primary, #00eaff);
    transform: scale(1.05);
}

/* Occupied cells - Base styling */
.board.four-board .cell.occupied {
    cursor: not-allowed;
}

.board.four-board .cell.occupied.X {
    background: linear-gradient(135deg, var(--cell-bg), rgba(233, 69, 96, 0.15));
    border-color: var(--accent-x, #e94560);
    color: var(--accent-x, #e94560);
}

.board.four-board .cell.occupied.O {
    background: linear-gradient(135deg, var(--cell-bg), rgba(83, 52, 131, 0.15));
    border-color: var(--accent-o, #533483);
    color: var(--accent-o, #533483);
}

/* Current player's pieces - Selectable (pointer cursor) */
.board.four-board .cell.occupied.current-player-piece {
    cursor: pointer !important;
    animation: subtlePulse 2s ease-in-out infinite;
}

.board.four-board .cell.occupied.current-player-piece:hover {
    transform: scale(1.08);
    box-shadow: 0 0 20px currentColor;
}

/* Opponent's pieces - Not selectable */
.board.four-board .cell.occupied.opponent-piece {
    cursor: not-allowed !important;
    opacity: 0.7;
}

/* Selected piece highlight */
.board.four-board .cell.selected {
    box-shadow: 0 0 clamp(0.75rem, 2vw, 1.5rem) currentColor !important;
    transform: scale(1.1) !important;
    z-index: 10;
    animation: selectedPulse 1s ease-in-out infinite;
}

/* Possible move locations */
.board.four-board .cell.possible-move {
    background: var(--success, rgba(46, 213, 115, 0.2)) !important;
    border-color: var(--success, #2ed573) !important;
    cursor: pointer !important;
    animation: possibleMovePulse 1.5s ease-in-out infinite;
}

/* Animations */
@keyframes subtlePulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

@keyframes selectedPulse {
    0%, 100% {
        box-shadow: 0 0 1rem currentColor;
    }
    50% {
        box-shadow: 0 0 2rem currentColor;
    }
}

@keyframes possibleMovePulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Winning cells */
.board.four-board .cell.winner {
    animation: winPulse 0.6s ease-in-out infinite;
    z-index: 20;
}

@keyframes winPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px currentColor;
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 40px currentColor;
    }
}

/* Game over state */
.board.four-board .cell.game-over {
    opacity: 0.6;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .board.four-board {
        max-width: min(350px, 92vw);
        gap: clamp(4px, 1.2vw, 6px);
        padding: clamp(0.6rem, 1.5vw, 1rem);
    }
    
    .board.four-board .cell {
        font-size: clamp(1.3rem, 3.5vw, 1.8rem);
        border-width: 1.5px;
    }
}

@media (max-width: 480px) {
    .board.four-board {
        max-width: 95vw;
        gap: 5px;
        padding: 0.5rem;
        border-radius: 1rem;
    }
    
    .board.four-board .cell {
        font-size: 1.4rem;
        border-width: 1.5px;
    }
    
    .board.four-board .cell.possible-move::after {
        font-size: 1.2rem;
    }
}

@media (max-width: 380px) {
    .board.four-board {
        gap: 4px;
        padding: 0.4rem;
    }
    
    .board.four-board .cell {
        font-size: 1.2rem;
        border-width: 1px;
    }
}

/* Large screens */
@media (min-width: 1200px) {
    .board.four-board {
        max-width: 400px;
    }
}

/* ===================================
   Pyramid Tic-Tac-Toe
   =================================== */
.board.pyramid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: fit-content;
    margin: 0 auto;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.pyramid-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.pyramid-row .cell {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-sm, 0.5rem);
    background: var(--cell-bg, rgba(26, 31, 58, 0.6));
    border: 2px solid var(--cell-border, rgba(154, 77, 255, 0.4));
    font-size: clamp(1.25rem, 4vw, 2rem);
}

@media (max-width: 768px) {
    .pyramid-row {
        gap: 6px;
    }
    
    .pyramid-row .cell {
        width: 55px;
        height: 55px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .pyramid-row {
        gap: 4px;
    }
    
    .pyramid-row .cell {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
}

/* ===================================
   Ultimate Tic-Tac-Toe Sub-boards
   =================================== */
.board.size-9 {
    gap: clamp(0.5rem, 1vw, 0.75rem);
    background: transparent;
    border: 2px solid var(--board-border, rgba(0, 234, 255, 0.3));
    padding: clamp(0.5rem, 1vw, 0.75rem);
}

/* Sub-board separators for Ultimate - Thicker borders between 3x3 groups */
/* Vertical separators after columns 3 and 6 (0-indexed: 2, 5) */
.board.size-9 .cell:nth-child(9n+3),
.board.size-9 .cell:nth-child(9n+6) {
    border-right: 3px solid var(--board-border, rgba(0, 234, 255, 0.5));
}

/* Horizontal separators after rows 3 and 6 (cells 28-36 and 55-63) */
.board.size-9 .cell:nth-child(n+28):nth-child(-n+36) {
    border-top: 3px solid var(--board-border, rgba(0, 234, 255, 0.5));
}

.board.size-9 .cell:nth-child(n+55):nth-child(-n+63) {
    border-top: 3px solid var(--board-border, rgba(0, 234, 255, 0.5));
}

/* Winning sub-board highlight */
.cell.sub-board-won {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(16, 185, 129, 0.1));
    border-color: var(--success-color, #10b981);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

/* ===================================
   Numerical Tic-Tac-Toe
   =================================== */
.board.numerical .cell {
    font-size: clamp(1.5rem, 6vw, 3rem);
}

.cell.odd-number {
    color: var(--player1-color, #e94560);
}

.cell.even-number {
    color: var(--player2-color, #5f27cd);
}

/* ===================================
   Win Animation
   =================================== */
@keyframes winPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(16, 185, 129, 0);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 30px rgba(16, 185, 129, 0.8);
    }
}

.cell.winning-cell {
    animation: winPulse 1s ease infinite;
    background: linear-gradient(135deg, var(--success-color, #10b981), rgba(16, 185, 129, 0.4));
    border-color: var(--success-color, #10b981);
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

/* ===================================
   Five Board Score Display
   =================================== */
.score-display {
    display: flex;
    justify-content: space-around;
    margin: clamp(1rem, 3vw, 2rem) 0;
    padding: clamp(1rem, 3vw, 1.5rem);
    background: rgba(26, 31, 58, 0.6);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: clamp(0.75rem, 2vw, 1rem);
    flex-wrap: wrap;
    gap: clamp(0.75rem, 2vw, 1.25rem);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.score-item {
    text-align: center;
}

.score-item .label {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    color: var(--text-secondary, #a0aec0);
    margin-bottom: clamp(0.5rem, 1.5vw, 0.75rem);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 400;
}

.score-item .value {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
}

.score-item.player-x .value {
    color: var(--player1-color, #e94560);
    text-shadow: 0 0 15px var(--player1-glow, rgba(233, 69, 96, 0.5));
}

.score-item.player-o .value {
    color: var(--player2-color, #5f27cd);
    text-shadow: 0 0 15px var(--player2-glow, rgba(95, 39, 205, 0.5));
}

/* ===================================
   Infinity Queue Display
   =================================== */
.queue-display {
    margin: clamp(1rem, 3vw, 2rem) 0;
    padding: clamp(1rem, 3vw, 1.5rem);
    background: rgba(26, 31, 58, 0.6);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: clamp(0.75rem, 2vw, 1rem);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.queue-display h4 {
    margin-bottom: clamp(0.75rem, 2vw, 1rem);
    color: var(--text-secondary, #a0aec0);
    font-size: clamp(1rem, 3vw, 1.25rem);
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
}

.queue-items {
    display: flex;
    gap: clamp(0.5rem, 1.5vw, 0.75rem);
    flex-wrap: wrap;
}

.queue-item {
    padding: clamp(0.5rem, 2vw, 0.75rem) clamp(1rem, 3vw, 1.5rem);
    background: rgba(37, 43, 74, 0.8);
    border: 1px solid rgba(124, 58, 237, 0.4);
    border-radius: clamp(0.5rem, 1.5vw, 0.75rem);
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    color: var(--text-primary, #ffffff);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
}

/* ===================================
   Number Selector (Numerical Game)
   =================================== */
.number-selector {
    display: flex;
    gap: clamp(0.5rem, 2vw, 0.75rem);
    justify-content: center;
    margin: clamp(1rem, 3vw, 2rem) 0;
    flex-wrap: wrap;
}

.number-btn {
    width: clamp(3rem, 10vw, 4.5rem);
    height: clamp(3rem, 10vw, 4.5rem);
    aspect-ratio: 1;
    border: 2px solid rgba(124, 58, 237, 0.4);
    background: rgba(37, 43, 74, 0.8);
    color: var(--text-primary, #ffffff);
    border-radius: clamp(0.5rem, 1.5vw, 0.75rem);
    font-size: clamp(1.25rem, 4vw, 2rem);
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.number-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.3) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
    border-radius: 50%;
}

.number-btn:hover:not(.used)::before {
    width: 150%;
    height: 150%;
}

.number-btn:hover:not(.used) {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--accent-primary, #00d4ff);
    transform: scale(1.1);
    box-shadow: 
        0 0 20px rgba(0, 212, 255, 0.4),
        inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.number-btn.used {
    opacity: 0.3;
    cursor: not-allowed;
}

.number-btn.selected {
    border-color: var(--player1-color, #e94560);
    background: linear-gradient(135deg, var(--player1-bg, rgba(233, 69, 96, 0.3)), var(--player1-bg, rgba(233, 69, 96, 0.1)));
    box-shadow: 
        0 0 25px var(--player1-glow, rgba(233, 69, 96, 0.5)),
        inset 0 2px 8px rgba(0, 0, 0, 0.2);
    color: var(--player1-color, #e94560);
}

.number-btn.odd {
    border-color: var(--player1-color, #e94560);
}

.number-btn.even {
    border-color: var(--player2-color, #5f27cd);
}

/* Player 1 Styling (Word Game) */
.cell.player1 {
    color: var(--player1-color, #e94560);
    border-color: var(--player1-color, #e94560);
    background: linear-gradient(135deg, var(--cell-bg, rgba(26, 31, 58, 0.6)), var(--player1-bg, rgba(233, 69, 96, 0.15)));
    text-shadow: 0 0 10px var(--player1-glow, rgba(233, 69, 96, 0.5));
    box-shadow: 0 0 10px var(--player1-glow, rgba(233, 69, 96, 0.6));
}

/* Player 2 Styling (Word Game) */
.cell.player2 {
    color: var(--player2-color, #5f27cd);
    border-color: var(--player2-color, #5f27cd);
    background: linear-gradient(135deg, var(--cell-bg, rgba(26, 31, 58, 0.6)), var(--player2-bg, rgba(95, 39, 205, 0.15)));
    text-shadow: 0 0 10px var(--player2-glow, rgba(95, 39, 205, 0.5));
    box-shadow: 0 0 10px var(--player2-glow, rgba(95, 39, 205, 0.6));
}

/* ===================================
   Ultimate Tic-Tac-Toe Overview
   =================================== */
.ultimate-overview {
    text-align: center;
    padding: clamp(1rem, 3vw, 1.5rem);
    background: var(--board-bg, rgba(13, 18, 40, 0.5));
    border: 1px solid var(--board-border, rgba(0, 234, 255, 0.3));
    border-radius: clamp(0.75rem, 2vw, 1rem);
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0, 0, 0, 0.6));
}

.ultimate-overview-title {
    margin-bottom: clamp(0.5rem, 1.5vw, 0.75rem);
    color: var(--text-secondary, rgba(217, 232, 255, 0.7));
    font-size: clamp(1rem, 3vw, 1.25rem);
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
}

.ultimate-mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(3, 40px);
    gap: 4px;
    justify-content: center;
    max-width: fit-content;
    margin: 0 auto;
    border: 2px solid var(--board-border, rgba(0, 234, 255, 0.3));
    padding: 4px;
    border-radius: var(--radius-sm, 0.5rem);
    background: var(--board-bg, rgba(13, 18, 40, 0.5));
}

.ultimate-mini-cell {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cell-bg, rgba(26, 31, 58, 0.6));
    border: 1px solid var(--cell-border, rgba(154, 77, 255, 0.4));
    border-radius: var(--radius-sm, 0.5rem);
    font-size: 1.25rem;
    font-weight: bold;
    font-family: 'Orbitron', sans-serif;
    color: var(--text-primary, #ffffff);
}

.ultimate-mini-cell.won-x {
    color: var(--player1-color, #e94560);
    border-color: var(--player1-color, #e94560);
    background: linear-gradient(135deg, var(--player1-bg, rgba(233, 69, 96, 0.2)), var(--player1-bg, rgba(233, 69, 96, 0.05)));
}

.ultimate-mini-cell.won-o {
    color: var(--player2-color, #5f27cd);
    border-color: var(--player2-color, #5f27cd);
    background: linear-gradient(135deg, var(--player2-bg, rgba(95, 39, 205, 0.2)), var(--player2-bg, rgba(95, 39, 205, 0.05)));
}

/* ===================================
   Game Modal (Victory/Draw)
   =================================== */
.game-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10000;
    animation: fadeIn 0.3s ease;
    justify-content: center;
    align-items: center;
}

.game-modal.show {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(135deg, var(--bg-secondary, rgba(13, 18, 40, 0.8)) 0%, var(--bg-primary, #0a0f1f) 100%);
    border: 2px solid var(--border-color, rgba(0, 234, 255, 0.3));
    border-radius: var(--radius-lg, 1.5rem);
    padding: clamp(2rem, 5vw, 3rem);
    max-width: min(500px, 90vw);
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 100px rgba(0, 234, 255, 0.2);
    animation: modalSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-100px) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(0, 234, 255, 0.05),
        transparent
    );
    animation: modalShine 3s ease-in-out infinite;
}

@keyframes modalShine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.modal-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.modal-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 20px currentColor);
}

/* Win Icon */
.modal-icon.win {
    animation: iconWinBounce 0.6s ease-in-out;
}

@keyframes iconWinBounce {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.2) rotate(-10deg);
    }
    50% {
        transform: scale(0.9) rotate(10deg);
    }
    75% {
        transform: scale(1.1) rotate(-5deg);
    }
}

/* Draw Icon */
.modal-icon.draw {
    animation: iconDrawShake 0.5s ease-in-out;
}

@keyframes iconDrawShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

.modal-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 1rem;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    z-index: 1;
}

.modal-title.win-player1 {
    color: var(--player1-color, #e94560);
    text-shadow: 0 0 30px var(--player1-color, #e94560);
    animation: titlePulse 1.5s ease-in-out infinite;
}

.modal-title.win-player2 {
    color: var(--player2-color, #5f27cd);
    text-shadow: 0 0 30px var(--player2-color, #5f27cd);
    animation: titlePulse 1.5s ease-in-out infinite;
}

.modal-title.draw {
    color: var(--warning, #ffa502);
    text-shadow: 0 0 30px var(--warning, #ffa502);
}

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

.modal-message {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--text-secondary, rgba(217, 232, 255, 0.7));
    margin-bottom: 2rem;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.modal-btn {
    min-width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1rem;
    padding: 0.875rem 1.5rem;
    transition: all 0.3s ease;
}

.modal-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 234, 255, 0.3);
}

.modal-btn:active {
    transform: translateY(-1px);
}

.modal-btn svg {
    transition: transform 0.3s ease;
}

.modal-btn:hover svg {
    transform: translateX(5px);
}

#btnModalHome:hover svg {
    transform: scale(1.1);
}

/* Confetti Animation for Win */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--accent-primary, #00eaff);
    animation: confettiFall 3s linear infinite;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .modal-content {
        padding: 1.5rem;
    }
    
    .modal-icon {
        width: 80px;
        height: 80px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
        min-width: unset;
    }
}
