/* BOT ARENA 3D — same palette as ../index.html, mobile first */

:root {
  --bg: #11120f; --card: #191a16; --ink: #efeee7; --mut: #aaa79a; --line: #30312b;
  --acc: #d7a45b; --danger: #d66c5f; --energy: #7e9fb8; --counter: #b88cff; --evade: #8fe3ff; --shield: #7fb8ff;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, sans-serif; }
a { color: inherit; }
.hidden { display: none !important; }
.mono { font: 11px ui-monospace, monospace; color: var(--mut); }
.w { max-width: 1280px; margin: auto; padding: 16px; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.top a { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }
.top .to2d { padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.hero { padding: 18px 0 12px; }
h1 { font-size: 34px; margin: 6px 0; }
.badge3d { font-size: .42em; vertical-align: super; padding: .12em .45em; border: 1px solid var(--acc); border-radius: 4px; color: var(--acc); letter-spacing: .1em; }
.sub { color: var(--mut); line-height: 1.6; margin: 0; font-size: 14px; }

.layout { display: grid; grid-template-columns: 1fr; gap: 16px; }
.layout > * { min-width: 0; }

/* ---------------------------------------------------------------- stage */
.stage {
  position: relative; width: 100%; aspect-ratio: 4 / 5; max-height: 76vh; min-height: 360px;
  overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #0b0c0a;
  user-select: none; -webkit-user-select: none; scroll-margin-top: 8px;
}
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#view:active { cursor: grabbing; }
.overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.tag { position: absolute; left: 0; top: 0; display: grid; gap: 2px; justify-items: center; font: 700 10px ui-monospace, monospace; text-shadow: 0 1px 3px #000; will-change: transform; }
.tag b { padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.45); }
.tag .mini { display: block; width: 46px; height: 4px; background: rgba(255,255,255,.14); border-radius: 2px; overflow: hidden; }
.tag .mini > i { display: block; height: 100%; width: 100%; background: var(--acc); }
.tag .mini.en { height: 3px; }
.tag .mini.en > i { background: var(--energy); }
.tag.side-b .mini:not(.en) > i { background: var(--danger); }

.float { position: absolute; left: 0; top: 0; font: 800 17px ui-monospace, monospace; text-shadow: 0 2px 4px #000, 0 0 8px rgba(0,0,0,.8); white-space: nowrap; will-change: transform, opacity; }
.float.hit { color: #ffd08a; font-size: 20px; }
.float.miss { color: #c9c5b8; font-size: 13px; }
.float.evade { color: var(--evade); }
.float.counter { color: var(--counter); }
.float.newbot { color: #fff; font-size: 18px; letter-spacing: .08em; text-shadow: 0 0 8px #8fe3ff, 0 2px 4px #000; }
.float.guard { color: var(--shield); font-size: 13px; }

.hud { position: absolute; left: 8px; right: 8px; top: 8px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: start; pointer-events: none; }
.fighter { padding: 7px 8px; border: 1px solid rgba(255,255,255,.08); border-radius: 8px; background: rgba(17,18,15,.72); backdrop-filter: blur(4px); min-width: 0; }
.fighter strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fighter .mono { font-size: 10px; }
.fighter.side-a { border-left: 3px solid var(--acc); }
.fighter.side-b { border-right: 3px solid var(--danger); text-align: right; }
.fighter .bar { position: relative; height: 9px; background: #333; margin-top: 5px; border-radius: 2px; overflow: hidden; }
.fighter .hp { height: 100%; background: var(--acc); transition: width .12s linear; }
.fighter.side-b .hp { background: var(--danger); margin-left: auto; }
.fighter.low .hp { animation: lowhp .6s infinite alternate; }
@keyframes lowhp { to { filter: brightness(1.6); } }
.fighter .hpn { position: absolute; right: 3px; top: -1px; font: 700 9px ui-monospace, monospace; color: #fff; text-shadow: 0 0 3px #000; }
.fighter.side-b .hpn { right: auto; left: 3px; }
.fighter .energy { height: 4px; background: #333; margin-top: 3px; border-radius: 2px; overflow: hidden; }
.fighter .en { height: 100%; background: var(--energy); transition: width .12s linear; }
.fighter.side-b .en { margin-left: auto; }
.turn { display: grid; justify-items: center; gap: 2px; padding: 6px 8px; border-radius: 8px; background: rgba(17,18,15,.72); }
.turn .mono { font-size: 9px; }
.turn b { font: 700 14px ui-monospace, monospace; white-space: nowrap; }

.caption { position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 8px 10px; border-radius: 8px; background: rgba(17,18,15,.78); font-size: 12px; line-height: 1.45; pointer-events: none; min-height: 34px; }
.caption:empty { display: none; }
.side-a > b, .caption b.side-a, b.side-a { color: var(--acc); }
.side-b > b, .caption b.side-b, b.side-b { color: var(--danger); }

.banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 16px 22px; border: 1px solid var(--line); border-radius: 12px; background: rgba(17,18,15,.86); text-align: center; display: grid; gap: 6px; pointer-events: none; max-width: calc(100% - 32px); animation: bannerIn .35s ease-out; }
.banner .big { font-size: 26px; font-weight: 800; }
.banner .wait { color: var(--ink); }
@keyframes bannerIn { from { opacity: 0; transform: translate(-50%, -40%); } }

.camhint { position: absolute; left: 50%; bottom: 54px; transform: translateX(-50%); padding: 6px 10px; border-radius: 999px; background: rgba(0,0,0,.55); font: 11px ui-monospace, monospace; color: var(--mut); white-space: nowrap; pointer-events: none; transition: opacity .5s; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; }
.camhint.gone { opacity: 0; }
.toast { position: absolute; left: 50%; top: 84px; transform: translate(-50%, -8px); padding: 7px 12px; border-radius: 8px; background: rgba(215,164,91,.92); color: #11120f; font: 700 12px ui-monospace, monospace; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.nowebgl { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; text-align: center; padding: 20px; background: #0b0c0a; }
.nowebgl a { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--acc); }

/* ---------------------------------------------------------------- controls */
.controls, .controls2 { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
button { font: inherit; color: inherit; }
.ctl, .seg button { min-width: 44px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; font-size: 15px; }
.ctl.on, .seg button.on { border-color: var(--acc); color: var(--acc); }
.ctl.wide { flex: 1; font-size: 12px; font-family: ui-monospace, monospace; }
.seg { display: flex; flex: 1; gap: 4px; }
.seg button { flex: 1; padding: 0 4px; font: 600 13px ui-monospace, monospace; }
#seek { width: 100%; height: 44px; margin: 6px 0 0; accent-color: var(--acc); background: transparent; }
.err { color: var(--danger); font-size: 13px; }
.log { margin-top: 10px; display: grid; gap: 5px; }
.log div { padding: 7px 9px; background: #141510; border-left: 2px solid var(--line); font-size: 12px; line-height: 1.45; }
.log div.side-a { border-left-color: var(--acc); }
.log div.side-b { border-left-color: var(--danger); }
.log .mono { margin-right: 6px; }
.log strong { margin-right: 5px; color: var(--acc); }
.log div.side-b strong { color: var(--danger); }
.legend { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pill { font: 10px ui-monospace, monospace; padding: 5px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--mut); }

/* ---------------------------------------------------------------- side */
.card { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.mlist { display: grid; gap: 6px; margin-top: 10px; }
.mrow { display: grid; gap: 3px; width: 100%; min-height: 44px; padding: 9px 10px; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: #141510; cursor: pointer; }
.mrow:hover { border-color: #4a4a40; }
.mrow.cur { border-color: var(--acc); background: rgba(215,164,91,.08); }
.mrow .mvs { font-size: 13px; overflow-wrap: anywhere; }
.mrow .mvs b.win { color: var(--acc); }
.mrow .mmeta { font-size: 10px; }
.chip { font: 700 9px ui-monospace, monospace; font-style: normal; padding: 1px 5px; border-radius: 999px; border: 1px solid var(--line); text-shadow: none; }
i.chip.new { color: var(--acc); border-color: #6e5b2d; }
i.chip.now { color: #11120f; background: var(--acc); border-color: var(--acc); }
table { width: 100%; border-collapse: collapse; margin-top: 6px; table-layout: fixed; }
td, th { text-align: left; padding: 7px 5px; border-bottom: 1px solid var(--line); font-size: 12px; overflow-wrap: anywhere; }
th:first-child, td:first-child { width: 28px; }

@media (max-width: 380px) {
  .hide-s { display: none; }
  .hud { grid-template-columns: 1fr 1fr; }
  .turn { grid-column: 1 / -1; grid-row: 2; justify-self: center; padding: 3px 8px; }
}

@media (min-width: 900px) {
  .w { padding: 28px; }
  h1 { font-size: 46px; }
  .layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; }
  .stage { aspect-ratio: 16 / 10; max-height: 72vh; }
  .side .mlist { max-height: 46vh; overflow: auto; }
  .fighter strong { font-size: 15px; }
}

/* NEW chip for the latest season's newcomer */
.newchip { display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 999px; background: #8fe3ff; color: #11120f; font: 800 9px/15px ui-monospace, monospace; font-style: normal; letter-spacing: .06em; vertical-align: middle; text-shadow: none; }
.tag .newchip { line-height: 13px; }
