/* Tank Arena. The stage is the game's own world with its own palette (game-specific colours are allowed by the
   site conventions); everything outside the stage uses the site tokens. */
.ta-shell { padding: 12px; }
.ta-stage {
  --ta-bg: #0b0f14; --ta-panel: rgba(16, 22, 30, .92); --ta-panel-2: rgba(28, 37, 49, .95); --ta-line: rgba(255, 255, 255, .1);
  --ta-text: #e8eef5; --ta-dim: #93a1b1; --ta-accent: #ffb43d; --ta-accent-2: #ff7a3d; --ta-ok: #4fe08a; --ta-bad: #ff5a5a; --ta-blue: #5ec8ff;
  position: relative; width: 100%; height: clamp(540px, 74vh, 780px); border-radius: 16px; overflow: hidden; background: var(--ta-bg);
  color: var(--ta-text); font-family: Inter, system-ui, sans-serif; user-select: none; -webkit-user-select: none; isolation: isolate;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}
.ta-stage.pseudo-fs, .ta-stage:fullscreen { position: fixed; inset: 0; height: 100%; height: 100dvh; width: 100%; border-radius: 0; z-index: 1000; }
#ta-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.ta-stage [hidden] { display: none !important; }
.ta-stage h2, .ta-stage h3, .ta-stage b, .ta-stage strong { color: inherit; }
.ta-stage .ta-title h2 { color: var(--ta-text); }

/* ---- screens (menus over the live battlefield) ---- */
.ta-screen { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px; display: flex; flex-direction: column; align-items: center;
  background: radial-gradient(ellipse at 50% 20%, rgba(10, 14, 20, .55), rgba(6, 9, 13, .9) 70%); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: ta-fade .25s ease; z-index: 5; user-select: text; -webkit-user-select: text; scroll-padding-bottom: 96px; }
@keyframes ta-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ta-wrap { width: 100%; max-width: 980px; margin: auto 0; }
.ta-narrow { max-width: 560px; }
.ta-logo { text-align: center; margin: 8px 0 18px; }
.ta-logo h2 { font-size: clamp(38px, 7vw, 68px); line-height: .95; margin: 0; font-weight: 900; letter-spacing: -.02em; text-transform: uppercase;
  background: linear-gradient(180deg, #fff3d6 0%, #ffb43d 55%, #ff6a2b 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .55)) drop-shadow(0 0 22px rgba(255, 140, 40, .35)); }
.ta-logo p { margin: 8px 0 0; color: var(--ta-dim); font-size: 14px; letter-spacing: .14em; text-transform: uppercase; }
.ta-card { background: var(--ta-panel); border: 1px solid var(--ta-line); border-radius: 14px; padding: 16px; margin: 0 0 12px; }
.ta-card h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--ta-dim); font-weight: 700; }
.ta-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ta-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.ta-menu-buttons { display: grid; gap: 10px; margin-top: 14px; }
.ta-btn { appearance: none; border: 1px solid var(--ta-line); background: var(--ta-panel-2); color: var(--ta-text); font: inherit; font-weight: 700; font-size: 15px;
  padding: 11px 16px; border-radius: 11px; cursor: pointer; transition: transform .08s, background .15s, border-color .15s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.ta-btn:hover { border-color: rgba(255, 255, 255, .28); background: #2b3848; }
.ta-btn:active { transform: translateY(1px) scale(.99); }
.ta-btn:focus-visible { outline: 2px solid var(--ta-accent); outline-offset: 2px; }
.ta-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.ta-btn.primary { background: linear-gradient(180deg, #ffc35a, #ff8a2b); color: #1a1006; border-color: transparent; box-shadow: 0 4px 0 #b4561a, 0 8px 22px rgba(255, 130, 40, .3); }
.ta-btn.primary:hover { background: linear-gradient(180deg, #ffd27a, #ff9a45); }
.ta-btn.primary:active { box-shadow: 0 2px 0 #b4561a; transform: translateY(2px); }
.ta-btn.big { font-size: 18px; padding: 15px 20px; border-radius: 14px; }
.ta-btn.small { font-size: 13px; padding: 7px 11px; border-radius: 9px; }
.ta-btn.danger { color: #ffb3b3; }
.ta-btn .sub { display: block; font-size: 12px; font-weight: 500; color: inherit; opacity: .7; }
.ta-big-label { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.ta-stage label.ta-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ta-dim); font-weight: 600; letter-spacing: .04em; min-width: 0; }
.ta-stage input[type="text"], .ta-stage select, .ta-stage textarea { background: #0e141c; color: var(--ta-text); border: 1px solid rgba(255, 255, 255, .16); border-radius: 9px;
  padding: 9px 11px; font: inherit; font-size: 15px; min-height: 0; width: 100%; box-sizing: border-box; }
.ta-stage textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; height: 60px; resize: vertical; word-break: break-all; }
.ta-stage input:focus, .ta-stage select:focus, .ta-stage textarea:focus { outline: 2px solid var(--ta-accent); outline-offset: 0; border-color: transparent; }
.ta-stage input[type="range"] { width: 100%; accent-color: var(--ta-accent); }
.ta-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.ta-seg button { appearance: none; font: inherit; font-size: 13px; font-weight: 700; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--ta-line); background: #141c26; color: var(--ta-dim); cursor: pointer; }
.ta-seg button[aria-pressed="true"] { background: rgba(255, 180, 61, .16); color: #ffd28a; border-color: rgba(255, 180, 61, .6); }
.ta-seg button:disabled { cursor: default; opacity: .6; }
.ta-cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.ta-pick { appearance: none; font: inherit; color: var(--ta-text); text-align: left; padding: 8px; border-radius: 11px; border: 2px solid transparent; background: #121a24; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.ta-pick canvas { width: 100%; aspect-ratio: 32 / 20; border-radius: 7px; display: block; background: #0a0e13; }
.ta-pick.tank canvas { aspect-ratio: 1.4; }
.ta-pick b { font-size: 14px; }
.ta-pick small { color: var(--ta-dim); font-size: 12px; line-height: 1.3; }
.ta-pick[aria-pressed="true"] { border-color: var(--ta-accent); background: #1c2532; box-shadow: 0 0 0 3px rgba(255, 180, 61, .15); }
.ta-pick:disabled { cursor: default; }
.ta-pick:disabled:not([aria-pressed="true"]) { opacity: .55; }
.ta-bars { display: grid; grid-template-columns: auto 1fr; gap: 2px 6px; align-items: center; font-size: 10px; color: var(--ta-dim); }
.ta-bars i { display: block; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--ta-accent), var(--ta-accent-2)); }
.ta-help { color: var(--ta-dim); font-size: 13px; line-height: 1.5; margin: 6px 0 0; }
.ta-help kbd { background: #1c2532; border: 1px solid var(--ta-line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; font-size: 11px; color: var(--ta-text); font-family: inherit; }
.ta-err { color: #ffd0d0; background: rgba(255, 80, 80, .14); border: 1px solid rgba(255, 80, 80, .35); border-radius: 10px; padding: 8px 12px; margin: 8px 0 0; font-size: 14px; }
.ta-note { color: var(--ta-dim); font-size: 13px; margin: 6px 0; line-height: 1.45; }
.ta-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; flex-wrap: wrap; }
.ta-title h2 { margin: 0; font-size: 24px; font-weight: 900; letter-spacing: -.01em; text-transform: uppercase; }
.ta-share { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; align-items: start; }
.ta-qr { width: 150px; aspect-ratio: 1; padding: 6px; border-radius: 10px; background: #fff; display: grid; place-items: center; }
.ta-qr svg { width: 100%; height: 100%; display: block; }
.ta-share p { margin: 0 0 6px; font-size: 13px; color: var(--ta-dim); }

/* lobby */
.ta-lobby { display: grid; gap: 12px; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; }
.ta-players { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ta-player { display: grid; grid-template-columns: 10px 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; background: #121a24; border-radius: 10px; border-left: 4px solid var(--c, #555); }
.ta-player canvas { width: 34px; height: 28px; }
.ta-player .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-player .meta { font-size: 12px; color: var(--ta-dim); }
.ta-badge { font-size: 11px; font-weight: 800; letter-spacing: .06em; padding: 3px 7px; border-radius: 6px; text-transform: uppercase; background: #232e3b; color: var(--ta-dim); }
.ta-badge.ready { background: rgba(79, 224, 138, .16); color: var(--ta-ok); }
.ta-badge.host { background: rgba(255, 180, 61, .16); color: #ffd28a; }
.ta-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ta-ok); box-shadow: 0 0 8px currentColor; color: var(--ta-ok); }
.ta-dot[data-s="reconnecting"], .ta-dot[data-s="relayed"] { background: var(--ta-accent); color: var(--ta-accent); }
.ta-dot[data-s="disconnected"] { background: var(--ta-bad); color: var(--ta-bad); }
.ta-chat { display: flex; flex-direction: column; gap: 8px; }
.ta-chat-log { height: 150px; overflow-y: auto; background: #0e141c; border-radius: 10px; padding: 8px 10px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.ta-chat-log .m b { color: #ffd28a; margin-right: 6px; }
.ta-chat-log .m.me b { color: var(--ta-blue); }
.ta-chat-log .sys { color: var(--ta-dim); font-style: italic; font-size: 13px; }
.ta-chat form { display: flex; gap: 6px; }
.ta-start { position: sticky; bottom: -22px; margin: 4px -22px -22px; padding: 12px 22px; background: linear-gradient(180deg, rgba(8, 11, 16, 0), rgba(8, 11, 16, .96) 30%); display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.ta-start .why { color: var(--ta-dim); font-size: 13px; margin-right: auto; }

/* results */
.ta-result-head { text-align: center; margin: 10px 0 16px; }
.ta-result-head h2 { font-size: clamp(36px, 7vw, 62px); font-weight: 900; margin: 0; text-transform: uppercase; letter-spacing: -.01em; }
.ta-result-head h2.win { color: #ffd25a; text-shadow: 0 0 30px rgba(255, 190, 60, .45); }
.ta-result-head h2.lose { color: #ff8080; }
.ta-result-head p { color: var(--ta-dim); margin: 6px 0 0; }
.ta-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ta-table th { text-align: left; color: var(--ta-dim); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; padding: 6px 8px; font-weight: 700; }
.ta-table td { padding: 8px; border-top: 1px solid var(--ta-line); }
.ta-table td.n, .ta-table th.n { text-align: right; font-variant-numeric: tabular-nums; }
.ta-table tr.me td { background: rgba(94, 200, 255, .08); }
.ta-table .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.ta-table-wrap { overflow-x: auto; }

/* ---- HUD ---- */
.ta-hud { position: absolute; inset: 0; pointer-events: none; z-index: 3; font-variant-numeric: tabular-nums; }
.ta-hud button, .ta-hud input, .ta-hud form { pointer-events: auto; }
.ta-top { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; }
.ta-pill { background: rgba(8, 12, 18, .72); border: 1px solid var(--ta-line); border-radius: 10px; padding: 6px 12px; font-weight: 800; font-size: 15px; white-space: nowrap; }
.ta-pill.timer { font-size: 20px; min-width: 78px; text-align: center; }
.ta-pill.warn { color: #ff8a8a; }
.ta-pill .r { color: #ff7a70; } .ta-pill .b { color: #6ec0ff; }
.ta-feed { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 4px; max-width: 46%; }
.ta-feed div { background: rgba(8, 12, 18, .72); border-radius: 8px; padding: 4px 9px; font-size: 13px; font-weight: 600; animation: ta-feed 5s forwards; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ta-feed .x { color: var(--ta-dim); margin: 0 6px; font-weight: 500; }
@keyframes ta-feed { 0% { opacity: 0; transform: translateX(-8px); } 6%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.ta-center { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); text-align: center; text-shadow: 0 3px 0 rgba(0, 0, 0, .6); }
.ta-center .big { font-size: clamp(64px, 12vw, 120px); font-weight: 900; color: #ffd25a; line-height: 1; animation: ta-pop .9s ease-out; }
.ta-center .msg { font-size: clamp(18px, 3vw, 26px); font-weight: 800; }
.ta-center .msg small { display: block; font-size: 14px; color: var(--ta-dim); font-weight: 600; margin-top: 4px; }
@keyframes ta-pop { 0% { transform: scale(1.8); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 100% { opacity: .85; } }
.ta-bottom { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; max-width: calc(100% - 24px); }
.ta-hp { background: rgba(8, 12, 18, .78); border: 1px solid var(--ta-line); border-radius: 12px; padding: 8px 12px; min-width: 200px; }
.ta-hp .lbl { white-space: nowrap; display: flex; justify-content: space-between; font-size: 12px; color: var(--ta-dim); font-weight: 700; margin-bottom: 5px; gap: 12px; }
.ta-hp .lbl b { color: var(--ta-text); font-size: 15px; }
.ta-hp .bar { height: 10px; border-radius: 6px; background: #222b36; overflow: hidden; position: relative; }
.ta-hp .bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #36c46e, #6af0a0); border-radius: 6px; transition: width .15s; }
.ta-hp .bar i.mid { background: linear-gradient(90deg, #e3a21a, #ffd25a); } .ta-hp .bar i.low { background: linear-gradient(90deg, #d93636, #ff6b6b); }
.ta-hp .bar s { position: absolute; inset: 0 auto 0 0; background: rgba(110, 210, 255, .55); }
.ta-buffs { display: flex; gap: 6px; }
.ta-buff { background: rgba(8, 12, 18, .78); border: 1px solid var(--ta-line); border-radius: 9px; padding: 5px 9px; font-size: 12px; font-weight: 800; }
.ta-tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }
.ta-ico { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--ta-line); background: rgba(8, 12, 18, .72); color: var(--ta-text); display: grid; place-items: center; cursor: pointer; padding: 0; }
.ta-ico svg { width: 19px; height: 19px; }
.ta-ico:hover { background: rgba(40, 52, 66, .9); }
.ta-hud .ta-tools ~ .ta-feed { top: 10px; }
.ta-board { position: absolute; left: 50%; top: 54px; transform: translateX(-50%); width: min(560px, calc(100% - 20px)); background: var(--ta-panel); border: 1px solid var(--ta-line); border-radius: 14px; padding: 10px 12px; }
.ta-banner { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); background: rgba(255, 180, 61, .95); color: #1a1006; font-weight: 800; font-size: 14px; padding: 7px 14px; border-radius: 10px; }
.ta-chatbox { position: absolute; left: 12px; bottom: 86px; width: min(340px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 6px; }
.ta-chatlines { display: flex; flex-direction: column; gap: 3px; }
.ta-chatlines div { background: rgba(8, 12, 18, .72); border-radius: 7px; padding: 3px 8px; font-size: 13px; animation: ta-feed 9s forwards; overflow-wrap: anywhere; }
.ta-chatlines b { color: #ffd28a; margin-right: 5px; }
.ta-chatbox form { display: flex; gap: 6px; }

/* touch controls */
.ta-touch { position: absolute; inset: 0; z-index: 2; display: none; touch-action: none; }
.ta-stage.playing.touch .ta-touch, .ta-stage.playing.coarse .ta-touch { display: block; }
.ta-stick { position: absolute; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .06); opacity: .55; pointer-events: none; }
.ta-stick[data-stick="move"] { left: 90px; top: calc(100% - 110px); }
.ta-stick[data-stick="aim"] { left: calc(100% - 90px); top: calc(100% - 110px); }
.ta-stick span { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; background: rgba(255, 255, 255, .35); box-shadow: 0 0 16px rgba(255, 255, 255, .25); }
.ta-stick[data-stick="aim"] span { background: rgba(255, 140, 60, .55); }
.ta-stick.on { opacity: 1; }
.ta-fire { position: absolute; right: 22px; top: calc(100% - 250px); width: 70px; height: 70px; border-radius: 50%; border: 2px solid rgba(255, 140, 60, .7); background: rgba(255, 110, 40, .3); color: #fff; font: 800 13px Inter, system-ui, sans-serif; letter-spacing: .06em; touch-action: none; }
.ta-fire.on { background: rgba(255, 110, 40, .65); }
.ta-stage.playing.touch .ta-bottom, .ta-stage.playing.coarse .ta-bottom { left: 50%; transform: translateX(-50%); bottom: auto; top: 104px; justify-content: center; flex-wrap: nowrap; }
.ta-stage.playing.touch .ta-hp, .ta-stage.playing.coarse .ta-hp { min-width: 0; width: 220px; padding: 5px 9px; }
.ta-stage.playing.touch .ta-hp .lbl, .ta-stage.playing.coarse .ta-hp .lbl { font-size: 11px; margin-bottom: 3px; }
.ta-stage.playing.touch .ta-hp .lbl b, .ta-stage.playing.coarse .ta-hp .lbl b { font-size: 12px; }
.ta-stage.playing.touch .ta-hp .bar, .ta-stage.playing.coarse .ta-hp .bar { height: 7px; }
.ta-stage.playing.touch .ta-hp .wpn, .ta-stage.playing.coarse .ta-hp .wpn { display: none; }
.ta-stage.playing.touch .ta-hp, .ta-stage.playing.coarse .ta-hp { background: rgba(8, 12, 18, .6); }
.ta-stage.playing.touch .ta-buffs, .ta-stage.playing.coarse .ta-buffs { position: absolute; top: 100%; margin-top: 4px; left: 0; }
.ta-stage.playing.touch .ta-chatbox, .ta-stage.playing.coarse .ta-chatbox { bottom: 210px; }

.ta-below { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; color: var(--text-2); font-size: 14px; }
.ta-below kbd { font-size: 12px; }

@media (max-width: 760px) {
  .ta-shell { padding: 6px; }
  .ta-stage { height: calc(100svh - 76px); min-height: 520px; border-radius: 12px; }
  .ta-screen { padding: 14px; }
  .ta-start { bottom: -14px; margin: 4px -14px -14px; padding: 10px 14px; }
  .ta-lobby { grid-template-columns: minmax(0, 1fr); }
  .ta-share { grid-template-columns: minmax(0, 1fr); }
  .ta-qr { margin: 0 auto; width: min(200px, 100%); }
  .ta-pill { padding: 4px 9px; font-size: 13px; } .ta-pill.timer { font-size: 16px; min-width: 60px; }
  .ta-top { top: 60px; }
  #hud-mode { display: none; }
  .ta-feed { top: 156px; max-width: 60%; }
  .ta-feed div { font-size: 12px; }
  .ta-tools { right: auto; left: 10px; }
  .ta-board { top: 156px; }
  .ta-banner { top: 156px; }
  .ta-title h2 { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { .ta-screen, .ta-center .big { animation: none; } }
