/* ============================================================================
   STYLE.CSS -- layout, HUD, quiz modal and overlay styling.
   Dimension theme colors used here should stay in sync with
   DIMENSION_THEMES in js/config.js.
   ============================================================================ */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #0b0b0f;
    color: #f2f2f2;
    font-family: 'Segoe UI', Tahoma, Verdana, sans-serif;
    overflow: hidden;
    user-select: none;
}

#game-container {
    position: relative;
    width: 960px;
    height: 540px;
    margin: 20px auto;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    max-width: 100vw;
}

@media (max-width: 980px) {
    #game-container {
        width: 100vw;
        height: calc(100vw * 0.5625);
        margin: 0 auto;
        border-radius: 0;
    }
}

canvas#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    background: #111;
}

.hidden { display: none !important; }

/* ---------------------------------------------------------------- HUD --- */
#hud {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px;
    pointer-events: none;
    font-weight: 600;
    text-shadow: 0 2px 6px rgba(0,0,0,0.8);
}

#hud-top-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hud-dimension {
    font-size: 20px;
    letter-spacing: 2px;
    padding: 4px 12px;
    border-radius: 6px;
    background: rgba(0,0,0,0.35);
    border: 2px solid currentColor;
    transition: color 0.3s;
}
.hud-dimension.theme-china { color: #ff5050; }
.hud-dimension.theme-america { color: #66c7ff; }

#hud-lives {
    font-size: 20px;
    color: #ff4d6d;
    padding-left: 4px;
}

#hud-quiz-score {
    font-size: 13px;
    color: #ffd24d;
    background: rgba(0,0,0,0.35);
    padding: 3px 10px;
    border-radius: 6px;
    width: fit-content;
}

#hud-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 12px;
    opacity: 0.85;
    background: rgba(0,0,0,0.35);
    padding: 6px 10px;
    border-radius: 6px;
}

/* ------------------------------------------------------------ Message --- */
#message-banner {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: rgba(20,20,20,0.85);
    border: 2px solid #ff4d4d;
    color: #fff;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 700;
    letter-spacing: 1px;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}
#message-banner.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ------------------------------------------------------- Transition FX --- */
#transition-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    animation: flashFade 0.9s ease forwards;
}
#transition-overlay.flash { animation: flashFade 0.9s ease forwards; }

@keyframes flashFade {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

#transition-text {
    font-size: 46px;
    font-weight: 900;
    letter-spacing: 6px;
    text-shadow: 0 0 20px rgba(0,0,0,0.8), 0 0 40px currentColor;
    animation: popIn 0.9s ease;
}

@keyframes popIn {
    0%   { transform: scale(0.7); opacity: 0; }
    30%  { transform: scale(1.08); opacity: 1; }
    60%  { transform: scale(1); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

/* -------------------------------------------------------- Quiz Modal --- */
#quiz-modal {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

#quiz-panel {
    position: relative;
    width: 560px;
    max-width: 88%;
    background: #17181d;
    border-radius: 14px;
    padding: 26px 28px 22px;
    border: 3px solid #666;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
#quiz-panel.theme-china {
    border-color: #e0202a;
    box-shadow: 0 0 40px rgba(224,32,42,0.35), 0 10px 40px rgba(0,0,0,0.6);
}
#quiz-panel.theme-america {
    border-color: #2179d6;
    box-shadow: 0 0 40px rgba(33,121,214,0.35), 0 10px 40px rgba(0,0,0,0.6);
}

#quiz-header {
    font-size: 12px;
    letter-spacing: 3px;
    opacity: 0.6;
    margin-bottom: 6px;
}

#quiz-question {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 18px;
    line-height: 1.4;
}

#quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-option {
    text-align: left;
    padding: 12px 16px;
    font-size: 15px;
    border-radius: 8px;
    border: 2px solid #444;
    background: #23242b;
    color: #f2f2f2;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.quiz-option:hover:not(:disabled) {
    background: #2f3038;
    transform: translateX(2px);
}
.quiz-option:disabled { cursor: default; opacity: 0.85; }
.quiz-option.correct {
    border-color: #3ecf5e;
    background: rgba(62,207,94,0.18);
}
.quiz-option.wrong {
    border-color: #e0454a;
    background: rgba(224,69,74,0.18);
}

.quiz-feedback {
    margin-top: 16px;
    font-weight: 700;
    min-height: 20px;
}
.feedback-correct { color: #3ecf5e; }
.feedback-wrong { color: #ff8080; }

#quiz-close {
    position: absolute;
    top: 10px; right: 14px;
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
}
#quiz-close:hover { color: #fff; }

/* --------------------------------------------------- Completion Screen --- */
#complete-screen {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(30,30,40,0.95), rgba(5,5,8,0.98));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
}
#complete-panel, #start-panel {
    text-align: center;
    padding: 40px 50px;
    max-width: 80%;
}
#complete-panel h1 {
    font-size: 40px;
    letter-spacing: 3px;
    margin: 0 0 14px;
    background: linear-gradient(90deg, #ff5050, #66c7ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
#complete-stats { font-size: 17px; margin-bottom: 24px; opacity: 0.9; }

button#restart-btn, button#start-btn {
    background: linear-gradient(135deg, #e0202a, #2179d6);
    border: none;
    color: white;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
button#restart-btn:hover, button#start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

/* -------------------------------------------------------- Start Screen --- */
#start-screen {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, #3a0a0a, #04122e 75%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
}
#start-panel h1 {
    font-size: 44px;
    letter-spacing: 6px;
    margin: 0 0 6px;
    background: linear-gradient(90deg, #ff5050, #66c7ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.group-header {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    opacity: 0.7;
    margin: 0 0 14px;
}
.subtitle { opacity: 0.8; margin: 0 0 18px; letter-spacing: 2px; }
.instructions { font-size: 14px; opacity: 0.85; margin-bottom: 16px; line-height: 1.5; }
.controls-list { font-size: 13px; opacity: 0.75; margin-bottom: 26px; }
