:root {
    --color-primary: #5D4037;
    --color-primary-light: #8D6E63;
    --color-primary-dark: #3E2723;
    --color-primary-gradient: linear-gradient(135deg, #5D4037 0%, #8D6E63 100%);
    
    --bg-cream: #FFF8F0;
    --bg-warm-white: #FFFAF5;
    --bg-light-gray: #f8f9fa;
    
    --text-primary: #333333;
    --text-secondary: #555555;
    --text-muted: #666666;
    --text-light: #777777;
    
    --color-success: #2E7D32;
    --color-success-light: #E8F5E9;
    --color-success-accent: #4CAF50;
    
    --color-error: #C62828;
    --color-error-light: #FFEBEE;
    
    --color-accent: #D2691E;
    --color-accent-light: #FFE4B5;
    --color-gold: #F39C12;
    
    --border-light: #ddd;
    --border-muted: #eee;
    --border-accent: #d4c4b0;
    
    --shadow-sm: 0 2px 8px rgba(93, 64, 55, 0.15);
    --shadow-md: 0 5px 20px rgba(93, 64, 55, 0.25);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--color-primary-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

h1 {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 30px;
    font-size: 28px;
}

h2 {
    color: var(--text-secondary);
    margin-bottom: 25px;
    text-align: center;
}

h3 {
    color: var(--text-muted);
    margin: 20px 0 15px;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

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

.form-group label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 500;
}

.primary-btn {
    width: 100%;
    padding: 15px;
    background: var(--color-primary-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.secondary-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
}

.secondary-btn:hover {
    background: var(--bg-cream);
}

.progress-bar {
    height: 8px;
    background: var(--border-muted);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.question {
    font-size: 48px;
    text-align: center;
    color: var(--text-primary);
    margin: 30px 0;
    font-weight: 600;
}

.feedback {
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    text-align: center;
    font-weight: 600;
}

.feedback.correct {
    background: var(--color-success-light);
    border-left: 3px solid var(--color-success);
    padding: 15px;
    margin-top: 8px;
    font-family: monospace;
    white-space: pre-line;
    font-size: 0.9em;
    border-radius: 4px;
}

.feedback.incorrect {
    background: var(--color-error-light);
    color: var(--color-error);
}

.hidden {
    display: none !important;
}

.score {
    font-size: 64px;
    text-align: center;
    color: var(--color-primary);
    font-weight: 700;
    margin: 20px 0;
}

.time {
    text-align: center;
    color: var(--text-muted);
    font-size: 18px;
    margin-bottom: 20px;
}

#answers-review {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}



#stats-summary {
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-light-gray);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.stat-card h4 {
    color: var(--color-primary);
    margin-bottom: 5px;
}

.stat-card p {
    color: var(--text-muted);
    font-size: 14px;
}

#stats-history {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.history-item {
    padding: 10px;
    border-bottom: 1px solid var(--border-muted);
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    cursor: default;
}

.history-item.clickable {
    cursor: pointer;
    transition: background 0.2s;
}

.history-item.clickable:hover {
    background: var(--bg-cream);
}

.history-item:last-child {
    border-bottom: none;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 35px;
    gap: 20px;
}

.header h1 {
    margin-bottom: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    flex-wrap: wrap;
}

.user-info span {
    color: var(--text-muted);
    font-weight: 500;
}

.user-info .level-title {
    color: #ffffff;
}

.level-badge-header .level-number {
    color: var(--color-primary-dark);
}

.logout-btn {
    padding: 6px 12px;
    background: transparent;
    color: var(--color-error);
    border: 1px solid var(--color-error);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--color-error);
    color: white;
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.icon-btn:hover {
    opacity: 1;
}

.auth-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.toggle-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: 2px solid var(--border-light);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.toggle-btn:hover {
    border-color: var(--color-primary);
}

.toggle-btn.active {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: white;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    border: 2px solid var(--border-light);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s;
}

.auth-form input[type="text"]:focus,
.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus {
    border-color: var(--color-primary);
}

.auth-error {
    background: var(--color-error-light);
    color: var(--color-error);
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 14px;
    text-align: center;
}

.worked-example {
    background: linear-gradient(135deg, var(--bg-cream) 0%, var(--bg-warm-white) 100%);
    border-left: 4px solid var(--color-accent);
    padding: 16px 20px;
    margin-top: 12px;
    border-radius: 8px;
    text-align: left;
    width: 100%;
}

.example-title {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.example-rule {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.95em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border-accent);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.example-steps {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.9em;
    line-height: 1.8;
    color: var(--text-primary);
}

.example-step {
    padding: 3px 0;
}

.example-step-label {
    color: var(--color-primary-light);
    font-weight: 600;
}

.example-answer {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-accent);
    font-weight: 700;
    color: var(--color-primary);
    font-size: 1.05em;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.answer-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

.answer-item.correct {
    background: var(--color-success-light);
    border-left: 3px solid var(--color-success-accent);
    opacity: 0.85;
}

.answer-item.correct .q-text {
    color: var(--color-success);
    font-size: 13px;
}

.answer-item.incorrect {
    background: var(--color-error-light);
    border-left: 3px solid var(--color-error);
}

.answer-item .q-text {
    flex: 1;
    min-width: 0;
}

.answer-item .q-correct {
    color: var(--color-error);
    margin-left: 8px;
    font-weight: 500;
}

.answer-item .q-time {
    color: var(--text-light);
    margin-left: 10px;
    white-space: nowrap;
}

.worked-example-toggle {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    margin-left: 10px;
    text-decoration: underline;
    white-space: nowrap;
}

.worked-example-toggle:hover {
    color: var(--color-primary-light);
}

.worked-example-container {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.worked-example-container.expanded {
    max-height: 500px;
}

.answer-item .worked-example {
    margin-top: 10px;
    margin-bottom: 0;
}

.level-badge-header {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #6D4C41;
    padding: 8px 14px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.level-number {
    background: white;
    color: var(--color-primary-dark);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.level-title {
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.xp-bar-container {
    position: relative;
    width: 120px;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.xp-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--color-primary-gradient);
    border-radius: 10px;
    transition: width 0.5s ease-out;
    width: 0%;
}

.xp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.xp-popup-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.xp-popup {
    position: absolute;
    font-size: 24px;
    font-weight: 700;
    color: var(--color-primary);
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    animation: xpFloat 1.5s ease-out forwards;
    pointer-events: none;
}

@keyframes xpFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(1.3);
    }
}

.confetti-particle {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
}

.streak-container {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ff6b6b, #ffa502);
    padding: 8px 16px;
    border-radius: 25px;
    color: white;
    font-weight: bold;
    animation: streakEnter 0.3s ease-out;
    z-index: 10;
}

.streak-flame {
    font-size: 24px;
    animation: flamePulse 0.5s ease-in-out infinite;
}

.streak-count {
    font-size: 28px;
}

.streak-label {
    font-size: 14px;
    opacity: 0.9;
}

.streak-pulse {
    animation: streakPulse 0.3s ease-out;
}

.streak-on-fire {
    background: linear-gradient(135deg, #ff4757, #ff6348);
    box-shadow: 0 0 30px rgba(255, 71, 87, 0.5);
}

.streak-unstoppable {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.6);
    animation: unstoppableGlow 1s ease-in-out infinite;
}

@keyframes streakEnter {
    from { transform: scale(0) translateX(50px); opacity: 0; }
    to { transform: scale(1) translateX(0); opacity: 1; }
}

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

@keyframes streakPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes unstoppableGlow {
    0%, 100% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.6); }
    50% { box-shadow: 0 0 60px rgba(255, 215, 0, 0.9); }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

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

.streak-result {
    text-align: center;
    padding: 10px;
    background: var(--bg-cream);
    border-radius: 10px;
    margin-bottom: 15px;
}

.streak-stat {
    color: var(--color-accent);
}

#quiz-screen {
    position: relative;
}

.daily-widget {
    background: linear-gradient(135deg, rgba(93, 64, 55, 0.125), rgba(141, 110, 99, 0.125));
    border: 2px solid rgba(93, 64, 55, 0.25);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
}

.daily-widget.daily-done {
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.125), rgba(76, 175, 80, 0.125));
    border-color: var(--color-success);
}

.daily-widget.streak-hot {
    border-color: #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.3);
}

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

.daily-icon {
    font-size: 24px;
}

.daily-title {
    font-weight: 600;
    color: var(--text-primary);
}

.daily-description {
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: 15px;
}

.daily-progress-container {
    background: #e0e0e0;
    border-radius: 10px;
    height: 24px;
    position: relative;
    overflow: hidden;
}

.daily-progress-bar {
    height: 100%;
    background: var(--color-primary-gradient);
    border-radius: 10px;
    transition: width 0.5s ease-out;
    width: 0%;
}

.daily-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.daily-completed {
    text-align: center;
    color: var(--color-success);
    font-weight: 600;
    margin-top: 10px;
    padding: 8px;
    background: var(--color-success-light);
    border-radius: 8px;
}

.play-streak {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 14px;
}

#play-streak-count {
    font-weight: bold;
    font-size: 18px;
    color: var(--color-primary);
}

.question {
    animation: questionEnter 0.4s ease-out;
}

@keyframes questionEnter {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.answer-correct {
    animation: answerPop 0.3s ease-out;
}

@keyframes answerPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); border-color: var(--color-success); }
    100% { transform: scale(1); border-color: var(--color-success); }
}

.answer-incorrect {
    animation: answerShake 0.4s ease-out;
}

@keyframes answerShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); border-color: var(--color-error); }
    40% { transform: translateX(8px); border-color: var(--color-error); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

.level-badge-pulse {
    animation: levelPulse 0.6s ease-out;
}

@keyframes levelPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); box-shadow: 0 0 30px rgba(102, 126, 234, 0.8); }
    100% { transform: scale(1); }
}

.xp-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.3), transparent);
    border-radius: 10px 10px 0 0;
}

.xp-bar.level-up {
    animation: xpBarGlow 0.5s ease-out;
}

@keyframes xpBarGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(93, 64, 55, 0.5); }
    50% { box-shadow: 0 0 20px rgba(93, 64, 55, 0.9); }
}

.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: overlayFadeIn 0.3s ease-out;
}

.celebration-overlay.hidden {
    display: none;
}

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

.celebration-content {
    background: white;
    padding: 40px 50px;
    border-radius: 20px;
    text-align: center;
    animation: celebrationPop 0.5s ease-out;
    max-width: 90%;
}

@keyframes celebrationPop {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.celebration-icon {
    font-size: 80px;
    margin-bottom: 15px;
    animation: celebrationBounce 0.6s ease-out infinite;
}

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

.celebration-title {
    font-size: 42px;
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 10px;
    background: var(--color-primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.celebration-subtitle {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.celebration-btn {
    margin-top: 25px;
    width: auto;
    padding: 15px 40px;
}

.new-level-number {
    font-size: 72px;
    font-weight: bold;
    color: var(--color-primary);
    line-height: 1;
}

.new-level-title {
    font-size: 20px;
    color: var(--text-muted);
    margin-top: 5px;
}

.perfect-content {
    background: linear-gradient(135deg, var(--bg-warm-white), var(--bg-cream));
    border: 3px solid var(--color-gold);
}

.perfect-content .celebration-icon {
    animation: perfectSpin 1s ease-out;
}

@keyframes perfectSpin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(720deg); }
}

.perfect-score {
    font-size: 48px;
    font-weight: bold;
    color: var(--color-success);
}

.perfect-bonus {
    font-size: 18px;
    color: var(--color-gold);
    margin-top: 10px;
}

.achievement-content {
    border: 3px solid var(--color-primary);
}

.achievement-overlay-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 10px;
}

.confetti-particle {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.rule-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    border: 2px solid #444;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.rule-option:hover {
    border-color: var(--color-primary);
    background: rgba(93, 64, 55, 0.1);
}

.rule-option input:checked + .rule-label {
    color: var(--color-primary);
    font-weight: bold;
}

.rule-option input {
    display: none;
}

.rule-label {
    font-size: 1.5em;
    font-weight: 600;
}

.rule-hint {
    font-size: 0.75em;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: center;
}

.toggle-all-btn {
    padding: 8px 16px;
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-all-btn:hover {
    background: var(--bg-cream);
}

.rule-selection-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

#trachtenberg-difficulty {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, var(--color-primary), var(--color-primary-light), var(--color-accent));
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin: 10px 0;
}

#trachtenberg-difficulty::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--color-primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

#trachtenberg-difficulty::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--color-primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.difficulty-description {
    text-align: center;
    margin-top: 10px;
    font-size: 0.95em;
    color: var(--text-light);
}

.rule-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--color-primary-gradient);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.1em;
    z-index: 10;
}

#trachtenberg-quiz-screen {
    position: relative;
}

#trachtenberg-progress-fill {
    height: 100%;
    background: var(--color-primary-gradient);
    width: 0%;
    transition: width 0.3s;
}

#trachtenberg-answer-input {
    width: 100%;
    padding: 15px;
    font-size: 24px;
    text-align: center;
    border: 2px solid var(--border-light);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s;
}

#trachtenberg-answer-input:focus {
    border-color: var(--color-primary);
}

#trachtenberg-feedback {
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    text-align: center;
    font-weight: 600;
}

#trachtenberg-worked-example {
    margin-top: 15px;
}

#trachtenberg-worked-example .worked-example {
    margin-top: 0;
}

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

.learn-mode-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.mode-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    border: 2px solid var(--border-light);
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn:hover {
    border-color: var(--color-primary);
    background: var(--bg-cream);
}

.mode-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.mode-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.mode-desc {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

#trachtenberg-practice-options {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-muted);
}

.learning-pathway {
    margin-bottom: 30px;
}

.phase-section {
    margin-bottom: 25px;
}

.phase-title {
    font-size: 16px;
    color: var(--color-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

.phase-rules {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.rule-card {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.rule-card.mastered {
    background: linear-gradient(135deg, var(--color-success), #2ecc71);
    color: white;
}

.rule-card.current {
    background: var(--color-primary-gradient);
    color: white;
    box-shadow: 0 0 15px rgba(93, 64, 55, 0.4);
}

.rule-card.unlocked {
    background: var(--bg-warm-white);
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.rule-card.unlocked:hover {
    background: #FFF5EB;
}

.rule-card.locked {
    background: #f5f5f5;
    border: 2px solid var(--border-light);
    color: var(--text-light);
    cursor: not-allowed;
}

.rule-card-icon {
    font-size: 14px;
}

.rule-card-label {
    font-size: 14px;
}

.rule-arrow {
    color: #ccc;
    font-size: 18px;
}

.current-rule-section, .locked-rule-section {
    background: var(--bg-cream);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.current-rule-section h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.level-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.level-dots {
    display: flex;
    gap: 6px;
}

.level-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e0e0e0;
    transition: all 0.2s;
}

.level-dot.filled {
    background: var(--color-primary-gradient);
}

.level-dot.current {
    background: var(--color-primary-gradient);
    box-shadow: 0 0 10px rgba(93, 64, 55, 0.5);
}

.rule-action-buttons {
    display: flex;
    gap: 12px;
}

.rule-action-buttons .secondary-btn,
.rule-action-buttons .primary-btn {
    flex: 1;
    margin-top: 0;
}

.locked-message {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: overlayFadeIn 0.3s ease-out;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: celebrationPop 0.5s ease-out;
}

.rule-intro-content {
    width: 480px;
    padding: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-muted);
    background: var(--color-primary-gradient);
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    color: white;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    opacity: 1;
}

.intro-section {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
}

.intro-section:last-of-type {
    border-bottom: none;
}

.intro-section h4 {
    color: var(--color-primary);
    margin-bottom: 10px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.intro-section:last-of-type {
    border-bottom: none;
}

#previously-learned-section {
    background: var(--bg-cream);
}

#previously-learned-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#previously-learned-list li {
    padding: 6px 0;
    color: var(--text-muted);
    font-size: 14px;
}

#previously-learned-list li::before {
    content: '✓ ';
    color: var(--color-success);
}

.rule-description {
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.5;
}

.rule-steps {
    padding-left: 20px;
    margin: 0;
}

.rule-steps li {
    padding: 6px 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
}

.rule-example {
    background: var(--bg-cream);
    padding: 16px;
    border-radius: 8px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 18px;
    text-align: center;
    color: var(--color-primary);
    font-weight: 600;
}

.rule-intro-content .example-step {
    font-size: 0.85rem;
}

.modal-actions {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    background: #fafafa;
    border-radius: 0 0 16px 16px;
}

.modal-actions .secondary-btn,
.modal-actions .primary-btn {
    flex: 1;
    margin-top: 0;
}

.celebration-modal {
    width: 360px;
    padding: 40px;
    text-align: center;
}

.celebration-modal .celebration-icon {
    font-size: 64px;
    animation: celebrationBounce 0.6s ease-out infinite;
}

.celebration-modal h3 {
    color: var(--color-primary);
    margin: 16px 0;
    font-size: 24px;
}

.unlocked-rule-badge {
    display: inline-block;
    background: var(--color-primary-gradient);
    color: white;
    font-size: 32px;
    font-weight: bold;
    padding: 12px 24px;
    border-radius: 12px;
    margin: 16px 0;
}

.celebration-modal p {
    color: var(--text-muted);
    font-size: 16px;
    margin-bottom: 24px;
}

.celebration-modal .primary-btn {
    width: auto;
    padding: 12px 40px;
}

.notes-section {
    margin-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
    padding-top: 1rem;
}

.notes-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.practice-template {
    background: var(--bg-light-gray);
    border-radius: 8px;
    padding: 1rem;
    border: 1px dashed #ccc;
}

.template-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.template-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.template-label {
    font-weight: 500;
    min-width: 70px;
    color: var(--text-secondary);
}

.template-input {
    width: 2.5rem;
    height: 2rem;
    text-align: center;
    border: 1px dashed #bbb;
    border-radius: 4px;
    background: white;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.template-input:focus {
    outline: none;
    border-color: var(--color-success-accent);
    border-style: solid;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.template-input::placeholder {
    color: #ccc;
}

.template-write {
    border-color: var(--color-success-accent);
    background: #f0fff0;
}

.template-answer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: bold;
}

.template-final {
    width: 5rem;
    border-color: var(--color-primary-light);
    background: var(--bg-cream);
}

.template-no-steps {
    font-style: italic;
    color: var(--text-light);
    margin: 0.5rem 0;
}

.rule-intro-content .practice-template {
    max-height: 250px;
    overflow-y: auto;
}

.text-muted {
    color: var(--text-muted);
}

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

.bg-cream {
    background: var(--bg-cream);
}

.notes-section-custom {
    margin-top: 1rem;
    padding: 1rem;
    border-top: 2px solid var(--color-primary);
    background: var(--bg-cream);
}

.notes-section-custom h4 {
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.practice-template-inner {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px dashed #ccc;
}

.no-sessions-msg {
    text-align: center;
    color: var(--text-muted);
}

@media (prefers-color-scheme: dark) {
    .practice-template {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .template-input {
        background: #1a1a1a;
        border-color: #555;
        color: #e0e0e0;
    }
    
    .template-write {
        background: #1a2e1a;
    }
    
    .template-final {
        background: #1a2a3a;
    }
}

.landing-body {
    display: block;
    padding: 0;
    min-height: 100vh;
    background: var(--bg-cream);
}

.landing-body .container {
    display: none;
}

.landing-body .container.visible {
    display: block;
}

.landing-page {
    min-height: 100vh;
}

.landing-page.hidden {
    display: none;
}

.landing-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: white;
    box-shadow: var(--shadow-sm);
    z-index: 1000;
}

.landing-logo {
    font-size: 20px;
    font-weight: bold;
    color: var(--color-primary);
}

.landing-auth-buttons {
    display: flex;
    gap: 12px;
}

.landing-btn-secondary {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    font-size: 14px;
    transition: all 0.2s;
}

.landing-btn-secondary:hover {
    background: var(--bg-cream);
}

.landing-btn-primary {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    background: var(--color-primary-gradient);
    color: white;
    border: none;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.landing-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.landing-hero {
    padding: 140px 40px 80px;
    text-align: center;
    background: var(--color-primary-gradient);
    color: white;
}

.landing-hero h1 {
    font-size: 48px;
    margin-bottom: 16px;
    color: white;
}

.landing-hero p {
    font-size: 20px;
    opacity: 0.9;
    margin-bottom: 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.landing-cta-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.landing-btn-hero-primary {
    padding: 16px 32px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    background: white;
    color: var(--color-primary);
    border: none;
    font-size: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.landing-btn-hero-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.landing-btn-hero-secondary {
    padding: 16px 32px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: white;
    border: 2px solid white;
    font-size: 16px;
    transition: all 0.2s;
}

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

.landing-section {
    padding: 80px 40px;
    text-align: center;
}

.landing-section h2 {
    font-size: 36px;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.landing-description {
    max-width: 700px;
    margin: 0 auto 40px;
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.landing-description a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-color: var(--color-primary-light);
    transition: color 0.2s, text-decoration-color 0.2s;
}

.landing-description a:hover {
    color: var(--color-accent);
    text-decoration-color: var(--color-accent);
}

.landing-features {
    background: white;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    max-width: 900px;
    margin: 0 auto;
}

.feature-card {
    background: var(--bg-cream);
    padding: 32px 24px;
    border-radius: 16px;
    border: 2px solid var(--border-accent);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--color-primary);
}

.feature-card p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

.trachtenberg-example {
    max-width: 400px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow-md);
}

.example-problem {
    font-size: 32px;
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 24px;
}

.example-steps-landing {
    text-align: left;
}

.example-step-landing {
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 15px;
}

.example-step-landing .step-label {
    color: var(--color-primary);
    font-weight: 600;
}

.example-result-landing {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px dashed var(--border-accent);
    font-size: 20px;
    color: var(--color-primary);
    font-weight: bold;
}

.landing-demo {
    background: var(--bg-light-gray);
}

.landing-subtitle {
    color: var(--text-muted);
    margin-bottom: 40px;
    font-size: 16px;
}

#demo-container {
    max-width: 400px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

#demo-start p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.demo-progress {
    margin-bottom: 24px;
}

#demo-progress-text {
    font-size: 14px;
    color: var(--text-muted);
}

.demo-progress-bar {
    height: 6px;
    background: var(--border-muted);
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

#demo-progress-fill {
    height: 100%;
    background: var(--color-primary-gradient);
    width: 0%;
    transition: width 0.3s;
}

.demo-question {
    font-size: 48px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 24px;
}

#demo-answer-input {
    width: 100%;
    padding: 16px;
    font-size: 24px;
    text-align: center;
    border: 2px solid var(--border-light);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 16px;
}

#demo-answer-input:focus {
    border-color: var(--color-primary);
}

.demo-feedback {
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-weight: 600;
    text-align: center;
}

.demo-feedback.correct {
    background: var(--color-success-light);
    color: var(--color-success);
}

.demo-feedback.incorrect {
    background: var(--color-error-light);
    color: var(--color-error);
}

.demo-example {
    background: var(--bg-cream);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    text-align: left;
    font-size: 14px;
}

.demo-example .example-step-landing {
    padding: 4px 0;
    font-size: 13px;
}

.demo-score {
    font-size: 64px;
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 16px;
}

#demo-score-message {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.landing-final-cta {
    background: var(--color-primary-gradient);
    color: white;
}

.landing-final-cta h2 {
    color: white;
}

.landing-final-cta p {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 32px;
}

.landing-footer {
    padding: 40px;
    text-align: center;
    background: var(--color-primary-dark);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

@media (max-width: 600px) {
    .landing-hero {
        padding: 120px 20px 60px;
    }
    
    .landing-hero h1 {
        font-size: 32px;
    }
    
    .landing-hero p {
        font-size: 16px;
    }
    
    .landing-cta-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .landing-btn-hero-primary,
    .landing-btn-hero-secondary {
        width: 100%;
        max-width: 250px;
    }
    
    .landing-section {
        padding: 60px 20px;
    }
    
    .landing-section h2 {
        font-size: 28px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .demo-question {
        font-size: 36px;
    }
    
    #demo-container {
        padding: 24px;
    }
    
    .trachtenberg-example {
        padding: 24px;
    }
    
    .example-problem {
        font-size: 24px;
    }
}
