:root {
    --primary: #dd5e36;
    --primary-dark: #ba4722;
    --primary-light: #ff7b59;
    --secondary: #61a8ff;
    --secondary-dark: #4389e3;
    --accent: #ffce56;
    --success: #4caf50;
    --topic-success: #f39c12;
    --error: #f44336;
    --soup-color: #ffca7a;
    --soup-shadow: #e6b663;
    --glow-color: rgba(221, 94, 54, 0.4);
    --topic-glow: rgba(241, 196, 15, 0.5);
    --bg: #fdf6ee;
    --surface: #ffffff;
    --text: #2c2c2c;
    --text-muted: #888;
    --radius: 16px;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.alphabet-soup-game {
    max-width: 820px;
    margin: 0 auto;
    padding: 24px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: relative;
}

/* ── HEADER ── */
.game-header { text-align: center; position: relative; }
.game-header h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.6rem;
    color: var(--primary);
    letter-spacing: 1px;
    line-height: 1.1;
}
.subtitle { font-size: 1.05rem; color: var(--text-muted); margin-top: 4px; }
.header-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
    flex-wrap: wrap;
}
.icon-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    background: var(--surface);
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}
.icon-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.icon-btn:active { transform: translateY(0); }

/* ── FULLSCREEN MODE ── */
:fullscreen .alphabet-soup-game,
:-webkit-full-screen .alphabet-soup-game,
:-moz-full-screen .alphabet-soup-game {
    max-width: 100%;
    height: 100vh;
    overflow-y: auto;
    padding: 16px 24px;
    background: var(--bg);
    scrollbar-width: thin;
}
:fullscreen .soup-bowl,
:-webkit-full-screen .soup-bowl,
:-moz-full-screen .soup-bowl {
    max-width: 520px;
}
:fullscreen .lessonvibe-banner,
:-webkit-full-screen .lessonvibe-banner,
:-moz-full-screen .lessonvibe-banner {
    display: none;
}
:fullscreen .instructions-panel,
:-webkit-full-screen .instructions-panel,
:-moz-full-screen .instructions-panel {
    display: none;
}

/* ── TOPIC SELECTOR ── */
.topic-selector { text-align: center; }
.topic-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.topic-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.topic-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    background: var(--surface);
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}
.topic-btn:hover {
    border-color: var(--topic-color, var(--primary));
    color: var(--topic-color, var(--primary));
    transform: translateY(-2px);
}
.topic-btn.active {
    background: var(--topic-color, var(--primary));
    border-color: var(--topic-color, var(--primary));
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ── GAME CONTAINER ── */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* ── SOUP BOWL ── */
.soup-bowl {
    position: relative;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 1/1;
}
.plate-shadow {
    position: absolute;
    bottom: -15px; left: 50%;
    transform: translateX(-50%);
    width: 90%; height: 20px;
    background: rgba(0,0,0,0.1);
    border-radius: 50%;
    filter: blur(10px);
    z-index: 1;
}
.plate {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 20px;
    background: linear-gradient(to bottom, #f8f8f8, #e8e8e8);
    border-radius: 50%;
    z-index: 2;
}
.bowl-container {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0,0,0,0.12), 0 5px 15px rgba(0,0,0,0.06), inset 0 -5px 15px rgba(0,0,0,0.05);
    background: white;
    z-index: 3;
}
.soup {
    position: absolute;
    top: 15px; left: 15px; right: 15px; bottom: 15px;
    border-radius: 50%;
    background-color: var(--soup-color);
    box-shadow: inset 0 -10px 20px var(--soup-shadow), inset 0 10px 20px rgba(255,255,255,0.3);
    overflow: hidden;
    cursor: pointer;
}
.bowl-highlight {
    position: absolute;
    top: 0; left: 50%;
    width: 80%; height: 40%;
    transform: translateX(-50%);
    background: linear-gradient(to bottom, rgba(255,255,255,0.3), rgba(255,255,255,0));
    border-radius: 50%;
    pointer-events: none;
    z-index: 4;
}
.steam-container {
    position: absolute;
    top: -10px; left: 0;
    width: 100%; height: 60px;
    z-index: 5;
    pointer-events: none;
}
.steam {
    position: absolute;
    width: 8px;
    background: linear-gradient(to top, transparent, rgba(255,255,255,0.7));
    border-radius: 50%;
    animation: steam 4s infinite ease-out;
    opacity: 0;
}
@keyframes steam {
    0%   { opacity: 0; transform: translateY(0) scale(1); filter: blur(2px); }
    30%  { opacity: 0.5; }
    70%  { opacity: 0.3; }
    100% { opacity: 0; transform: translateY(-80px) scale(3); filter: blur(6px); }
}
.spoon-container {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none; z-index: 10; display: none;
}
.spoon { position: absolute; transform-origin: center; }
.spoon-handle {
    position: absolute;
    width: 12px; height: 150px;
    background: linear-gradient(to right, #d2c0a5, #eadbc8, #d2c0a5);
    border-radius: 5px;
    transform-origin: top center;
    bottom: -150px; left: -6px;
}
.spoon-head {
    position: absolute;
    width: 40px; height: 60px;
    background: linear-gradient(to right, #e0d1bc, #f5eee4, #e0d1bc);
    border-radius: 50%;
    top: -30px; left: -20px;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.1);
}

/* ── LETTERS ── */
.letter {
    position: absolute;
    width: 40px; height: 40px;
    background: white;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Fredoka One', cursive;
    font-size: 20px;
    color: var(--primary);
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    z-index: 5;
    overflow: hidden;
}
.letter:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.18), 0 0 12px var(--glow-color);
    transform: translateY(-3px) scale(1.05);
}
.letter-points {
    position: absolute;
    bottom: 2px; right: 3px;
    font-family: 'Nunito', sans-serif;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
}
.letter.selected {
    background: var(--primary);
    color: white;
    transform: scale(1.12);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2), 0 0 18px var(--glow-color);
}
.letter.selected .letter-points { color: rgba(255,255,255,0.75); }
.letter .ripple {
    position: absolute;
    width: 100%; height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 70%);
    transform: scale(0);
    animation: ripple 0.6s ease-out;
    border-radius: 50%;
    z-index: -1;
}
@keyframes ripple { to { transform: scale(2.5); opacity: 0; } }

/* ── PARTICLES ── */
.particles-container {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none; z-index: 1000;
}
:fullscreen .particles-container,
:-webkit-full-screen .particles-container,
:-moz-full-screen .particles-container {
    position: absolute;
}
:fullscreen .message-container,
:-webkit-full-screen .message-container,
:-moz-full-screen .message-container {
    position: absolute;
    top: 20px;
}
.particle {
    position: absolute;
    border-radius: 50%;
    width: 8px; height: 8px;
    animation: particle-fade 1s forwards ease-out;
}
@keyframes particle-fade {
    0%   { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--tx), var(--ty)); }
}

/* ── WORD BUILDER ── */
.word-builder {
    width: 100%; max-width: 480px;
    display: flex; flex-direction: column;
    gap: 14px; align-items: center;
}
.word-display-wrap { width: 100%; }
.word-display {
    width: 100%;
    min-height: 62px;
    background: var(--surface);
    border-radius: 32px;
    padding: 14px 28px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    text-align: center;
    box-shadow: var(--shadow);
    letter-spacing: 3px;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid transparent;
}
.word-placeholder {
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #ccc;
    letter-spacing: 0;
}
.word-display.valid { border-color: var(--success); color: var(--success); }
.word-display.topic-valid { border-color: var(--topic-success); color: var(--topic-success); background: #fffbf0; }
.word-display.invalid { border-color: var(--error); color: var(--error); background: #fff5f5; }
.word-display.already-found { border-color: #ccc; color: #aaa; }

.control-buttons {
    display: flex; gap: 12px;
    flex-wrap: wrap; justify-content: center;
}
.btn {
    display: flex; align-items: center; justify-content: center;
    gap: 7px;
    padding: 11px 22px;
    border: none; border-radius: 32px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800; font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,0.15); }
.btn:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
.stir-btn   { background: var(--secondary); color: white; }
.stir-btn:hover { background: var(--secondary-dark); }
.submit-btn { background: var(--success); color: white; }
.submit-btn:hover { background: #43a047; }
.clear-btn  { background: #ecf0f1; color: #7f8c8d; }
.clear-btn:hover { background: #dfe4ea; }

/* ── TARGET WORDS ── */
.target-words-panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--topic-success);
}
.target-words-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.target-words-panel h3 {
    font-size: 1rem; font-weight: 800;
    color: var(--topic-success);
    margin: 0;
}
.words-found-count {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    background: #f5f5f5;
    padding: 3px 10px;
    border-radius: 12px;
}
.target-words-list {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.target-word {
    padding: 5px 14px;
    background: #fef9ec;
    border: 2px solid #f0d080;
    border-radius: 20px;
    font-family: 'Fredoka One', cursive;
    font-size: 1rem;
    color: #b8860b;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}
.target-word.found {
    background: var(--success);
    border-color: var(--success);
    color: white;
    text-decoration: line-through;
    opacity: 0.7;
}

/* ── SCORE BOARD ── */
.score-board {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
}
.score-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px; padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}
.score-header h3 { font-size: 1.1rem; font-weight: 800; }
.score-display {
    font-family: 'Fredoka One', cursive;
    font-size: 1.3rem; color: var(--primary);
}
.word-list {
    display: flex; flex-wrap: wrap; gap: 8px;
    max-height: 140px; overflow-y: auto; padding: 4px;
}
.word-item {
    background: #f5f5f5;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 700; font-size: 0.9rem;
    display: flex; align-items: center; gap: 7px;
}
.word-item.topic-word {
    background: #fef9ec;
    border: 1px solid #f0d080;
}
.topic-badge {
    font-size: 0.75rem; color: #b8860b; font-weight: 700;
}
.word-item-points {
    background: var(--primary); color: white;
    padding: 2px 8px; border-radius: 12px;
    font-size: 0.8rem; font-weight: 800;
}
.word-item.topic-word .word-item-points { background: var(--topic-success); }

/* ── CUSTOM WORD PANEL ── */
.custom-word-panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid #16a085;
}
.custom-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #16a085;
    margin-bottom: 10px;
}
.custom-word-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    resize: vertical;
    transition: border-color 0.2s ease;
    background: #fafafa;
    color: var(--text);
}
.custom-word-input:focus {
    outline: none;
    border-color: #16a085;
}
.custom-btns {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.custom-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── LESSONVIBE BANNER ── */
.lessonvibe-banner {
    font-family: Arial, sans-serif;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.lv-logo { height: 40px; flex-shrink: 0; }
.lv-text { flex: 1; min-width: 200px; }
.lv-headline { font-size: 17px; font-weight: bold; margin-bottom: 4px; }
.lv-sub { font-size: 13px; color: #666; }
.lv-btn {
    display: inline-block;
    background: #7c3aed; color: #fff;
    font-weight: bold;
    padding: 10px 22px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    flex-shrink: 0;
    white-space: nowrap;
}
.lv-btn:hover { background: #6d28d9; }

/* ── INSTRUCTIONS ── */
.instructions-panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
}
.instructions-panel h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 10px; }
.instructions-panel ol { padding-left: 22px; }
.instructions-panel li { margin-bottom: 6px; color: var(--text-muted); font-size: 0.95rem; }

/* ── MESSAGES ── */
.message-container {
    position: fixed; top: 20px; left: 50%;
    transform: translateX(-50%);
    display: flex; flex-direction: column; gap: 10px;
    width: 90%; max-width: 380px;
    pointer-events: none; z-index: 100;
}
.message {
    background: var(--primary); color: white;
    padding: 11px 22px;
    border-radius: 32px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    text-align: center;
    animation: message-fade 2.2s forwards;
    opacity: 0;
}
.message.success { background: var(--success); }
.message.topic   { background: var(--topic-success); }
.message.error   { background: var(--error); }
.message.checking { background: var(--secondary); }
@keyframes message-fade {
    0%   { opacity: 0; transform: translateY(-16px); }
    15%  { opacity: 1; transform: translateY(0); }
    75%  { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-16px); }
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
    .game-header h1 { font-size: 2rem; }
    .soup-bowl { max-width: 340px; }
    .letter { width: 34px; height: 34px; font-size: 17px; }
    .word-display { font-size: 1.4rem; min-height: 52px; padding: 12px 20px; }
    .btn { padding: 10px 16px; font-size: 0.88rem; }
    .lv-btn { width: 100%; text-align: center; }
}
@media (max-width: 400px) {
    .soup-bowl { max-width: 280px; }
    .letter { width: 30px; height: 30px; font-size: 15px; }
}
