:root {
    --bg-color: #f0f2f5;
    --wood-dark: rgb(92, 64, 56);
    /* iOS parseliDark */
    --wood-light: #8d6e63;
    --wood-panel: #d7ccc8;
    --wood-panel-border: #a1887f;
    --marble-red: #d32f2f;
    --marble-black: #212121;
    --forbidden-color: rgba(0, 0, 0, 0.3);
    --font-main: 'Outfit', sans-serif;
    --grid-gap: 0.8vmin;
    /* iOS-inspired colors */
    --parseli-light: rgb(217, 204, 191);
    --parseli-accent: rgb(242, 166, 51);
    /* Warm orange */
    --parseli-cream: rgb(245, 237, 224);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    background-image: url('bg_pattern.png');
    background-repeat: repeat;
    background-size: auto;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: #333;
}

.game-container {
    position: relative;
    /* For absolute positioning of user-display */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    /* Reduced gap */
    padding: 10px;
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    padding-left: calc(10px + env(safe-area-inset-left));
    padding-right: calc(10px + env(safe-area-inset-right));
    /* Reduced padding */
    max-width: 100vw;
    min-height: 100vh;
    /* Full height */
    height: auto;
    justify-content: flex-start;
    /* Center vertically */
}

/* Sound Toggle Button */
.sound-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(to bottom, var(--wood-dark), color-mix(in srgb, var(--wood-dark) 90%, black));
    border: 2px solid color-mix(in srgb, var(--wood-dark) 70%, black);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.sound-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.sound-toggle:active {
    transform: scale(0.95);
}

.sound-toggle.muted {
    opacity: 0.5;
}

.game-header {
    text-align: center;
    width: 100%;
}

h1 {
    font-size: 3rem;
    color: var(--wood-dark);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.status-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.turn-indicator {
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.2rem;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.turn-indicator.red-turn {
    color: var(--marble-red);
    border: 2px solid var(--marble-red);
}

.turn-indicator.black-turn {
    color: var(--marble-black);
    border: 2px solid var(--marble-black);
}

.btn {
    position: relative;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(to bottom,
            color-mix(in srgb, var(--wood-dark) 85%, white),
            var(--wood-dark),
            color-mix(in srgb, var(--wood-dark) 90%, black));
    color: white;
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow:
        0 5px 0 0 color-mix(in srgb, var(--wood-dark) 70%, black),
        0 6px 8px rgba(0, 0, 0, 0.4);
    border: 2px solid color-mix(in srgb, var(--wood-dark) 70%, black);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0.3),
            rgba(255, 255, 255, 0));
    border-radius: 10px 10px 0 0;
    pointer-events: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 7px 0 0 color-mix(in srgb, var(--wood-dark) 70%, black),
        0 8px 12px rgba(0, 0, 0, 0.5);
}

.btn:active {
    transform: translateY(3px);
    box-shadow:
        0 2px 0 0 color-mix(in srgb, var(--wood-dark) 70%, black),
        0 3px 4px rgba(0, 0, 0, 0.3);
}

.board-area {
    background: transparent;
    padding: 20px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex: 1;
    width: 100%;
    max-height: 90vh;
}

.board {
    position: relative;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: var(--grid-gap);
    background: transparent;
    padding: var(--grid-gap);
    border-radius: 4px;
    align-self: center;
    width: min(60vw, 75vh);
    height: min(60vw, 75vh);
    max-width: none;
    max-height: none;
    aspect-ratio: 1 / 1;
}

/* ... (panel styles) ... */


.panel {
    background-color: rgb(217, 204, 191);
    /* iOS panel color */
    border: 3px solid rgb(92, 64, 56);
    /* Dark brown border like iOS */
    border-radius: 12px;
    display: grid;
    gap: var(--grid-gap);
    /* Match board gap for square cells */
    place-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    transition: opacity 0.3s;
}

/* Wood texture effect */
.panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0, 0, 0, 0.02) 10px, rgba(0, 0, 0, 0.02) 20px);
    pointer-events: none;
}

.panel.forbidden {
    opacity: 0.6;
    filter: grayscale(0.5);
    cursor: not-allowed;
    box-shadow: inset 0 0 0 2px var(--wood-panel-border), inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.hole {
    width: 85%;
    height: 85%;
    aspect-ratio: 1;
    background-color: rgb(153, 136, 127);
    /* iOS hole color */
    border-radius: 50%;
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.hole:hover {
    transform: scale(1.05);
}

/* Highlight Styles */
/* Highlight Styles */
.hole.highlight-red,
.hole.highlight-black {
    border: 4px solid #2196F3;
    position: relative;
    z-index: 5;
    transform: translateZ(0);
    /* Hardware acceleration */
}

.hole.highlight-red {
    background-color: rgba(211, 47, 47, 0.6);
}

.hole.highlight-black {
    background-color: rgba(33, 33, 33, 0.6);
}

/* Optimized Pulse using Pseudo-element */
.hole.highlight-red::after,
.hole.highlight-black::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    /* Cover border */
    border-radius: 50%;
    box-shadow: 0 0 15px #2196F3, 0 0 25px #2196F3;
    opacity: 0;
    animation: pulseOpacity 1.5s infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes pulseOpacity {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}





.marble {
    width: 80%;
    height: 80%;
    border-radius: 50%;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4), inset -2px -2px 5px rgba(0, 0, 0, 0.2);
    animation: dropIn 0.3s ease-out;
}

.marble.red {
    background: radial-gradient(circle at 30% 30%, rgba(255, 0, 0, 0.8), rgb(153, 0, 0));
}

.marble.black {
    background: radial-gradient(circle at 30% 30%, rgb(128, 128, 128), rgb(0, 0, 0));
}

@keyframes dropIn {
    from {
        transform: scale(1.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

p {
    margin: 0;
}

.footer-logo-link {
    transition: transform 0.2s ease, opacity 0.2s ease;
    display: block;
}

.footer-logo-link:hover {
    transform: scale(1.05);
    opacity: 0.8;
}

.footer-logo-link:active {
    transform: scale(0.98);
}

.footer-logo {
    height: 52px;
    width: auto;
    display: block;
}

.game-footer {
    position: relative;
    /* Changed from fixed */
    margin-top: auto;
    /* Push to bottom of container */
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: var(--wood-dark);
    font-weight: 600;
    z-index: 100;
}

.footer-logo-link {
    transition: transform 0.2s ease, opacity 0.2s ease;
    display: block;
    pointer-events: auto;
}

/* Menu Styles */
.menu-container {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 500px;
    width: 90%;
    margin: 20px auto;
}

.menu-btn {
    position: relative;
    display: block;
    width: 100%;
    margin: 15px 0;
    padding: 16px 24px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 16px;
    background: linear-gradient(to bottom,
            color-mix(in srgb, var(--wood-dark) 85%, white),
            var(--wood-dark),
            color-mix(in srgb, var(--wood-dark) 90%, black));
    color: white;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: var(--font-main);
    box-shadow:
        0 5px 0 0 color-mix(in srgb, var(--wood-dark) 70%, black),
        0 6px 10px rgba(0, 0, 0, 0.4);
    border: 3px solid color-mix(in srgb, var(--wood-dark) 70%, black);
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0.4),
            rgba(255, 255, 255, 0));
    border-radius: 13px 13px 0 0;
    pointer-events: none;
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 7px 0 0 color-mix(in srgb, var(--wood-dark) 70%, black),
        0 8px 14px rgba(0, 0, 0, 0.5);
}

.menu-btn:active {
    transform: translateY(3px);
    box-shadow:
        0 2px 0 0 color-mix(in srgb, var(--wood-dark) 70%, black),
        0 3px 5px rgba(0, 0, 0, 0.3);
}

.marble.last-move {
    border: 4px solid #ffffff;
    transform: scale(1.15);
    z-index: 20;
    position: relative;
    /* No box-shadow animation on main element */
}

.marble.last-move::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    box-shadow: 0 0 15px #ffffff, 0 0 25px #ffffff;
    opacity: 0;
    animation: pulseOpacity 1.5s infinite;
    z-index: -1;
}

/* Reusing pulseOpacity from highlight styles */

/* Score Panels */
.score-panel {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 10px;
    /* width: 250px; Removed fixed width */
    flex: 1;
    /* Adaptive width */
    min-width: 220px;
    max-width: 320px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    text-align: center;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent overflow */
}

.score-panel h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    border-bottom: 2px solid #ddd;
    padding-bottom: 10px;
}

.red-panel h3 {
    color: var(--marble-red);
    border-color: var(--marble-red);
}

.black-panel h3 {
    color: var(--marble-black);
    border-color: var(--marble-black);
}

.marble-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--wood-dark);
    background: rgba(0, 0, 0, 0.05);
    padding: 10px;
    border-radius: 8px;
}

.marble-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4), inset -2px -2px 5px rgba(0, 0, 0, 0.2);
}

.marble-icon.red {
    background: radial-gradient(circle at 30% 30%, #ff5252, #b71c1c);
}

.marble-icon.black {
    background: radial-gradient(circle at 30% 30%, #616161, #000000);
}

.score-details {
    text-align: left;
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
    flex: 1;
    /* Fill available space */
    overflow-y: auto;
    /* Scroll if needed */
    min-height: 0;
    /* Required for flex scrolling */
}

.total-score {
    font-size: 2rem;
    font-weight: bold;
    color: var(--wood-dark);
    margin-top: auto;
    /* Push to bottom */
}

.score-panel.winner {
    border: 5px solid #4caf50;
    box-shadow: 0 0 20px #4caf50;
}

.score-panel.loser {
    opacity: 0.7;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: #333;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    font-size: 1rem;
    opacity: 0;
    transform: translateX(100%);
    animation: slideIn 0.3s forwards, fadeOut 0.3s forwards 3s;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
}

.toast.info {
    border-left: 5px solid #2196F3;
}

.toast.success {
    border-left: 5px solid #4CAF50;
}

.toast.warning {
    border-left: 5px solid #FF9800;
}

.toast.error {
    border-left: 5px solid #F44336;
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.score-item {
    margin-bottom: 8px;
    font-size: 1rem;
    border-bottom: 1px dashed #eee;
    padding-bottom: 4px;
}

.score-item:last-child {
    border-bottom: none;
}

/* Interactive Score Highlights */
/* Interactive Score Highlights */
.highlight-line,
.highlight-area {
    box-shadow: inset 0 0 30px rgba(255, 215, 0, 0.8) !important;
    border: 3px solid #FFD700 !important;
    transform: scale(1.02);
    z-index: 100 !important;
    opacity: 1 !important;
}

/* Remove old marble highlights */
.highlight-line .marble,
.highlight-area .marble {
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4), inset -2px -2px 5px rgba(0, 0, 0, 0.2);
    /* Reset to default */
    z-index: auto;
}

.highlight-panel-won {
    box-shadow: inset 0 0 30px rgba(255, 215, 0, 0.8) !important;
    border: 3px solid #FFD700 !important;
    transform: scale(1.02);
    z-index: 100 !important;
    /* Ensure it's on top */
    opacity: 1 !important;
    /* Override any disabled opacity */
}

.score-item {
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

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

.panel-detail-list {
    display: block;
    /* Always visible */
    margin-top: 5px;
    padding-left: 10px;
    font-size: 0.85rem;
    color: #555;
    text-align: left;
    max-height: 150px;
    /* Optional: scroll if too many */
    overflow-y: auto;
}

/* .score-item:hover .panel-detail-list { display: block; }  <-- Removed */

.panel-detail-item {
    margin-bottom: 2px;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
}

.panel-detail-item:hover {
    background-color: rgba(255, 215, 0, 0.2);
    font-weight: bold;
}

/* Mobile Responsiveness */

/* Tablet / Narrow Desktop */
@media (max-width: 850px) {
    .board-area {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
        padding: 10px;
        max-height: none;
    }

    .score-panel {
        width: 45%;
        max-width: none;
        min-width: 140px;
        order: 2;
        min-height: auto;
        /* Let content define height */
        margin: 0;
        padding: 10px;
    }

    .board {
        order: 1;
        /* Board first */
        width: 100%;
        height: auto;
        max-width: none;
        max-height: none;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .board-area {
        padding: 10px;
        gap: 20px;
    }

    .board {
        gap: 2px;
        padding: 5px;
    }

    .hole {
        width: 34px;
        height: 34px;
    }

    .marble {
        width: 26px;
        height: 26px;
    }

    .panel {
        border-width: 1px;
    }

    .score-panel {
        padding: 15px;
    }

    .score-panel h3 {
        font-size: 1.2rem;
    }

    .total-score {
        font-size: 1.5rem;
    }
}

/* Header Redesign */
.status-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 20px;
}

.status-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.user-info {
    position: absolute;
    top: 20px;
    right: 20px;
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--wood-dark);
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
    z-index: 100;
}

.icon-btn {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-icon {
    display: none;
    /* Hide icons by default on desktop */
}

.btn.secondary {
    background-color: #795548;
}

.btn.danger {
    background-color: #d32f2f;
}

/* Mobile Header Adjustments */
@media (max-width: 600px) {
    .status-bar {
        flex-direction: column;
        gap: 15px;
    }

    .status-info {
        width: 100%;
        justify-content: space-between;
    }

    .status-controls {
        width: 100%;
        justify-content: space-between;
    }

    .icon-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 5px;
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    .user-info {
        position: static;
        /* Reset absolute positioning */
        margin: 10px auto;
        width: fit-content;
        max-width: 100%;
    }

    .status-bar {
        flex-direction: column;
    }

    .game-header h1 {
        margin-top: 10px;
    }
}

/* Shake Animation for Forbidden Moves */
@keyframes shakeError {

    0%,
    100% {
        transform: translateX(0);
    }

    25%,
    75% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }
}

.panel.shake-error {
    animation: shakeError 0.4s ease-in-out;
    box-shadow: inset 0 0 0 2px red, inset 0 0 10px rgba(0, 0, 0, 0.05) !important;
    z-index: 10;
    /* Bring to front */
}

/* Shake/Flash Animation for Invalid Holes */
@keyframes flashError {
    0% {
        background-color: #a1887f;
        box-shadow: none;
    }

    50% {
        background-color: rgba(244, 67, 54, 0.5);
        box-shadow: 0 0 10px red;
    }

    100% {
        background-color: #a1887f;
        box-shadow: none;
    }
}



/* Refined Flash Animation (Border Only) */
@keyframes flashErrorBorder {
    0% {
        box-shadow: none;
    }

    50% {
        box-shadow: inset 0 0 0 4px rgba(255, 82, 82, 0.7);
    }

    /* Thicker, paler red (Red A200ish) */
    100% {
        box-shadow: none;
    }
}

.hole.flash-error {
    animation: flashErrorBorder 0.4s ease-in-out;
}

/* Modern Login Redesign */
.auth-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    overflow-y: auto;
}

.auth-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 2rem 1rem;
}

.auth-card {
    background-color: var(--wood-panel);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        inset 0 0 0 2px rgba(255, 255, 255, 0.1),
        inset 0 0 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 380px;
    text-align: center;
    position: relative;
    border: 6px solid var(--wood-dark);
    animation: cardEntrance 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 2px dashed var(--wood-panel-border);
    border-radius: 12px;
    pointer-events: none;
}

.auth-title {
    font-size: 2rem;
    color: var(--wood-dark);
    margin-bottom: 0.5rem;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.4);
}

.auth-subtitle {
    color: #5d4037;
    opacity: 0.8;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.game-input-group {
    margin-bottom: 1.2rem;
    position: relative;
    text-align: left;
}

.game-input-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--wood-dark);
    font-weight: bold;
    font-size: 0.9rem;
    padding-left: 5px;
}

.game-input {
    width: 100%;
    padding: 14px 16px;
    background-color: white;
    border: none;
    border-radius: 14px;
    color: var(--wood-dark);
    font-size: 1rem;
    font-weight: 600;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.08),
        inset 0 0 0 2px color-mix(in srgb, var(--wood-dark) 15%, transparent);
    transition: all 0.3s ease;
    font-family: var(--font-main);
}

.game-input::placeholder {
    color: color-mix(in srgb, var(--wood-dark) 40%, transparent);
    font-weight: 500;
}

.game-input:focus {
    outline: none;
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.12),
        inset 0 0 0 2px var(--parseli-accent);
}

.wood-btn {
    position: relative;
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(to bottom,
            color-mix(in srgb, var(--wood-dark) 85%, white),
            var(--wood-dark),
            color-mix(in srgb, var(--wood-dark) 90%, black));
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: var(--font-main);
    letter-spacing: 0.5px;
    box-shadow:
        0 4px 0 0 color-mix(in srgb, var(--wood-dark) 70%, black),
        0 5px 8px rgba(0, 0, 0, 0.4);
    border: 2px solid color-mix(in srgb, var(--wood-dark) 70%, black);
}

.wood-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0.4),
            rgba(255, 255, 255, 0));
    border-radius: 13px 13px 0 0;
    pointer-events: none;
}

.wood-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 7px 0 0 color-mix(in srgb, var(--wood-dark) 70%, black),
        0 8px 14px rgba(0, 0, 0, 0.5);
}

.wood-btn:active {
    transform: translateY(3px);
    box-shadow:
        0 2px 0 0 color-mix(in srgb, var(--wood-dark) 70%, black),
        0 3px 5px rgba(0, 0, 0, 0.3);
}

.wood-btn.secondary {
    background: linear-gradient(to bottom,
            color-mix(in srgb, #8d6e63 85%, white),
            #8d6e63,
            color-mix(in srgb, #8d6e63 90%, black));
    border-color: color-mix(in srgb, #8d6e63 70%, black);
    box-shadow:
        0 5px 0 0 color-mix(in srgb, #8d6e63 70%, black),
        0 6px 10px rgba(0, 0, 0, 0.4);
    margin-top: 1rem;
}

.wood-btn.secondary:hover {
    box-shadow:
        0 7px 0 0 color-mix(in srgb, #8d6e63 70%, black),
        0 8px 14px rgba(0, 0, 0, 0.5);
}

.wood-btn.secondary:active {
    box-shadow:
        0 2px 0 0 color-mix(in srgb, #8d6e63 70%, black),
        0 3px 5px rgba(0, 0, 0, 0.3);
}

/* Red button for logout - iOS style */
.wood-btn.red-btn {
    background: linear-gradient(to bottom, #ff4444, #dc3545, #c82333);
    border-color: #c82333;
    box-shadow:
        0 4px 0 0 #a71d2a,
        0 5px 8px rgba(0, 0, 0, 0.4);
}

.wood-btn.red-btn:hover {
    background: linear-gradient(to bottom, #ff5555, #e04555, #d63545);
    transform: translateY(-1px);
    box-shadow:
        0 5px 0 0 #a71d2a,
        0 7px 12px rgba(0, 0, 0, 0.5);
}

.wood-btn.red-btn:active {
    transform: translateY(3px);
    box-shadow:
        0 2px 0 0 #a71d2a,
        0 3px 5px rgba(0, 0, 0, 0.4);
}

.auth-divider {
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    color: var(--wood-dark);
    opacity: 0.6;
    font-size: 0.9rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--wood-dark);
    opacity: 0.3;
}

.auth-divider span {
    padding: 0 10px;
}

.auth-footer {
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.auth-link {
    color: var(--wood-dark);
    text-decoration: none;
    font-weight: bold;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
}

.auth-link:hover {
    border-color: var(--wood-dark);
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    /* High z-index to sit on top of everything */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    margin: auto;
    animation: cardEntrance 0.4s ease-out;
}

.close {
    color: var(--wood-dark);
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
}

.close:hover,
.close:focus {
    color: #d32f2f;
    text-decoration: none;
    cursor: pointer;
}



/* Main Menu User Info */
.menu-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px dashed #ddd;
    width: 100%;
}

.user-avatar-large {
    width: 80px;
    height: 80px;
    background-color: var(--wood-light);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 4px solid white;
}

.menu-username {
    font-size: 1.5rem;
    color: var(--wood-dark);
    font-weight: bold;
    margin: 0;
}

/* Mobile adjustments for menu header */
@media (max-width: 480px) {
    .menu-header {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }

    .user-avatar-large {
        width: 60px;
        height: 60px;
        font-size: 2.2rem;
    }

    .menu-username {
        font-size: 1.3rem;
    }
}

/* Active Player Glow */
.score-panel.active-turn {
    box-shadow: 0 0 20px rgba(33, 150, 243, 0.8), 0 0 40px rgba(33, 150, 243, 0.4);
    border: 2px solid #2196F3;
    z-index: 10;
}


/* Online Status Indicator */

/* Modal Close Button */

/* Auth Input Styles */
.auth-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--wood-dark);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-main);
    background: white;
    transition: all 0.2s;
}

.auth-input:focus {
    outline: none;
    border-color: var(--parseli-accent);
    box-shadow: 0 0 0 3px rgba(242, 166, 51, 0.1);
}

.password-container {
    position: relative;
    width: 100%;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 4px;
    line-height: 1;
    color: var(--wood-dark);
    opacity: 0.6;
    transition: all 0.2s ease;
    user-select: none;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.password-toggle:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateY(-50%) scale(1.1);
}

.password-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

.forgot-password-link {
    display: inline-block;
    width: 100%;
    margin-top: 0.75rem;
    font-size: 0.95rem;
    color: var(--wood-dark);
    text-align: right;
    text-decoration: none;
    font-weight: 600;
    opacity: 0.8;
    transition: all 0.2s ease;
}

.forgot-password-link:hover {
    opacity: 1;
    transform: translateX(-2px);
    text-decoration: underline;
}

.reset-step {
    display: none;
}

.reset-step.active {
    display: block;
}

.auth-input::placeholder {
    color: #999;
}



/* Store Badge Styles */
.store-badges {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
}

.store-badge-link {
    display: block;
    height: 48px;
    width: auto;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.store-badge {
    height: 100%;
    width: auto;
    display: block;
    border-radius: 6px;
}

.store-badge-link:hover {
    transform: translateY(-2px) scale(1.02);
    opacity: 0.9;
}

.store-badge-link:active {
    transform: translateY(1px) scale(0.98);
}

@media (min-width: 480px) {
    .store-badges {
        flex-direction: row;
        justify-content: center;
        gap: 1.5rem;
    }

    .store-badge-link {
        height: 52px;
    }
}