/* MathBored Demo - World-class minimal design with progressive disclosure */

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

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --error: #ef4444;
    --border: #334155;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.5;
}

/* Navigation - subtle, top-left */
.demo-nav {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.demo-nav:hover {
    opacity: 1;
}

.nav-back {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-back:hover {
    color: var(--accent);
}

/* Progress indicator - subtle, top-right */
.progress-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.difficulty-badge {
    font-size: 0.85rem;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
    opacity: 0.8;
    animation: fadeIn 0.4s ease;
}

.current-problem {
    color: var(--accent);
    font-size: 1.3rem;
}

.separator {
    margin: 0 4px;
    opacity: 0.5;
}

/* Main container - full viewport height */
.demo-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px 100px;
    position: relative;
}

/* Problem area - hero section */
.problem-area {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

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

/* Problem display - the star of the show */
.problem-display {
    font-size: clamp(3rem, 12vw, 8rem);
    font-weight: 300;
    letter-spacing: 0.1em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: clamp(1rem, 3vw, 2.5rem);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    flex-wrap: wrap;
    justify-content: center;
}

.problem-display .operator {
    color: var(--accent);
    font-weight: 400;
}

.problem-display .operand {
    font-variant-numeric: tabular-nums;
}

/* Answer container */
.answer-container {
    width: 100%;
    max-width: 300px;
    position: relative;
}

.answer-field {
    width: 100%;
    padding: 24px;
    font-size: clamp(2rem, 5vw, 3rem);
    text-align: center;
    background: transparent;
    border: none;
    border-bottom: 3px solid var(--border);
    color: var(--text-primary);
    font-weight: 300;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
    font-variant-numeric: tabular-nums;
    caret-color: var(--accent);
}

.answer-field:focus {
    outline: none;
    border-bottom-color: var(--accent);
    box-shadow: 0 4px 0 var(--accent);
}

.answer-field::placeholder {
    color: var(--text-muted);
    opacity: 0.4;
}

/* Remove spinner for number input */
.answer-field::-webkit-outer-spin-button,
.answer-field::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.answer-field[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Feedback area - progressive disclosure */
.feedback-area {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.feedback-area.show {
    opacity: 1;
    transform: scale(1);
}

.feedback-area.correct {
    color: var(--success);
}

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

/* Action hint - subtle guidance */
.action-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.3s ease 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-hint.show {
    opacity: 1;
}

.action-hint kbd {
    background: var(--bg-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 2px 0 var(--border);
}

.hint-button {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hint-button:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-1px);
}

.hint-button:active {
    transform: translateY(0);
}

/* Completion screen - hidden initially */
.completion-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 200;
}

.completion-screen.show {
    opacity: 1;
    pointer-events: all;
}

.completion-content {
    text-align: center;
    max-width: 500px;
    padding: 40px;
    animation: celebrationPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

.completion-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

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

.completion-title {
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 700;
    margin-bottom: 40px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.completion-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.stat {
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Difficulty selection */
.difficulty-selection {
    margin: 30px 0;
    padding: 30px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease;
}

.difficulty-selection.show {
    opacity: 1;
    max-height: 500px;
}

.difficulty-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.difficulty-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

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

.difficulty-option {
    padding: 24px 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.difficulty-option:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
    background: var(--bg-tertiary);
}

.difficulty-option:active {
    transform: translateY(-2px);
}

.difficulty-emoji {
    font-size: 2.5rem;
    margin-bottom: 4px;
}

.difficulty-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.difficulty-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.completion-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-btn {
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.action-btn.primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.action-btn.primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.action-btn.secondary {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.action-btn.secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.action-btn:active {
    transform: translateY(0);
}

/* Footer - subtle, progressive disclosure */
.demo-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 20px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
    background: linear-gradient(to top, var(--bg-primary) 70%, transparent);
}

.demo-footer.show {
    opacity: 1;
    transform: translateY(0);
}

.footer-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.footer-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Animations for transitions */
.problem-area.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.problem-area.fade-in {
    animation: fadeInUp 0.4s ease forwards;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .demo-nav,
    .progress-indicator {
        top: 15px;
    }

    .demo-nav {
        left: 15px;
    }

    .progress-indicator {
        right: 15px;
    }

    .demo-container {
        padding: 60px 15px 80px;
    }

    .problem-area {
        gap: 30px;
    }

    .answer-field {
        padding: 20px;
    }

    .completion-stats {
        gap: 20px;
    }

    .stat-value {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .problem-display {
        gap: clamp(0.8rem, 3vw, 1.5rem);
    }

    .completion-content {
        padding: 30px 20px;
    }

    .completion-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .action-hint {
        flex-direction: column;
        gap: 12px;
    }
    
    .difficulty-options {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .difficulty-option {
        padding: 20px 16px;
    }
    
    .difficulty-emoji {
        font-size: 2rem;
    }
    
    .difficulty-name {
        font-size: 1.1rem;
    }
}

/* Print styles */
@media print {
    .demo-nav,
    .progress-indicator,
    .action-hint,
    .demo-footer {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }
}

