/* 星罗合弈 · 网页端响应式与桌面端宽屏星夜工作台样式（色板严格对齐 design/ui-style.md） */
:root {
  --wd-night-deep: #070a1c;
  --wd-night: #0b0f26;
  --wd-card: rgba(21, 29, 64, 0.74);
  --wd-card-strong: rgba(27, 38, 69, 0.86);
  --wd-deep: #1b2645;
  --wd-gold: #e9b44c;
  --wd-gold-light: #ffe9a8;
  --wd-gold-dark: #b57f22;
  --wd-coral: #e8654a;
  --wd-coral-light: #f78662;
  --wd-teal: #5fd6cf;
  --wd-star-cold: #8fdcff;
  --wd-light: #fff8ea;
  --wd-cream: #f7eedb;
  --wd-mist: #a9b1c6;
  --wd-soft: #4d5877;
  --wd-ally: #62e36a;
  --wd-foe: #ff5d52;
  --wd-fire: #ff7a52;
  --wd-earth: #e3a554;
  --wd-wind: #43c9b4;
  --wd-water: #79a4ff;
  --wd-border: rgba(255, 248, 234, 0.12);
  --wd-gold-line: rgba(233, 180, 76, 0.34);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: var(--wd-night-deep);
  color: var(--wd-light);
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#safe-probe {
  position: fixed; top: 0; left: 0; width: 0; height: 0; visibility: hidden; pointer-events: none;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* 外层全景容器 */
#web-shell {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wd-night-deep);
}

/* 桌面模式：深空星夜氛围底 + 星轨微光，告别黑底小手机框 */
#web-shell[data-mode="wide"],
#web-shell[data-mode="medium"],
#web-shell[data-mode="focus"] {
  background:
    radial-gradient(ellipse 68% 54% at 50% 14%, rgba(43, 66, 144, 0.42) 0%, rgba(11, 15, 38, 0) 70%),
    radial-gradient(ellipse 46% 42% at 16% 84%, rgba(233, 180, 76, 0.11) 0%, rgba(7, 10, 28, 0) 68%),
    radial-gradient(ellipse 44% 40% at 86% 78%, rgba(95, 214, 207, 0.1) 0%, rgba(7, 10, 28, 0) 68%),
    radial-gradient(circle at 20% 24%, rgba(255, 248, 234, 0.55) 0 1px, transparent 1.5px),
    radial-gradient(circle at 78% 18%, rgba(255, 233, 168, 0.5) 0 1px, transparent 1.5px),
    radial-gradient(circle at 11% 62%, rgba(143, 220, 255, 0.45) 0 1px, transparent 1.5px),
    radial-gradient(circle at 89% 54%, rgba(255, 248, 234, 0.45) 0 1px, transparent 1.5px),
    radial-gradient(circle at 31% 88%, rgba(255, 233, 168, 0.4) 0 1px, transparent 1.5px),
    radial-gradient(circle at 68% 86%, rgba(143, 220, 255, 0.4) 0 1px, transparent 1.5px),
    linear-gradient(180deg, #0b1029 0%, #070a1c 56%, #060918 100%);
  gap: 18px;
  padding: 14px 18px;
}

#web-shell[data-mode="wide"]::before,
#web-shell[data-mode="medium"]::before,
#web-shell[data-mode="focus"]::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, transparent 24%, rgba(233, 180, 76, 0.055) 24.15%, transparent 24.4%),
    radial-gradient(circle at 50% 50%, transparent 40%, rgba(143, 220, 255, 0.04) 40.12%, transparent 40.35%);
}

/* 中央游戏画布舞台 */
#stage {
  position: relative;
  flex: 0 0 auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  border-radius: 18px;
  overflow: hidden;
  background: var(--wd-night-deep);
  z-index: 2;
}
#stage.full {
  width: 100%;
  height: 100%;
  border-radius: 0;
  box-shadow: none;
}
#stage.desktop {
  border-radius: 16px;
  border: 1px solid var(--wd-gold-line);
  box-shadow:
    0 0 0 1px rgba(255, 248, 234, 0.06) inset,
    0 0 42px rgba(233, 180, 76, 0.12),
    0 24px 72px rgba(0, 0, 0, 0.72);
}

canvas { display: block; }

#capsule {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #333;
  font-size: 16px;
  pointer-events: none;
}

/* 左右侧栏：仅在桌面宽屏/中屏显示 */
.wd-rail {
  display: none;
  position: relative;
  z-index: 2;
  flex-direction: column;
  gap: 10px;
  height: min(calc(100vh - 28px), 1040px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(233, 180, 76, 0.28) transparent;
}
.wd-rail::-webkit-scrollbar { width: 4px; }
.wd-rail::-webkit-scrollbar-thumb { background: rgba(233, 180, 76, 0.28); border-radius: 4px; }
.wd-rail::-webkit-scrollbar-track { background: transparent; }

#wd-left { width: 276px; flex: 0 0 276px; }
#wd-right { width: 304px; flex: 0 0 304px; }
@media (min-width: 1360px) {
  #wd-left { width: 296px; flex-basis: 296px; }
  #wd-right { width: 320px; flex-basis: 320px; }
}

#web-shell[data-mode="wide"] #wd-left,
#web-shell[data-mode="wide"] #wd-right { display: flex; }
#web-shell[data-mode="medium"] #wd-right { display: flex; width: 300px; flex-basis: 300px; }

/* 专注模式悬浮还原条（#wd-float 是 #web-shell 的后续兄弟节点） */
#wd-float {
  display: none;
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 20;
  gap: 6px;
  align-items: center;
}
#web-shell[data-mode="focus"] ~ #wd-float { display: flex; }

/* 通用星夜琉璃卡片 */
.wd-card {
  background: linear-gradient(180deg, rgba(27, 38, 69, 0.78) 0%, rgba(11, 15, 38, 0.86) 100%);
  border: 1px solid var(--wd-border);
  border-radius: 14px;
  padding: 12px 13px;
  box-shadow: 0 10px 28px rgba(4, 6, 18, 0.42), inset 0 1px 0 rgba(255, 248, 234, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.wd-card-gold { border-color: rgba(233, 180, 76, 0.34); }

/* 品牌顶卡 */
.wd-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.wd-brand-title {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(180deg, #fff8ea 0%, #ffe9a8 58%, #e9b44c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.wd-brand-sub {
  font-size: 11px;
  color: var(--wd-mist);
  margin-top: 2px;
}
.wd-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(7, 10, 28, 0.65);
  border: 1px solid rgba(255, 248, 234, 0.14);
  color: var(--wd-cream);
}
.wd-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wd-soft);
}
.wd-dot.on { background: var(--wd-ally); box-shadow: 0 0 6px var(--wd-ally); }
.wd-dot.warn { background: var(--wd-gold); box-shadow: 0 0 6px var(--wd-gold); }

/* 分节标题（同 Look.section：暖金字 + 渐隐金线） */
.wd-sec {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--wd-gold-light);
}
.wd-sec::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(233, 180, 76, 0.45), rgba(233, 180, 76, 0));
}
.wd-sec-note {
  font-size: 10px;
  font-weight: 600;
  color: var(--wd-mist);
}

/* 顶部 PC 快捷工具条 */
.wd-toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
}
.wd-tbtn {
  flex: 1;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(255, 248, 234, 0.14);
  background: linear-gradient(180deg, rgba(39, 54, 92, 0.72), rgba(11, 15, 38, 0.85));
  color: var(--wd-cream);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  padding: 0 8px;
  white-space: nowrap;
}
.wd-tbtn:hover {
  border-color: rgba(233, 180, 76, 0.55);
  color: var(--wd-gold-light);
  background: linear-gradient(180deg, rgba(43, 66, 144, 0.82), rgba(18, 28, 70, 0.92));
}
.wd-tbtn:active { transform: translateY(1px); }
.wd-tbtn.active {
  border-color: rgba(233, 180, 76, 0.75);
  color: var(--wd-gold-light);
  background: rgba(233, 180, 76, 0.18);
}

/* 导航按钮 */
.wd-nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.wd-nav-btn {
  position: relative;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 248, 234, 0.12);
  background: rgba(7, 10, 28, 0.52);
  color: var(--wd-cream);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  transition: all 0.15s;
}
.wd-nav-btn:hover {
  border-color: rgba(233, 180, 76, 0.45);
  background: rgba(39, 54, 92, 0.6);
}
.wd-nav-btn.on {
  border-color: rgba(233, 180, 76, 0.8);
  background: linear-gradient(180deg, rgba(233, 180, 76, 0.24), rgba(181, 127, 34, 0.14));
  color: var(--wd-gold-light);
  box-shadow: inset 0 0 12px rgba(233, 180, 76, 0.12);
}
.wd-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--wd-coral);
  color: var(--wd-light);
  font-size: 10px;
  font-weight: 900;
  margin-left: 4px;
}

.wd-sub-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.wd-sub-btn {
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255, 248, 234, 0.1);
  background: rgba(255, 248, 234, 0.04);
  color: var(--wd-mist);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.wd-sub-btn:hover {
  color: var(--wd-gold-light);
  border-color: rgba(233, 180, 76, 0.4);
  background: rgba(233, 180, 76, 0.1);
}

/* 预设分段 */
.wd-seg {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(7, 10, 28, 0.6);
  border: 1px solid rgba(255, 248, 234, 0.1);
}
.wd-seg-btn {
  flex: 1;
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--wd-mist);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}
.wd-seg-btn:hover { color: var(--wd-light); }
.wd-seg-btn.on {
  background: linear-gradient(180deg, var(--wd-gold-light), var(--wd-gold));
  color: var(--wd-deep);
}

/* 星象标签 & 胶囊 */
.wd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.wd-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(7, 10, 28, 0.56);
  border: 1px solid rgba(255, 248, 234, 0.14);
  color: var(--wd-cream);
}
.wd-chip.el-fire { border-color: rgba(255, 122, 82, 0.55); color: var(--wd-fire); }
.wd-chip.el-earth { border-color: rgba(227, 165, 84, 0.55); color: var(--wd-earth); }
.wd-chip.el-wind { border-color: rgba(67, 201, 180, 0.55); color: var(--wd-wind); }
.wd-chip.el-water { border-color: rgba(121, 164, 255, 0.55); color: var(--wd-water); }
.wd-chip.pair { border-color: rgba(233, 180, 76, 0.48); color: var(--wd-gold-light); background: rgba(233, 180, 76, 0.1); }
.wd-chip.dim { opacity: 0.45; }

/* 对局：星链进度行 */
.wd-chain-row {
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(7, 10, 28, 0.48);
  border-left: 3px solid var(--wd-gold);
  margin-bottom: 6px;
}
.wd-chain-row:last-child { margin-bottom: 0; }
.wd-chain-row.el-fire { border-left-color: var(--wd-fire); }
.wd-chain-row.el-earth { border-left-color: var(--wd-earth); }
.wd-chain-row.el-wind { border-left-color: var(--wd-wind); }
.wd-chain-row.el-water { border-left-color: var(--wd-water); }
.wd-chain-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
}
.wd-chain-sub {
  font-size: 10.5px;
  color: var(--wd-mist);
  margin-top: 3px;
  line-height: 1.4;
}
.wd-bar-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 248, 234, 0.1);
  overflow: hidden;
  margin-top: 5px;
}
.wd-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--wd-gold), var(--wd-gold-light));
  transition: width 0.2s ease;
}

/* 星卡清单 */
.wd-buff-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
}
.wd-buff-item {
  padding: 6px 8px;
  border-radius: 9px;
  background: rgba(7, 10, 28, 0.5);
  border: 1px solid rgba(255, 248, 234, 0.1);
}
.wd-buff-item.rar-rare { border-color: rgba(111, 196, 255, 0.45); }
.wd-buff-item.rar-legend { border-color: rgba(233, 180, 76, 0.6); background: rgba(233, 180, 76, 0.08); }
.wd-buff-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--wd-gold-light);
}
.wd-buff-desc {
  font-size: 10.5px;
  color: var(--wd-mist);
  line-height: 1.4;
  margin-top: 2px;
}

/* 右侧：单位实时详卡检视器 */
.wd-ins-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.wd-ins-name {
  font-size: 16px;
  font-weight: 900;
  color: var(--wd-light);
  display: flex;
  align-items: center;
  gap: 6px;
}
.wd-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  background: rgba(255, 248, 234, 0.1);
  color: var(--wd-cream);
}
.wd-pill.ally { background: rgba(98, 227, 106, 0.18); color: var(--wd-ally); }
.wd-pill.foe { background: rgba(255, 93, 82, 0.2); color: var(--wd-coral-light); }
.wd-pill.gold { background: rgba(233, 180, 76, 0.22); color: var(--wd-gold-light); }

.wd-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 8px;
}
.wd-stat-box {
  background: rgba(7, 10, 28, 0.56);
  border: 1px solid rgba(255, 248, 234, 0.08);
  border-radius: 8px;
  padding: 5px 4px;
  text-align: center;
}
.wd-stat-k { font-size: 9.5px; color: var(--wd-mist); }
.wd-stat-v { font-size: 12px; font-weight: 900; color: var(--wd-gold-light); margin-top: 1px; }

/* 5×4 迷你星图 */
.wd-map-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(7, 10, 28, 0.48);
}
.wd-map {
  display: grid;
  grid-template-columns: repeat(5, 13px);
  grid-template-rows: repeat(4, 11px);
  gap: 2px;
  flex: 0 0 auto;
}
.wd-cell {
  border-radius: 2.5px;
  background: rgba(255, 248, 234, 0.08);
}
.wd-cell.self { background: var(--wd-gold-light); box-shadow: 0 0 6px var(--wd-gold); }
.wd-cell.hit { background: rgba(233, 180, 76, 0.45); border: 1px solid var(--wd-gold-light); }
.wd-map-info { font-size: 11px; color: var(--wd-cream); line-height: 1.45; }
.wd-map-sub { font-size: 10px; color: var(--wd-mist); margin-top: 2px; }

.wd-skill-box {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 9px;
  background: rgba(7, 10, 28, 0.45);
  border-left: 2.5px solid rgba(233, 180, 76, 0.55);
}
.wd-skill-title {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--wd-gold-light);
}
.wd-skill-desc {
  font-size: 10.5px;
  color: var(--wd-cream);
  line-height: 1.45;
  margin-top: 2px;
}

/* 交战实时输出榜 */
.wd-dps-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  font-size: 11px;
}
.wd-dps-name {
  width: 58px;
  flex: 0 0 58px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wd-dps-bar {
  flex: 1;
  height: 12px;
  border-radius: 6px;
  background: rgba(7, 10, 28, 0.62);
  overflow: hidden;
}
.wd-dps-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.16s linear;
}
.wd-dps-fill.ally { background: linear-gradient(90deg, #b57f22, #ffe9a8); }
.wd-dps-fill.foe { background: linear-gradient(90deg, #1f7a7a, #5fd6cf); }
.wd-dps-val {
  width: 42px;
  flex: 0 0 42px;
  text-align: right;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--wd-cream);
}

/* 快捷键提示 */
.wd-keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 8px;
}
.wd-key-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--wd-mist);
}
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 5px;
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 800;
  color: var(--wd-gold-light);
  background: rgba(7, 10, 28, 0.78);
  border: 1px solid rgba(233, 180, 76, 0.35);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

/* 行动按钮（召唤/准备完毕快捷） */
.wd-action-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.wd-cta {
  flex: 1;
  height: 32px;
  border-radius: 9px;
  border: 1px solid rgba(255, 233, 168, 0.55);
  background: linear-gradient(180deg, var(--wd-coral-light), var(--wd-coral));
  color: var(--wd-light);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.wd-cta:disabled { opacity: 0.42; cursor: not-allowed; }
.wd-cta-sec {
  background: linear-gradient(180deg, #2b4290, #121c46);
  color: var(--wd-gold-light);
}

/* 轻量 FPS / 3D / RTT 诊断浮标（桌面停靠左上角，手机停靠右上角避开左上 Lv 头像） */
#wd-fps {
  display: none;
  position: fixed;
  top: max(6px, env(safe-area-inset-top, 6px));
  left: 12px;
  z-index: 40;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(7, 10, 28, 0.86);
  border: 1px solid rgba(233, 180, 76, 0.45);
  color: var(--wd-gold-light);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  font-weight: 700;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
#wd-fps.on { display: block; }
#web-shell[data-mode="mobile"] ~ #wd-fps { left: auto; right: 8px; }

/* 左侧出战阵容守护者快捷列表 */
.wd-roster {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 9px;
}
.wd-roster-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 248, 234, 0.1);
  border-left: 3px solid var(--wd-gold);
  background: rgba(7, 10, 28, 0.5);
  color: var(--wd-light);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.wd-roster-btn:hover {
  background: rgba(39, 54, 92, 0.65);
  border-color: rgba(233, 180, 76, 0.5);
}
.wd-roster-btn.el-fire { border-left-color: var(--wd-fire); }
.wd-roster-btn.el-earth { border-left-color: var(--wd-earth); }
.wd-roster-btn.el-wind { border-left-color: var(--wd-wind); }
.wd-roster-btn.el-water { border-left-color: var(--wd-water); }
.wd-roster-sub { font-size: 10px; font-weight: 600; color: var(--wd-mist); }

.wd-empty {
  font-size: 11px;
  color: var(--wd-mist);
  padding: 6px 2px;
  line-height: 1.5;
}
