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

:root {
    --primary: #673de6;
    --primary-dark: #4a26b3;
    --accent: #00d4aa;
    --danger: #ff4d6d;
    --warning: #ffb800;
    --bg: #0f0c29;
    --bg-2: #302b63;
    --bg-3: #24243e;
    --text: #ffffff;
    --text-muted: rgba(255,255,255,0.75);
    --card: rgba(255,255,255,0.08);
    --card-border: rgba(255,255,255,0.18);
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: linear-gradient(135deg, var(--bg), var(--bg-2), var(--bg-3));
    background-size: 200% 200%;
    animation: bgShift 15s ease infinite;
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

@keyframes bgShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

#app { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }

.screen { display: none; width: 100%; max-width: 900px; }
.screen.active { display: block; animation: fadeIn 0.6s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== CARDS ===== */
.card {
    background: var(--card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    text-align: center;
}

.logo .rocket {
    font-size: 80px;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

h1 {
    font-size: 2.5rem;
    margin: 15px 0;
    background: linear-gradient(90deg, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 25px;
}

/* ===== FORMS ===== */
.form-group { text-align: left; margin: 18px 0; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem; }
.form-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--card-border);
    background: rgba(0,0,0,0.25);
    color: var(--text);
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}
.form-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0,212,170,0.15); }

.rules {
    text-align: left;
    background: rgba(0,0,0,0.25);
    padding: 20px 25px;
    border-radius: 14px;
    margin: 25px 0;
    border-left: 4px solid var(--accent);
}
.rules h3 { margin-bottom: 12px; }
.rules ul { list-style: none; }
.rules li { padding: 6px 0; font-size: 0.95rem; }

/* ===== BUTTONS ===== */
.btn {
    padding: 14px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s;
    margin: 5px;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 8px 25px rgba(103, 61, 230, 0.5);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(103, 61, 230, 0.7); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
    background: rgba(255,255,255,0.15);
    color: var(--text);
    border: 1px solid var(--card-border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.25); }

/* ===== HUD ===== */
.hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 14px 22px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 12px;
}
.hud-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}
.hud-label { color: var(--text-muted); font-size: 0.85rem; }

.progress-bar {
    height: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 20px;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 100px;
}

/* ===== PREGUNTA ===== */
.question-area {
    background: var(--card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.badge {
    display: inline-block;
    background: var(--accent);
    color: #06251f;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

#questionText {
    font-size: 1.4rem;
    margin-bottom: 20px;
    line-height: 1.4;
}

.question-extra {
    background: rgba(0,0,0,0.3);
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
    border-left: 3px solid var(--warning);
    display: none;
}
.question-extra.show { display: block; }

.options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.option {
    background: rgba(255,255,255,0.08);
    border: 2px solid var(--card-border);
    color: var(--text);
    padding: 18px 20px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 1rem;
    text-align: left;
    transition: all 0.25s;
    font-weight: 500;
}
.option:hover:not(:disabled) {
    background: rgba(255,255,255,0.18);
    transform: translateY(-2px);
    border-color: var(--accent);
}
.option.correct {
    background: rgba(0,212,170,0.3);
    border-color: var(--accent);
    animation: pulse 0.5s;
}
.option.incorrect {
    background: rgba(255,77,109,0.3);
    border-color: var(--danger);
    animation: shake 0.5s;
}
.option:disabled { cursor: not-allowed; }

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* ===== ORDER (drag) ===== */
.order-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.order-item {
    background: rgba(255,255,255,0.08);
    border: 2px solid var(--card-border);
    padding: 14px 18px;
    border-radius: 12px;
    cursor: grab;
    user-select: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}
.order-item:hover { background: rgba(255,255,255,0.15); }
.order-item.dragging { opacity: 0.4; transform: scale(0.98); }
.order-num {
    background: var(--accent);
    color: #06251f;
    font-weight: 700;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ===== FEEDBACK ===== */
.feedback {
    padding: 18px;
    border-radius: 14px;
    margin: 18px 0;
    font-weight: 600;
    display: none;
    animation: fadeIn 0.4s;
}
.feedback.show { display: block; }
.feedback.correct { background: rgba(0,212,170,0.2); border-left: 4px solid var(--accent); }
.feedback.incorrect { background: rgba(255,77,109,0.2); border-left: 4px solid var(--danger); }
.feedback small { display: block; font-weight: 400; margin-top: 8px; opacity: 0.85; }

/* ===== RESULT / DIPLOMA ===== */
.result-emoji {
    font-size: 100px;
    animation: bounce 1.5s ease infinite;
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.diploma {
    background: linear-gradient(135deg, #fffbe6, #fff);
    color: #2c2c2c;
    padding: 35px 30px;
    border-radius: 16px;
    margin: 25px 0;
    border: 4px double #b8860b;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}
.diploma-header {
    font-family: 'Georgia', serif;
    font-size: 1.4rem;
    color: #b8860b;
    letter-spacing: 4px;
    margin-bottom: 15px;
    font-weight: bold;
}
.diploma p { margin: 6px 0; }
.diploma h2 {
    font-family: 'Georgia', serif;
    color: #4a26b3;
    margin: 12px 0;
    font-size: 1.8rem;
    border-bottom: 1px solid #ccc;
    padding-bottom: 8px;
}
.diploma-course { color: #b8860b; font-size: 1.1rem; margin-top: 8px !important; }

.diploma-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed #b8860b;
}
.stat-num {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-dark);
}
.stat-label { font-size: 0.85rem; color: #666; }
.diploma-date { margin-top: 15px; font-size: 0.85rem; color: #777; font-style: italic; }

.result-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .card { padding: 25px 20px; }
    h1 { font-size: 1.8rem; }
    .options { grid-template-columns: 1fr; }
    .hud { font-size: 0.8rem; }
    .hud-item { gap: 4px; }
    #questionText { font-size: 1.15rem; }
    .diploma-stats { flex-direction: column; gap: 12px; }
}

/* ===== PRINT (diploma) ===== */
@media print {
    @page { size: A4 portrait; margin: 1cm; }
    body { background: white !important; color: black !important; animation: none !important; }
    .screen { display: none !important; }
    #screen-end { display: block !important; }
    /* Aplanar el card padre: que no se vea, pero que el diploma sí salga */
    .card.result-card {
        background: none !important;
        backdrop-filter: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    .result-emoji,
    #resultTitle,
    #resultMessage,
    .result-actions { display: none !important; }
    .diploma {
        box-shadow: none !important;
        margin: 0 !important;
        page-break-inside: avoid;
    }
}
