/* Spell Scribe Academy - Styles */

:root {
    /* Academy colors - deep scholarly blues and golds */
    --academy-navy: #1e3a5f;
    --academy-blue: #2d5a87;
    --academy-gold: #d4a84b;
    --academy-parchment: #f5e6c8;
    --academy-ink: #1a1a2e;
    --academy-quill: #8b4513;

    --text-light: #f8f4e8;
    --text-dark: #2c2c2c;
    --text-muted: #6b7280;

    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;

    --input-bg: rgba(255, 255, 255, 0.95);
    --input-border: #d4a84b;

    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
}

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

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: linear-gradient(135deg, var(--academy-navy) 0%, var(--academy-blue) 50%, var(--academy-navy) 100%);
    color: var(--text-light);
    min-height: 100vh;
    line-height: 1.6;
}

.game-container {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.game-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    gap: 1rem;
}

.back-link {
    color: var(--academy-gold);
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.back-link:hover {
    opacity: 1;
}

.game-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--academy-gold);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    flex: 1;
    text-align: center;
}

/* Screens */
.screen {
    display: none;
    flex-direction: column;
    padding: 1rem;
    flex: 1;
}

.screen.active {
    display: flex;
}

/* Owl Character */
.owl-intro, .owl-message, .owl-companion {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.owl-avatar {
    font-size: 4rem;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
    animation: owlBob 3s ease-in-out infinite;
}

.owl-avatar.small {
    font-size: 2.5rem;
}

.owl-avatar.large {
    font-size: 5rem;
}

@keyframes owlBob {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-5px) rotate(2deg); }
}

.speech-bubble {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1rem;
    flex: 1;
    position: relative;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 20px;
    border: 8px solid transparent;
    border-right-color: var(--glass-border);
}

.speech-bubble.small {
    padding: 0.75rem;
}

.owl-speech {
    font-style: italic;
    line-height: 1.5;
}

/* Welcome Content */
.welcome-content {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.welcome-content h2 {
    color: var(--academy-gold);
    margin-bottom: 0.5rem;
    text-align: center;
}

.welcome-content > p {
    text-align: center;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.challenge-list {
    list-style: none;
    margin-bottom: 1.5rem;
}

.challenge-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--glass-border);
}

.challenge-list li:last-child {
    border-bottom: none;
}

.challenge-icon {
    font-size: 1.2rem;
}

/* Settings Toggle */
.settings-toggle {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.toggle-label input {
    display: none;
}

.toggle-slider {
    width: 48px;
    height: 24px;
    background: #666;
    border-radius: 12px;
    position: relative;
    transition: background 0.3s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.toggle-label input:checked + .toggle-slider {
    background: var(--success);
}

.toggle-label input:checked + .toggle-slider::after {
    transform: translateX(24px);
}

.toggle-text {
    flex: 1;
}

/* Stage Preview */
.stage-preview {
    margin-top: 1rem;
}

.stage-preview h3 {
    font-size: 1rem;
    color: var(--academy-gold);
    margin-bottom: 0.75rem;
    text-align: center;
}

.stage-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stage-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
}

.stage-item.unlocked {
    background: rgba(212, 168, 75, 0.2);
    border: 1px solid var(--academy-gold);
}

.stage-item.locked {
    opacity: 0.6;
}

.stage-icon {
    font-size: 1.2rem;
}

.stage-name {
    flex: 1;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    min-height: 44px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--academy-gold), #c49a3e);
    color: var(--text-dark);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-light);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-outline {
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--glass-border);
}

.btn-outline:hover {
    background: var(--glass-bg);
}

.btn-hint {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.btn-hint:hover {
    background: rgba(245, 158, 11, 0.3);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.welcome-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Stage Select */
.stage-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stage-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.stage-btn:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
}

.stage-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.stage-btn .stage-icon {
    font-size: 1.5rem;
}

.stage-btn .stage-info {
    flex: 1;
}

.stage-btn .stage-name {
    font-weight: bold;
    color: var(--academy-gold);
    display: block;
}

.stage-btn .stage-desc {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--glass-bg);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.stat {
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    opacity: 0.7;
    display: block;
}

.stat-value {
    font-size: 1rem;
    font-weight: bold;
    color: var(--academy-gold);
}

/* Challenge Container */
.challenge-container {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.challenge-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(212, 168, 75, 0.2);
    border: 1px solid var(--academy-gold);
    border-radius: 2rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.type-icon {
    font-size: 1rem;
}

.type-name {
    color: var(--academy-gold);
    font-weight: 600;
}

/* Challenge Display */
.challenge-display {
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

/* Flash word display */
.flash-word {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--academy-gold);
    letter-spacing: 0.1em;
    animation: flashIn 0.3s ease-out;
}

@keyframes flashIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.flash-countdown {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.flash-hidden {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.reflash-btn {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* Missing letters display */
.missing-word {
    font-size: 2rem;
    font-weight: bold;
    letter-spacing: 0.15em;
    color: var(--text-light);
}

.missing-word .blank {
    display: inline-block;
    width: 1.5rem;
    border-bottom: 3px solid var(--academy-gold);
    margin: 0 0.1rem;
}

/* Error spotting options */
.spelling-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.spelling-option {
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 0.5rem;
    font-size: 1.2rem;
    font-family: inherit;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.05em;
}

.spelling-option:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--academy-gold);
}

.spelling-option.selected {
    background: rgba(212, 168, 75, 0.3);
    border-color: var(--academy-gold);
}

.spelling-option.correct {
    background: rgba(34, 197, 94, 0.3);
    border-color: var(--success);
}

.spelling-option.incorrect {
    background: rgba(239, 68, 68, 0.3);
    border-color: var(--error);
}

/* Audio play button */
.audio-play-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--academy-gold), #c49a3e);
    border: none;
    cursor: pointer;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s;
}

.audio-play-btn:hover {
    transform: scale(1.05);
}

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

.audio-instruction {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.cant-listen-btn {
    margin-top: 1rem;
    padding: 0.4rem 0.8rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    font-family: inherit;
    text-decoration: underline;
}

.cant-listen-btn:hover {
    opacity: 1;
}

/* Input Area */
.input-area {
    margin-top: 1rem;
}

.spell-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.5rem;
    font-family: inherit;
    text-align: center;
    letter-spacing: 0.1em;
    border: 2px solid var(--input-border);
    border-radius: 0.5rem;
    background: var(--input-bg);
    color: var(--text-dark);
}

.spell-input:focus {
    outline: none;
    border-color: var(--academy-gold);
    box-shadow: 0 0 0 3px rgba(212, 168, 75, 0.3);
}

.spell-input.correct {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.spell-input.incorrect {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.input-area.hidden {
    display: none;
}

/* Game Actions */
.game-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.game-actions .btn {
    flex: 1;
}

/* Hint & Feedback Areas */
.hint-area, .feedback-area {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.hint-area {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid var(--warning);
    color: var(--warning);
}

.feedback-area {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid var(--success);
}

.feedback-area.error {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
}

/* Game Controls */
.game-controls {
    margin-top: auto;
    padding-top: 1rem;
    text-align: center;
}

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

.overlay-content {
    background: linear-gradient(135deg, var(--academy-navy), var(--academy-blue));
    border: 2px solid var(--academy-gold);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.word-summary {
    font-size: 1.5rem;
    color: var(--academy-gold);
    margin: 1rem 0;
    letter-spacing: 0.1em;
}

/* Stage Complete */
.celebration {
    text-align: center;
    margin-bottom: 2rem;
}

.celebration h2 {
    color: var(--academy-gold);
    margin: 1rem 0 0.5rem 0;
}

.stage-stats, .session-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 1rem;
    text-align: center;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--academy-gold);
    display: block;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    opacity: 0.8;
}

.unlock-message {
    background: rgba(212, 168, 75, 0.2);
    border: 1px solid var(--academy-gold);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.stage-complete-buttons, .session-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Responsive */
@media (max-width: 480px) {
    .game-title {
        font-size: 1.1rem;
    }

    .owl-avatar {
        font-size: 3rem;
    }

    .owl-avatar.small {
        font-size: 2rem;
    }

    .flash-word {
        font-size: 2rem;
    }

    .missing-word {
        font-size: 1.5rem;
    }

    .spell-input {
        font-size: 1.2rem;
    }

    .stage-stats, .session-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .stat-card .stat-number {
        font-size: 1.5rem;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
