* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Segoe UI', 'Comic Sans MS', sans-serif;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fdfcfb 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}
.container {
    background: #fffbe6;
    border-radius: 32px;
    padding: 48px 40px 40px;
    max-width: 680px;
    width: 92%;
    box-shadow: 0 12px 40px rgba(255, 154, 158, 0.3);
    text-align: center;
    border: 3px solid #ffd1d1;
    position: relative;
}
h1 {
    font-size: 52px;
    color: #ff6b6b;
    margin-bottom: 24px;
    letter-spacing: 2px;
}
.word-display {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 32px 0;
    min-height: 80px;
    align-items: center;
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
}
.letter-box {
    width: 52px;
    height: 60px;
    border-bottom: 4px solid #ff9f43;
    background: #ffebd6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: bold;
    color: #ff6b6b;
    text-transform: lowercase;
    transition: all 0.2s;
}
.letter-box.small {
    width: 38px;
    height: 48px;
    font-size: 24px;
    border-bottom-width: 3px;
}
.letter-box.revealed {
    animation: pop 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
.letter-box.space {
    border-bottom: none;
    background: transparent;
    border-radius: 0;
}
@keyframes pop {
    0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
    60% { transform: scale(1.2) rotate(3deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.message {
    font-size: 22px;
    font-weight: bold;
    min-height: 40px;
    color: #ff6b6b;
}
.message.win {
    color: #5dd39e;
}
.message.fail {
    color: #ff6b6b;
    animation: shake 0.4s ease;
}
.buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 24px 0;
    flex-wrap: wrap;
}
.buttons button {
    padding: 14px 32px;
    font-size: 28px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.buttons button:active {
    transform: scale(0.9);
}
#pronounce-btn {
    background: #ff9f43;
    color: white;
    box-shadow: 0 4px 0 #e8831a;
}
#pronounce-btn:hover { background: #ffb566; }
#new-word-btn {
    background: #48dbfb;
    color: white;
    box-shadow: 0 4px 0 #2cb3d9;
}
#new-word-btn:hover { background: #6ee3fc; }
.bottom-group { margin-top: auto; }
.keyboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 16px;
}
.keyboard button {
    width: 38px;
    height: 48px;
    font-size: 24px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: #ffdde1;
    color: #666;
    cursor: pointer;
    text-transform: uppercase;
    transition: transform 0.1s, background 0.1s;
}
.keyboard button:active { transform: scale(0.9); }
.keyboard button.used { background: #ff6b6b; color: #fff; }
.keyboard button.correct { background: #5dd39e; color: #fff; }
.loading {
    color: #999;
    font-size: 18px;
    padding: 20px;
}

@media (max-width: 480px) {
    body { overflow: auto; height: auto; min-height: 100dvh; display: block; }
    .container { display:flex; flex-direction:column; padding: 24px 12px 12px; width: 98%; max-width: none; min-height: calc(100dvh - 20px); margin: 0 auto; }
    h1 { font-size: 36px; margin-bottom: 12px; }
    .word-display { gap: 6px; margin: 16px 0; min-height: 50px; }
    .letter-box { width: 36px; height: 42px; font-size: 22px; border-bottom-width: 3px; }
    .letter-box.small { width: 30px; height: 36px; font-size: 18px; border-bottom-width: 2px; }
    .message { font-size: 16px; min-height: 28px; }
    .buttons { margin: 12px 0; }
    .buttons button { padding: 10px 20px; font-size: 22px; border-radius: 12px; }
    .status-bar { gap: 6px; padding: 4px 8px; }
    .score { font-size: 6px; white-space: nowrap; }
    #hearts { font-size: 6px; letter-spacing: 0; white-space: nowrap; }
    .keyboard { margin-bottom: 4px; }
    .keyboard button { width: 30px; height: 36px; font-size: 12px; border-radius: 6px; }
    .progress-bar-wrap { height: 24px; }
    .progress-track { height: 10px; }
    .runner { font-size: 24px; top: -5px; }
    .animal-picker-grid button { font-size: 22px; width: 36px; height: 36px; }
}
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0;
    padding: 8px 16px;
    margin-bottom: 8px;
}
.score {
    font-size: 20px;
    font-weight: 600;
    white-space: nowrap;
}
.score.win-label { color: #5dd39e; }
.score.lose-label { color: #ff6b6b; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
#hearts { font-size: 32px; letter-spacing: 6px; white-space: nowrap; }
#hearts.shake { animation: shake 0.3s ease; }
.progress-area {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.progress-bar-wrap {
    flex: 1;
    position: relative;
    height: 30px;
}
.progress-track {
    width: 100%;
    height: 14px;
    background: #ddd;
    border-radius: 10px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: #5dd39e;
    border-radius: 10px;
    transition: width 0.3s ease;
}
.runner {
    position: absolute;
    left: 0%;
    top: -6px;
    font-size: 26px;
    transition: left 0.3s ease;
    transform: translateX(-50%);
    cursor: pointer;
    user-select: none;
}
.animal-picker {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border-radius: 16px;
    padding: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
    z-index: 20;
    border: 2px solid #ffe0e0;
}
.animal-picker.open {
    display: block;
}
.animal-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}
.animal-picker-grid button {
    font-size: 28px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s;
    padding: 0;
}
.animal-picker-grid button:hover { background: #fce4ec; }
