body {
    background: #f2f2f2;
    font-family: Arial, sans-serif;
    margin: 0;
}

h1 {
    text-align: center;
    color: #444;
    margin-top: 28px;
    margin-bottom: 0;
    font-size: 22px;
    letter-spacing: 1px;
}

#game {
    width: 600px;
    height: 600px;
    border: 2px solid #bbb;
    margin: 18px auto;
    position: relative;
    background: white;
    box-shadow: 2px 3px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: border-color 0.15s;
}

#hit-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: #e05050;
}

#aim-line {
    position: absolute;
    top: 450px;
    left: 0;
    width: 100%;
    border: none;
    border-top: 1px dashed #bbb;
    margin: 0;
}

#score {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 14px;
    color: #444;
}

#lives {
    position: absolute;
    top: 10px;
    left: 90px;
    font-size: 14px;
    color: #444;
}

#word-panel {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 10px 8px;
    min-width: 110px;
    text-align: center;
}

#word-label {
    font-size: 11px;
    color: #999;
    margin-bottom: 5px;
}

#word-display {
    display: flex;
    gap: 3px;
    justify-content: center;
    flex-wrap: wrap;
}

.word-letter {
    width: 22px;
    height: 26px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: #555;
}

.word-letter.hit {
    background: #dff0d8;
    border-color: #5cb85c;
    color: #3a7a3a;
}

.note {
    position: absolute;
    left: 260px;
    width: 28px;
    height: 28px;
    background: #ddeeff;
    border: 1px solid #99bbdd;
    border-radius: 3px;
    text-align: center;
    line-height: 28px;
    font-size: 15px;
    font-weight: bold;
    color: #334466;
}

/* --- Combo display --- */
@keyframes comboPulse {
    0%   { transform: translateX(-50%) scale(1); }
    50%  { transform: translateX(-50%) scale(1.3); }
    100% { transform: translateX(-50%) scale(1); }
}

#combo-display {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 17px;
    font-weight: bold;
    color: #f0ad4e;
    text-shadow: 0 1px 4px rgba(0,0,0,0.15);
    display: none;
    z-index: 5;
    white-space: nowrap;
    pointer-events: none;
}

#combo-display.combo-pulse {
    animation: comboPulse 0.25s ease;
}

/* --- Miss feedback --- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

.miss-flash {
    border-color: #d9534f !important;
    animation: shake 0.4s ease;
}

/* --- Particles --- */
@keyframes particleFade {
    0%   { transform: scale(1); opacity: 1; }
    100% { transform: scale(0); opacity: 0; }
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: particleFade 0.55s ease-out forwards;
    pointer-events: none;
    z-index: 10;
}

/* --- End overlay --- */
@keyframes fadeOverlay {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes popIn {
    0%   { transform: scale(0.6); opacity: 0; }
    70%  { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

#end-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.93);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    animation: fadeOverlay 0.3s ease;
}

#end-text {
    font-size: 42px;
    font-weight: bold;
    white-space: nowrap;
    animation: popIn 0.5s ease forwards;
}

#end-text.win  { color: #5cb85c; }
#end-text.lose { color: #d9534f; }

#end-score {
    font-size: 16px;
    color: #555;
    margin: 10px 0 20px;
}

#restart-btn {
    padding: 9px 32px;
    background: #334466;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    letter-spacing: 0.5px;
    font-family: Arial, sans-serif;
    transition: background 0.15s;
}

#restart-btn:hover {
    background: #4a6090;
}

/* --- Start screen --- */
#start-screen {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#start-content {
    text-align: center;
    padding: 10px;
}

#start-game-title {
    font-size: 52px;
    font-weight: bold;
    color: #334466;
    letter-spacing: 4px;
    margin-bottom: 4px;
}

#start-highscore {
    font-size: 13px;
    color: #aaa;
    margin-bottom: 22px;
    min-height: 18px;
}

.option-group {
    margin-bottom: 14px;
}

.option-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.btn-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.opt-btn {
    padding: 5px 13px;
    border: 1.5px solid #ccc;
    border-radius: 4px;
    background: white;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    font-family: Arial, sans-serif;
    transition: all 0.15s;
}

.opt-btn:hover {
    border-color: #334466;
    color: #334466;
}

.opt-btn.active {
    background: #334466;
    border-color: #334466;
    color: white;
}

#start-instructions {
    font-size: 12px;
    color: #bbb;
    margin: 18px 0 22px;
}

#play-btn {
    padding: 11px 44px;
    background: #5cb85c;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    letter-spacing: 1px;
    font-family: Arial, sans-serif;
    transition: background 0.15s;
}

#play-btn:hover {
    background: #4cae4c;
}
