/* Snake & Ladder game styles with light/dark theme variables */
:root {
    --bg: #1708e67a;
    --page-text: #000407;
    --board-bg: rgba(255, 255, 255, 0.96);
    --board-text: #0b1b26;
    --muted: rgba(11, 27, 38, 0.7);
    --card-border: rgba(11, 27, 38, 0.06);
    --cell-focus: rgba(0, 229, 255, 0.12);
    --grid-line: rgba(0, 0, 0, 0.9);
    --header-color: var(--page-text);
}

.theme-dark {
    --bg: #1667e0;
    --page-text: rgba(255, 255, 255, 0.95);
    --board-bg: rgba(255, 255, 255, 0.92);
    --board-text: #0b1b26;
    --muted: rgba(255, 255, 255, 0.78);
    --card-border: rgba(255, 255, 255, 0.06);
    --cell-focus: rgba(0, 229, 255, 0.06);
    --grid-line: rgba(0, 0, 0, 0.18);
    --header-color: var(--page-text);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, rgba(23, 8, 230, 0.47) 0%, rgba(255, 0, 255, 0.15) 50%, rgba(138, 43, 226, 0.15) 100%);
    background-attachment: fixed;
    color: var(--page-text);
}

/* GameHub navigation in top-left corner */
.gamehub-nav {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 100;
}

.gamehub-link {
    display: inline-block;
    padding: 8px 12px;
    background: var(--board-bg);
    color: var(--board-text);
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid var(--card-border);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gamehub-link:hover {
    background: var(--cell-focus);
    transform: translateY(-2px);
}

.game-app {
    max-width: 1400px;
    margin: 12px auto;
    padding: 12px 12px;
    color: var(--page-text);
    display: flex;
    flex-direction: column;
}

/* Menu styling */
.game-menu {
    position: fixed;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    z-index: 99;
    background: var(--board-bg);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--card-border);
}

.controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.controls button {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--card-border);
    background: var(--board-bg);
    color: var(--board-text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.controls button:hover {
    background: var(--cell-focus);
}

.settings-dropdown {
    position: relative;
}

.settings-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--board-bg);
    color: #ffffff;
    border: none;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.settings-btn:hover {
    background: var(--cell-focus);
    color: #ffffff;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--board-bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 8px 0;
    min-width: 150px;
    z-index: 101;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dropdown-menu.active {
    display: flex;
    flex-direction: column;
}

.dropdown-item {
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--board-text);
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    transition: background 0.2s ease;
}

.dropdown-item:hover {
    background: var(--cell-focus);
}

/* Title styling */
.game-title-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    margin-top: 60px;
}

.game-title {
    font-size: 2.5rem;
    margin: 0;
    color: var(--header-color);
}

/* Player selection screen */
.player-selection-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    padding: 20px;
}

.selection-container {
    background: var(--board-bg);
    border-radius: 12px;
    padding: 40px 60px;
    text-align: center;
    border: 1px solid var(--card-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.selection-container h2 {
    font-size: 1.8rem;
    margin: 0 0 30px 0;
    color: var(--board-text);
}

.player-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.player-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid var(--card-border);
    background: var(--board-bg);
    color: var(--board-text);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.player-btn:hover {
    background: var(--cell-focus);
    border-color: rgba(0, 229, 255, 0.5);
    transform: scale(1.05);
}

/* Game board section */
.game-board-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 20px;
}

.game-container {
    display: flex;
    gap: 30px;
    background: var(--board-bg);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--card-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    max-width: 1200px;
    width: 100%;
}

.board-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.snake-ladder-board {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 1px;
    background: rgba(0, 0, 0, 0.05);
    padding: 8px;
    border-radius: 8px;
    width: 100%;
    aspect-ratio: 1/1;
    max-width: 500px;
}

.square {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--board-text);
    position: relative;
    min-height: 45px;
}

.square.snake {
    background: rgba(255, 100, 100, 0.2);
    border-color: rgba(255, 100, 100, 0.5);
}

.square.ladder {
    background: rgba(100, 255, 100, 0.2);
    border-color: rgba(100, 255, 100, 0.5);
}

.square-number {
    font-size: 0.8rem;
    opacity: 0.6;
}

.player-token {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.player-token.player-1 { background: #FF6B6B; }
.player-token.player-2 { background: #4ECDC4; }
.player-token.player-3 { background: #FFE66D; }
.player-token.player-4 { background: #95E1D3; }

/* Game info section */
.game-info-section {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.players-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-info {
    padding: 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    border-left: 4px solid;
    font-weight: 500;
}

.player-info.player-1 { border-color: #FF6B6B; }
.player-info.player-2 { border-color: #4ECDC4; }
.player-info.player-3 { border-color: #FFE66D; }
.player-info.player-4 { border-color: #95E1D3; }

.player-info.active {
    background: rgba(0, 0, 0, 0.08);
    font-weight: 700;
}

.player-name {
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.player-position {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Game controls */
.game-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.roll-btn {
    padding: 12px 24px;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.roll-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

.dice-display {
    font-size: 3rem;
    text-align: center;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-message {
    padding: 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    text-align: center;
    font-size: 0.95rem;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--card-border);
}

.game-message.success {
    background: rgba(100, 255, 100, 0.2);
    border-color: rgba(100, 255, 100, 0.5);
    color: #2d5016;
    font-weight: 600;
}

/* Footer */
.game-footer {
    text-align: center;
    padding: 20px;
    color: var(--muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 900px) {
    .game-container {
        flex-direction: column;
        gap: 20px;
    }

    .game-info-section {
        flex: 1;
        width: 100%;
    }

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

    .selection-container {
        padding: 30px 40px;
    }

    .player-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .player-btn {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .game-menu {
        flex-direction: column;
        gap: 4px;
    }

    .game-container {
        padding: 15px;
    }

    .snake-ladder-board {
        grid-template-columns: repeat(10, 1fr);
        max-width: 100%;
    }

    .game-title-wrap {
        margin-top: 80px;
    }

    .selection-container {
        padding: 20px 30px;
    }
}
