:root {
    --bg-dark: #050505;
    --card-bg: rgba(20, 20, 25, 0.7);
    --primary: #00f2ff;
    --secondary: #7000ff;
    --accent: #ff00c8;
    --text-main: #ffffff;
    --text-dim: #a0a0b0;
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-main: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
}

#app {
    width: 100%;
    max-width: 850px;
    padding: 15px;
    padding-top: 80px;
    z-index: 10;
    position: relative;
    margin: 0 auto;
}

/* ─── Top Bar ─── */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 850px;
    padding: 10px 15px;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(5, 5, 5, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.lang-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.lang-btn.active {
    background: var(--primary);
    color: black;
    box-shadow: 0 0 12px var(--primary);
}

.timer-display {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    font-size: 0.75rem;
    color: var(--text-dim);
    white-space: nowrap;
}

.timer-display .mono {
    font-family: var(--font-mono);
    color: var(--primary);
    font-weight: bold;
    margin-left: 4px;
}

/* ─── Screens ─── */
.screen {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ─── Glassmorphism Card ─── */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: clamp(16px, 4vw, 28px);
    padding: clamp(18px, 5vw, 40px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin: 0 auto;
    width: 100%;
}

.main-card { max-width: 800px; }
.quiz-card { max-width: 850px; min-height: 400px; display: flex; flex-direction: column; }
.results-card { max-width: 800px; text-align: center; }

/* ─── Typography (Responsive) ─── */
h1 {
    font-size: clamp(1.5rem, 6vw, 2.8rem);
    font-weight: 800;
    margin-bottom: 15px;
    line-height: 1.15;
}
h2 {
    font-size: clamp(1.1rem, 4vw, 1.7rem);
    margin-bottom: 20px;
}
.highlight { color: var(--primary); text-shadow: 0 0 20px rgba(0, 242, 255, 0.3); }
.subtitle {
    font-size: clamp(0.85rem, 2.5vw, 1.1rem);
    color: var(--text-dim);
    margin-bottom: 25px;
}

/* ─── Badge ─── */
.badge {
    display: inline-block;
    background: rgba(0, 242, 255, 0.1);
    color: var(--primary);
    padding: 5px 14px;
    border-radius: 100px;
    font-size: clamp(0.7rem, 2vw, 0.85rem);
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid rgba(0, 242, 255, 0.2);
}

/* ─── Intro Stats ─── */
.intro-stats {
    display: flex;
    gap: clamp(15px, 5vw, 40px);
    margin-bottom: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-val { font-size: clamp(1.3rem, 5vw, 2.2rem); font-weight: 800; color: var(--text-main); }
.stat-label { font-size: clamp(0.55rem, 1.8vw, 0.75rem); color: var(--text-dim); text-transform: uppercase; letter-spacing: 1.5px; }

/* ─── Email Input ─── */
.user-info input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: clamp(12px, 3vw, 20px);
    border-radius: 14px;
    color: white;
    font-size: clamp(0.85rem, 2.5vw, 1.05rem);
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.user-info input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
}

/* ─── PISA Badge ─── */
.pisa-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: clamp(0.65rem, 2vw, 0.8rem);
    color: var(--text-dim);
    flex-wrap: wrap;
}

.pisa-badge img {
    height: 20px;
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.footnote {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 15px;
    opacity: 0.6;
    line-height: 1.4;
}

/* ─── Buttons ─── */
.btn {
    padding: clamp(12px, 3vw, 18px) clamp(20px, 4vw, 35px);
    border-radius: 14px;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    width: 100%;
    box-shadow: 0 8px 18px -5px rgba(0, 242, 255, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px -5px rgba(0, 242, 255, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid var(--glass-border);
}

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

/* ─── Welcome Actions & Resume ─── */
.welcome-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.resume-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 12px;
    border-radius: 14px;
    text-align: center;
}

.resume-box > span {
    font-size: 0.75rem;
    color: var(--text-dim);
    display: block;
    margin-bottom: 8px;
}

.resume-input-group {
    display: flex;
    gap: 8px;
}

.resume-input-group input {
    flex: 1;
    margin-bottom: 0 !important;
    padding: 10px 12px !important;
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-size: 0.85rem;
}

.btn-icon {
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0 14px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    box-shadow: 0 0 12px var(--secondary);
}

/* ─── Progress Bar ─── */
.progress-container {
    width: 100%;
    max-width: 850px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-bar-bg {
    flex-grow: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    overflow: hidden;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
    box-shadow: 0 0 12px var(--primary);
}

.progress-text { font-family: var(--font-mono); font-size: clamp(0.7rem, 2vw, 0.85rem); color: var(--text-dim); white-space: nowrap; }

/* ─── Quiz Options ─── */
.options-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 25px;
    flex-grow: 1;
}

.option {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: clamp(12px, 3vw, 18px);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
}

.option:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.3);
}

.option.selected {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--primary);
}

.option-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--text-dim);
    flex-shrink: 0;
}

.option.selected .option-dot {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

/* ─── Quiz Footer ─── */
.quiz-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.quiz-footer .btn { flex: 1; }

/* ─── Discreet Admin Footer ─── */
.discreet-footer {
    position: fixed;
    bottom: 10px;
    right: 10px;
    opacity: 0.2;
    transition: opacity 0.3s ease;
    z-index: 50;
}

.discreet-footer:hover {
    opacity: 1;
}

.admin-dot-btn {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-dot-btn:hover {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
    transform: scale(1.5);
}

/* ─── Admin Modal ─── */
.modal {
    display: none !important;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    backdrop-filter: blur(15px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex !important;
}

.modal-content {
    max-width: 380px;
    width: 90%;
    text-align: center;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#adminPassword {
    text-align: center;
    font-size: 1.1rem;
    letter-spacing: 5px;
}

/* ─── Background Elements ─── */
.bg-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.35;
    border-radius: 50%;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: var(--secondary);
    top: -150px;
    left: -150px;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    bottom: -100px;
    right: -100px;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: var(--accent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ─── Survey Form ─── */
.survey-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 20px 0;
    text-align: left;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: clamp(0.7rem, 2vw, 0.85rem);
    color: var(--text-dim);
    font-weight: 500;
}

input[type="text"],
input[type="number"],
select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 10px 14px;
    border-radius: 10px;
    color: white;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    transition: all 0.2s ease;
    outline: none;
    width: 100%;
}

input:focus, select:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

/* ─── Custom Toggles ─── */
.toggle-group, .mini-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
}

.toggle-group .toggle-btn, .mini-toggle .toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 8px;
    border-radius: 7px;
    cursor: pointer;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    font-weight: 600;
    transition: all 0.3s ease;
}

.toggle-group .toggle-btn.active, .mini-toggle .toggle-btn.active {
    background: var(--secondary);
    color: white;
    box-shadow: 0 4px 15px rgba(112, 0, 255, 0.3);
}

.toggle-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.toggle-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toggle-item label {
    font-size: clamp(0.7rem, 2vw, 0.8rem);
    color: var(--text-dim);
}

.mini-toggle {
    width: fit-content;
}

.mini-toggle .toggle-btn {
    padding: 6px 16px;
    min-width: 55px;
}

/* ─── Score Display ─── */
.score-display {
    margin: 30px 0;
}

.score-circle {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

#finalScore { font-size: clamp(3rem, 12vw, 5.5rem); font-weight: 800; color: var(--primary); }
.score-total { font-size: clamp(1rem, 4vw, 1.8rem); color: var(--text-dim); }

.category-breakdown {
    text-align: left;
    margin-bottom: 30px;
}

.cat-row { margin-bottom: 12px; }
.cat-label { display: flex; justify-content: space-between; font-size: clamp(0.75rem, 2vw, 0.85rem); margin-bottom: 5px; }
.cat-bar-bg { height: 5px; background: rgba(255, 255, 255, 0.05); border-radius: 100px; }
.cat-bar-fill { height: 100%; background: var(--primary); border-radius: 100px; }

/* ═══════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════ */

/* Tablets and up */
@media (min-width: 600px) {
    #app {
        padding: 20px;
        padding-top: 90px;
    }

    .top-bar {
        padding: 12px 20px;
    }

    .form-row {
        grid-template-columns: 1fr 1fr;
    }

    .toggle-grid {
        grid-template-columns: 1fr 1fr;
    }

    .quiz-card { min-height: 500px; }
}

/* Desktop */
@media (min-width: 900px) {
    #app {
        padding-top: 100px;
    }

    .welcome-actions {
        flex-direction: row;
        align-items: stretch;
    }

    .welcome-actions .btn-primary {
        flex: 1;
    }

    .resume-box {
        flex: 1;
    }
}

/* Very small screens */
@media (max-width: 400px) {
    .top-bar {
        flex-direction: column;
        gap: 6px;
        padding: 8px 10px;
    }

    #app {
        padding-top: 100px;
    }

    .intro-stats {
        gap: 10px;
    }

    .quiz-footer {
        flex-direction: column;
    }

    .quiz-footer .btn {
        width: 100%;
    }
}
