:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --background: #0f172a;
    --surface: rgba(30, 41, 59, 0.7);
    --surface-light: rgba(51, 65, 85, 0.8);
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --success: #22c55e;
    --error: #ef4444;
    --border: rgba(255, 255, 255, 0.1);
    --glow: 0 0 20px rgba(99, 102, 241, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 10s infinite ease-in-out;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: var(--secondary);
    bottom: -50px;
    right: -50px;
    animation-delay: -2s;
}

.blob-3 {
    width: 200px;
    height: 200px;
    background: #8b5cf6;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -4s;
}

@keyframes float {

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

    50% {
        transform: translate(20px, -20px);
    }
}

/* Container & Layout */
.container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.screen {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Cards & Glassmorphism */
.card {
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.glass {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

.range-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="range"] {
    flex: 1;
    height: 6px;
    background: var(--surface-light);
    border-radius: 3px;
    appearance: none;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary);
}

#question-count-display {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary);
    min-width: 30px;
    text-align: center;
}

/* Radio Cards */
.radio-group {
    display: grid;
    gap: 1rem;
}

.radio-card {
    position: relative;
    cursor: pointer;
}

.radio-card input {
    position: absolute;
    opacity: 0;
}

.radio-content {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.radio-card input:checked+.radio-content {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.radio-content .icon {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.radio-content .text {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 1rem;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.checkbox-label:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

.checkbox-label span {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn.secondary {
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Quiz Screen */
.quiz-header {
    margin-bottom: 1.5rem;
}

.progress-bar {
    height: 6px;
    background: var(--surface-light);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

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

.stats-mini {
    text-align: right;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.question-card {
    text-align: center;
    margin-bottom: 1.5rem;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#question-text {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.question-display {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.option-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 12px;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.option-btn:hover {
    background: var(--surface-light);
    transform: translateY(-2px);
}

.option-btn.correct {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--success);
    color: var(--success);
}

.option-btn.wrong {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
    color: var(--error);
}

/* Results Screen */
.results-card {
    text-align: center;
}

.score-circle {
    width: 150px;
    height: 150px;
    margin: 0 auto 2rem;
}

.circular-chart {
    display: block;
    margin: 10px auto;
    max-width: 80%;
    max-height: 250px;
}

.circle-bg {
    fill: none;
    stroke: var(--surface-light);
    stroke-width: 2.5;
}

.circle {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke: var(--primary);
    transition: stroke-dasharray 1s ease-out;
}

.percentage {
    fill: var(--text);
    font-family: sans-serif;
    font-weight: bold;
    font-size: 0.5em;
    text-anchor: middle;
}

.stats-summary {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

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

.stat-item .label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.stat-item .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-item.correct .value {
    color: var(--success);
}

.stat-item.wrong .value {
    color: var(--error);
}

.mistakes-section {
    margin-top: 2rem;
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 10px;
}

.mistakes-section.hidden {
    display: none;
}

.mistakes-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.mistakes-list {
    list-style: none;
}

.mistake-item {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--error);
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    border-radius: 0 8px 8px 0;
    font-size: 0.9rem;
}

.mistake-item span {
    display: block;
}

.mistake-item .correct-answer {
    color: var(--success);
    font-weight: 600;
    margin-top: 0.2rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Element Tile */
.element-tile {
    width: 280px;
    min-height: 320px;
    border: 3px solid var(--text);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto 1fr auto;
    gap: 8px;
    padding: 12px;
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    margin: 0 auto;
    font-size: 0.85rem;
}

.element-tile .atomic-number {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 1rem;
    font-weight: 600;
}

.element-tile .atomic-mass {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text);
}

.element-tile .radioactive-indicator {
    position: absolute;
    top: 28px;
    right: 8px;
    font-size: 1.2rem;
    color: var(--error);
}

.element-tile .symbol-section {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 20px;
    margin-bottom: 10px;
}

.element-tile .symbol {
    font-size: 5.5rem;
    font-weight: 700;
    line-height: 1;
    display: block;
}

.element-tile .name {
    font-size: 1.6rem;
    margin-top: 5px;
    font-weight: 500;
    display: block;
}

.element-tile .property {
    display: flex;
    flex-direction: column;
    padding: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.element-tile .property-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.element-tile .property-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.element-tile .electron-config {
    grid-column: 1 / -1;
    text-align: center;
    padding: 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.element-tile .electron-config .property-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.element-tile .electron-config .property-value {
    font-size: 0.85rem;
    font-weight: 500;
    word-break: break-all;
}

@media (max-width: 480px) {
    .options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .option-btn {
        padding: 0.8rem;
        font-size: 0.9rem;
    }

    h1 {
        font-size: 2rem;
    }
}

/* Creator Footer */
.creator-footer {
    margin-top: 3rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.creator-footer p {
    margin-bottom: 0;
}

.creator-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.creator-footer a:hover {
    color: var(--primary-dark);
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}