/* Modern CSS Reset */
*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    line-height: 1.5;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Screen Management */
.screen {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s ease-out;
}

.screen.active {
    display: block;
}

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

/* Start Screen */
.start-content {
    background: white;
    border-radius: 16px;
    padding: 3rem 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.start-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #1f2937;
    text-shadow: none;
}

.game-description {
    font-size: 1.25rem;
    color: #6b7280;
    margin-bottom: 2rem;
}

.start-button {
    padding: 1rem 2.5rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.start-button:hover:not(:disabled) {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.start-button:active:not(:disabled) {
    transform: translateY(0);
}

.start-button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

.start-button.error {
    background: #ef4444;
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 1rem;
}

.error-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.timer-container,
.score-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.timer-label,
.score-label {
    font-weight: 600;
    color: #6b7280;
    font-size: 1rem;
}

.timer {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.score {
    font-size: 1.5rem;
    font-weight: 700;
    color: #10b981;
}

.game-content {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    min-height: 400px;
}

/* Mode Selection */
.mode-selection {
    text-align: center;
}

.mode-selection h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #1f2937;
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.mode-btn {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.mode-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mode-title {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.mode-description {
    display: block;
    font-size: 1rem;
    color: #6b7280;
}

/* Challenge Display */
.challenge {
    animation: fadeIn 0.3s ease-out;
}

.challenge.hidden {
    display: none;
}

.challenge-prompt {
    text-align: center;
    margin-bottom: 2rem;
}

.prompt-label {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
}

.iso-string {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
}

.human-readable {
    font-size: 1.75rem;
    font-weight: 600;
    color: #1f2937;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
}

/* Decoder Options */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.option-button {
    padding: 1.5rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1.125rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.option-button:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
}

.option-button.correct {
    background: #10b981;
    color: white;
    border-color: #10b981;
    animation: flashGreen 0.3s ease-out;
}

.option-button.incorrect {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    animation: flashRed 0.3s ease-out;
}

@keyframes flashGreen {
    0%, 100% {
        background: #10b981;
    }
    50% {
        background: #34d399;
    }
}

@keyframes flashRed {
    0%, 100% {
        background: #ef4444;
    }
    50% {
        background: #f87171;
    }
}

/* Frenzy Input */
.input-container {
    margin-top: 2rem;
}

.frenzy-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1.25rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: #f9fafb;
    transition: all 0.2s ease;
    text-align: center;
}

.frenzy-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.frenzy-input.correct {
    background: #10b981;
    color: white;
    border-color: #10b981;
    animation: flashGreen 0.3s ease-out;
}

.frenzy-input.incorrect {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    animation: flashRed 0.3s ease-out;
}

/* End Screen */
.end-content {
    background: white;
    border-radius: 16px;
    padding: 3rem 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.end-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: #1f2937;
}

.results {
    margin-bottom: 2.5rem;
}

.final-score,
.rank {
    margin-bottom: 1.5rem;
}

.final-score .label,
.rank .label {
    display: block;
    font-size: 1.125rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.final-score .value {
    display: block;
    font-size: 3rem;
    font-weight: 700;
    color: #667eea;
}

.rank .value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #10b981;
}

.end-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.action-button {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
}

.action-button.primary {
    background: #667eea;
    color: white;
}

.action-button.primary:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.action-button.secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.action-button.secondary:hover {
    background: #f0f4ff;
    transform: translateY(-2px);
}

.study-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    transition: color 0.2s ease;
}

.study-link:hover {
    color: #667eea;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem 0.75rem;
    }

    .start-content h1,
    .end-content h1 {
        font-size: 2rem;
    }

    .game-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .game-content {
        padding: 1.5rem;
    }

    .mode-buttons {
        grid-template-columns: 1fr;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .iso-string {
        font-size: 1.5rem;
    }

    .human-readable {
        font-size: 1.5rem;
    }

    .final-score .value {
        font-size: 2.5rem;
    }

    .rank .value {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    .start-content,
    .game-content,
    .end-content {
        padding: 1.5rem 1rem;
    }

    .start-content h1,
    .end-content h1 {
        font-size: 1.75rem;
    }

    .game-description {
        font-size: 1rem;
    }

    .timer,
    .score {
        font-size: 1.25rem;
    }
}

