/* ── Rain game ───────────────────────────────────────────── */
.rain-context { display: flex; flex-direction: column; gap: 10px; user-select: none; }

/* HUD */
.rain-hud         { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px; }
.rain-health-wrap { display: flex; align-items: center; gap: 8px; flex: 1; }
.rain-heart-icon  { color: #f87171; font-size: 0.85rem; flex-shrink: 0; }
.rain-health-bar  { flex: 1; height: 10px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; }
.rain-health-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #34d399, #4db8ff); transition: width 0.25s ease, background 0.4s ease; }
.rain-health-fill--warn   { background: linear-gradient(90deg, #fb923c, #facc15); }
.rain-health-fill--danger { background: linear-gradient(90deg, #ef4444, #f87171); animation: health-pulse 0.6s ease-in-out infinite; }
@keyframes health-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
.rain-health-num { font-size: 0.72rem; font-weight: 700; color: var(--muted); min-width: 28px; text-align: right; }

.rain-score-wrap, .rain-hs-wrap { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rain-score-wrap small, .rain-hs-wrap small { font-size: 0.65rem; color: var(--muted); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.rain-score { font-size: 2rem; font-weight: 900; color: var(--accent); text-shadow: 0 0 16px rgba(6,182,212,0.45); transition: color 0.15s; }
.rain-hs    { font-size: 1.1rem; font-weight: 700; color: var(--muted); }

@keyframes rain-score-pop {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.28); }
    100% { transform: scale(1); }
}
.rain-score--pop { animation: rain-score-pop 0.22s ease-out; }

/* Game field */
.rain-field {
    position: relative; height: 380px;
    background: linear-gradient(180deg, rgba(0,8,22,0.55) 0%, rgba(0,12,32,0.70) 100%);
    border-radius: 20px; border: 1px solid rgba(8,100,120,0.18); overflow: hidden;
}
@keyframes panic-pulse {
    0%   { border-color: rgba(248,113,113,0.70); box-shadow: 0 0 22px rgba(248,113,113,0.28); }
    100% { border-color: rgba(8,100,120,0.18);   box-shadow: none; }
}
.rain-field--panic { animation: panic-pulse 0.4s ease-out forwards; }

/* Floor */
.rain-floor { position: absolute; bottom: 0; left: 0; right: 0; height: 5px; background: rgba(248,113,113,0.35); border-radius: 0 0 20px 20px; }
@keyframes floor-flash {
    0%   { background: rgba(248,113,113,0.95); height: 12px; }
    100% { background: rgba(248,113,113,0.35); height: 5px; }
}
.rain-floor--flash { animation: floor-flash 0.5s ease-out forwards; }

/* Falling letter */
.rain-letter {
    position: absolute; top: -72px; width: 66px; height: 66px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Frank Ruhl Libre', 'David Libre', 'Times New Roman', serif;
    font-size: 2.2rem; font-weight: 900; border-radius: 12px;
    border: 1.5px solid transparent;
    background: rgba(4,16,36,0.55); backdrop-filter: blur(2px);
    animation: rain-fall linear forwards; pointer-events: none;
    --rot: 180deg;
}
@keyframes rain-fall {
    from { transform: translateY(0)     rotate(0deg);       opacity: 0; }
    5%   { opacity: 1; }
    93%  { opacity: 1; }
    to   { transform: translateY(500px) rotate(var(--rot)); opacity: 0.7; }
}
@keyframes rain-catch {
    0%   { transform: scale(1)   rotate(0deg);  opacity: 1; }
    50%  { transform: scale(1.6) rotate(10deg); opacity: 0.9; }
    100% { transform: scale(0)   rotate(20deg); opacity: 0; }
}
@keyframes rain-miss {
    0%   { opacity: 1; }
    100% { transform: translateY(40px); opacity: 0; }
}
.rain-letter--missed { animation: rain-miss 0.28s ease-out forwards !important; }

/* Rain rule icon colors */
.rain-rules .fa-bullseye    { color: #4db8ff; }
.rain-rules .fa-heart-crack { color: #f87171; }
.rain-rules .fa-bolt        { color: #facc15; }
.rain-rules .fa-chart-line  { color: #a78bfa; }
.rain-rules .fa-trophy      { color: #fbbf24; }
.rain-rules .rain-rule-heal { color: #34d399; }
.rain-rules .fa-keyboard    { color: #9ec8e8; }

/* Heal popup */
.rain-heal-popup {
    position: absolute; bottom: 30%;
    color: #34d399; font-size: 1.1rem; font-weight: 900;
    text-shadow: 0 0 14px rgba(52,211,153,0.90);
    pointer-events: none; z-index: 15; white-space: nowrap;
    animation: heal-float 1s ease-out forwards;
}
@keyframes heal-float {
    0%   { transform: translateY(0);     opacity: 1; }
    100% { transform: translateY(-70px); opacity: 0; }
}

/* Warning bar */
.rain-warn-bar { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; z-index: 20; pointer-events: none; }
.rain-warn      { font-size: 0.80rem; font-weight: 800; padding: 5px 14px; border-radius: 999px; white-space: nowrap; animation: fade-in 0.15s ease; }
.rain-warn--caps { background: rgba(248,113,113,0.90); color: #fff; }
.rain-warn--lang { background: rgba(251,146,60,0.90); color: #021428; }

/* Intro overlay */
.rain-intro {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
    background: rgba(4,12,28,0.92); border-radius: 20px; backdrop-filter: blur(6px);
    direction: rtl; z-index: 10; padding: 24px 28px;
}
.rain-intro-title { font-size: 1.7rem; font-weight: 900; color: #38bdf8; text-shadow: 0 0 20px rgba(56,189,248,0.55); }
.rain-rules       { list-style: none; display: flex; flex-direction: column; gap: 10px; text-align: right; padding: 0; }
.rain-rules li    { font-size: 0.88rem; color: var(--muted); line-height: 1.4; }

/* Game-over overlay */
.rain-gameover {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    background: rgba(4,12,28,0.88); border-radius: 20px; backdrop-filter: blur(6px);
    direction: rtl; animation: fade-in 0.35s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.rain-go-title  { font-size: 1.6rem; font-weight: 800; color: var(--danger); }
.rain-go-score  { font-size: 3.2rem; font-weight: 900; color: var(--accent); text-shadow: 0 0 28px rgba(6,182,212,0.55); line-height: 1; }
.rain-go-sub    { font-size: 0.72rem; color: var(--muted); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

.rain-restart-btn { margin-top: 6px; padding: 11px 32px; border-radius: 999px; background: var(--accent); color: #021428; font-weight: 800; font-size: 1rem; border: none; cursor: pointer; transition: box-shadow 0.18s, transform 0.18s; }
.rain-restart-btn:hover { box-shadow: 0 6px 22px rgba(6,182,212,0.50); transform: translateY(-2px); }

/* In-game restart button */
.rain-ingame-restart {
    position: absolute; top: 10px; left: 10px;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px; padding: 6px 10px; color: var(--muted); font-size: 0.85rem;
    cursor: pointer; transition: background 0.15s, color 0.15s; z-index: 5;
}
.rain-ingame-restart:hover { background: rgba(248,113,113,0.15); color: var(--danger); border-color: rgba(248,113,113,0.3); }
