/* ═══════════════════════════════════════════════════
   КОСМИЧЕСКИЙ ТЕСТ-ДРАЙВ — Pixel Art Space Theme
   ═══════════════════════════════════════════════════ */

:root {
    --bg-deep: #0a0a1a;
    --bg-panel: #111133;
    --bg-panel-border: #3344aa;
    --accent: #ffcc00;
    --accent-glow: #ffdd44;
    --text: #e0e0ff;
    --text-dim: #8888bb;
    --danger: #ff4444;
    --success: #44ff88;
    --pixel-font: 'Press Start 2P', monospace;
    --pixel-border: 4px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--pixel-font);
    background: var(--bg-deep);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    image-rendering: pixelated;
}

#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ═══════ SCREENS ═══════ */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
    padding: 20px;
}

.screen.active {
    display: flex;
}

.panel {
    background: var(--bg-panel);
    border: var(--pixel-border) solid var(--bg-panel-border);
    padding: 30px;
    max-width: 600px;
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow:
        0 0 0 2px var(--bg-deep),
        0 0 20px rgba(51, 68, 170, 0.3),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.panel::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid rgba(255, 204, 0, 0.1);
    pointer-events: none;
}

/* ═══════ TYPOGRAPHY ═══════ */
.title {
    font-size: 18px;
    line-height: 1.8;
    color: var(--accent);
    text-shadow:
        0 0 10px rgba(255, 204, 0, 0.5),
        2px 2px 0 #000;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 10px;
    color: var(--text-dim);
    margin-bottom: 20px;
    letter-spacing: 3px;
}

.ascii-rocket {
    color: var(--accent);
    font-size: 8px;
    line-height: 1.2;
    margin-bottom: 10px;
    text-shadow: 0 0 8px rgba(255, 204, 0, 0.4);
    display: inline-block;
}

/* ═══════ RULES ═══════ */
.rules-box {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(51, 68, 170, 0.5);
    padding: 15px;
    margin: 20px 0;
    text-align: left;
}

.rules-box p {
    font-size: 8px;
    line-height: 2;
    color: var(--text-dim);
}

/* ═══════ INPUTS ═══════ */
.input-group {
    margin: 15px 0;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 8px;
    color: var(--accent);
    margin-bottom: 8px;
}

.input-group input,
.input-group textarea,
.input-group select {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--bg-panel-border);
    color: var(--text);
    font-family: var(--pixel-font);
    font-size: 10px;
    padding: 12px;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.2);
}

.input-group input::placeholder {
    color: rgba(136, 136, 187, 0.5);
}

.input-group textarea {
    resize: vertical;
    min-height: 60px;
}

.input-group select {
    cursor: pointer;
}

.input-group select option {
    background: var(--bg-panel);
    color: var(--text);
}

/* ═══════ BUTTONS ═══════ */
.pixel-btn {
    font-family: var(--pixel-font);
    font-size: 12px;
    padding: 14px 28px;
    background: var(--bg-panel-border);
    color: var(--accent);
    border: 3px solid var(--accent);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.1s;
    position: relative;
    margin-top: 10px;
    image-rendering: pixelated;
}

.pixel-btn:hover:not(:disabled) {
    background: var(--accent);
    color: var(--bg-deep);
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--bg-panel-border);
}

.pixel-btn:active:not(:disabled) {
    transform: translate(0, 0);
    box-shadow: none;
}

.pixel-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pixel-btn.small {
    font-size: 8px;
    padding: 8px 14px;
}

.pixel-btn.cancel {
    background: #442222;
    border-color: var(--danger);
    color: var(--danger);
}

.pixel-btn.cancel:hover {
    background: var(--danger);
    color: #fff;
}

.pixel-btn.export {
    background: #224422;
    border-color: var(--success);
    color: var(--success);
}

.pixel-btn.export:hover {
    background: var(--success);
    color: #000;
}

/* ═══════ ERROR ═══════ */
.error-msg {
    font-size: 8px;
    color: var(--danger);
    margin-top: 8px;
    text-shadow: 0 0 5px rgba(255, 68, 68, 0.5);
}

.hidden {
    display: none !important;
}

/* ═══════ QUIZ SCREEN ═══════ */
.quiz-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 20;
    padding: 10px 20px;
    background: rgba(10, 10, 26, 0.9);
    border-bottom: 3px solid var(--bg-panel-border);
}

.timer-bar-wrap {
    width: 100%;
    height: 20px;
    background: #1a1a3a;
    border: 2px solid var(--bg-panel-border);
    position: relative;
    overflow: hidden;
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff4444, #ff8800, #ffcc00);
    transition: width 1s linear;
    position: relative;
}

.timer-fire {
    position: absolute;
    right: 0;
    top: -5px;
    width: 12px;
    height: 30px;
    background: radial-gradient(ellipse, #ffcc00, #ff6600, transparent);
    animation: fire-flicker 0.2s infinite alternate;
    pointer-events: none;
}

@keyframes fire-flicker {
    0% { opacity: 0.7; transform: scaleY(0.9) scaleX(0.8); }
    100% { opacity: 1; transform: scaleY(1.1) scaleX(1.2); }
}

.timer-display {
    font-size: 14px;
    color: var(--accent);
    text-align: center;
    margin-top: 5px;
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
}

.timer-display.warning {
    color: var(--danger);
    animation: blink 0.5s infinite;
}

@keyframes blink {
    50% { opacity: 0.3; }
}

/* ═══════ ROCKET PROGRESS ═══════ */
.rocket-progress {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 40px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.rocket-track {
    width: 8px;
    height: 200px;
    background: #1a1a3a;
    border: 2px solid var(--bg-panel-border);
    position: relative;
    border-radius: 4px;
}

.rocket-icon {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    filter: drop-shadow(0 0 5px rgba(255, 150, 0, 0.8));
    transition: bottom 0.5s ease-out;
}

.progress-label {
    font-size: 7px;
    color: var(--text-dim);
    margin-top: 8px;
    writing-mode: vertical-lr;
    text-orientation: mixed;
}

/* ═══════ QUIZ PANEL ═══════ */
.quiz-panel {
    margin-top: 120px;
    max-width: 650px;
}

.question-num {
    font-size: 8px;
    color: var(--text-dim);
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.question-text {
    font-size: 11px;
    line-height: 2;
    color: var(--text);
    margin-bottom: 25px;
    min-height: 50px;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.option-btn {
    font-family: var(--pixel-font);
    font-size: 9px;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--bg-panel-border);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: all 0.1s;
    line-height: 1.8;
    word-break: break-word;
}

.option-btn:hover {
    border-color: var(--accent);
    background: rgba(255, 204, 0, 0.05);
    transform: translateX(4px);
}

.option-btn.selected {
    border-color: var(--accent);
    background: rgba(255, 204, 0, 0.15);
    color: var(--accent);
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.2);
}

.option-btn .opt-num {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background: var(--bg-panel-border);
    color: var(--accent);
    margin-right: 10px;
    font-size: 8px;
}

.option-btn.selected .opt-num {
    background: var(--accent);
    color: var(--bg-deep);
}

/* ═══════ END SCREEN ═══════ */
.end-icon {
    font-size: 48px;
    margin-bottom: 15px;
    animation: float 2s ease-in-out infinite;
    display: inline-block;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.end-msg {
    font-size: 10px;
    color: var(--success);
    margin: 20px 0 10px;
    line-height: 2;
}

.end-sub {
    font-size: 8px;
    color: var(--text-dim);
    margin-bottom: 20px;
}

/* ═══════ SCHOOL LOGO ═══════ */
.school-logo {
    position: fixed;
    top: 12px;
    left: 12px;
    width: 56px;
    height: auto;
    z-index: 200;
    image-rendering: auto;
    filter: drop-shadow(0 0 6px rgba(255, 204, 0, 0.3));
    transition: transform 0.2s;
}

.school-logo:hover {
    transform: scale(1.1);
}

/* ═══════ SOUND TOGGLE ═══════ */
.sound-btn {
    position: fixed;
    bottom: 15px;
    right: 15px;
    background: rgba(17, 17, 51, 0.8);
    border: 2px solid var(--bg-panel-border);
    color: var(--accent);
    font-size: 18px;
    padding: 8px 12px;
    cursor: pointer;
    z-index: 100;
    font-family: var(--pixel-font);
}

.sound-btn:hover {
    border-color: var(--accent);
}

/* ═══════ MOBILE ═══════ */
@media (max-width: 700px) {
    .title { font-size: 14px; }
    .panel { padding: 20px 15px; }
    .pixel-btn { font-size: 10px; padding: 12px 20px; }
    .question-text { font-size: 9px; }
    .option-btn { font-size: 8px; padding: 10px 12px; }
    .rocket-progress { display: none; }
    .quiz-panel { margin-top: 100px; }
    .ascii-rocket { font-size: 6px; }
}
