/* ===========================================
   THE HIDEOUT — 3-Column Layout v2
   Fixed: chess visibility, full-width games,
   captured pieces, toggle colors
   =========================================== */

/* ── Toggle Button (always visible) ── */
.hideout-toggle-wrap {
    /* Previously absolute bottom-right, now inline but keeping class for structure */
    z-index: 200;
}

.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

.theme-switch-container {
    display: inline-block;
    position: relative;
    width: 60px;
    height: 34px;
}

.theme-switch-container input {
    display: none;
}

#hideout-toggle-svg {
    display: block;
}

.theme-switch-checkmark {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transition: 0.4s;
}

/* ── Inline Footer Switch Support ── */
.hideout-footer-link {
    display: flex !important;
    align-items: center;
    gap: 0.8rem;
    width: fit-content;
}

.footer-inline-switch {
    display: inline-block;
    vertical-align: middle;
    /* Adjust scale if it feels too big next to the text */
    transform: scale(0.85);
    transform-origin: left center;
}

.footer-inline-switch .theme-switch-wrapper {
    margin: 0;
    padding: 0;
}

.footer-emails {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 1rem;
}

.alt-email {
    color: #666 !important;
    font-size: 0.85rem !important;
}

.alt-email:hover {
    color: #ff4757 !important;
}

/* ── Container — Overlays the footer ── */
.hideout-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    z-index: 50;
    display: grid;
    grid-template-columns: 80px 1fr 160px;
    box-sizing: border-box;
    border: 2px solid #ff4757;
    overflow: hidden;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        opacity 0.4s ease;
    pointer-events: none;
}

.hideout-container.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.hideout-container.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

/* ═══════════════════════════════════
   LEFT SIDEBAR
   ═══════════════════════════════════ */
.hideout-sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #0a0a0a;
    border-right: 1px solid #1a1a1a;
    padding: .5rem 0;
    overflow-y: auto;
}

.sidebar-games {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: .6rem .25rem;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    color: #666;
    cursor: pointer;
    transition: all .2s;
    font-family: 'Space Grotesk', monospace, sans-serif;
}

.sidebar-btn:hover {
    background: #111;
    color: #ccc;
    border-left-color: #444;
}

.sidebar-btn.active {
    background: #111;
    color: #ff4757;
    border-left-color: #ff4757;
}

.sb-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.sb-label {
    font-size: .5rem;
    letter-spacing: .5px;
    text-transform: uppercase;
}

/* Undo / Redo */
.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: .5rem;
}

.action-btn {
    background: transparent;
    border: 1px solid #333;
    color: #ff4757;
    padding: .35rem .3rem;
    cursor: pointer;
    font-family: 'Orbitron', monospace, sans-serif;
    font-size: .55rem;
    letter-spacing: 1px;
    transition: all .2s;
    border-radius: 3px;
}

.action-btn:hover:not(:disabled) {
    background: rgba(255, 71, 87, .12);
    border-color: #ff4757;
}

.action-btn:disabled {
    color: #333;
    border-color: #1a1a1a;
    cursor: not-allowed;
}

/* ═══════════════════════════════════
   CENTER — GAME SCREEN
   ═══════════════════════════════════ */
.hideout-center {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
    position: relative;
    padding: 0;
}

.game-screen {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Welcome screen */
.game-welcome {
    text-align: center;
}

.game-welcome h2 {
    font-family: 'Orbitron', monospace, sans-serif;
    font-size: 2rem;
    color: #ff4757;
    letter-spacing: 6px;
    margin: 0 0 .8rem 0;
    text-shadow: 0 0 20px rgba(255, 71, 87, .3);
}

.game-welcome p {
    font-family: 'Space Grotesk', monospace, sans-serif;
    font-size: .85rem;
    color: #555;
    letter-spacing: 2px;
    margin: 0;
}

/* Canvas fills the container */
canvas.game-canvas {
    display: block;
    background: #000;
    width: 100% !important;
    height: 100% !important;
}

/* ═══════════════════════════════════
   RIGHT — INFO PANEL
   ═══════════════════════════════════ */
.hideout-info {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1rem;
    padding: 1rem .8rem;
    background: #050505;
    border-left: 1px solid #1a1a1a;
    overflow-y: auto;
}

.info-score {
    text-align: right;
}

.info-label {
    font-family: 'Space Grotesk', monospace;
    font-size: .7rem;
    color: #666;
    display: block;
    letter-spacing: 1px;
}

.info-value {
    font-family: 'Orbitron', monospace, sans-serif;
    font-size: 1.4rem;
    color: #ff4757;
    font-weight: 700;
    word-break: break-word;
}

.info-player {
    text-align: right;
    padding: .5rem .4rem;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    transition: all .3s;
}

.info-player span {
    font-family: 'Orbitron', monospace, sans-serif;
    font-size: .6rem;
    letter-spacing: 2px;
}

.info-player.p1 span {
    color: #ccc;
}

.info-player.p2 span {
    color: #ff4757;
}

.info-player.active-turn {
    border-color: #ff4757;
    background: rgba(255, 71, 87, .08);
    box-shadow: 0 0 10px rgba(255, 71, 87, .15);
}

/* Captured pieces area */
.captured-area {
    margin-top: .5rem;
    padding: .4rem;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    min-height: 30px;
}

.captured-area .cap-title {
    font-family: 'Space Grotesk', monospace;
    font-size: .5rem;
    color: #444;
    letter-spacing: 1px;
    margin-bottom: .25rem;
    display: block;
}

.captured-area .cap-pieces {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    font-size: 1rem;
    line-height: 1.2;
}

.info-hint {
    margin-top: auto;
}

.info-hint span {
    font-family: monospace;
    font-size: .55rem;
    color: #444;
    letter-spacing: .5px;
}

/* ═══════════════════════════════════
   TIC-TAC-TOE — centered, fills space
   ═══════════════════════════════════ */
.xo-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 6px;
    width: min(85vh, 85%);
    height: min(85vh, 85%);
    max-width: 480px;
    max-height: 480px;
    aspect-ratio: 1;
}

.xo-cell {
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(2rem, 5vw, 4rem);
    cursor: pointer;
    font-family: 'Orbitron', monospace, sans-serif;
    color: #444;
    border: 1px solid #333;
    transition: all .15s;
}

.xo-cell:hover {
    background: #1a1a1a;
}

.xo-cell.x {
    color: #ff4757;
}

.xo-cell.o {
    color: #ffffff;
}

.xo-cell.win {
    background: rgba(255, 71, 87, .2);
    border-color: #ff4757;
}

/* Countdown overlay */
.countdown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
}

.countdown-overlay span {
    font-family: 'Orbitron', monospace, sans-serif;
    font-size: 5rem;
    color: #ff4757;
    text-shadow: 0 0 30px rgba(255, 71, 87, .5);
    animation: countPulse .5s ease-out;
}

@keyframes countPulse {
    0% {
        transform: scale(1.6);
        opacity: 0.3;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ═══════════════════════════════════
   CHESS — centered, fills height
   ═══════════════════════════════════ */
.chess-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    padding: 8px 0;
    box-sizing: border-box;
}

.chess-captured-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: .9rem;
    min-width: 22px;
    align-items: center;
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border: 2px solid #444;
    aspect-ratio: 1;
    height: calc(100% - 16px);
    max-height: 100%;
    box-sizing: border-box;
}

.chess-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    cursor: pointer;
    transition: background .12s;
    position: relative;
    aspect-ratio: 1;
    box-sizing: border-box;
}

.chess-cell.light {
    background: #b0b0b0;
}

.chess-cell.dark {
    background: #3a3a3a;
}

.chess-cell.selected {
    background: #ff4757 !important;
}

.chess-cell.legal-move::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: rgba(255, 71, 87, .45);
    border-radius: 50%;
}

.chess-cell.legal-capture {
    box-shadow: inset 0 0 0 3px rgba(255, 71, 87, .55);
}

.chess-cell.last-move {
    background: rgba(255, 200, 0, .25) !important;
}

.chess-cell.in-check {
    background: rgba(255, 0, 0, .35) !important;
}

.chess-piece {
    pointer-events: none;
    line-height: 1;
    user-select: none;
}

.white-piece {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}

.black-piece {
    color: #1a1a1a;
    text-shadow: 0 1px 2px rgba(255, 255, 255, .2);
}

/* ═══════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════ */
@media (max-width: 768px) {
    .hideout-container {
        grid-template-columns: 60px 1fr 0px;
    }

    .hideout-info {
        display: none;
    }

    .chess-cell {
        font-size: 1.2rem;
    }
}

/* ═══════════════════════════════════
   3D RUBIK'S CUBE GAME (Three.js Container)
   ═══════════════════════════════════ */
.cube-game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    height: 100%;
    width: 100%;
}

#cube-canvas-container {
    cursor: grab;
}

#cube-canvas-container:active {
    cursor: grabbing;
}

.cube-face.bottom {
    transform: rotateX(-90deg) translateZ(90px);
}

.cube-info {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.cube-level {
    font-family: 'Orbitron', monospace;
    font-size: 0.85rem;
    color: #ff4757;
    letter-spacing: 3px;
}

.cube-level span {
    font-size: 1.1rem;
    font-weight: 700;
}

.cube-status {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.78rem;
    color: #888;
    letter-spacing: 2px;
    transition: color 0.3s;
}

.cube-moves {
    font-family: 'Rajdhani', monospace;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 2px;
}

.cube-target {
    margin-top: 0.5rem;
}

.target-label {
    font-family: 'Orbitron', monospace;
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.target-grid {
    display: grid;
    grid-template-columns: repeat(3, 18px);
    gap: 2px;
}

/* Chess AI Toggle Switch */
.cyber-switch input:checked+.slider {
    background-color: #ff4757;
    box-shadow: 0 0 8px rgba(255, 71, 87, 0.6);
}

.cyber-switch input:focus+.slider {
    box-shadow: 0 0 1px #ff4757;
}

.cyber-switch input:checked+.slider .slider-knob {
    transform: translateX(20px);
}