/* Fraction Pizza - Mobile-first styles */

:root {
    --pizza-crust: #D4A574;
    --pizza-cheese: #FFE4B5;
    --pizza-painted: #FF6B6B;
    --pizza-painted-hover: #FF8585;
    --correct: #4CAF50;
    --incorrect: #F44336;
    --bg-primary: #FFF8E7;
    --bg-secondary: #FFF3D6;
    --text-primary: #5D4037;
    --text-secondary: #8D6E63;
    --accent: #FF9800;
    --accent-dark: #F57C00;
    --white: #FFFFFF;
    --shadow: rgba(93, 64, 55, 0.15);
    --transition-speed: 0.2s;
}

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

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stats {
    display: flex;
    gap: 1rem;
}

.stat {
    font-size: 1rem;
    font-weight: 600;
    background: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    box-shadow: 0 2px 4px var(--shadow);
}

/* Game Area */
.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Pizza Canvas */
.pizza-container {
    background: var(--white);
    border-radius: 1rem;
    padding: 0.5rem;
    box-shadow: 0 4px 12px var(--shadow);
    touch-action: manipulation;
}

#pizza-canvas {
    display: block;
    cursor: pointer;
}

/* Question Box */
.question-box {
    background: var(--white);
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    text-align: center;
    box-shadow: 0 2px 8px var(--shadow);
    width: 100%;
    max-width: 300px;
}

#question-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Options Grid (Identify Mode) */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    width: 100%;
    max-width: 300px;
}

.option-btn {
    padding: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    border: 3px solid var(--accent);
    border-radius: 1rem;
    background: var(--white);
    color: var(--accent-dark);
    cursor: pointer;
    transition: all var(--transition-speed);
    min-height: 60px;
    touch-action: manipulation;
}

.option-btn:active {
    transform: scale(0.95);
    background: var(--accent);
    color: var(--white);
}

.option-btn.selected {
    background: var(--accent);
    color: var(--white);
}

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

.option-btn.incorrect {
    background: var(--incorrect);
    border-color: var(--incorrect);
    color: var(--white);
}

/* Primary Button */
.btn-primary {
    width: 100%;
    max-width: 300px;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 700;
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: 1rem;
    cursor: pointer;
    transition: all var(--transition-speed);
    touch-action: manipulation;
    min-height: 56px;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
    background: var(--accent-dark);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* Feedback */
.feedback {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
    animation: fadeIn 0.3s ease;
}

.feedback.correct {
    background: var(--correct);
    color: var(--white);
}

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

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

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

.feedback-icon {
    font-size: 1.5rem;
}

/* Controls Footer */
.controls {
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mode-toggle {
    display: flex;
    background: var(--white);
    border-radius: 1rem;
    padding: 0.25rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.mode-btn {
    flex: 1;
    padding: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 0.75rem;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-speed);
    touch-action: manipulation;
}

.mode-btn.active {
    background: var(--accent);
    color: var(--white);
}

.denominator-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.denominator-selector .label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.denominator-buttons {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
}

.denom-btn {
    width: 44px;
    height: 44px;
    font-size: 1rem;
    font-weight: 700;
    border: 2px solid var(--pizza-crust);
    border-radius: 0.75rem;
    background: var(--white);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-speed);
    touch-action: manipulation;
}

.denom-btn.active {
    background: var(--pizza-crust);
    color: var(--white);
}

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

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 100;
}

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

.modal {
    background: var(--white);
    border-radius: 1.5rem;
    padding: 1.5rem;
    max-width: 340px;
    width: 100%;
    text-align: center;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.help-content {
    text-align: left;
    margin-bottom: 1.5rem;
}

.help-section {
    margin-bottom: 1rem;
}

.help-section h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--accent-dark);
}

.help-section p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Responsive adjustments */
@media (min-width: 375px) {
    .header h1 {
        font-size: 1.5rem;
    }

    #question-text {
        font-size: 1.375rem;
    }
}

@media (min-width: 480px) {
    .container {
        padding: 1.5rem;
    }

    .pizza-container {
        padding: 1rem;
    }
}

/* Landscape mode adjustments */
@media (max-height: 600px) and (orientation: landscape) {
    .container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: flex-start;
        gap: 1rem;
    }

    .header {
        width: 100%;
    }

    .game-area {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .controls {
        flex-direction: row;
        justify-content: center;
    }
}

/* Animation for score update */
.stat span.updated {
    animation: pulse 0.3s ease;
}
