/* Survival — Режим Выживания */

.survival-game-wrap {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    padding: 4px;
}

.survival-root {
    margin: 0;
    width: 100%;
    outline: none;
}

.survival-arena {
    position: relative;
    width: 100%;
    height: min(78vh, 820px);
    min-height: 520px;
    background: linear-gradient(145deg, #1a0a08 0%, #2d1510 40%, #1f1208 100%);
    border-radius: 10px;
    overflow: hidden;
    outline: none;
}

.survival-arena.is-playing .survival-idle {
    display: none;
}

.survival-arena:not(.is-playing) .survival-play-ui {
    display: none;
}

/* Fullscreen */
.survival-fs-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 25;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.88);
    background: rgba(26, 10, 8, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.15s, border-color 0.15s;
}

.survival-fs-btn:hover {
    background: rgba(249, 115, 22, 0.25);
    border-color: rgba(249, 115, 22, 0.5);
    color: #fff;
}

.survival-fs-icon {
    font-size: 15px;
    line-height: 1;
}

.survival-arena:fullscreen,
.survival-arena.is-fullscreen {
    width: 100vw;
    height: 100vh;
    max-height: none;
    min-height: 0;
    border-radius: 0;
}

.survival-arena:fullscreen .survival-fs-btn,
.survival-arena.is-fullscreen .survival-fs-btn {
    top: 16px;
    right: 16px;
}

/* HUD */
.survival-hud {
    position: absolute;
    top: 12px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 120px 0 12px;
    pointer-events: none;
    z-index: 5;
}

.survival-pill {
    background: rgba(26, 10, 8, 0.88);
    border: 1px solid rgba(249, 115, 22, 0.25);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(8px);
    text-transform: lowercase;
}

.survival-pill b {
    color: #fdba74;
    font-size: 14px;
    margin-left: 4px;
}

.survival-pill-timer b {
    color: #fb923c;
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}

.survival-pill-timer.survival-pill-warning {
    border-color: rgba(239, 68, 68, 0.5);
    animation: sv-timer-pulse 0.8s ease-in-out infinite;
}

.survival-pill-unit {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 1px;
}

.survival-lives {
    font-size: 14px;
    letter-spacing: 2px;
}

.survival-lives.life-lost-anim {
    animation: sv-life-shake 0.4s ease-in-out;
}

/* Timer bar */
.survival-timer-bar-wrap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.35);
    z-index: 6;
}

.survival-timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #f97316, #fbbf24);
    transition: width 0.35s ease-out;
    box-shadow: 0 0 8px rgba(249, 115, 22, 0.5);
}

.survival-timer-bar.survival-timer-low {
    background: linear-gradient(90deg, #ef4444, #f97316);
}

/* Text area */
.survival-text-wrap {
    position: absolute;
    left: 24px;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.97);
    border-radius: 16px;
    padding: 36px 28px;
    min-height: 200px;
    overflow: hidden;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    z-index: 4;
    cursor: text;
    transition: box-shadow 0.15s ease;
}

.survival-text-wrap.survival-focused {
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.3),
        inset 0 0 0 2px rgba(249, 115, 22, 0.45);
}

.survival-text-wrap.survival-error-flash {
    box-shadow:
        inset 0 0 0 2px rgba(239, 68, 68, 0.55),
        0 4px 24px rgba(239, 68, 68, 0.2);
}

.survival-typing-text {
    font-size: clamp(1.2rem, 2.4vw, 1.45rem);
    line-height: 1.7;
    color: #1e293b;
    min-height: 100px;
    word-break: break-word;
}

.survival-typing-text .char {
    display: inline;
    transition: color 0.12s, background 0.12s;
}

.survival-typing-text .char.space-char {
    white-space: pre;
}

.survival-typing-text .char.is-typed {
    color: #94a3b8;
}

.survival-typing-text .char.is-current {
    background: #f97316;
    color: #fff;
    border-radius: 3px;
    padding: 0 2px;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.35);
    animation: sv-cursor-pulse 1.2s ease-in-out infinite;
}

.survival-typing-text.shake {
    animation: sv-shake 0.35s ease-in-out;
}

.survival-combo-bar {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 20px;
    background: rgba(26, 10, 8, 0.88);
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    z-index: 5;
    transition: transform 0.15s;
}

.survival-combo-bar b {
    color: #fdba74;
}

.survival-combo-bar.combo-bump {
    transform: translateX(-50%) scale(1.12);
}

.survival-focus-hint {
    position: absolute;
    bottom: 72px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
    z-index: 5;
    pointer-events: none;
}

/* Countdown */
.survival-countdown {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 5, 4, 0.72);
    backdrop-filter: blur(4px);
}

.survival-countdown-num {
    font-size: clamp(64px, 12vw, 120px);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 40px rgba(249, 115, 22, 0.6);
    animation: sv-countdown-pop 0.85s ease-out;
}

/* Floating effects */
.survival-float-effect {
    position: absolute;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%);
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    z-index: 30;
    pointer-events: none;
    animation: sv-float-up 1.8s ease-out forwards;
    white-space: nowrap;
}

.survival-time-float {
    position: absolute;
    font-weight: 800;
    font-size: 1.25rem;
    pointer-events: none;
    z-index: 30;
    animation: sv-time-float 1s ease-out forwards;
}

.survival-text-complete-flash {
    position: absolute;
    inset: 0;
    background: rgba(249, 115, 22, 0.12);
    border-radius: 16px;
    pointer-events: none;
    animation: sv-flash-fade 0.6s ease-out forwards;
    z-index: 3;
}

/* Idle overlay */
.survival-idle {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(12, 6, 4, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.survival-idle-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 28px;
    width: 100%;
    max-width: 920px;
    align-items: start;
}

@media (max-width: 768px) {
    .survival-idle-grid {
        grid-template-columns: 1fr;
        max-width: 420px;
        max-height: 90%;
        overflow-y: auto;
    }

    .survival-hud {
        padding-right: 12px;
    }
}

.survival-idle-left {
    text-align: left;
    color: #fff;
}

.survival-title {
    font-size: clamp(26px, 4vw, 38px);
    font-weight: 800;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #fdba74, #f97316, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.survival-desc {
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.75);
    font-size: 15px;
    margin-bottom: 16px;
}

.survival-rules {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.7;
}

.survival-rules li {
    position: relative;
    padding-left: 18px;
    margin-bottom: 6px;
}

.survival-rules li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: #f97316;
    font-weight: 700;
}

.survival-rules strong {
    color: rgba(255, 255, 255, 0.88);
    font-weight: 600;
}

.survival-progress-snippet {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.survival-progress-snippet strong {
    color: #fdba74;
}

.survival-idle-result {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.28);
    border-radius: 10px;
}

.survival-fail-label {
    font-size: 18px;
    font-weight: 800;
    color: #f87171;
    margin-bottom: 4px;
}

.survival-over-stats {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.78);
    margin: 0;
    line-height: 1.55;
}

.survival-btn {
    font-size: 17px;
    font-weight: 800;
    padding: 12px 44px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4);
    transition: filter 0.15s, transform 0.1s;
}

.survival-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.survival-hidden {
    display: none !important;
}

/* Leaderboard */
.survival-idle-right .survival-leaderboard {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(249, 115, 22, 0.2);
    border-radius: 16px;
    padding: 18px 16px 16px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 8px 32px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
    min-height: 280px;
    display: flex;
    flex-direction: column;
}

.survival-lb-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.survival-lb-header-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.25), rgba(234, 88, 12, 0.15));
    border: 1px solid rgba(249, 115, 22, 0.35);
    border-radius: 12px;
    flex-shrink: 0;
}

.survival-leaderboard-title {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 2px;
}

.survival-lb-subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.survival-leaderboard-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px 12px 28px;
}

.survival-lb-empty-visual {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(249, 115, 22, 0.2), rgba(255, 255, 255, 0.03));
    border: 1px dashed rgba(249, 115, 22, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    animation: sv-empty-pulse 3s ease-in-out infinite;
}

.survival-lb-empty-crown {
    font-size: 32px;
}

.survival-lb-empty-title {
    font-size: 15px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 6px;
}

.survival-lb-empty-text {
    font-size: 13px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.42);
    margin: 0;
}

.survival-leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.survival-leaderboard-row {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    font-size: 13px;
}

.survival-leaderboard-row.rank-top-1 {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.14), rgba(255, 255, 255, 0.04));
    border-color: rgba(255, 215, 0, 0.25);
}

.survival-leaderboard-row.rank-top-2 {
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.12), rgba(255, 255, 255, 0.03));
    border-color: rgba(192, 192, 192, 0.2);
}

.survival-leaderboard-row.rank-top-3 {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.12), rgba(255, 255, 255, 0.03));
    border-color: rgba(205, 127, 50, 0.2);
}

.survival-leaderboard-row.is-me {
    background: rgba(249, 115, 22, 0.12);
    border: 1px solid rgba(249, 115, 22, 0.4);
}

.survival-lb-rank {
    font-weight: 700;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

.survival-lb-name {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.survival-lb-score {
    font-weight: 800;
    font-size: 13px;
    color: #fdba74;
    font-variant-numeric: tabular-nums;
    padding: 3px 8px;
    background: rgba(249, 115, 22, 0.12);
    border-radius: 6px;
}

.survival-leaderboard-gap {
    text-align: center;
    padding: 10px 0 6px;
    color: rgba(255, 255, 255, 0.28);
    font-size: 14px;
    letter-spacing: 4px;
}

.survival-leaderboard-me {
    margin-top: 6px;
}

#progress-best-score,
#progress-total-plays,
#progress-average-speed-wpm,
#progress-average-accuracy {
    display: none;
}

/* Keyframes */
@keyframes sv-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

@keyframes sv-cursor-pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.35); }
    50% { box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.55); }
}

@keyframes sv-timer-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
}

@keyframes sv-life-shake {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.2) rotate(-5deg); }
    75% { transform: scale(1.2) rotate(5deg); }
}

@keyframes sv-countdown-pop {
    0% { transform: scale(0.4); opacity: 0; }
    40% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes sv-float-up {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
    100% { opacity: 0; transform: translate(-50%, -80%) scale(1); }
}

@keyframes sv-time-float {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-28px); }
}

@keyframes sv-flash-fade {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes sv-empty-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.85; }
}
