/* ==========================================================================
   EON · TACTICAL RADAR — UI 样式
   ========================================================================== */
:root {
  --bg-0: #05080c;
  --bg-1: #0a1119;
  --bg-2: #101a24;
  --surface: rgba(14, 22, 31, 0.86);
  --surface-solid: #0e161f;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #e9f0f7;
  --text-dim: #8fa1b3;
  --text-faint: #5d7086;

  --accent: #34d399;
  --accent-soft: rgba(52, 211, 153, 0.14);
  --accent-line: rgba(52, 211, 153, 0.42);
  --danger: #ff6b5e;

  --self: #7ee787;
  --ally: #4aa8ff;
  --enemy: #ff5f56;
  --team-0: #f2c35b;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

body[data-game="valorant"] {
  --accent: #f4703f;
  --accent-soft: rgba(244, 112, 63, 0.14);
  --accent-line: rgba(244, 112, 63, 0.42);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select { font-family: inherit; }

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

/* ---------------------------------------------------------------- 顶栏 */
.topbar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(8, 13, 19, 0.96), rgba(8, 13, 19, 0.72));
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  transition: color .3s, background .3s, border-color .3s;
}
.brand__mark svg { width: 21px; height: 21px; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text b { font-size: 15px; letter-spacing: .5px; font-weight: 600; }
.brand__text i {
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 1.6px;
  color: var(--text-faint);
  font-family: var(--mono);
}

/* 游戏切换 */
.switch {
  position: relative;
  display: flex;
  gap: 2px;
  margin-left: auto;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
}
.switch__btn {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color .25s;
  white-space: nowrap;
}
.switch__btn svg { width: 16px; height: 16px; }
.switch__btn.is-active { color: #05100c; }
body[data-game="valorant"] .switch__btn.is-active { color: #1a0800; }
.switch__glider {
  position: absolute;
  top: 4px; left: 0;
  height: calc(100% - 8px);
  border-radius: 9px;
  background: var(--accent);
  box-shadow: 0 6px 20px var(--accent-soft);
  transition: transform .32s cubic-bezier(.34, 1.32, .64, 1), width .32s, background .3s;
  z-index: 1;
}

/* 连接状态 */
.conn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
}
.conn__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #57677a;
  box-shadow: 0 0 0 0 rgba(126, 231, 135, .55);
  transition: background .3s;
}
.conn__dot.is-on {
  background: var(--self);
  animation: pulse 2.1s infinite;
}
.conn__dot.is-warn { background: #f2c35b; animation: pulse 1.4s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(126, 231, 135, .5); }
  70% { box-shadow: 0 0 0 9px rgba(126, 231, 135, 0); }
  100% { box-shadow: 0 0 0 0 rgba(126, 231, 135, 0); }
}
.conn__label { font-size: 12.5px; color: var(--text-dim); }
.conn__btn {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  cursor: pointer;
  transition: .2s;
}
.conn__btn:hover { color: var(--text); background: rgba(255, 255, 255, .12); }
.conn__btn svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- 画布 */
.stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  background:
    radial-gradient(1100px 700px at 50% 0%, #0d1720 0%, #070c12 55%, #04070a 100%);
  cursor: grab;
  touch-action: none;
}
.stage:active { cursor: grabbing; }
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(120, 180, 220, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 180, 220, .045) 1px, transparent 1px);
  background-size: 46px 46px;
  pointer-events: none;
  z-index: 1;
}
#radar-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; }

/* 角落 HUD */
.hud { position: absolute; z-index: 6; pointer-events: none; }
.hud--tl { top: 14px; left: 16px; display: flex; flex-direction: column; gap: 5px; }
.hud--tr { top: 14px; right: 16px; display: flex; gap: 7px; }
.hud--bl {
  bottom: 16px; left: 16px;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 13px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.hud__row { display: flex; align-items: baseline; gap: 8px; }
.hud__k { font-size: 10.5px; letter-spacing: 1.4px; color: var(--text-faint); font-family: var(--mono); }
.hud__v {
  font-size: 14px; font-weight: 600; letter-spacing: .3px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .8);
}
.hud__chip {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-dim);
}
.hud__chip i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); opacity: .9;
}

/* 空状态 */
.stage__empty {
  position: absolute; inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 50%, rgba(6, 11, 16, .55), rgba(4, 7, 10, .9));
  transition: opacity .35s, visibility .35s;
}
.stage__empty.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.stage__empty-card { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 20px; }
.stage__empty-card h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: .5px; }
.stage__empty-card p { margin: 0; font-size: 12.5px; color: var(--text-dim); max-width: 300px; line-height: 1.65; }
.empty__btn {
  margin-top: 6px;
  padding: 10px 26px;
  border-radius: 999px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .2s;
}
.empty__btn:hover { background: var(--accent); color: #05100c; }

.radar-spin {
  width: 92px; height: 92px;
  border-radius: 50%;
  margin-bottom: 4px;
  background:
    conic-gradient(from 0deg, transparent 0deg, var(--accent-soft) 40deg, transparent 90deg),
    radial-gradient(circle, transparent 58%, var(--line-strong) 59%, transparent 60%),
    radial-gradient(circle, transparent 34%, var(--line-strong) 35%, transparent 36%),
    radial-gradient(circle, transparent 8%, var(--line-strong) 9%, transparent 10%);
  animation: spin 3.2s linear infinite;
  position: relative;
}
.radar-spin::after {
  content: "";
  position: absolute; inset: 47%;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 地图加载进度 */
.mapload {
  position: absolute; inset: 0; z-index: 12;
  display: grid; place-items: center;
  background: rgba(4, 7, 10, .78);
  backdrop-filter: blur(6px);
  transition: opacity .3s, visibility .3s;
}
.mapload.is-hidden { opacity: 0; visibility: hidden; }
.mapload__box { width: min(320px, 74vw); text-align: center; }
.mapload__name { font-size: 13.5px; font-weight: 600; margin-bottom: 12px; letter-spacing: .6px; }
.mapload__bar {
  height: 4px; border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, .09);
}
.mapload__bar i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), #8ef0c4);
  border-radius: 999px;
  transition: width .25s;
}
.mapload__pct { margin-top: 9px; font-size: 11.5px; font-family: var(--mono); color: var(--text-dim); }

/* 悬浮工具条 */
.dock {
  position: absolute;
  right: 16px; bottom: 16px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.dock__btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 0; border-radius: 11px;
  background: rgba(255, 255, 255, .05);
  color: var(--text-dim);
  cursor: pointer;
  transition: .18s;
}
.dock__btn svg { width: 18px; height: 18px; }
.dock__btn:hover { background: rgba(255, 255, 255, .11); color: var(--text); }
.dock__btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

/* ---------------------------------------------------------------- 抽屉 */
.drawer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.drawer__scrim {
  position: absolute; inset: 0;
  background: rgba(2, 5, 8, .62);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .3s;
}
.drawer__panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(392px, 92vw);
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 64px rgba(0, 0, 0, .5);
  transform: translateX(102%);
  transition: transform .34s cubic-bezier(.32, .72, 0, 1);
}
.drawer.is-open { pointer-events: auto; }
.drawer.is-open .drawer__scrim { opacity: 1; }
.drawer.is-open .drawer__panel { transform: none; }

.drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  padding-top: max(16px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
}
.drawer__title { font-size: 14.5px; font-weight: 600; letter-spacing: 1px; }
.drawer__close {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border: 0; border-radius: 9px;
  background: rgba(255, 255, 255, .06);
  color: var(--text-dim);
  cursor: pointer;
}
.drawer__close:hover { color: var(--text); background: rgba(255, 255, 255, .12); }
.drawer__close svg { width: 16px; height: 16px; }
.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overscroll-behavior: contain;
}

/* 卡片 */
.card {
  padding: 14px 15px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .028);
  border: 1px solid var(--line);
}
.card__title {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.6px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-family: var(--mono);
}
.card__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.card__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hint { margin: 0; font-size: 11.5px; line-height: 1.7; color: var(--text-faint); word-break: break-all; }

/* 表单 */
.field { display: block; margin-bottom: 11px; }
.field:last-child { margin-bottom: 0; }
.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 11.5px;
  color: var(--text-dim);
  letter-spacing: .3px;
}
.field__label b { color: var(--accent); font-family: var(--mono); font-weight: 600; }
.field__input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, .3);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
}
.field__input::placeholder { color: var(--text-faint); }
.field__input:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select.field__input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%238fa1b3' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px;
  padding-right: 32px;
  cursor: pointer;
}
select.field__input option { background: var(--surface-solid); color: var(--text); }

input.range {
  padding: 0;
  height: 26px;
  border: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
input.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .13);
}
input.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px; height: 15px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0b1219;
  box-shadow: 0 0 10px var(--accent-soft);
}
input.range::-moz-range-track {
  height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .13);
}
input.range::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); border: 2px solid #0b1219;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 0;
  font-size: 12.5px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.check input {
  appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 34px; height: 19px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .13);
  transition: background .25s;
  cursor: pointer;
}
.check input::after {
  content: "";
  position: absolute;
  top: 2.5px; left: 2.5px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #95a7b8;
  transition: transform .25s, background .25s;
}
.check input:checked { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.check input:checked::after { transform: translateX(15px); background: var(--accent); }
.check:hover span { color: var(--text); }

.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row { display: flex; align-items: center; }

/* 按钮 */
.btn {
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: .18s;
}
.btn:hover { background: rgba(255, 255, 255, .11); }
.btn--fill {
  background: var(--accent);
  border-color: var(--accent);
  color: #05100c;
  font-weight: 600;
}
body[data-game="valorant"] .btn--fill { color: #1a0800; }
.btn--fill:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; color: var(--text-dim); }
.btn--ghost:hover { color: var(--text); background: rgba(255, 255, 255, .06); }

/* 提示条 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 90;
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(18, 27, 37, .96);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font-size: 12.5px;
  color: var(--text);
  transform: translate(-50%, 14px);
  opacity: 0;
  visibility: hidden;
  transition: .28s;
  max-width: 84vw;
  text-align: center;
}
.toast.is-show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ------------------------------------------------------------ 响应式 */
@media (max-width: 720px) {
  .brand__text i { display: none; }
  .switch__btn span { display: none; }
  .switch__btn { padding: 9px 13px; }
  .conn__label { display: none; }
  .conn { padding: 5px; }
  .hud--tr { top: auto; bottom: 16px; right: 16px; flex-direction: column; align-items: flex-end; }
  .hud--bl { display: none; }
  .dock { flex-direction: row; right: 50%; transform: translateX(50%); bottom: 14px; }
  .hud__chip { padding: 5px 9px; font-size: 11px; }
  .hud--tl { top: 10px; left: 12px; }
}
@media (max-width: 720px) {
  .drawer__panel {
    top: auto; left: 0; right: 0; bottom: 0;
    width: 100%;
    max-height: 88vh;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 20px 20px 0 0;
    transform: translateY(102%);
  }
  .drawer.is-open .drawer__panel { transform: none; }
  .drawer__body { padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  .toggles { grid-template-columns: 1fr 1fr; }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.18); }
