/* === Quoridor Styles === */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    min-height: calc(100vh - var(--nav-height));
    padding-top: calc(var(--nav-height) + var(--space-6));
}

/* Orientation toggle button */
.qr-orient-btn {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    border: 1px solid rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    font-family: var(--font-body);
    transition: all var(--transition-fast);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.qr-orient-btn:hover {
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.5);
}

.qr-orient-btn:active {
    transform: scale(0.95);
    background: rgba(251, 191, 36, 0.25);
}

/* Board wrapper — holds inventory strips + board */
.qr-board-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: clamp(300px, 85vw, 460px);
}

/* Wall inventory strips */
.qr-wall-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.qr-wall-strip--top {
    background: linear-gradient(180deg, rgba(220, 38, 38, 0.08) 0%, rgba(10, 12, 28, 0.3) 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 2px solid var(--glass-border);
    border-bottom: none;
}

.qr-wall-strip--bottom {
    background: linear-gradient(0deg, rgba(37, 99, 235, 0.08) 0%, rgba(10, 12, 28, 0.3) 100%);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    border: 2px solid var(--glass-border);
    border-top: none;
}

.qr-wall-strip__label {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-right: 10px;
    white-space: nowrap;
    opacity: 0.7;
}

.qr-wall-strip--top .qr-wall-strip__label {
    color: #f87171;
}

.qr-wall-strip--bottom .qr-wall-strip__label {
    color: #60a5fa;
}

/* Individual wall token */
.qr-wall-token {
    width: 22px;
    height: 8px;
    border-radius: 3px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
}

/* Player (blue) wall tokens */
.qr-wall-token--player {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.2);
    cursor: grab;
}

.qr-wall-token--player:hover {
    transform: scale(1.2) translateY(-2px);
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.qr-wall-token--player:active {
    cursor: grabbing;
}

/* CPU (red) wall tokens */
.qr-wall-token--cpu {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

/* Used (empty) wall token */
.qr-wall-token--used {
    background: rgba(255, 255, 255, 0.04) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06) !important;
    cursor: default !important;
    transform: none !important;
}

/* Board */
.qr-board {
    display: grid;
    gap: 0;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    background: rgba(10, 12, 28, 0.6);
    border: 2px solid var(--glass-border);
    width: 100%;
    aspect-ratio: 1;
}

/* Cell (square) */
.qr-cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    transition: background 0.15s;
}

.qr-cell--square {
    background: rgba(30, 35, 60, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.qr-cell--square:hover {
    background: rgba(45, 50, 75, 0.8);
}

.qr-cell--square.qr-cell--valid {
    background: rgba(16, 185, 129, 0.15);
    cursor: pointer;
}

.qr-cell--square.qr-cell--valid::after {
    content: '';
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
    animation: qr-pulse-dot 1.5s ease-in-out infinite;
}

@keyframes qr-pulse-dot {

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

    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

/* Groove cells (wall slots) — widened for easier targeting */
.qr-cell--hgroove,
.qr-cell--vgroove {
    background: rgba(15, 15, 35, 0.15);
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.qr-cell--intersection {
    background: rgba(15, 15, 35, 0.1);
    cursor: pointer;
    transition: background 0.15s;
}

/* Groove hover highlight */
.qr-cell--hgroove:hover,
.qr-cell--vgroove:hover,
.qr-cell--intersection:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Wall preview (valid) */
.qr-cell--wall-preview {
    background: rgba(245, 158, 11, 0.45) !important;
    box-shadow: inset 0 0 8px rgba(245, 158, 11, 0.35), 0 0 12px rgba(245, 158, 11, 0.2) !important;
    border-radius: 2px;
}

/* Wall preview (invalid) */
.qr-cell--wall-invalid {
    background: rgba(239, 68, 68, 0.25) !important;
    box-shadow: inset 0 0 6px rgba(239, 68, 68, 0.2) !important;
}

/* Placed walls — player (blue) */
.qr-cell--wall-player {
    background: linear-gradient(135deg, #2563eb, #3b82f6) !important;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.2), 0 0 8px rgba(59, 130, 246, 0.5);
    border-radius: 2px;
    animation: qr-wall-place 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Placed walls — CPU (red) */
.qr-cell--wall-cpu {
    background: linear-gradient(135deg, #dc2626, #ef4444) !important;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.15), 0 0 8px rgba(239, 68, 68, 0.5);
    border-radius: 2px;
    animation: qr-wall-place 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes qr-wall-place {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

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

/* Pawns */
.qr-pawn {
    width: 72%;
    height: 72%;
    border-radius: 50%;
    position: relative;
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.qr-pawn--player {
    background: radial-gradient(circle at 35% 35%, #60a5fa, #2563eb);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3), 0 3px 8px rgba(37, 99, 235, 0.4), 0 0 16px rgba(96, 165, 250, 0.3);
    border: 2px solid rgba(96, 165, 250, 0.6);
}

.qr-pawn--cpu {
    background: radial-gradient(circle at 35% 35%, #f87171, #dc2626);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2), 0 3px 8px rgba(220, 38, 38, 0.4), 0 0 16px rgba(248, 113, 113, 0.3);
    border: 2px solid rgba(248, 113, 113, 0.6);
}

/* Goal row highlights */
.qr-cell--player-goal {
    background: rgba(37, 99, 235, 0.06) !important;
}

.qr-cell--cpu-goal {
    background: rgba(220, 38, 38, 0.06) !important;
}

/* Orientation hint tooltip */
.qr-orient-hint {
    position: fixed;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.85);
    color: #fbbf24;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.qr-orient-hint--visible {
    opacity: 1;
}

/* Drag ghost */
.qr-drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 200;
    width: 60px;
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.6);
    opacity: 0.85;
    transform: translate(-50%, -50%);
    transition: width 0.15s, height 0.15s;
}

.qr-drag-ghost--vertical {
    width: 12px;
    height: 60px;
}

/* Drop target highlight on board */
.qr-board--drag-over {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(251, 191, 36, 0.3);
}

/* Info modal */
.info-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.info-modal__card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    max-width: 460px;
    width: 90%;
}

.info-modal__card h2 {
    margin-bottom: var(--space-4);
    color: var(--text-primary);
}

.info-modal__card ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.info-modal__card li {
    color: var(--text-secondary);
    padding-left: var(--space-4);
    position: relative;
}

.info-modal__card li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-primary-bright);
}

@media (max-width: 480px) {
    .qr-board-wrapper {
        width: min(94vw, 360px);
    }

    .qr-wall-token {
        width: 16px;
        height: 6px;
    }

    .qr-wall-strip {
        gap: 4px;
        padding: 7px 10px;
    }

    .qr-wall-strip__label {
        font-size: 10px;
        margin-right: 6px;
    }
}