/* ============================================
   Spell Quest Adventure - Main Styles
   ============================================ */

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

:root {
    --primary: #6C5CE7;
    --primary-dark: #5a4ad1;
    --secondary: #00CEC9;
    --accent: #FD79A8;
    --success: #00B894;
    --warning: #FDCB6E;
    --error: #FF7675;
    --background: #2D3436;
    --surface: #636E72;
    --text: #DFE6E9;
    --text-muted: #B2BEC3;
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #6C5CE7 100%);
    min-height: 100vh;
    color: var(--text);
    overflow-x: hidden;
}

/* ============================================
   App Container
   ============================================ */

.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* ============================================
   Screens
   ============================================ */

.screen {
    display: none;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

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

.screen-content {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   Landing Screen
   ============================================ */

.landing-content {
    text-align: center;
    padding: 60px 20px;
}

.game-title {
    font-size: 3.5rem;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #FDCB6E, #FD79A8, #6C5CE7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        filter: drop-shadow(0 0 5px rgba(253, 203, 110, 0.5));
    }
    to {
        filter: drop-shadow(0 0 20px rgba(253, 121, 168, 0.8));
    }
}

.subtitle {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 50px;
}

.landing-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 300px;
    margin: 0 auto;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, #00b5b0 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 206, 201, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--error) 0%, #d63031 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 118, 117, 0.4);
}

.btn-back {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    margin-top: 20px;
}

.btn-large {
    padding: 18px 40px;
    font-size: 1.2rem;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* ============================================
   Profile Creation
   ============================================ */

.profile-form {
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 30px;
}

.form-group label {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-family: inherit;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.3);
}

.avatar-selection,
.grade-selection {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.avatar-btn,
.grade-btn {
    width: 80px;
    height: 80px;
    font-size: 2.5rem;
    background: rgba(255, 255, 255, 0.15);
    border: 3px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.avatar-btn:hover,
.grade-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.25);
}

.avatar-btn.selected,
.grade-btn.selected {
    border-color: var(--accent);
    background: rgba(253, 121, 168, 0.3);
    transform: scale(1.1);
}

.grade-btn {
    font-size: 1rem;
    padding: 0 15px;
    width: auto;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Saved Profiles
   ============================================ */

.saved-profiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.saved-profile {
    background: rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.saved-profile:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-5px);
}

.saved-profile .avatar {
    font-size: 3rem;
    margin-bottom: 10px;
}

.saved-profile .name {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.saved-profile .grade {
    color: var(--text-muted);
}

/* ============================================
   Main Menu
   ============================================ */

.player-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.player-avatar {
    font-size: 4rem;
    background: rgba(255, 255, 255, 0.15);
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.player-info h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.player-stats {
    display: flex;
    gap: 20px;
}

.stat {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 400px;
    margin: 0 auto;
}

/* ============================================
   Mode Select
   ============================================ */

.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.mode-card {
    background: rgba(255, 255, 255, 0.15);
    padding: 30px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.mode-card:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.mode-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.mode-card h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.mode-card p {
    color: var(--text-muted);
}

/* ============================================
   Game Screen
   ============================================ */

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
}

.game-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.game-stat {
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
}

.game-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.word-display {
    text-align: center;
    margin-bottom: 30px;
}

.word-image {
    font-size: 5rem;
    margin-bottom: 15px;
}

.pronounce-btn {
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0.7;
}

.pronounce-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.word-definition {
    font-size: 1.3rem;
    color: var(--text-muted);
    margin-top: 15px;
    font-style: italic;
}

.spelling-area {
    margin-bottom: 30px;
}

.spelling-box {
    min-height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    min-height: 100px;
}

.spelling-box .letter {
    background: var(--primary);
    padding: 10px 15px;
    border-radius: 8px;
    animation: popIn 0.3s ease;
}

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

.letter-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.letter-tile {
    width: 60px;
    height: 60px;
    font-size: 1.8rem;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.letter-tile:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.letter-tile.used {
    opacity: 0.3;
    cursor: not-allowed;
}

.game-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   Feedback Message
   ============================================ */

.feedback-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 30px 50px;
    border-radius: var(--border-radius);
    font-size: 2rem;
    font-weight: bold;
    z-index: 1000;
    animation: bounceIn 0.5s ease;
    display: none;
}

.feedback-message.show {
    display: block;
}

.feedback-message.correct {
    background: linear-gradient(135deg, var(--success) 0%, #00a383 100%);
    color: white;
    box-shadow: 0 10px 40px rgba(0, 184, 148, 0.5);
}

.feedback-message.incorrect {
    background: linear-gradient(135deg, var(--error) 0%, #d63031 100%);
    color: white;
    box-shadow: 0 10px 40px rgba(255, 118, 117, 0.5);
}

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

/* ============================================
   Results Screen
   ============================================ */

.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.result-item {
    background: rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
}

.result-label {
    display: block;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.result-value {
    font-size: 2rem;
    font-weight: bold;
}

.result-value.correct {
    color: var(--success);
}

.result-value.xp {
    color: var(--warning);
}

.result-value.coins {
    color: var(--accent);
}

.results-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   Import Screen
   ============================================ */

.import-instructions {
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-muted);
}

.import-area {
    text-align: center;
    margin-bottom: 30px;
}

.import-status {
    margin-top: 20px;
    padding: 15px;
    border-radius: var(--border-radius);
    display: none;
}

.import-status.success {
    display: block;
    background: rgba(0, 184, 148, 0.3);
    color: var(--success);
}

.import-status.error {
    display: block;
    background: rgba(255, 118, 117, 0.3);
    color: var(--error);
}

.sample-format {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.sample-format h3 {
    margin-bottom: 15px;
}

.sample-format pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.9rem;
}

/* ============================================
   Stats Screen
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.15);
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============================================
   Settings Screen
   ============================================ */

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: var(--border-radius);
}

.setting-item label {
    font-size: 1.1rem;
    font-weight: bold;
}

.toggle-btn {
    padding: 10px 25px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    min-width: 70px;
}

.toggle-btn.on {
    background: var(--success);
    color: white;
}

.toggle-btn.off {
    background: var(--error);
    color: white;
}

/* ============================================
   Popups
   ============================================ */

.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    animation: popupIn 0.5s ease;
}

.popup.hidden {
    display: none;
}

@keyframes popupIn {
    from {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.popup-content {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 30px 50px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: 0 10px 40px rgba(108, 92, 231, 0.5);
}

.popup-content.coins {
    background: linear-gradient(135deg, var(--accent) 0%, #e84393 100%);
    box-shadow: 0 10px 40px rgba(253, 121, 168, 0.5);
}

.xp-amount,
.coins-amount {
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
}

.xp-bar {
    width: 200px;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    margin-top: 15px;
    overflow: hidden;
}

.xp-fill {
    height: 100%;
    background: var(--warning);
    border-radius: 5px;
    transition: width 0.5s ease;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }

    .game-title {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    .screen-content {
        padding: 20px;
    }

    .player-header {
        flex-direction: column;
        text-align: center;
    }

    .player-stats {
        justify-content: center;
    }

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

    .game-header {
        flex-direction: column;
        gap: 15px;
    }

    .game-stats {
        justify-content: center;
    }

    .letter-tile {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .spelling-box {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .results-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 2rem;
    }

    .btn {
        padding: 12px 20px;
        font-size: 1rem;
    }

    .btn-large {
        padding: 15px 30px;
        font-size: 1.1rem;
    }

    .avatar-btn,
    .grade-btn {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .letter-tile {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }

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

/* ============================================
   Animations
   ============================================ */

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

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

.shake {
    animation: shake 0.5s ease;
}

.pulse {
    animation: pulse 1s ease infinite;
}

/* ============================================
   Utility Classes
   ============================================ */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}
