/* ========================================
   Rajipo - Simple & Engaging
   Focus: Learn Satsang Diksha
   Style: Duolingo-inspired
   ======================================== */

/* Variables */
:root {
    --green: #58CC02;
    --green-dark: #46A302;
    --green-light: #89E219;
    --blue: #1CB0F6;
    --red: #FF4B4B;
    --orange: #FF9600;
    --yellow: #FFC800;
    --gray-bg: #F7F7F7;
    --gray-border: #E5E5E5;
    --text: #3C3C3C;
    --text-light: #777;
    --white: #FFFFFF;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
}

[data-theme="dark"] {
    --gray-bg: #1F1F1F;
    --gray-border: #3A3A3A;
    --text: #FFFFFF;
    --text-light: #AFAFAF;
    --white: #2A2A2A;
}

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

html, body {
    overflow-x: hidden;
}

body {
    font-family: 'Nunito', -apple-system, sans-serif;
    background: var(--gray-bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    -webkit-tap-highlight-color: transparent;
}

/* ========================================
   App Structure
   ======================================== */

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Safe area for notched phones */
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Header */
.header {
    background: var(--white);
    border-bottom: 2px solid var(--gray-border);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 28px;
    animation: bounce 2s infinite;
}

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

.logo-text {
    font-family: 'Fredoka One', cursive;
    font-size: 24px;
    background: linear-gradient(135deg, var(--green), var(--blue));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.streak-display {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--orange);
    padding: 8px 16px;
    border-radius: 100px;
    box-shadow: 0 3px 0 #E68500;
}

.streak-flame {
    font-size: 20px;
    animation: flicker 1.5s infinite;
}

@keyframes flicker {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.9; }
}

.streak-number {
    font-weight: 800;
    font-size: 18px;
    color: white;
}

/* Main Content */
.main {
    flex: 1;
    overflow-y: auto;
}

.content-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

.page-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    text-align: center;
}

.page-subtitle {
    font-size: 18px;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 40px;
}

/* ========================================
   Progress Card
   ======================================== */

.progress-card {
    background: var(--white);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 40px;
    border: 2px solid var(--gray-border);
}

.progress-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin-bottom: 20px;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 36px;
    font-weight: 800;
    color: var(--green);
}

.stat-label {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 600;
}

.stat-divider {
    width: 2px;
    height: 40px;
    background: var(--gray-border);
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 16px;
    background: var(--gray-bg);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--green-light));
    border-radius: 100px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: rgba(255,255,255,0.3);
    border-radius: 100px 100px 0 0;
}

.progress-percent {
    font-weight: 800;
    color: var(--green);
    min-width: 45px;
}

/* ========================================
   Learning Path (Duolingo-style)
   ======================================== */

.learning-path {
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding: 0;
    max-width: 400px;
    margin: 0 auto;
}

/* Section Container */
.path-section {
    background: var(--white);
    border-radius: 24px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--gray-border);
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, var(--green) 0%, var(--green-light) 100%);
    border-radius: 16px;
    margin-bottom: 20px;
    color: white;
}

.section-header.complete {
    background: linear-gradient(135deg, var(--yellow) 0%, var(--orange) 100%);
}

.section-badge {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
}

.section-info {
    flex: 1;
}

.section-title {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 2px;
}

.section-range {
    font-size: 12px;
    opacity: 0.9;
}

.section-progress {
    font-size: 14px;
    font-weight: 800;
    background: rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: 100px;
}

/* Path Row - Zigzag pattern */
.path-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    justify-items: center;
}

/* Node Wrapper */
.node-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Path Mascot */
.path-mascot {
    position: absolute;
    top: -35px;
    font-size: 28px;
    animation: bounce 1s infinite;
    z-index: 10;
}

/* Path Node Button */
.path-node-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    background: var(--white);
    border: 4px solid var(--gray-border);
    box-shadow: 0 4px 0 var(--gray-border);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.path-node-btn:hover:not(.locked) {
    transform: translateY(-4px);
    box-shadow: 0 8px 0 var(--gray-border);
}

.path-node-btn:active:not(.locked) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--gray-border);
}

/* Node States */
.path-node-btn.locked {
    background: var(--gray-bg);
    border-color: var(--gray-border);
    color: var(--text-light);
    cursor: not-allowed;
    font-size: 14px;
}

.path-node-btn.current {
    border-color: var(--green);
    box-shadow: 0 4px 0 var(--green-dark), 0 0 0 8px rgba(88, 204, 2, 0.15);
    animation: currentPulse 2s infinite;
}

@keyframes currentPulse {
    0%, 100% { box-shadow: 0 4px 0 var(--green-dark), 0 0 0 8px rgba(88, 204, 2, 0.15); }
    50% { box-shadow: 0 4px 0 var(--green-dark), 0 0 0 12px rgba(88, 204, 2, 0.1); }
}

.path-node-btn.completed {
    background: var(--green);
    border-color: var(--green-dark);
    box-shadow: 0 4px 0 var(--green-dark);
    color: white;
    font-size: 20px;
}

/* Node Tooltip */
.node-tooltip {
    position: absolute;
    bottom: -24px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-light);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
}

.node-wrapper:hover .node-tooltip {
    opacity: 1;
}

/* More Sections Indicator */
.more-sections {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px;
    background: var(--white);
    border-radius: 16px;
    border: 2px dashed var(--gray-border);
    color: var(--text-light);
}

.more-icon {
    font-size: 32px;
}

.more-text {
    font-size: 14px;
    font-weight: 600;
}

/* ========================================
   Lesson View
   ======================================== */

.view {
    display: none;
}

.view.active {
    display: block;
}

.lesson-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #FFFFFF 0%, var(--gray-bg) 100%);
}

.lesson-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--white);
    border-bottom: 2px solid var(--gray-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.close-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gray-bg);
    border: 2px solid var(--gray-border);
    font-size: 20px;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lesson-progress {
    flex: 1;
    height: 16px;
    background: var(--gray-bg);
    border-radius: 100px;
    overflow: hidden;
}

.lesson-progress-fill {
    height: 100%;
    background: var(--green);
    border-radius: 100px;
    transition: width 0.3s ease;
}

.lesson-hearts {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    min-width: 80px;
    justify-content: flex-end;
}

/* Battery Styles */
.battery-container {
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.3s ease;
}

.battery-container.shake {
    animation: batteryShake 0.5s ease;
}

@keyframes batteryShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.battery-tip {
    width: 4px;
    height: 10px;
    background: #555;
    border-radius: 2px 0 0 2px;
}

.battery-body {
    width: 50px;
    height: 22px;
    border: 3px solid #555;
    border-radius: 4px;
    background: #eee;
    position: relative;
    overflow: hidden;
}

.battery-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease, background 0.3s ease;
    position: relative;
}

.battery-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: rgba(255,255,255,0.3);
}

.battery-text {
    font-size: 16px;
    font-weight: 800;
    color: #555;
    min-width: 16px;
}

.battery-container.critical .battery-body {
    animation: batteryPulse 1s ease infinite;
}

@keyframes batteryPulse {
    0%, 100% { border-color: #FF4B4B; }
    50% { border-color: #FF8888; }
}

.battery-container.critical .battery-text {
    color: #FF4B4B;
}

.battery-container.low .battery-text {
    color: #FF9600;
}

/* Inflate animation (correct answer) */
.battery-container.inflate {
    animation: batteryInflate 0.5s ease;
}

@keyframes batteryInflate {
    0% { transform: scale(1); }
    30% { transform: scale(1.2); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.battery-container.inflate .battery-fill {
    animation: fillGlow 0.5s ease;
}

@keyframes fillGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.5); }
}

/* Deflate animation (wrong answer) */
.battery-container.deflate {
    animation: batteryDeflate 0.5s ease;
}

@keyframes batteryDeflate {
    0% { transform: scale(1) translateX(0); }
    20% { transform: scale(0.9) translateX(-5px); }
    40% { transform: scale(0.85) translateX(5px); }
    60% { transform: scale(0.9) translateX(-3px); }
    80% { transform: scale(0.95) translateX(3px); }
    100% { transform: scale(1) translateX(0); }
}

.lesson-content {
    flex: 1;
    padding: 40px 20px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.question-type {
    font-size: 12px;
    font-weight: 800;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    background: rgba(28, 176, 246, 0.1);
    padding: 6px 12px;
    border-radius: 100px;
    display: inline-block;
}

.question-text {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 32px;
    color: var(--text);
    line-height: 1.3;
    animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.shlok-display {
    font-family: 'Noto Sans Devanagari', sans-serif;
    font-size: 22px;
    line-height: 2;
    padding: 32px;
    background: var(--white);
    border-radius: 20px;
    border: 2px solid var(--gray-border);
    margin-bottom: 40px;
    box-shadow: var(--shadow);
    animation: fadeIn 0.5s ease;
    text-align: center;
}

/* Style for 2-line shlok format */
.shlok-display br {
    display: block;
    content: "";
    margin-top: 12px;
}

/* Shlok options in match questions */
.shlok-options .option-btn {
    text-align: center;
    line-height: 1.8;
    padding: 20px 16px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.option-btn {
    padding: 20px 24px;
    background: var(--white);
    border: 3px solid var(--gray-border);
    border-radius: 16px;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    text-align: left;
    line-height: 1.6;
    transition: all 0.15s ease;
    box-shadow: 0 4px 0 var(--gray-border);
    position: relative;
}

.option-btn::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border: 3px solid var(--gray-border);
    border-radius: 50%;
    background: var(--white);
    transition: all 0.15s ease;
}

.option-btn {
    padding-left: 52px;
}

.option-btn:hover {
    background: #F0F8FF;
    border-color: var(--blue);
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--gray-border);
}

.option-btn:hover::before {
    border-color: var(--blue);
}

.option-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--gray-border);
}

.option-btn.selected {
    border-color: var(--blue);
    background: rgba(28, 176, 246, 0.08);
    box-shadow: 0 4px 0 #0A8BD8;
}

.option-btn.selected::before {
    background: var(--blue);
    border-color: var(--blue);
}

.option-btn.correct {
    border-color: var(--green);
    background: rgba(88, 204, 2, 0.1);
    box-shadow: 0 4px 0 var(--green-dark);
    animation: correctBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.option-btn.correct::before {
    background: var(--green);
    border-color: var(--green);
}

@keyframes correctBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.option-btn.wrong {
    border-color: var(--red);
    background: rgba(255, 75, 75, 0.1);
    box-shadow: 0 4px 0 #CC3333;
    animation: shake 0.5s ease;
}

.option-btn.wrong::before {
    background: var(--red);
    border-color: var(--red);
}

/* Sanskrit text in options */
.option-btn.sanskrit {
    font-family: 'Noto Sans Devanagari', sans-serif;
    font-size: 18px;
    line-height: 1.8;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.lesson-footer {
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    background: var(--white);
    border-top: 2px solid var(--gray-border);
}

.lesson-btn {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: block;
    padding: 18px;
    background: var(--green);
    color: white;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: 0 6px 0 var(--green-dark);
    transition: all 0.1s ease;
}

.lesson-btn:hover {
    background: var(--green-light);
}

.lesson-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 var(--green-dark);
}

.lesson-btn:disabled {
    background: var(--gray-border);
    box-shadow: 0 6px 0 #D0D0D0;
    cursor: not-allowed;
    opacity: 0.5;
}

/* ========================================
   Feedback Panel
   ======================================== */

.feedback-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--green);
    padding: 32px 20px;
    padding-bottom: max(32px, env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
}

.feedback-panel.show {
    transform: translateY(0);
}

.feedback-panel.wrong {
    background: var(--red);
}

.feedback-content {
    max-width: 600px;
    margin: 0 auto;
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.feedback-icon {
    font-size: 48px;
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes popIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.feedback-title {
    font-size: 28px;
    font-weight: 800;
    color: white;
}

.feedback-message {
    font-size: 16px;
    color: rgba(255,255,255,0.9);
    margin-bottom: 24px;
    line-height: 1.6;
}

.feedback-btn {
    width: 100%;
    padding: 18px;
    background: white;
    color: var(--green);
    border-radius: 16px;
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: 0 4px 0 rgba(0,0,0,0.1);
}

.feedback-panel.wrong .feedback-btn {
    color: var(--red);
}

/* ========================================
   Complete View
   ======================================== */

.complete-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--green), var(--green-light));
}

.complete-animation {
    text-align: center;
    margin-bottom: 60px;
}

.complete-icon {
    font-size: 120px;
    animation: celebrate 1s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes celebrate {
    0% { 
        transform: scale(0) rotate(0deg); 
        opacity: 0;
    }
    60% { 
        transform: scale(1.2) rotate(180deg); 
    }
    100% { 
        transform: scale(1) rotate(360deg); 
        opacity: 1;
    }
}

.complete-title {
    font-size: 48px;
    font-weight: 800;
    color: white;
    margin-bottom: 12px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.complete-subtitle {
    font-size: 20px;
    color: rgba(255,255,255,0.9);
}

.complete-stats {
    display: flex;
    gap: 32px;
    margin-bottom: 60px;
}

.complete-stat {
    background: white;
    padding: 32px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 0 rgba(0,0,0,0.1);
    animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    animation-fill-mode: both;
}

.complete-stat:nth-child(1) { animation-delay: 0.1s; }
.complete-stat:nth-child(2) { animation-delay: 0.2s; }

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

.complete-stat-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.complete-stat-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--green);
    margin-bottom: 4px;
}

.complete-stat-label {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 700;
}

.complete-btn {
    padding: 20px 60px;
    background: white;
    color: var(--green);
    border-radius: 16px;
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: 0 6px 0 rgba(0,0,0,0.1);
    animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.3s both;
}

/* ========================================
   Confetti Animation
   ======================================== */

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: var(--yellow);
    animation: confettiFall 3s ease-out forwards;
    z-index: 9999;
    pointer-events: none;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 600px) {
    .page-title { font-size: 24px; }
    .page-subtitle { font-size: 16px; }
    .question-text { font-size: 18px; margin-bottom: 16px; }
    .shlok-display { font-size: 16px; padding: 16px; line-height: 1.8; margin-bottom: 16px; }
    .complete-title { font-size: 28px; }
    .complete-stats { flex-direction: column; gap: 16px; }
    
    /* Header adjustments */
    .header-content { padding: 12px 16px; }
    .logo-text { font-size: 20px; }
    
    /* Lesson header on mobile */
    .lesson-header { 
        padding: 12px 16px; 
        gap: 12px;
    }
    .lesson-hearts { 
        font-size: 16px; 
        min-width: 90px;
    }
    .heart { font-size: 16px; }
    .close-btn { 
        width: 36px; 
        height: 36px; 
        font-size: 16px;
    }
    .lesson-progress { height: 12px; }
    
    /* Content padding - reduced for mobile */
    .lesson-content { padding: 16px 12px; }
    
    /* Options - Duolingo style compact cards */
    .options-grid {
        gap: 10px;
        margin-top: 12px;
    }
    
    .option-btn { 
        padding: 12px 12px 12px 44px;
        font-size: 14px;
        line-height: 1.4;
        border-radius: 12px;
        border-width: 2px;
        box-shadow: 0 2px 0 var(--gray-border);
    }
    
    .option-btn::before {
        left: 12px;
        width: 18px;
        height: 18px;
        border-width: 2px;
    }
    
    .shlok-options .option-btn {
        padding: 12px 12px 12px 44px;
        font-size: 14px;
        text-align: left;
    }
    
    /* Audio player */
    .audio-player { padding: 10px 12px; margin-bottom: 12px; }
    .audio-btn { padding: 6px 10px; font-size: 12px; }
    
    /* Footer button */
    .lesson-btn { padding: 14px; font-size: 16px; }
    .lesson-footer { padding: 12px; }
    
    /* Feedback panel */
    .feedback-panel { padding: 20px 16px; }
    .feedback-title { font-size: 22px; }
    .feedback-message { font-size: 13px; }
    .feedback-btn { padding: 14px; font-size: 16px; }
    
    /* Learning path */
    .section-header { font-size: 14px; padding: 10px 20px; }
    .path-node { width: 56px; height: 56px; }
    .node-number { font-size: 16px; }
    .node-icon { font-size: 20px; }
    
    /* Question type badge */
    .question-type {
        font-size: 11px;
        padding: 4px 10px;
        margin-bottom: 8px;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .page-title { font-size: 20px; }
    .shlok-display { font-size: 14px; padding: 12px; margin-bottom: 12px; }
    .option-btn { 
        font-size: 13px; 
        padding: 10px 10px 10px 38px;
        line-height: 1.35;
    }
    .option-btn::before {
        left: 10px;
        width: 16px;
        height: 16px;
    }
    .lesson-hearts { font-size: 14px; min-width: 80px; }
    .heart { font-size: 14px; }
    .question-text { font-size: 16px; margin-bottom: 12px; }
    .lesson-content { padding: 12px 10px; }
    .options-grid { gap: 8px; margin-top: 10px; }
    .audio-player { padding: 8px 10px; margin-bottom: 10px; }
}

/* ========================================
   Utilities
   ======================================== */

.sanskrit {
    font-family: 'Noto Sans Devanagari', sans-serif;
}

/* ========================================
   Script Toggle
   ======================================== */

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.script-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--gray-border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.script-toggle:hover {
    transform: scale(1.05);
}

.script-toggle.active {
    background: var(--green);
    border-color: var(--green);
    box-shadow: 0 3px 0 var(--green-dark);
}

.script-toggle .toggle-text {
    font-family: 'Noto Sans Devanagari', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.script-toggle.active .toggle-text {
    color: white;
}

/* ========================================
   Audio Player
   ======================================== */

.audio-player {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--white);
    border-radius: 12px;
    border: 2px solid var(--gray-border);
    margin-bottom: 20px;
}

.audio-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--blue);
    color: white;
    border-radius: 100px;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 3px 0 #0A8BD8;
    transition: all 0.2s ease;
}

.audio-btn:hover {
    transform: translateY(-1px);
}

.audio-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #0A8BD8;
}

.audio-icon {
    font-size: 18px;
}

.audio-time {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 600;
    min-width: 40px;
}

.speed-btn {
    padding: 8px 12px;
    background: var(--gray-bg);
    border: 2px solid var(--gray-border);
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    color: var(--text);
    transition: all 0.2s ease;
}

.speed-btn:hover {
    background: var(--gray-border);
}

@media (max-width: 600px) {
    .audio-player {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .audio-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
}

/* ========================================
   Header Icon Buttons
   ======================================== */

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--white);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.icon-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* ========================================
   Modals
   ======================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: 16px;
    max-width: 420px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-lg {
    max-width: 520px;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--gray-border);
}

.modal-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-bg);
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--gray-border);
    color: var(--text);
}

.modal-body {
    padding: 20px;
}

.modal-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 20px;
    text-align: center;
}

/* ========================================
   Registration Form
   ======================================== */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
    border: 2px solid var(--gray-border);
    border-radius: 12px;
    background: var(--white);
    color: var(--text);
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--green);
}

.form-group input::placeholder {
    color: var(--text-light);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--green);
    color: white;
    border: none;
    box-shadow: 0 4px 0 var(--green-dark);
}

.btn-primary:hover {
    background: var(--green-light);
}

.btn-primary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--green-dark);
}

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

.btn-secondary {
    background: var(--gray-bg);
    color: var(--text);
    border: 2px solid var(--gray-border);
}

.btn-secondary:hover {
    background: var(--gray-border);
}

/* ========================================
   Leaderboard
   ======================================== */

.leaderboard-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
    background: var(--gray-bg);
    border: 2px solid var(--gray-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text);
}

.tab-btn.active {
    background: var(--green);
    border-color: var(--green);
    color: white;
}

.tab-btn:hover:not(.active) {
    background: var(--gray-border);
}

.leaderboard-content {
    min-height: 200px;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
    font-weight: 600;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--gray-bg);
    border-radius: 12px;
    gap: 12px;
    transition: all 0.2s ease;
}

.leaderboard-item.current-user {
    background: rgba(88, 204, 2, 0.15);
    border: 2px solid var(--green);
}

.leaderboard-rank {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    border-radius: 50%;
    background: var(--white);
    color: var(--text);
}

.leaderboard-item:nth-child(1) .leaderboard-rank {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
    font-size: 18px;
}

.leaderboard-item:nth-child(2) .leaderboard-rank {
    background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
    color: white;
}

.leaderboard-item:nth-child(3) .leaderboard-rank {
    background: linear-gradient(135deg, #CD7F32, #B87333);
    color: white;
}

.leaderboard-info {
    flex: 1;
    min-width: 0;
}

.leaderboard-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-details {
    font-size: 12px;
    color: var(--text-light);
}

.leaderboard-xp {
    font-size: 15px;
    font-weight: 800;
    color: var(--orange);
    display: flex;
    align-items: center;
    gap: 4px;
}

.leaderboard-xp::before {
    content: '⭐';
    font-size: 14px;
}

.leaderboard-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.leaderboard-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.leaderboard-empty-text {
    font-size: 14px;
    font-weight: 600;
}

/* ========================================
   Profile View
   ======================================== */

.profile-card {
    text-align: center;
    padding: 20px 0;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: var(--green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 16px;
}

.profile-name {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}

.profile-details {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 20px;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
}

.profile-stat {
    text-align: center;
}

.profile-stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
}

.profile-stat-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 600;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-btn.primary {
    background: var(--green);
    color: white;
    border: none;
    box-shadow: 0 4px 0 var(--green-dark);
}

.profile-btn.primary:hover {
    background: var(--green-light);
}

.profile-btn.danger {
    background: transparent;
    color: var(--red);
    border: 2px solid var(--red);
}

.profile-btn.danger:hover {
    background: rgba(255, 75, 75, 0.1);
}

/* Guest profile */
.profile-guest {
    text-align: center;
    padding: 20px 0;
}

.profile-guest-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.profile-guest h3 {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
}

.profile-guest p {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 20px;
}

/* Sync Status */
.sync-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--gray-bg);
    border-radius: 8px;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-light);
}

.sync-status.syncing {
    color: var(--blue);
}

.sync-status.synced {
    color: var(--green);
}

.sync-status.error {
    color: var(--red);
}
