/* Шрифты лежат локально: Playables не разрешает внешние запросы (Google Fonts, OFL) */
@font-face { font-family: "Nunito"; src: url("../fonts/Nunito.ttf") format("truetype"); font-weight: 200 1000; font-display: swap; }
@font-face { font-family: "Rubik Bubbles"; src: url("../fonts/RubikBubbles.ttf") format("truetype"); font-display: swap; }

* { box-sizing: border-box; }
html, body {
    margin: 0; height: 100%; overflow: hidden;
    background: #1c1f17;
    font-family: "Nunito", "Trebuchet MS", system-ui, sans-serif;
    font-weight: 800;
    -webkit-user-select: none; user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
button { font: inherit; cursor: pointer; border: 0; }

.stage { position: fixed; inset: 0; overflow: hidden; }
/* onPause из YouTube: замораживаем все CSS-анимации */
.stage.paused *, .stage.paused *::before, .stage.paused *::after { animation-play-state: paused !important; }
.scene { position: absolute; left: 50%; top: 50%; transform-origin: 50% 50%; overflow: hidden; }
.bg { position: absolute; left: 0; top: 0; }

/* ── Загрузка ── */
.boot { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
        background: radial-gradient(circle at 50% 40%, #4d5b2f, #1c1f17); }
.boot-title { font-family: "Rubik Bubbles", "Nunito", sans-serif; color: #facc15; font-size: 52px; letter-spacing: 2px; -webkit-text-stroke: 2px #3f4a1d; text-shadow: 0 5px 0 #3f4a1d; }
.boot-bar { width: 260px; height: 14px; border-radius: 8px; background: rgba(255,255,255,.15); overflow: hidden; }
.boot-bar div { height: 100%; width: var(--blazor-load-percentage, 5%); background: #facc15; transition: width .2s; }

/* ── Машины ── */
.veh { position: absolute; left: 0; top: 0; width: 0; height: 0; transition-property: transform; transition-timing-function: linear; z-index: 2; }
.veh.lifted { z-index: 40; }
.veh-in { position: absolute; transition: transform 150ms ease-out; cursor: pointer; }
.veh-in svg { display: block; overflow: visible; }
.veh-in.shake svg { animation: shake .36s; }
.veh.lifted .veh-in svg { filter: drop-shadow(0 22px 10px rgba(0,0,0,.35)); }
.heli-mode .veh-in.pickable { animation: pulse 0.9s infinite; }
@keyframes shake { 0%,100% { transform: translateX(0) } 20% { transform: translateX(-6px) } 40% { transform: translateX(6px) } 60% { transform: translateX(-4px) } 80% { transform: translateX(4px) } }
@keyframes pulse { 50% { filter: brightness(1.25) drop-shadow(0 0 8px #fde047); } }
.siren { animation: siren .5s infinite alternate; }
.siren.alt { animation-delay: .25s; }
@keyframes siren { to { opacity: .25; } }

.seat-badge { position: absolute; left: 0; top: 0; background: #1e293b; color: #fff; font-size: 14px; font-weight: 800;
              padding: 2px 8px; border-radius: 10px; white-space: nowrap; pointer-events: none; z-index: 5; }

.lock { position: absolute; transform: translate(-50%, -50%); background: rgba(15,23,42,.35); border-radius: 16px;
        display: flex; flex-direction: column; align-items: center; padding: 8px 18px; z-index: 1; }
.lock.locked { opacity: .65; filter: grayscale(.6); }
.lock.buy { animation: pulse 1.4s infinite; }
.lock-opts { display: flex; gap: 6px; margin-top: 4px; }
.lock-opts button { border-radius: 10px; padding: 3px 8px; box-shadow: 0 3px 0 rgba(0,0,0,.3); }
.lock-opts .coin { background: #f59e0b; }
.lock-opts .ad { background: #7c3aed; }
.lock .price { display: flex; align-items: center; gap: 4px; color: #fff; font-weight: 800; font-size: 15px; }

/* ── Бойцы ── */
.sol { position: absolute; left: 0; top: 0; width: 0; height: 0; transition-property: transform; transition-timing-function: ease-out; z-index: 10; pointer-events: none; }
.sol svg { position: absolute; left: -16px; top: -46px; }
.sol.front svg { animation: hop .6s infinite; }
.sol.walking { z-index: 20; }
.sol.walking svg { animation: hop .2s infinite; }
@keyframes hop { 50% { transform: translateY(-4px); } }

/* ── Всплывающие надписи комбо ── */
.floats { position: absolute; inset: 0; pointer-events: none; z-index: 60; }
.float { position: absolute; transform: translate(-50%, -50%); pointer-events: none; z-index: 60; white-space: nowrap; animation: floatUp 1.3s ease-out forwards; }
.float.word { font-family: "Rubik Bubbles", "Nunito", sans-serif; font-size: 66px; color: #a3e635; letter-spacing: 1px;
              -webkit-text-stroke: 3px #14532d; paint-order: stroke fill;
              text-shadow: 0 6px 0 #14532d, 0 10px 14px rgba(0,0,0,.35); }
.float.word::first-letter { color: #facc15; }
.float.combo { font-size: 20px; font-weight: 900; color: #fde047; background: #1e293b; padding: 4px 16px; border-radius: 14px; border: 2px solid #fde047; box-shadow: 0 4px 0 rgba(0,0,0,.3); }
@keyframes floatUp {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(.4); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
    25% { transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -110%) scale(1); }
}

/* ── HUD ── */
.hud { position: absolute; top: 12px; left: 14px; right: 14px; display: flex; align-items: center; gap: 10px; z-index: 100; }
.pill { height: 50px; background: #fff; border-radius: 25px; display: flex; align-items: center; gap: 6px; padding: 0 16px;
        font-weight: 800; font-size: 20px; color: #1e293b; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.pill.icon { width: 50px; padding: 0; justify-content: center; }
.progress { flex: 1; height: 42px; background: #fff; border-radius: 21px; display: flex; align-items: center; gap: 8px; padding: 0 14px;
            box-shadow: 0 4px 0 rgba(0,0,0,.18); min-width: 120px; }
.progress b { color: #1e293b; font-size: 18px; min-width: 30px; text-align: right; }
.track { flex: 1; height: 12px; background: #e2e8f0; border-radius: 6px; overflow: hidden; }
.bar { height: 100%; background: linear-gradient(90deg, #4ade80, #16a34a); transition: width .25s; }
.chest-meter { display: flex; align-items: center; gap: 4px; background: rgba(15,23,42,.75); border-radius: 14px; padding: 4px 10px 4px 4px; width: 120px; }
.chest-meter .bar { background: linear-gradient(90deg, #fde047, #f59e0b); }
.booster { position: relative; width: 58px; height: 54px; background: #fff; border-radius: 16px; display: flex; align-items: center; justify-content: center;
           box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.booster.active { background: #fde047; box-shadow: 0 0 0 4px #f59e0b; }
.booster .badge { position: absolute; top: -7px; right: -7px; background: #ef4444; color: #fff; font-weight: 900; font-size: 14px;
                  min-width: 24px; height: 24px; border-radius: 12px; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.booster .badge.buy { background: #22c55e; }
.portrait .hud { flex-wrap: wrap; }
.portrait .progress { order: 10; flex-basis: 100%; }

.toast { position: absolute; left: 50%; top: 92px; transform: translateX(-50%); z-index: 150; background: rgba(15,23,42,.88); color: #fff;
         padding: 12px 24px; border-radius: 18px; font-weight: 800; font-size: 20px; white-space: nowrap; animation: toastIn .25s ease-out; pointer-events: none; }
.portrait .toast { top: 150px; white-space: normal; max-width: 640px; text-align: center; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -12px); } }

/* ── Оверлеи и окна ── */
.overlay { position: absolute; inset: 0; z-index: 200; background: rgba(15,23,42,.45); backdrop-filter: blur(4px);
           display: flex; align-items: center; justify-content: center; }
.modal { position: relative; width: 420px; background: #fff; border-radius: 30px; box-shadow: 0 10px 0 #cbd5e1, 0 20px 40px rgba(0,0,0,.3);
         padding-top: 64px; animation: popIn .3s cubic-bezier(.2,1.6,.4,1); }
@keyframes popIn { from { transform: scale(.6); opacity: 0; } }
.modal h2 { margin: 0; position: absolute; top: 0; left: 0; right: 0; height: 100px; border-radius: 30px 30px 0 0; padding-top: 44px;
            text-align: center; color: #fff; font-family: "Rubik Bubbles", "Nunito", sans-serif; font-size: 36px; font-weight: 400; letter-spacing: 1px;
            -webkit-text-stroke: 2px rgba(0,0,0,.45); paint-order: stroke fill; text-shadow: 0 4px 0 rgba(0,0,0,.3); }
.modal.blue h2 { background: linear-gradient(#60a5fa, #3b82f6); }
.modal.green h2 { background: linear-gradient(#86efac, #22c55e); }
.modal.red h2 { background: linear-gradient(#fca5a5, #ef4444); }
.modal.gold h2 { background: linear-gradient(#fde047, #f59e0b); }
.medal { position: absolute; top: -46px; left: 50%; transform: translateX(-50%); width: 92px; height: 92px; border-radius: 50%; background: #fff;
         display: flex; align-items: center; justify-content: center; z-index: 2; box-shadow: 0 4px 10px rgba(0,0,0,.2); }
.close { position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.3); color: #fff; font-size: 20px; z-index: 3; }
.modal .body { position: relative; padding: 50px 26px 26px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.modal p { margin: 0; text-align: center; color: #475569; font-weight: 700; font-size: 18px; }

.btn { height: 58px; border-radius: 29px; color: #fff; font-weight: 900; font-size: 22px; display: flex; align-items: center; justify-content: center; gap: 8px;
       transition: transform .08s; }
.btn:active { transform: translateY(3px); }
.btn.green { background: linear-gradient(#4ade80, #22c55e); box-shadow: 0 5px 0 #15803d; }
.btn.purple { background: linear-gradient(#a78bfa, #7c3aed); box-shadow: 0 5px 0 #5b21b6; }
.btn.blue { background: linear-gradient(#60a5fa, #2563eb); box-shadow: 0 5px 0 #1d4ed8; }
.btn.white { background: #f8fafc; color: #334155; box-shadow: 0 5px 0 #cbd5e1; }
.btn.small { height: 42px; font-size: 17px; align-self: center; padding: 0 22px; }
.btn.big { height: 70px; font-size: 28px; border-radius: 35px; }

.row { display: flex; align-items: center; justify-content: space-between; background: #eef2f7; border-radius: 16px; padding: 12px 16px;
       font-weight: 800; font-size: 20px; color: #334155; cursor: pointer; }
.row.col { flex-direction: column; align-items: stretch; gap: 10px; cursor: default; }
.row input { display: none; }
.switch { width: 56px; height: 32px; border-radius: 16px; background: #cbd5e1; position: relative; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: left .2s; }
.row input:checked + .switch { background: #22c55e; }
.row input:checked + .switch::after { left: 27px; }

.langs { display: flex; gap: 8px; justify-content: center; }
.lang { flex: 1; padding: 10px 6px; border-radius: 12px; background: #fff; color: #334155; font-weight: 800; font-size: 16px; box-shadow: 0 3px 0 #cbd5e1; }
.lang.on { background: #2563eb; color: #fff; box-shadow: 0 3px 0 #1e40af; }

/* Меню */
.menu { background: rgba(28,31,23,.55); }
.menu-card { width: 640px; max-width: 94%; background: rgba(255,255,255,.96); border-radius: 32px; padding: 28px 30px; display: flex; flex-direction: column; gap: 16px;
             box-shadow: 0 10px 0 #a3a38a, 0 24px 50px rgba(0,0,0,.4); animation: popIn .35s cubic-bezier(.2,1.6,.4,1); }
.logo { text-align: center; font-family: "Rubik Bubbles", "Nunito", sans-serif; font-size: 62px; line-height: 1.05; letter-spacing: 1px;
        color: #facc15; -webkit-text-stroke: 3px #3f4a1d; paint-order: stroke fill;
        text-shadow: 0 7px 0 #3f4a1d, 0 12px 18px rgba(0,0,0,.3); animation: logoBob 2.4s ease-in-out infinite; }
.logo span { display: inline-block; }
.logo .w2 { color: #84cc16; margin-left: .25em; }
@keyframes logoBob { 50% { transform: translateY(-4px) rotate(-1deg); } }
.sub { text-align: center; font-weight: 800; color: #475569; font-size: 20px; }
.legend { display: flex; justify-content: space-between; gap: 4px; }
.unit { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; white-space: nowrap; font-weight: 800; flex: 1; }
.unit svg { transform: scale(1.25); margin: 8px 0 6px; }
.legend-tcc { display: flex; align-items: center; justify-content: center; gap: 12px; font-weight: 800; color: #334155; font-size: 17px;
              background: #f1f5f9; border-radius: 14px; padding: 8px; }
.legend-tcc svg { overflow: visible; }

/* Победа */
.stars { display: flex; justify-content: center; align-items: flex-end; gap: 6px; color: #e2e8f0; height: 70px; margin-top: -12px; }
.star { animation: starIn .45s cubic-bezier(.2,1.8,.4,1) both; }
.star.on { color: #facc15; }
.star.s1 { animation-delay: .15s; } .star.s2 { animation-delay: .35s; } .star.s3 { animation-delay: .55s; }
@keyframes starIn { from { transform: scale(0) rotate(-60deg); opacity: 0; } }
.chip { align-self: center; display: flex; align-items: center; gap: 6px; background: #f1f5f9; color: #166534; font-weight: 800; padding: 4px 14px; border-radius: 14px; }
.chip.combo { color: #fff; background: #1e293b; }
.chip.gold { color: #92400e; background: #fef3c7; }
.coin-reward { align-self: center; display: flex; align-items: center; gap: 10px; background: #fef3c7; border: 3px solid #fde68a; border-radius: 30px;
               padding: 6px 26px; font-size: 34px; font-weight: 900; color: #d97706; }

.roadmap { position: relative; height: 120px; border-radius: 18px; background: repeating-linear-gradient(135deg, #3b82f6 0 18px, #3577e8 18px 36px);
           box-shadow: 0 5px 0 #1d4ed8; }
.road-line { position: absolute; left: 6%; right: 6%; top: 74px; height: 5px; background: #fff; border-radius: 3px; }
.node { position: absolute; top: 0; bottom: 0; width: 60px; transform: translateX(-30%); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 8px; }
.node .bubble { width: 50px; height: 50px; border-radius: 50%; background: #fff; border: 3px solid #22c55e; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.node.gold .bubble { border-color: #f59e0b; }
.node .stick { width: 6px; height: 14px; background: #ef4444; border-radius: 3px; margin-bottom: 2px; }
.node .marker { margin-bottom: 4px; }
.node .num { background: #22c55e; color: #fff; font-weight: 900; font-size: 14px; padding: 1px 10px; border-radius: 10px; margin-top: 2px; }
.node.gold .num { background: #f59e0b; }
.node.done .num { background: #16a34a; }

.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: fall linear infinite; }
@keyframes fall { to { transform: translateY(1400px) rotate(720deg); } }

/* Сундук */
.chest-big { position: relative; height: 180px; display: flex; align-items: center; justify-content: center; }
.chest-big svg { position: relative; animation: wobble 1.2s infinite; }
.rays { position: absolute; width: 240px; height: 240px; border-radius: 50%;
        background: repeating-conic-gradient(rgba(253,224,71,.5) 0 10deg, transparent 10deg 25deg);
        -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%);
        animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wobble { 0%,100% { transform: rotate(0) } 10% { transform: rotate(-6deg) } 20% { transform: rotate(6deg) } 30% { transform: rotate(0) } }
.rewards { display: flex; justify-content: center; gap: 16px; padding: 18px 0; }
.reward { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #fef3c7; border-radius: 18px; padding: 12px 18px; font-size: 26px; font-weight: 900; color: #92400e; }
.reward.pop { animation: popIn .4s cubic-bezier(.2,1.8,.4,1) both; }
.reward.d1 { animation-delay: .2s; }

/* Режим обложки (?cover=N): только поле и бойцы + логотип */
.scene.cover .hud, .scene.cover .overlay, .scene.cover .lock, .scene.cover .seat-badge { display: none; }
.cover-title { position: absolute; left: 0; right: 0; top: 18px; z-index: 300; display: flex; justify-content: center; pointer-events: none; }
.cover-title .logo { font-size: 92px; background: rgba(255,255,255,.82); border-radius: 36px; padding: 6px 40px 18px; box-shadow: 0 10px 0 #a3a38a; animation: none; }
.portrait .cover-title { top: 60px; }
.portrait .cover-title .logo { font-size: 84px; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: #fef3c7; padding: 8px 16px; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }
