/* Swiss Privacy Theme Variables */
:root {
    --swiss-bg: #f8f6f6;
    --swiss-bg-panel: #ffffff;
    --swiss-primary: #ec4d13;
    /* Orange/Red */
    --swiss-primary-dim: rgba(236, 77, 19, 0.1);
    --swiss-text: #1b110d;
    --swiss-text-mute: #737373;
    --swiss-border: #e5e5e5;
    --swiss-dark: #1b110d;

    /* Sector Colors (Muted for Swiss Style) */
    --sector-blue: #2563eb;
    --sector-pink: #ec4899;
    --sector-yellow: #f59e0b;
    --sector-red: #ef4444;
    --sector-orange: #f97316;
    --sector-green: #10b981;
    --sector-purple: #a855f7;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--swiss-text);
    background-color: var(--swiss-bg);
}

/* Animations */
@keyframes spin-slow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.animate-spin-slow {
    animation: spin-slow 20s linear infinite;
}

/* Board Grid */
#board-grid {
    perspective: 1000px;
    width: 100%;
    max-width: 600px;
}

/* House Button (Node) */
.house-btn {
    aspect-ratio: 1;
    border-radius: 0;
    /* Blocky nodes */
    background: white;
    border: 3px solid var(--swiss-dark);
    box-shadow: 4px 4px 0px 0px rgba(0, 0, 0, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    font-size: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--swiss-dark);
}

.house-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px 0px rgba(0, 0, 0, 1);
    z-index: 10;
}

.house-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px 0px rgba(0, 0, 0, 1);
}

/* Current Player Position */
.house-btn.active-player {
    transform: scale(1.1) translate(-2px, -2px);
    box-shadow: 6px 6px 0px 0px rgba(0, 0, 0, 1);
    z-index: 20;
}

.house-btn.active-player::after {
    display: block;
    content: '';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: var(--swiss-primary);
    border: 2px solid var(--swiss-dark);
    animation: pulse-dot 1s infinite alternate;
}

@keyframes pulse-dot {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.2);
    }
}

/* Sector Colors Implementation */
.sector-blue {
    background: var(--sector-blue);
    color: white;
}

.sector-pink {
    background: var(--sector-pink);
    color: white;
}

.sector-yellow {
    background: var(--sector-yellow);
    color: var(--swiss-dark);
}

.sector-red {
    background: var(--sector-red);
    color: white;
}

.sector-orange {
    background: var(--sector-orange);
    color: var(--swiss-dark);
}

.sector-green {
    background: var(--sector-green);
    color: black;
}

.sector-purple {
    background: var(--sector-purple);
    color: white;
}


/* Quiz Options */
.option-btn {
    width: 100%;
    padding: 1.5rem;
    border: 2px solid var(--swiss-dark);
    margin-bottom: 1rem;
    background: white;
    box-shadow: 4px 4px 0px 0px rgba(0, 0, 0, 1);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--swiss-dark);
}

.option-btn:hover:not(:disabled) {
    background: var(--swiss-bg);
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px 0px rgba(0, 0, 0, 1);
}

.option-btn:active:not(:disabled) {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px 0px rgba(0, 0, 0, 1);
}

.option-btn:before {
    content: '';
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid var(--swiss-dark);
    background: white;
    display: block;
    transition: all 0.2s;
    flex-shrink: 0;
}

.option-btn:hover:before {
    background: var(--swiss-dark);
}

/* Correct Answer */
.option-btn.correct {
    background: #16a34a;
    border-color: var(--swiss-dark);
    color: white;
}

.option-btn.correct:before {
    background: white;
    border-color: white;
}

/* Wrong Answer */
.option-btn.wrong {
    background: #dc2626;
    border-color: var(--swiss-dark);
    color: white;
}

.option-btn.wrong:before {
    background: white;
    border-color: white;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--swiss-gray);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--swiss-text-mute);
}

/* Geometric Symbols for Avatar Selection */
/* Geometric Symbols for Avatar Selection */
.symbol-opt {
    flex: 1;
    /* Distribute space evenly */
    height: 80px;
    /* Taller touch target */
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    border: 2px solid transparent;
    /* Container border */
    border-radius: 8px;
    background: #f4f4f5;
    /* Light background for unselected */
}

.symbol-opt:hover,
.symbol-opt.selected {
    opacity: 1;
    transform: scale(1.1);
    background-color: rgba(0, 0, 0, 0.05);
    /* Subtle highlight */
}

/* Specific Symbols */
.symbol-circle {
    width: 40px;
    height: 40px;
    background-color: #ec4d13;
    /* Swiss Orange/Red */
    border-radius: 50%;
}

.symbol-square {
    width: 40px;
    height: 40px;
    border: 4px solid #1b110d;
    /* Swiss Dark */
    background: transparent;
}

.symbol-triangle {
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 35px solid #d1d5db;
    /* Gray-300 */
    background: transparent;
}

.symbol-cross {
    position: relative;
    width: 40px;
    height: 40px;
}

.symbol-cross:before,
.symbol-cross:after {
    position: absolute;
    left: 16px;
    /* (40 - 8) / 2 */
    top: 0;
    content: ' ';
    height: 40px;
    width: 8px;
    background-color: #d1d5db;
    /* Gray-300 */
    border-radius: 4px;
}

.symbol-cross:before {
    transform: rotate(45deg);
}

.symbol-cross:after {
    transform: rotate(-45deg);
}

/* Selected States - Color Change */
.symbol-opt.selected .symbol-circle {
    box-shadow: 0 0 0 4px rgba(236, 77, 19, 0.3);
}

.symbol-opt.selected .symbol-square {
    border-color: #ec4d13;
}

.symbol-opt.selected .symbol-triangle {
    border-bottom-color: #ec4d13;
}

.symbol-opt.selected .symbol-cross:before,
.symbol-opt.selected .symbol-cross:after {
    background-color: #ec4d13;
}

/* Tiny Symbols for Board/Header */
.symbol-tiny {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.symbol-tiny .symbol-circle {
    width: 16px;
    height: 16px;
}

.symbol-tiny .symbol-square {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.symbol-tiny .symbol-triangle {
    border-left-width: 8px;
    border-right-width: 8px;
    border-bottom-width: 14px;
}

.symbol-tiny .symbol-cross {
    width: 16px;
    height: 16px;
}

.symbol-tiny .symbol-cross:before,
.symbol-tiny .symbol-cross:after {
    left: 7px;
    height: 16px;
    width: 2px;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    pointer-events: none;
}

.toast {
    background: white;
    padding: 1rem 2rem;
    border-radius: 0;
    border: 3px solid var(--swiss-dark);
    box-shadow: 6px 6px 0px 0px rgba(0, 0, 0, 1);
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease-out forwards;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: bold;
    font-family: 'JetBrains Mono', monospace;
}

.toast.success {
    border-left: 4px solid #22c55e;
    color: #15803d;
}

.toast.error {
    border-left: 4px solid #ef4444;
    color: #b91c1c;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

/* ==========================================
   RESPONSIVE DESIGN (Mobile First Adjustments)
   ========================================== */

@media (max-width: 1024px) {
    body {
        height: auto !important;
        overflow-y: auto !important;
    }

    /* Header Adjustments */
    header {
        height: auto;
        padding: 1rem;
        flex-direction: column !important;
        gap: 0.75rem;
        text-align: center;
        z-index: 100;
        position: relative;
    }

    .flex.items-center.gap-6 {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
    }

    /* Main Container Logic */
    main {
        height: auto !important;
        display: flex !important;
        flex-direction: column !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        /* Smooth scroll for iOS/Safari */
    }

    #header-xp-info {
        display: flex !important;
        position: relative !important;
        left: auto !important;
        top: auto !important;
        transform: none !important;
        margin: 0.5rem 0;
        width: max-content;
        align-self: center;
    }

    #right-panel {
        width: 100% !important;
        border-top: 1px solid var(--swiss-border);
        min-height: auto;
        /* Don't force 100vh on stack */
    }

    /* Board Scaling */
    #game-board-container {
        padding: 2rem 0;
        width: 100%;
        overflow: hidden;
    }

    #board-grid {
        gap: 8px;
        grid-template-columns: repeat(4, 1fr) !important;
        transform: none !important;
        /* Simplify on mobile */
        max-width: 100%;
        margin: 0 auto;
    }

    /* UI Spacing Panels */
    #panel-login,
    #screen-result {
        padding: 2rem 1rem;
    }

    h2.text-5xl {
        font-size: 2.5rem;
    }

    /* Certificate & Results on Mobile */
    #certificate-body {
        width: 100%;
        box-shadow: 5px 5px 0px 0px rgba(0, 0, 0, 1);
        padding: 1.5rem !important;
    }

    #accuracy-rate {
        font-size: 4rem !important;
    }

    .grid-cols-3 {
        grid-template-columns: 1fr;
        /* Stack stats on mobile */
    }

    .grid-cols-3>div {
        border-bottom: 2px solid black;
        border-right: 0 !important;
        padding: 1rem 0;
    }

    /* Actions Footer Stack */
    .md\:flex-row {
        flex-direction: column !important;
        gap: 1rem;
    }

    /* Quiz Panels */
    .px-12 {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }

    #quiz-question {
        font-size: 1.5rem;
    }

    /* Bottom Controls */
    #game-controls {
        position: static;
        /* Let it flow in the stack */
        width: 100%;
        margin-top: 2rem;
    }
}


/* Premium Dice Visuals */
.premium-dice {
    width: 60px;
    height: 60px;
    background: white;
    border: 2px solid var(--swiss-dark);
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 6px;
    gap: 4px;
    position: relative;
    box-shadow: 4px 4px 0 var(--swiss-dark);
}

.premium-dice.empty {
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: none;
    background: transparent;
    border-style: dashed;
    border-color: var(--swiss-border);
}

.dice-dot {
    background: var(--swiss-primary);
    border-radius: 50%;
    width: 100%;
    height: 100%;
}

/* Grid Positioning for Dots */
.dot-1 {
    grid-area: 1 / 1;
}

.dot-2 {
    grid-area: 1 / 2;
}

.dot-3 {
    grid-area: 1 / 3;
}

.dot-4 {
    grid-area: 2 / 1;
}

.dot-5 {
    grid-area: 2 / 2;
}

.dot-6 {
    grid-area: 2 / 3;
}

.dot-7 {
    grid-area: 3 / 1;
}

.dot-8 {
    grid-area: 3 / 2;
}

.dot-9 {
    grid-area: 3 / 3;
}

/* Adjustments for the Dice container in footer */
#dice-move {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 80px;
}

/* ==========================================
   MODE SELECTION CARDS
   ========================================== */
.mode-card {
    position: relative;
    overflow: hidden;
}

.mode-card::after {
    content: '→';
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    font-weight: bold;
    opacity: 0;
    transition: all 0.2s ease;
}

.mode-card:hover::after {
    opacity: 1;
    right: 1rem;
}

/* ==========================================
   TIMER BAR (Incidente Real)
   ========================================== */
#timer-container {
    transition: all 0.3s ease;
}

#timer-bar {
    transition: width linear, background-color 0.3s ease;
}

@keyframes timer-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

#timer-container.warning #timer-bar {
    animation: timer-pulse 0.5s ease infinite;
}

/* ==========================================
   FUNDAMENTAÇÃO BLOCKS
   ========================================== */
.fundamentacao-block {
    animation: fadeInUp 0.4s ease-out;
    border-radius: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* ==========================================
   ERROR COUNTER (Auditoria)
   ========================================== */
#error-counter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ==========================================
   MOBILE: Mode Select Panel
   ========================================== */
@media (max-width: 1024px) {
    #panel-mode-select {
        padding: 1.5rem !important;
    }

    .mode-card {
        padding: 1rem !important;
    }

    .mode-card h3 {
        font-size: 1rem;
    }

    #panel-setup {
        padding: 1.5rem !important;
    }
}