/* ===== Танки Блиц — оформление страницы ===== */

.tk-hero { margin-bottom: 18px; }

.tk-topbar {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}

.tk-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 18px;
    align-items: start;
}

.tk-stage {
    position: relative;
    background: #0b1018;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .45);
}

/* на телефоне не даём странице «прокручиваться» под пальцем:
   иначе браузер уходит в pull-to-refresh и рисует белый экран поверх игры */
body.tanks-page { overscroll-behavior-y: contain; }

#tank-canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    touch-action: none;
    cursor: crosshair;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* --- оверлей старта/финала --- */
.tk-overlay {
    position: absolute; inset: 0;
    background: rgba(6, 10, 18, .82);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 5;
}
.tk-overlay[hidden] { display: none; }

.tk-overlay-card {
    text-align: center;
    padding: 28px 34px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, #16203a, #0d1424);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
    max-width: 460px;
}
.tk-overlay-card h3 {
    font-size: 1.7rem; margin-bottom: 10px;
    background: linear-gradient(90deg, var(--amber), var(--orange));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tk-overlay-card p { color: var(--muted); margin-bottom: 18px; }

/* --- панель справа --- */
/* --- карточка входа по позывному --- */
.tk-login {
    position: absolute; inset: 0;
    background: rgba(6, 10, 18, .88);
    backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    z-index: 6;
}
.tk-login[hidden] { display: none; }
.tk-login-card {
    text-align: center;
    padding: 26px 30px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, #16203a, #0d1424);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
    max-width: 420px;
}
.tk-login-card h4 { font-size: 1.35rem; margin-bottom: 6px; }
.tk-login-lead { color: var(--muted); font-size: .9rem; margin-bottom: 14px; }
.tk-input {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #0a1018;
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 12px;
    text-align: center;
}
.tk-input:focus { outline: none; border-color: var(--cyan); }
.tk-login-vip {
    margin-top: 12px; font-size: .82rem; color: var(--amber);
    background: rgba(255, 176, 32, .10);
    border: 1px solid rgba(255, 176, 32, .35);
    border-radius: 10px; padding: 7px 10px;
}
.tk-login-err { margin-top: 10px; color: var(--red); font-size: .85rem; }

/* --- позывной и рейтинг в панели --- */
.tk-cs {
    background: #0d1424; border: 1px solid var(--line);
    border-radius: 10px; padding: 8px 12px; font-size: .92rem;
}
.tk-cs b { color: var(--amber); }
.tk-cs span { color: var(--violet); font-size: .8rem; }
.tk-rating h5 { font-size: .82rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.tk-rating-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.tk-rating-list li {
    display: flex; justify-content: space-between; gap: 8px;
    background: #0d1424; border: 1px solid var(--line);
    border-radius: 8px; padding: 5px 9px; font-size: .84rem;
}
.tk-rating-list li b { color: var(--text); }
.tk-rating-list li span { color: var(--muted); font-size: .78rem; }
.tk-rating-list li.vip { border-color: rgba(255, 176, 32, .5); background: rgba(255, 176, 32, .08); }
.tk-rating-list li.vip b { color: var(--amber); }
.tk-rating-empty { color: var(--muted); font-size: .82rem; text-align: center; }

.tk-panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    display: flex; flex-direction: column; gap: 14px;
}

.tk-hp-top {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: .82rem; color: var(--muted); margin-bottom: 6px;
}
.tk-hp-top b { color: var(--text); font-size: .95rem; }

.tk-bar {
    height: 14px; border-radius: 8px;
    background: #0a0f1a; border: 1px solid var(--line);
    overflow: hidden;
}
.tk-bar.thin { height: 9px; }
.tk-bar i {
    display: block; height: 100%;
    background: linear-gradient(90deg, #34d399, #22d3ee);
    transition: width .18s ease;
}
.tk-bar i.gold { background: linear-gradient(90deg, var(--amber), var(--orange)); }

.tk-stats {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.tk-stats div {
    background: #0d1424; border: 1px solid var(--line);
    border-radius: 10px; padding: 8px 6px; text-align: center;
}
.tk-stats span { display: block; font-size: .7rem; color: var(--muted); }
.tk-stats b { font-size: 1.25rem; color: var(--amber); }

.tk-mini {
    width: 100%; height: auto; aspect-ratio: 16 / 10;
    border: 1px solid var(--line); border-radius: 10px;
    background: #0a0f1a;
}

.tk-toolbar { display: flex; flex-direction: column; gap: 9px; }
.tk-lbl { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.tk-hint { font-size: .78rem; color: var(--muted); text-align: center; }

/* --- экранные кнопки (телефон) --- */
.tk-touch {
    position: absolute; inset: auto 0 0 0;
    display: none; justify-content: space-between; align-items: flex-end;
    padding: 16px; pointer-events: none;
    z-index: 4;
}
.tk-touch > div { display: flex; gap: 10px; pointer-events: auto; align-items: flex-end; }

/* аналоговый джойстик */
.tk-stick {
    position: relative;
    width: 136px; height: 136px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 45%, rgba(60,90,130,.30), rgba(10,16,26,.62) 70%),
        rgba(12, 18, 30, .45);
    border: 2px solid rgba(120, 160, 210, .30);
    box-shadow: 0 8px 26px rgba(0, 0, 0, .45), inset 0 0 24px rgba(0, 0, 0, .35);
    touch-action: none;
    user-select: none;
}
.tk-stick::before {
    content: '';
    position: absolute; inset: 22px;
    border-radius: 50%;
    border: 1px dashed rgba(160, 200, 240, .22);
}
.tk-stick i {
    position: absolute;
    left: 50%; top: 50%;
    width: 58px; height: 58px;
    margin: -29px 0 0 -29px;
    border-radius: 50%;
    background: radial-gradient(circle at 34% 28%, #9fe6ff, #2f7fb0 60%, #1b5273);
    box-shadow: 0 5px 16px rgba(0, 0, 0, .55), inset 0 -3px 8px rgba(0, 0, 0, .35);
    transition: transform .04s linear;
    pointer-events: none;
}

.tk-btn {
    width: 58px; height: 58px; border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(18, 26, 44, .88);
    color: var(--text); font-size: 1.3rem;
    touch-action: none; user-select: none; cursor: pointer;
}
.tk-btn:active { background: rgba(34, 211, 238, .25); transform: scale(.94); }
/* крупная кнопка выстрела */
.tk-fire {
    width: 92px; height: 92px; border-radius: 50%;
    font-size: 2rem;
    background: radial-gradient(circle at 36% 30%, rgba(255,150,60,.55), rgba(180,70,25,.55));
    border: 2px solid var(--orange);
    box-shadow: 0 6px 22px rgba(251, 146, 60, .35);
}
.tk-fire:active { background: rgba(255,170,70,.75); }
.tk-mine {
    width: 66px; height: 66px; border-radius: 50%;
    background: rgba(167, 139, 250, .28);
    border: 2px solid var(--violet);
}

/* сенсорные кнопки показываем на устройствах с тачем или по кнопке */
body.has-touch .tk-touch { display: flex; }
body.no-touch .tk-touch { display: none !important; }

@media (max-width: 900px) {
    .tk-layout { grid-template-columns: 1fr; }
    .tk-panel { order: -1; }
}

/* ===== полноэкранный режим ===== */
/* Запасной вариант (класс .fs) — для браузеров без Fullscreen API */
.tk-stage.fs {
    position: fixed;
    inset: 0;
    z-index: 999;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #06090f;
}
.tk-stage.fs #tank-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    aspect-ratio: auto;
}

.tk-stage:fullscreen,
.tk-stage:-webkit-full-screen,
.tk-stage:fs {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #06090f;
}

.tk-stage:fullscreen #tank-canvas,
.tk-stage:-webkit-full-screen #tank-canvas {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
    aspect-ratio: auto;
}

.tk-stage:fullscreen .tk-overlay,
.tk-stage:-webkit-full-screen .tk-overlay {
    border-radius: 0;
}

.tk-stage:fullscreen .tk-touch,
.tk-stage:-webkit-full-screen .tk-touch {
    display: flex;
}
