@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;700;900&display=swap');

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

body {
    background: #1a1a2e;
    overflow: hidden;
    font-family: 'Nunito', sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#gameCanvas {
    display: block;
    image-rendering: pixelated;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    z-index: 10;
}

#hud {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
    gap: 10px;
    flex-wrap: wrap;
}

#hud.visible {
    display: flex;
}

#hud-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#level-display {
    font-family: 'Fredoka One', cursive;
    font-size: 1.2em;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    white-space: nowrap;
}

#word-display {
    display: flex;
    gap: 5px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.letter-box {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka One', cursive;
    font-size: 1em;
    font-weight: bold;
    color: white;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.letter-box.pending {
    background: rgba(255,255,255,0.15);
    border: 2px dashed rgba(255,255,255,0.4);
    color: rgba(255,255,255,0.3);
}

.letter-box.current {
    background: linear-gradient(135deg, #00e676, #00c853);
    border: 2px solid #fff;
    color: white;
    animation: pulse-glow 1.5s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(0,230,118,0.6);
}

.letter-box.found {
    background: linear-gradient(135deg, #ffd700, #ffab00);
    border: 2px solid #fff;
    color: #333;
    transform: scale(1.05);
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(0,230,118,0.4); }
    50% { box-shadow: 0 0 25px rgba(0,230,118,0.8); }
}

#score-display {
    font-family: 'Fredoka One', cursive;
    font-size: 1.1em;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    white-space: nowrap;
}

#lives-display {
    font-size: 1.2em;
    white-space: nowrap;
}

#wallbreak-display, #hint-display {
    font-family: 'Fredoka One', cursive;
    font-size: 0.9em;
    color: #42a5f5;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    white-space: nowrap;
    cursor: default;
}

#hint-display {
    color: #ffd700;
}

#wallbreak-display.used, #hint-display.used {
    color: #555;
    text-decoration: line-through;
}

#timer-display {
    font-family: 'Fredoka One', cursive;
    font-size: 0.9em;
    color: #4fc3f7;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    white-space: nowrap;
}

.wall-break {
    color: #42a5f5;
    font-weight: bold;
}

.hint-item {
    color: #ffd700;
    font-weight: bold;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: radial-gradient(ellipse at center, #16213e 0%, #0f0f23 70%);
}

.screen-content {
    text-align: center;
    color: white;
    max-width: 500px;
    padding: 30px;
}

.scores-content {
    max-width: 550px;
    max-height: 85vh;
    overflow-y: auto;
}

.screen h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 3em;
    background: linear-gradient(135deg, #ffd700, #ff6b6b, #00e676, #42a5f5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    line-height: 1.2;
    animation: title-shimmer 3s ease-in-out infinite;
}

@keyframes title-shimmer {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

.screen h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5em;
    color: #ffd700;
    margin-bottom: 15px;
}

.subtitle {
    font-size: 1.2em;
    color: #aab;
    margin-bottom: 20px;
}

.instructions {
    background: rgba(255,255,255,0.05);
    border-radius: 15px;
    padding: 15px 20px;
    margin-bottom: 25px;
    text-align: left;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    color: #dde;
    font-size: 0.95em;
    justify-content: center;
}

.key-hint {
    background: rgba(255,255,255,0.15);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.9em;
    color: #fff;
}

.good-letter {
    color: #00e676;
    font-weight: bold;
}

.bad-letter {
    color: #ff5252;
    font-weight: bold;
}

/* Buttons */
.btn-play {
    font-family: 'Fredoka One', cursive;
    font-size: 1.4em;
    padding: 15px 50px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #ffd700, #ffab00);
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 5px 20px rgba(255,215,0,0.3);
    pointer-events: all;
}

.btn-play:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 30px rgba(255,215,0,0.5);
}

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

.menu-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.menu-secondary {
    display: flex;
    gap: 12px;
}

.btn-secondary {
    font-family: 'Fredoka One', cursive;
    font-size: 1em;
    padding: 10px 25px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 30px;
    background: rgba(255,255,255,0.08);
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: all;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-color: rgba(255,255,255,0.5);
}

/* Level intro extras */
.theme-label {
    font-family: 'Fredoka One', cursive;
    font-size: 0.9em;
    color: #4fc3f7;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 5px;
}

.word-emoji {
    font-size: 4em;
    margin: 15px 0;
    animation: emoji-bounce 1.5s ease-in-out infinite;
}

@keyframes emoji-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.word-category {
    font-size: 0.9em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.word-announce {
    font-size: 1.2em;
    color: #aab;
    margin-bottom: 5px;
}

.word-reveal {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.word-reveal .reveal-letter {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka One', cursive;
    font-size: 1.6em;
    color: white;
    text-transform: uppercase;
    background: linear-gradient(135deg, #42a5f5, #1e88e5);
    animation: pop-in 0.3s ease backwards;
}

.word-reveal .reveal-letter:nth-child(2) { animation-delay: 0.1s; }
.word-reveal .reveal-letter:nth-child(3) { animation-delay: 0.2s; }
.word-reveal .reveal-letter:nth-child(4) { animation-delay: 0.3s; }
.word-reveal .reveal-letter:nth-child(5) { animation-delay: 0.4s; }
.word-reveal .reveal-letter:nth-child(6) { animation-delay: 0.5s; }
.word-reveal .reveal-letter:nth-child(7) { animation-delay: 0.6s; }
.word-reveal .reveal-letter:nth-child(8) { animation-delay: 0.7s; }
.word-reveal .reveal-letter:nth-child(9) { animation-delay: 0.8s; }

@keyframes pop-in {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

.stars {
    font-size: 3em;
    margin: 20px 0;
}

.win-message {
    font-size: 1.2em;
    color: #aab;
    margin-bottom: 10px;
}

/* Scores */
.total-score-label {
    font-family: 'Fredoka One', cursive;
    font-size: 1.2em;
    color: #ffd700;
    margin-bottom: 15px;
}

.scores-list {
    max-height: 50vh;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 5px;
}

.scores-list::-webkit-scrollbar {
    width: 6px;
}

.scores-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.score-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    margin-bottom: 4px;
    font-size: 0.95em;
}

.score-row.locked {
    opacity: 0.4;
}

.score-level {
    font-family: 'Fredoka One', cursive;
    color: #4fc3f7;
    min-width: 30px;
}

.score-emoji {
    font-size: 1.3em;
    min-width: 28px;
    text-align: center;
}

.score-word {
    flex: 1;
    text-align: left;
    color: #ddd;
    text-transform: capitalize;
}

.score-stars {
    font-size: 0.9em;
    min-width: 55px;
    text-align: center;
}

.score-pts {
    font-family: 'Fredoka One', cursive;
    color: #ffd700;
    min-width: 50px;
    text-align: right;
    font-size: 0.9em;
}

/* Customize / color picker */
.color-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 30px 0;
}

.color-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: all;
    box-shadow: 0 3px 12px rgba(0,0,0,0.3);
}

.color-btn:hover {
    transform: scale(1.15);
}

.color-btn.selected {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(255,255,255,0.4);
}

/* Mobile */
@media (max-width: 600px) {
    .screen h1 { font-size: 2em; }
    .screen h2 { font-size: 1.8em; }
    .btn-play { font-size: 1.1em; padding: 12px 35px; }
    .letter-box { width: 26px; height: 26px; font-size: 0.85em; }
    #hud { padding: 6px 10px; }
    #level-display, #score-display { font-size: 0.9em; }
    #hud-right { gap: 8px; }
    #wallbreak-display, #hint-display, #timer-display { font-size: 0.8em; }
    .word-emoji { font-size: 3em; }
    .word-reveal .reveal-letter { width: 40px; height: 40px; font-size: 1.3em; }
    .color-btn { width: 45px; height: 45px; }
    .score-row { font-size: 0.85em; padding: 6px 8px; }
}
