:root {
    --bg-color: #1a1a2e;
    --text-color: #fff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --text-dim: rgba(255, 255, 255, 0.6);
    --text-faded: rgba(255, 255, 255, 0.5);
    --primary-color: #FFD93D;
    --success-color: #4CAF50;
    --error-color: #e74c3c;
    --button-bg: rgba(255, 255, 255, 0.15);
    --button-bg-hover: rgba(255, 255, 255, 0.25);
    --pill-bg: rgba(255, 255, 255, 0.1);
}

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

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
}

.game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}

.content {
    text-align: center;
    padding: 20px;
    max-width: 400px;
    width: 100%;
}

.title {
    font-size: 2.5rem;
    margin: 0 0 5px;
    color: var(--primary-color);
}

.tagline {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin: 0 0 20px;
}

.controls-inline {
    margin-bottom: 20px;
}

.control-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--pill-bg);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.control-pill .touch::before {
    content: '👆';
}

/* Timer display */
.timer-display {
    margin-bottom: 25px;
}

.timer-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.timer-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-top: -5px;
}

/* Problem display */
.problem-display {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 60px;
}

.operator {
    color: var(--primary-color);
}

.equals {
    color: var(--text-faded);
}

.answer-placeholder {
    color: var(--primary-color);
    min-width: 60px;
}

/* Answer buttons */
.answers {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 280px;
    margin: 0 auto 20px;
}

.answer-btn {
    background: var(--button-bg);
    border: none;
    border-radius: 12px;
    padding: 18px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    cursor: pointer;
    transition: transform 0.1s, background 0.15s;
}

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

.answer-btn:hover {
    background: var(--button-bg-hover);
}

.answer-btn.correct {
    background: var(--success-color);
    animation: pulse-correct 0.3s ease-out;
}

.answer-btn.wrong {
    background: var(--error-color);
    animation: shake 0.3s ease-out;
}

@keyframes pulse-correct {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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

/* Feedback */
.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
    padding: 10px 25px;
    border-radius: 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.feedback.correct {
    background: rgba(76, 175, 80, 0.9);
    opacity: 1;
}

.feedback.wrong {
    background: rgba(231, 76, 60, 0.9);
    opacity: 1;
}

/* Score display */
.score-display {
    margin-top: 10px;
}

.score-label {
    color: var(--text-dim);
    font-size: 1rem;
}

.current-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-left: 8px;
}

/* Result */
.result {
    display: none;
}

.final-score {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 10px;
}

.best-score {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin: 0 0 20px;
}

.share-container {
    margin-top: 15px;
}

/* Home link */
.home-link {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-faded);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 10px 20px;
    z-index: 100;
}

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

/* State visibility */
.state-idle .timer-display,
.state-idle .problem-display,
.state-idle .answers,
.state-idle .score-display,
.state-idle .result {
    display: none;
}

.state-playing .controls-inline,
.state-playing .tagline,
.state-playing .result {
    display: none;
}

.state-result .controls-inline,
.state-result .tagline,
.state-result .timer-display,
.state-result .problem-display,
.state-result .answers,
.state-result .score-display {
    display: none;
}

.state-result .result {
    display: block;
}

/* Timer warning state - pulses red when time is running out */
.timer-warning .timer-value {
    color: var(--error-color);
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
