:root {
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --secondary: #ec4899;
    --bg: #0f172a;
    --text: #f8fafc;
    --card: #1e293b;
    --success: #10b981;
    --danger: #f43f5e;
    --gray: #94a3b8;
    --gray-light: #334155;
    --shadow-color: #020617;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    background-image: 
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.15) 0px, transparent 50%);
    color: var(--text);
    height: 100dvh; /* Accounts for mobile browser UI */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#app {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg);
}

.header {
    padding: 1.25rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    z-index: 10;
}

.brand {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900;
    font-size: 1.4rem;
    letter-spacing: -0.5px;
}

.xp-badge {
    background: linear-gradient(135deg, #fef08a, #facc15);
    color: #713f12;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow-y: auto;
    animation: fadeIn 0.3s ease-out;
}

.title {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn {
    padding: 1.25rem;
    border-radius: 16px;
    border: 2px solid var(--gray-light);
    background: var(--card);
    box-shadow: 0 4px 0 var(--shadow-color);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.1s ease;
}

.btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 var(--shadow-color);
}

.btn-icon {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    margin-right: 1rem;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.2);
}

.btn-content {
    display: flex;
    align-items: center;
}

.btn-primary {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    justify-content: center;
    margin-top: auto;
    box-shadow: 0 6px 0 #5b21b6, 0 10px 20px rgba(124, 58, 237, 0.4);
}

.btn-primary:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 #5b21b6;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    color: var(--gray);
    font-weight: 700;
    font-size: 1.1rem;
}

.progress-bar {
    height: 12px;
    background: var(--gray-light);
    border-radius: 6px;
    margin-bottom: 2rem;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s ease;
    border-radius: 4px;
}

.question-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.question-text {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    font-weight: 800;
    line-height: 1.2;
}

.options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.option-btn {
    padding: 1.5rem 1rem;
    border-radius: 16px;
    border: 2px solid var(--gray-light);
    background: var(--card);
    box-shadow: 0 6px 0 var(--shadow-color);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    text-align: center;
    cursor: pointer;
    transition: all 0.1s ease;
}

.option-btn:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 var(--shadow-color);
}

.option-btn.correct {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: var(--success);
    box-shadow: 0 6px 0 #065f46;
}

.option-btn.wrong {
    background: rgba(244, 63, 94, 0.1);
    color: var(--danger);
    border-color: var(--danger);
    box-shadow: 0 6px 0 #9f1239;
}

.option-btn.correct:active {
    box-shadow: 0 0 0 #065f46;
}

.option-btn.wrong:active {
    box-shadow: 0 0 0 #9f1239;
}

.summary-icon {
    font-size: 5rem;
    margin: 1rem 0;
    text-align: center;
    animation: bounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

@keyframes bounce {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}