/* ===== Word Scramble Styles ===== */

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

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark, #050505);
    color: var(--text-main, #ffffff);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow-x: hidden;
}

/* ===== Header ===== */
.g4f-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-card, rgba(20, 20, 25, 0.7));
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass, rgba(255, 255, 255, 0.1));
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main, #fff);
    font-size: 1.2rem;
    font-weight: 600;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-neon, #6366f1), var(--secondary-neon, #ec4899));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.highlight-4 {
    color: var(--secondary-neon, #ec4899);
    font-weight: 700;
}

.lang-switch {
    display: flex;
    gap: 6px;
}

.lang-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.1));
    border-radius: 8px;
    background: transparent;
    color: var(--text-dim, #94a3b8);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.lang-btn.active {
    background: var(--primary-neon, #6366f1);
    color: #fff;
    border-color: var(--primary-neon, #6366f1);
}

.lang-btn:hover {
    border-color: var(--primary-neon, #6366f1);
}

/* ===== Game Container ===== */
.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
}

/* ===== Screens ===== */
.screen {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.4s ease;
}

.screen.active {
    display: flex;
}

/* ===== Start Screen ===== */
#start-screen {
    justify-content: center;
    min-height: 50vh;
    gap: 16px;
    text-align: center;
}

.game-title {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-neon, #6366f1), var(--secondary-neon, #ec4899));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-subtitle {
    color: var(--text-dim, #94a3b8);
    font-size: 1rem;
    margin-bottom: 16px;
}

/* ===== Buttons ===== */
.btn-primary {
    padding: 14px 36px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-neon, #6366f1), var(--secondary-neon, #ec4899));
    color: #fff;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    padding: 10px 20px;
    border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.15));
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim, #94a3b8);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
}

.btn-secondary:hover {
    border-color: var(--primary-neon, #6366f1);
    color: var(--text-main, #fff);
    background: rgba(99, 102, 241, 0.1);
}

.btn-skip {
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.btn-skip:hover {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

/* ===== Stats Bar ===== */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 32px;
    width: 100%;
    margin-bottom: 16px;
    padding: 14px 20px;
    background: var(--bg-card, rgba(20, 20, 25, 0.7));
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.1));
    border-radius: 14px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim, #94a3b8);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main, #fff);
    font-variant-numeric: tabular-nums;
}

.stat-streak .stat-value {
    color: #fbbf24;
}

/* ===== Progress Bar ===== */
.progress-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--primary-neon, #6366f1), var(--secondary-neon, #ec4899));
    border-radius: 2px;
    transition: width 0.3s linear;
}

/* ===== Hint Area ===== */
.hint-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    margin-bottom: 20px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.3s;
}

.hint-area.visible {
    opacity: 1;
}

.hint-label {
    font-size: 0.8rem;
    color: var(--primary-neon, #6366f1);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hint-text {
    color: var(--text-main, #fff);
    font-size: 0.95rem;
}

/* ===== Letter Tiles ===== */
.tiles-area {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
    min-height: 72px;
    padding: 8px;
}

.letter-tile {
    width: 56px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-main, #fff);
    background: var(--bg-card, rgba(20, 20, 25, 0.7));
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.15));
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.letter-tile:hover {
    border-color: var(--primary-neon, #6366f1);
    background: rgba(99, 102, 241, 0.12);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.2);
}

.letter-tile:active {
    transform: translateY(0);
}

.letter-tile.used {
    opacity: 0.25;
    pointer-events: none;
    transform: scale(0.9);
}

.letter-tile.correct-anim {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.15);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.3);
    animation: correctPop 0.4s ease;
}

@keyframes correctPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ===== Answer Area ===== */
.answer-area {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    min-height: 64px;
    padding: 8px;
}

.answer-slot {
    width: 52px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-main, #fff);
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    transition: all 0.2s;
    cursor: pointer;
}

.answer-slot.filled {
    border-style: solid;
    border-color: var(--primary-neon, #6366f1);
    background: rgba(99, 102, 241, 0.1);
}

.answer-slot.correct {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
    color: #4ade80;
    animation: slotCorrect 0.5s ease;
}

.answer-slot.wrong {
    border-color: #f87171;
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
    animation: shake 0.4s ease;
}

@keyframes slotCorrect {
    0% { transform: scale(1); }
    40% { transform: scale(1.1) rotate(-3deg); }
    70% { transform: scale(1.05) rotate(2deg); }
    100% { transform: scale(1) rotate(0deg); }
}

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

/* ===== Feedback ===== */
.feedback {
    font-size: 1.1rem;
    font-weight: 600;
    min-height: 32px;
    margin-bottom: 12px;
    opacity: 0;
    transition: opacity 0.3s;
    text-align: center;
}

.feedback.visible {
    opacity: 1;
}

.feedback.correct {
    color: #4ade80;
}

.feedback.wrong {
    color: #f87171;
}

.feedback.streak {
    color: #fbbf24;
}

/* ===== Text Input ===== */
.text-input {
    width: 100%;
    max-width: 320px;
    padding: 12px 18px;
    margin-bottom: 16px;
    border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.15));
    border-radius: 12px;
    background: var(--bg-card, rgba(20, 20, 25, 0.7));
    backdrop-filter: blur(12px);
    color: var(--text-main, #fff);
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 4px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.text-input::placeholder {
    color: var(--text-dim, #94a3b8);
    opacity: 0.4;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
    font-size: 0.9rem;
}

.text-input:focus {
    border-color: var(--primary-neon, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ===== Action Buttons ===== */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

/* ===== Results Panel ===== */
.results-panel {
    width: 100%;
    padding: 32px;
    background: var(--bg-card, rgba(20, 20, 25, 0.7));
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.1));
    border-radius: 14px;
    text-align: center;
}

.results-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-neon, #6366f1), var(--secondary-neon, #ec4899));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.new-record {
    display: inline-block;
    padding: 4px 16px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    animation: pulse 1.5s ease-in-out infinite;
}

.new-record.hidden {
    display: none;
}

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

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 14px;
    margin: 24px 0;
}

.result-item {
    padding: 16px 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.result-item.result-primary {
    border-color: var(--primary-neon, #6366f1);
    background: rgba(99, 102, 241, 0.08);
}

.result-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim, #94a3b8);
    margin-bottom: 6px;
}

.result-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main, #fff);
    font-variant-numeric: tabular-nums;
}

.result-primary .result-value {
    background: linear-gradient(135deg, var(--primary-neon, #6366f1), var(--secondary-neon, #ec4899));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2rem;
}

/* ===== Ad Container ===== */
.g4f-ad-container {
    width: 100%;
    margin-top: 24px;
    padding: 20px;
    border: 1px dashed var(--border-glass, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    text-align: center;
}

.ad-placeholder-content {
    color: var(--text-dim, #94a3b8);
    font-size: 0.8rem;
    opacity: 0.5;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-dim, #94a3b8);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-glass, rgba(255, 255, 255, 0.1));
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes tileAppear {
    from { opacity: 0; transform: scale(0.5) rotate(-10deg); }
    to { opacity: 1; transform: scale(1) rotate(0deg); }
}

.letter-tile {
    animation: tileAppear 0.3s ease backwards;
}

/* Stagger tile appearance */
.letter-tile:nth-child(1) { animation-delay: 0.05s; }
.letter-tile:nth-child(2) { animation-delay: 0.1s; }
.letter-tile:nth-child(3) { animation-delay: 0.15s; }
.letter-tile:nth-child(4) { animation-delay: 0.2s; }
.letter-tile:nth-child(5) { animation-delay: 0.25s; }
.letter-tile:nth-child(6) { animation-delay: 0.3s; }
.letter-tile:nth-child(7) { animation-delay: 0.35s; }
.letter-tile:nth-child(8) { animation-delay: 0.4s; }

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .game-container {
        padding: 16px 12px;
    }

    .stats-bar {
        gap: 16px;
        padding: 12px 14px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .letter-tile {
        width: 48px;
        height: 56px;
        font-size: 1.4rem;
        border-radius: 10px;
    }

    .answer-slot {
        width: 44px;
        height: 52px;
        font-size: 1.3rem;
    }

    .tiles-area, .answer-area {
        gap: 7px;
    }

    .action-buttons {
        gap: 8px;
    }

    .btn-secondary {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .btn-primary {
        padding: 12px 28px;
        font-size: 0.95rem;
    }

    .text-input {
        max-width: 280px;
        font-size: 1.05rem;
    }

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

@media (max-width: 360px) {
    .letter-tile {
        width: 42px;
        height: 50px;
        font-size: 1.2rem;
    }

    .answer-slot {
        width: 38px;
        height: 46px;
        font-size: 1.1rem;
    }
}
