:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --accent-color: #38bdf8;
    --error-color: #ef4444;
    --success-color: #22c55e;
    --card-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Ambient Background */
body::before {
    content: '';
    position: absolute;
    width: 150vw;
    height: 150vh;
    background: radial-gradient(circle at center, rgba(56, 189, 248, 0.08) 0%, transparent 60%);
    z-index: -1;
    animation: pulse 10s infinite ease-in-out;
}

@keyframes pulse {

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

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

h1 {
    font-weight: 800;
    letter-spacing: -0.05em;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
}

.subtitle {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 2rem;
    font-weight: 500;
}

/* Game Container */
.game-wrapper {
    position: relative;
    padding: 10px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    width: 90vw;
    height: 90vw;
    max-width: 600px;
    max-height: 600px;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    /* background-image managed by JS */
    background-size: cover;
    background-position: center;
    cursor: crosshair;
}

/* Interactive Zones */
.zone {
    width: 100%;
    height: 100%;
    position: relative;
    transition: background-color 0.2s;
}

.zone:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Feedback UI */
.hud {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    padding: 8px 16px;
    border-radius: 99px;
    border: 1px solid var(--glass-border);
    text-align: center;
    width: 90%;
    max-width: 400px;
    z-index: 10;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.hud-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
}

.hud-target {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

/* Arrows */
.arrow-indicator {
    position: absolute;
    width: 60px;
    height: 60px;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
    z-index: 20;
}

.arrow-indicator.visible {
    opacity: 1;
    transform: scale(1);
}

/* Specific positions for arrows based on quadrants */
/* Top-Left: Disgust (Nose) */
#arrow-0 {
    top: 22%;
    left: 25%;
    transform: rotate(45deg);
}

/* Top-Right: Fear (Brows) */
#arrow-1 {
    top: 15%;
    left: 75%;
    transform: rotate(-45deg);
}

/* Bottom-Left: Fake Smile (Eyes/Crow's feet) */
#arrow-2 {
    top: 60%;
    left: 18%;
    transform: rotate(135deg);
}

/* Bottom-Right: Blend (Mouth/Lips) */
#arrow-3 {
    top: 85%;
    left: 75%;
    transform: rotate(-135deg);
}

/* Animations */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-10px) rotate(-1deg);
        border-color: var(--error-color);
    }

    40% {
        transform: translateX(10px) rotate(1deg);
    }

    60% {
        transform: translateX(-5px);
    }

    80% {
        transform: translateX(5px);
    }
}

.shake-effect {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

.explanation-toast {
    position: absolute;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success-color);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s;
    white-space: nowrap;
    box-shadow: 0 10px 20px rgba(34, 197, 94, 0.3);
}

.explanation-toast.show {
    bottom: 20px;
    opacity: 1;
}

/* Wrong styling */
.wrong-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(239, 68, 68, 0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.game-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

.game-over.active {
    opacity: 1;
    pointer-events: all;
}

button.restart-btn {
    margin-top: 20px;
    padding: 12px 30px;
    background: var(--accent-color);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

button.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(56, 189, 248, 0.4);
}

/* Signature Tag */
.signature-tag {
    position: fixed;
    bottom: 24px;
    right: 24px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
    background: rgba(15, 23, 42, 0.6);
    padding: 10px 20px;
    border-radius: 99px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: transform 0.3s ease;
}

.signature-tag:hover {
    transform: translateY(-2px);
    background: rgba(15, 23, 42, 0.8);
}

.maple-leaf {
    display: inline-block;
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.6));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

/* Hard Mode Controls */
.hard-mode-controls {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.mode-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.05em;
    transition: color 0.3s;
}

/* Difficulty Colors */
.mode-easy .mode-label {
    color: #22c55e;
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.4);
}

.mode-normal .mode-label {
    color: #38bdf8;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.mode-hard .mode-label {
    color: #f59e0b;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.mode-expert .mode-label {
    color: #ef4444;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.hard-mode-controls {
    cursor: pointer;
    user-select: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.hard-mode-controls:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Timer Bar */
.timer-bar-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: #1e293b;
    z-index: 50;
    transition: opacity 0.3s;
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #f87171, #ef4444);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
    transform-origin: left;
    /* Animation will be handled by JS */
}

/* Summary Screen Stats */
.summary-container {
    width: 80%;
    margin: 20px 0;
    text-align: left;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.1rem;
}

.stat-value {
    font-weight: 700;
    color: var(--accent-color);
}

.missed-section {
    margin-top: 20px;
}

.missed-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 10px;
    letter-spacing: 0.1em;
}

.missed-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
}

.missed-tag {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 0.85rem;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.empty-missed {
    color: var(--success-color);
    font-style: italic;
    font-size: 0.9rem;
}

/* Custom scrollbar for missed list */
.missed-list::-webkit-scrollbar {
    width: 6px;
}

.missed-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}