/*
© 2026 Logic Duel Puzzles. All rights reserved. Unauthorized duplication, modification, or redistribution of this source code is strictly prohibited.
// --- Start: QuadraDuel CSS ---
*/

:root {
    /* Theme A: Prism (Default - Bright, distinct pastels for fast visual matching) */
    --bg-color: #0d0d0d;
    --overlay-bg: rgba(13, 13, 13, 0.85);
    --neutral-bg: rgba(255, 255, 255, 0.06);
    --text-color: #e0e0e0;
    --accent-color: #ffc107;
    
    /* 10 distinct values mapped to colors */
    --val-0: #f43f5e; /* Rose */
    --val-1: #f97316; /* Orange */
    --val-2: #eab308; /* Yellow */
    --val-3: #84cc16; /* Lime */
    --val-4: #10b981; /* Emerald */
    --val-5: #06b6d4; /* Cyan */
    --val-6: #3b82f6; /* Blue */
    --val-7: #8b5cf6; /* Violet */
    --val-8: #d946ef; /* Fuchsia */
    --val-9: #64748b; /* Slate */
}

[data-theme="glacier"] {
    /* Theme B: Glacier (Cool, soothing blues, purples, and grays) */
    --bg-color: #0f172a;
    --overlay-bg: rgba(15, 23, 42, 0.85);
    --neutral-bg: rgba(255, 255, 255, 0.06);
    --text-color: #f8fafc;
    --accent-color: #38bdf8;

    --val-0: #e2e8f0;
    --val-1: #cbd5e1;
    --val-2: #94a3b8;
    --val-3: #64748b;
    --val-4: #475569;
    --val-5: #334155;
    --val-6: #7dd3fc;
    --val-7: #38bdf8;
    --val-8: #0ea5e9;
    --val-9: #0284c7;
}

[data-theme="void"] {
    /* Theme C: Void (High-contrast, strictly monochrome logic focus) */
    --bg-color: #000000;
    --overlay-bg: rgba(0, 0, 0, 0.90);
    --neutral-bg: rgba(255, 255, 255, 0.06);
    --text-color: #ffffff;
    --accent-color: #a3a3a3;

    /* All tiles force the neutral background, relying purely on text numbers */
    --val-0: var(--neutral-bg);
    --val-1: var(--neutral-bg);
    --val-2: var(--neutral-bg);
    --val-3: var(--neutral-bg);
    --val-4: var(--neutral-bg);
    --val-5: var(--neutral-bg);
    --val-6: var(--neutral-bg);
    --val-7: var(--neutral-bg);
    --val-8: var(--neutral-bg);
    --val-9: var(--neutral-bg);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100dvh;
    overflow: hidden;
}

#app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 850px; /* Slightly wider than HexaDuel to accommodate side-by-side matrices */
    margin: 0 auto;
    padding: 12px;
    position: relative;
    z-index: 1;
    height: 100dvh;
    overflow-y: auto;
    padding-bottom: 40px;
}

/* --- Ambient Background Vectors --- */
.ambient-vectors {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- Unified Row Components --- */
.ui-row {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 6px 0;
    gap: 10px;
}

.level-controls, .system-controls, .action-group, .timer-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Global Button Styling --- */
.btn {
    background: var(--neutral-bg);
    color: var(--text-color);
    border: 1px solid var(--text-color);
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.2);
}

.donate-btn { border-color: #ff9800; }

/* --- Modern Sliding Tab Pill --- */
.sliding-tab-container {
    position: relative;
    display: flex;
    background: var(--neutral-bg);
    border: 1px solid var(--accent-color);
    border-radius: 20px;
    padding: 2px;
    overflow: hidden;
    isolation: isolate;
}

.diff-tab-container { min-width: 240px; }
.zen-tab-container { min-width: 90px; border-radius: 16px; }
.theme-tab-container { min-width: 200px; flex: 1; }

.tab-btn {
    background: transparent;
    color: var(--text-color);
    border: none;
    padding: 6px 0;
    flex: 1;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 18px;
    z-index: 2;
    transition: color 0.2s ease;
    text-align: center;
}

.tab-btn.active { color: var(--bg-color) !important; }
.zen-btn { padding: 4px 0; border-radius: 14px; }

/* The physical animated background elements */
.sliding-pill {
    position: absolute;
    top: 2px; left: 2px; bottom: 2px;
    background: var(--accent-color);
    border-radius: 18px;
    z-index: 1;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Adjust pill widths based on tab counts */
.diff-pill { width: calc(25% - 2px); }
.zen-pill { width: calc(50% - 2px); border-radius: 14px; }
.theme-pill { width: calc(33.333% - 2px); }

/* --- Seed Input & Clock --- */
.control-label { font-size: 0.8rem; font-weight: bold; color: var(--text-color); }

#seed-input {
    background: transparent; border: none; outline: none; padding: 0;
    color: var(--text-color); font-family: monospace; font-size: 1.05rem;
    font-weight: bold; width: 48px; text-align: center; transition: color 0.2s;
}
#seed-input:focus { color: var(--accent-color) !important; }
#seed-input.history-solved { color: #4caf50; }
#seed-input.history-gave-up { color: #f44336; }
#seed-input.history-zen { color: rgba(255, 255, 255, 0.35); }

#game-clock {
    font-family: monospace; font-size: 1.35rem; font-weight: bold;
    background: var(--neutral-bg); padding: 4px 12px; border-radius: 6px;
    transition: opacity 0.2s ease, color 0.2s ease; cursor: pointer;
}
#game-clock:hover { color: var(--accent-color); }
#game-clock.zen-active { opacity: 0.25; color: rgba(255, 255, 255, 0.5); }

/* --- Responsive Dual-Grid Play Area --- */
#game-board-area {
    flex: 1;
    display: flex;
    flex-direction: column; /* Stacked vertically on mobile */
    gap: 10px; /* Tighter gap to save vertical space */
    width: 100%;
    justify-content: flex-start; /* FIX: Prevents top content from permanently clipping off-screen */
    align-items: center;
    position: relative;
    padding: 5px 0;
    min-height: 0;
}

@media (min-width: 768px) {
    #game-board-area {
        flex-direction: row; /* Side-by-side on desktop/tablet */
        align-items: stretch;
        justify-content: center; /* Safe to center horizontally on wide screens */
    }
}

.grid-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 400px; 
    min-height: 0; /* FIX: Allows the flex container to shrink correctly */
}

.grid-label {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 6px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

#pool-svg, #solution-svg {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1; /* Forces perfect square scaling on all devices */
    max-height: 32vh; 
    background: rgba(255, 255, 255, 0.02);
    border: 2px solid var(--neutral-bg);
    border-radius: 6px;
    display: block;
}

@media (min-width: 768px) {
    #pool-svg, #solution-svg {
        max-height: 60vh; /* Relax the height constraint for desktop */
    }
}

/* --- SVG Tile & Grid Styling --- */
.quad-grid-line {
    stroke: var(--bg-color);
    stroke-width: 1.5;
    pointer-events: none; /* Prevents lines from blocking clicks */
}

.quad-tile {
    cursor: pointer;
    transition: transform 0.1s ease, filter 0.2s ease;
}

.quad-tile.selected {
    filter: drop-shadow(0px 0px 8px var(--accent-color));
}

.quad-triangle {
    stroke: var(--bg-color);
    stroke-width: 0.5;
}

.quad-text {
    font-family: monospace;
    font-weight: bold;
    fill: #ffffff;
    pointer-events: none;
    text-shadow: 0px 1px 3px rgba(0,0,0,0.8);
}

[data-theme="void"] .quad-text {
    fill: var(--text-color);
}

/* --- Responsive Extreme Difficulty Hiding --- */
@media (max-width: 600px) {
    .diff-extreme {
        display: none !important; /* Hide on small screens to prevent tile crowding */
    }
    .diff-pill {
        width: calc(33.333% - 2px); /* Adjust pill width for 3 tabs */
    }
}

/* --- Dual Overlay System (Identical to HexaDuel) --- */
.overlay-hidden { opacity: 0; pointer-events: none; }

#board-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--overlay-bg);
    backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 10; transition: opacity 0.2s ease; border-radius: 8px;
}
#board-overlay-content { text-align: center; color: var(--text-color); }

#info-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100dvh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center;
    z-index: 999; transition: opacity 0.2s ease;
}
#info-overlay-content {
    display: flex; flex-direction: column; width: 92%; max-width: 500px; max-height: 85dvh;
    background: var(--bg-color); border-radius: 12px; padding: 20px;
    text-align: center; color: var(--text-color); border: 2px solid var(--accent-color);
    box-shadow: 0px 10px 40px rgba(0,0,0,0.9);
}

.overlay-scroll-area {
    overflow-y: auto; text-align: left; margin-bottom: 15px; padding: 15px;
    font-size: 0.95rem; line-height: 1.6; background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 8px;
}

/* The 3D Tactile Close Button */
.overlay-sticky-close {
    background: var(--accent-color) !important; color: #000000 !important;
    font-weight: 900; padding: 16px; border-radius: 8px; border: none;
    text-transform: uppercase; letter-spacing: 1px; cursor: pointer;
    box-shadow: 0px 5px 0px rgba(0, 0, 0, 0.4), 0px 10px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s ease, box-shadow 0.1s ease; flex-shrink: 0;
}
.overlay-sticky-close:active {
    transform: translateY(5px); box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.4), 0px 2px 5px rgba(0, 0, 0, 0.3);
}

.overlay-icon-btn {
    font-size: 5rem; cursor: pointer; background: none; border: none;
    color: var(--text-color); transition: transform 0.2s ease, color 0.2s ease;
    text-shadow: 0px 4px 15px rgba(0,0,0,0.5);
}
.overlay-icon-btn:hover { transform: scale(1.1); color: var(--accent-color); }

.overlay-text { font-size: 1.6rem; font-weight: bold; margin-bottom: 25px; text-shadow: 0px 3px 6px rgba(0,0,0,0.9); padding: 0 15px; }
.overlay-actions { display: flex; gap: 35px; justify-content: center; }
.overlay-actions .btn { font-size: 1.2rem; padding: 10px 30px; border-radius: 6px; font-weight: bold; }

/* Custom Scrollbars */
.overlay-scroll-area::-webkit-scrollbar { width: 6px; }
.overlay-scroll-area::-webkit-scrollbar-track { background: transparent; }
.overlay-scroll-area::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 10px; transition: background 0.2s ease; }
.overlay-scroll-area::-webkit-scrollbar-thumb:hover { background: var(--accent-color); }
.overlay-scroll-area { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.15) transparent; }

/* --- Empty Grid Slot Styling --- */
.grid-slot {
    fill: rgba(255, 255, 255, 0.06);
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 2;
    transition: fill 0.2s ease, stroke 0.2s ease;
}

[data-theme="void"] .grid-slot {
    fill: rgba(255, 255, 255, 0.12); /* Brighter base for Void */
    stroke: rgba(255, 255, 255, 0.35); /* Much harsher outline for visibility */
}

/* Optional: Subtle animation for invalid moves */
@keyframes shake-error {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-4px, 0); }
    50% { transform: translate(4px, 0); }
    75% { transform: translate(-4px, 0); }
}
.error-shake {
    animation: shake-error 0.2s ease-in-out;
}

.shift-btn { 
    padding: 2px 8px; 
    font-size: 0.8rem; 
}

/*
// --- End: QuadraDuel CSS ---
*/