/* ===== INDEX PAGE LAYOUT ===== */
.title-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Watermark filigrane */
.title-screen::before {
    content: 'Cul de Chouette';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-18deg);
    font-family: var(--font-title);
    font-size: clamp(5rem, 12vw, 10rem);
    color: var(--ink);
    opacity: 0.04;
    white-space: nowrap;
    pointer-events: none;
    z-index: 0;
    letter-spacing: 0.05em;
}

/* 3-column lobby row */
.lobby-row {
    display: grid;
    grid-template-columns: 1fr minmax(340px, 560px) 1fr;
    gap: 16px;
    align-items: start;
    justify-content: center;
    width: 100%;
    max-width: 1400px;
    max-height: calc(100vh - 40px);
    position: relative;
    z-index: 1;
}

.lobby-col {
    overflow-y: auto;
    max-height: calc(100vh - 60px);
}

.title-card {
    max-width: 600px;
    width: 100%;
    padding: 60px 50px;
    text-align: center;
}

.title-card h1 {
    font-size: 2.8rem;
    margin-bottom: 5px;
}

.title-card .subtitle {
    font-family: var(--font-ui);
    font-size: 1.1rem;
    color: var(--ink-light);
    letter-spacing: 0.08em;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 30px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
    text-align: left;
}

.mode-btn .mode-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
    width: 40px;
    text-align: center;
}

.mode-btn .mode-info h3 {
    font-family: var(--font-score);
    font-size: 1.15rem;
    color: var(--ink);
    margin-bottom: 2px;
}

.mode-btn .mode-info p {
    font-size: 0.9rem;
    color: var(--ink-light);
    margin: 0;
}

/* Setup panels */
.setup-panel {
    max-width: 500px;
    width: 100%;
    padding: 40px;
    position: relative;
    z-index: 1;
}

.setup-panel h2 {
    font-size: 1.6rem;
    text-align: center;
    margin-bottom: 20px;
}

/* Solo setup: wider + compact to avoid scroll */
#solo-setup {
    max-width: 680px;
    padding: 24px 32px;
}
#solo-setup h2 {
    margin-bottom: 12px;
}
#solo-setup .form-group {
    margin-bottom: 10px;
}

/* Name + camera row */
.name-camera-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.name-camera-row .input {
    flex: 1;
}

/* Camera selfie widget */
.camera-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px dashed rgba(180, 150, 110, 0.4);
    background: var(--parchment-dark);
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--ink-light);
    transition: all 0.3s;
    position: relative;
}
.camera-toggle:hover {
    border-color: var(--gold);
    background: rgba(180, 150, 110, 0.1);
}
.camera-toggle.active {
    border-style: solid;
    border-color: var(--gold);
}
.camera-toggle video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

/* 2-column grid for blason + opponents side by side */
.solo-pickers-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Bottom row: difficulty + theme side by side */
.solo-options-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    margin-bottom: 6px;
    color: var(--ink-light);
}

.difficulty-select {
    display: flex;
    gap: 8px;
}

.difficulty-select .btn {
    flex: 1;
    text-align: center;
    padding: 10px;
}

.difficulty-select .btn.active {
    background: linear-gradient(180deg, var(--accent) 0%, #5a1a0a 100%);
    color: var(--parchment);
}

.waiting-room {
    text-align: center;
}

.waiting-room .room-code {
    font-family: var(--font-score);
    font-size: 2.5rem;
    color: var(--accent);
    letter-spacing: 0.15em;
    margin: 15px 0;
}

.player-list {
    list-style: none;
    margin: 20px 0;
}

.player-list li {
    font-family: var(--font-body);
    font-size: 1.1rem;
    padding: 8px 0;
    color: var(--ink);
}

.player-list li::before {
    content: '\2767\00a0\00a0';
    color: var(--gold);
}

/* ===== GAME PAGE LAYOUT ===== */
.game-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    grid-template-rows: auto 1fr;
    gap: 12px;
    padding: 12px;
    min-height: 100vh;
    max-width: 1280px;
    margin: 0 auto;
}

.game-header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
}

.game-header h1 {
    font-size: 1.4rem;
}

.game-header .turn-info {
    font-family: var(--font-score);
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--parchment-light);
    background: linear-gradient(180deg, #5a1a0a, #3a0e04);
    border: 2px solid var(--gold);
    border-radius: 24px;
    padding: 6px 22px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4), inset 0 1px 0 rgba(180,150,110,0.15);
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    transition: all 0.4s ease;
    white-space: nowrap;
}

.game-sidebar {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.game-main {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-footer {
    grid-column: 1 / -1;
}

/* Dice area — 3D canvas with overlaid UI */
.dice-area {
    text-align: center;
    min-height: 340px;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto auto;
    align-items: center;
    justify-items: center;
    gap: 0;
    background: #1a0e06;
    border: 2px solid #8b6e4e;
    border-radius: 12px;
    box-shadow:
        0 0 0 2px #b4966e,
        0 8px 30px rgba(0,0,0,0.6);
    overflow: hidden;
    position: relative;
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

/* Active turn: golden glow on dice area */
.dice-area.my-turn {
    border-color: var(--gold);
    box-shadow:
        0 0 0 2px var(--gold),
        0 0 20px rgba(212, 168, 67, 0.25),
        0 8px 30px rgba(0,0,0,0.6);
}

/* Waiting for opponent: subtle dimming */
.dice-area.waiting {
    border-color: #5a4a3a;
}

.combination-display {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    pointer-events: none;
    font-family: var(--font-score);
    font-size: 1.3rem;
    color: var(--accent);
    min-height: 30px;
    text-shadow: 0 0 10px rgba(180, 150, 110, 0.3);
}

.action-buttons {
    grid-row: 2;
    grid-column: 1;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 10px 16px;
    width: 100%;
    z-index: 5;
}

/* Waiting text styling */
.action-buttons .waiting-text {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--ink-light);
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-buttons .waiting-text::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--gold);
    border-radius: 50%;
    animation: waitingDot 1.2s ease-in-out infinite;
}

@keyframes waitingDot {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* Log area — compact to give more room to dice/interaction */
.log-area {
    padding: 10px 14px;
    max-height: 100px;
    overflow-y: auto;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.3s ease, max-height 0.3s ease;
}
.log-area:hover {
    opacity: 1;
    max-height: 200px;
}

.log-area h3 {
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.log-entries {
    list-style: none;
}

.log-entries li {
    font-size: 0.82rem;
    padding: 2px 0;
    color: var(--ink-light);
    border-bottom: 1px dotted rgba(180, 150, 110, 0.2);
}

.log-entries li:last-child {
    color: var(--ink);
    font-weight: bold;
}

/* ===== RESPONSIVE ===== */

/* Video strip — tablet */
@media (max-width: 900px) {
    .video-card video {
        width: 160px;
        height: 120px;
    }
    .video-card.local video {
        width: 120px;
        height: 90px;
    }
}

@media (max-width: 900px) {
    .game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto;
    }

    .game-sidebar {
        grid-column: 1;
        grid-row: auto;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: visible;
        max-height: none;
        gap: 10px;
    }

    .game-main {
        grid-column: 1;
        grid-row: auto;
    }

    .game-sidebar .parchment {
        min-width: 200px;
        flex-shrink: 0;
    }

    .title-card {
        padding: 40px 25px;
    }

    .title-card h1 {
        font-size: 2rem;
    }

    .game-header h1 {
        font-size: 1.1rem;
    }

    .lobby-extras {
        grid-template-columns: 1fr;
    }

    .lobby-row {
        grid-template-columns: 1fr;
        max-height: none;
    }

    .lobby-col {
        max-height: none;
        overflow-y: visible;
    }

    .lobby-left,
    .lobby-right {
        display: block;
    }
}

/* Video strip — mobile */
@media (max-width: 500px) {
    .video-strip {
        gap: 6px;
        padding: 6px 8px;
    }
    .video-card video {
        width: 120px;
        height: 90px;
    }
    .video-card.local video {
        width: 100px;
        height: 75px;
    }
    .video-modal video {
        width: 90vw;
        height: auto;
        max-height: 70vh;
    }
}

@media (max-width: 500px) {
    .game-container {
        padding: 8px;
        gap: 8px;
    }

    .dice-area {
        min-height: 250px;
    }

    #dice-3d-canvas {
        min-height: 250px;
    }

    .mode-btn {
        padding: 14px 16px;
    }

    .game-header {
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .game-header h1 {
        font-size: 1rem;
    }

    .log-area {
        max-height: 150px;
        padding: 12px 14px;
    }

    .action-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .action-buttons .btn {
        width: 100%;
        min-height: 48px;
    }

    /* Reflex zones stacked on mobile */
    .reflex-zones {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(3, 1fr);
    }

    .reflex-zone {
        font-size: 1.8rem;
    }

    /* Sidebar vertical on very small screens */
    .game-sidebar {
        flex-direction: column;
    }

    .game-sidebar .parchment {
        min-width: auto;
    }

    /* Settings panel full-width on mobile */
    .settings-panel {
        right: 8px;
        left: 8px;
    }

    /* Rules modal smaller */
    .rules-modal {
        padding: 25px 20px;
        max-height: 90vh;
    }

    .rules-combo-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .rules-combo-name {
        min-width: auto;
    }
}
