/* ============================================================
   KUKA Dashboard — Deep Texture Upgrade
   质感体系：暖色多阶阴影 / 多层玻璃拟态 / 微噪点纹理 / 光斑氛围
   间距：4px/8px 网格节奏
   ============================================================ */

:root {
  color-scheme: light;

  /* ── 底色系 ── */
  --bg-0: #ffffff;
  --bg-1: #f8f9fa;
  --bg-2: #f1f3f5;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --line: rgba(0, 0, 0, 0.06);
  --line-strong: rgba(0, 0, 0, 0.10);
  --text: #111418;
  --text-soft: #343a40;
  --muted: #868e96;

  /* ── 品牌色 (暖橙) + 冷色点缀 ── */
  --blue: #ff6b00;
  --blue-deep: #cc5500;
  --blue-soft: #ff8c33;
  --blue-dim: rgba(255, 107, 0, 0.06);
  --cool-accent: #5c7c8a;          /* 冷灰蓝 — 用于次级元素 */
  --cool-accent-dim: rgba(92, 124, 138, 0.06);

  --violet: #ff8c33;
  --gold: #ff6b00;
  --silver: #adb5bd;
  --cyan-dim: rgba(255, 107, 0, 0.06);

  /* ── 多级阴影 (暖色调，模拟真实环境光) ── */
  --shadow-ambient:  0 1px 2px  rgba(200, 80, 20, 0.04);
  --shadow-surface:  0 2px 6px  rgba(180, 60, 10, 0.06);
  --shadow-raised:   0 8px 24px rgba(140, 40,  0, 0.07);
  --shadow-floating: 0 16px 40px rgba(120, 30,  0, 0.10), 0 4px 12px rgba(160, 50, 10, 0.06);
  --shadow-glow:     0 0 32px rgba(255, 107, 0, 0.12);

  --shadow-card:
    var(--shadow-ambient),
    var(--shadow-surface),
    var(--shadow-raised),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --shadow-card-hover:
    0 2px 3px  rgba(200, 80, 20, 0.05),
    0 6px 14px rgba(160, 50, 10, 0.08),
    0 14px 32px rgba(120, 30,  0, 0.10),
    var(--shadow-glow),
    0 0 0 1px var(--rarity-glow, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);

  /* ── 圆角 ── */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* ── 缓动曲线 ── */
  --ease-out:    cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-in-out: cubic-bezier(0.42, 0, 0.58, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── 字体栈 ── */
  --font: "Inter", "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ══════════════════════════════════════════════════════════
   RESET & GLOBAL
   ══════════════════════════════════════════════════════════ */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── 背景：多层径向渐变 + 冷暖交织 + 微光斑 ── */
body {
  background:
    /* 左上暖橙光斑 */
    radial-gradient(ellipse 900px 700px at 8% 0%,  rgba(255, 140, 51, 0.07),  transparent 55%),
    /* 右上冷色光斑 (打破单一色相) */
    radial-gradient(ellipse 700px 600px at 92% 4%,  rgba(130, 160, 175, 0.05), transparent 55%),
    /* 中上暖光 */
    radial-gradient(ellipse 600px 500px at 50% 2%,  rgba(255, 120, 30, 0.04),  transparent 60%),
    /* 左中冷光 */
    radial-gradient(ellipse 500px 500px at 3%  50%, rgba(160, 180, 195, 0.03), transparent 55%),
    /* 右下暖光 */
    radial-gradient(ellipse 700px 500px at 95% 85%, rgba(255, 140, 51, 0.04),  transparent 55%),
    /* 底部基线渐变 */
    linear-gradient(175deg, #fefefe 0%, #f9f7f4 50%, #f4f2ef 100%);
  position: relative;
}

/* ── 背景：超大品牌水印 ── */
body::after {
  content: "KUKA";
  position: fixed;
  inset: 0;
  pointer-events: none;
  font: 900 18vw/1 "Inter", sans-serif;
  letter-spacing: 0.15em;
  color: rgba(255, 107, 0, 0.018);
  transform: rotate(-12deg);
  z-index: -1;
  text-align: center;
}

/* ── 背景：微噪点纹理 + 网格线 (营造纸质感) ── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    /* 网格线 */
    linear-gradient(rgba(0, 0, 0, 0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.010) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 80%);
}

/* ── 背景：浮动光斑 (CSS 动画) ── */
@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.55; }
  33%  { transform: translate(60px, -40px) scale(1.12); opacity: 0.72; }
  66%  { transform: translate(-30px, 20px) scale(0.92); opacity: 0.48; }
}
@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.45; }
  50%  { transform: translate(-70px, 30px) scale(1.08); opacity: 0.62; }
}
.orb-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}
.orb-layer::before,
.orb-layer::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
}
.orb-layer::before {
  width: 500px; height: 500px;
  background: rgba(255, 140, 51, 0.08);
  top: -10%; left: 8%;
  animation: orbFloat1 22s ease-in-out infinite;
}
.orb-layer::after {
  width: 420px; height: 420px;
  background: rgba(130, 160, 175, 0.06);
  bottom: -8%; right: 5%;
  animation: orbFloat2 18s ease-in-out infinite;
}

/* ══════════════════════════════════════════════════════════
   SCROLLBAR — 全局统一
   ══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 107, 0, 0.16);
  border-radius: 3px;
  transition: background 200ms ease;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 107, 0, 0.28); }
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 107, 0, 0.16) transparent;
}

/* ══════════════════════════════════════════════════════════
   BUTTONS & INPUTS
   ══════════════════════════════════════════════════════════ */
button, input, select { font: inherit; }
button {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: #ffffff;
  cursor: pointer;
  transition:
    transform 180ms var(--ease-out),
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    opacity 180ms ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
button:hover {
  transform: translateY(-1px);
  border-color: var(--blue);
  box-shadow:
    0 2px 6px rgba(200, 80, 20, 0.06),
    0 0 0 1px rgba(255, 107, 0, 0.04);
}
button:active {
  transform: translateY(0) scale(0.985);
  transition-duration: 80ms;
}
button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ── select 自定义箭头 ── */
select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: #ffffff;
  outline: none;
  padding: 0 12px;
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23868e96' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
select:hover { border-color: var(--line-strong); }
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.06);
}

/* ══════════════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════════════ */
.app-shell {
  position: relative;
  z-index: 1;
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.view {
  display: none;
  animation: pageIn 360ms var(--ease-out) both;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}
.view-active { display: flex; }

/* ══════════════════════════════════════════════════════════
   SYSTEM BAR
   ══════════════════════════════════════════════════════════ */
.system-bar {
  display: grid;
  grid-template-columns: 1fr minmax(300px, 540px) auto;
  gap: 16px;
  align-items: center;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-sigil {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  color: #ffffff;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.02em;
  background: linear-gradient(145deg, #ffb37a, #ff6b00 45%, #cc5500);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 2px 8px  rgba(255, 107, 0, 0.12),
    0 8px 24px rgba(200, 60,  0, 0.10);
  transition: transform 320ms var(--ease-spring), box-shadow 320ms ease;
}
.brand-sigil:hover {
  transform: scale(1.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 4px 12px rgba(255, 107, 0, 0.18),
    0 12px 32px rgba(200, 60, 0, 0.16);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.06;
  letter-spacing: -0.015em;
  font-weight: 800;
}

/* ── 搜索框 ── */
.command-search {
  position: relative;
  display: block;
}
.command-search input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: none;
  padding: 0 16px 0 44px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color 220ms ease, box-shadow 220ms ease, background 220ms ease;
}
.command-search input:hover {
  border-color: var(--line-strong);
}
.command-search input:focus {
  border-color: var(--blue);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* 搜索图标 (CSS 绘制) */
.command-search span::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 16px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  transition: border-color 200ms ease;
}
.command-search span::after {
  content: "";
  position: absolute;
  left: 27px;
  top: 30px;
  width: 7px;
  height: 2px;
  background: var(--muted);
  transform: rotate(45deg);
  transition: background 200ms ease;
}
.command-search input:focus ~ span::before { border-color: var(--blue); }
.command-search input:focus ~ span::after { background: var(--blue); }

/* ── 操作按钮 ── */
.primary-action, .ghost-action {
  height: 48px;
  padding: 0 20px;
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: var(--radius-md);
}
.primary-action {
  border-color: rgba(255, 107, 0, 0.25);
  color: #ffffff;
  background: linear-gradient(135deg, #ff8c33, #ff6b00);
  box-shadow:
    0 2px 8px  rgba(255, 107, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}
.primary-action:hover {
  border-color: #ff6b00;
  box-shadow:
    0 4px 16px rgba(255, 107, 0, 0.22),
    0 8px 24px rgba(200, 60,  0, 0.14);
  transform: translateY(-2px);
}
.primary-action:active {
  transform: translateY(0) scale(0.975);
  box-shadow: 0 1px 4px rgba(255, 107, 0, 0.10);
}
.ghost-action {
  color: var(--text-soft);
  background: #ffffff;
}
.ghost-action:hover {
  background: var(--bg-2);
  border-color: var(--line-strong);
}

/* ══════════════════════════════════════════════════════════
   HALL LAYOUT
   ══════════════════════════════════════════════════════════ */
.hall-layout {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr) 372px;
  gap: 16px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

/* ══════════════════════════════════════════════════════════
   PANEL — 多层玻璃拟态 + 渐变边框
   ══════════════════════════════════════════════════════════ */
.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    0 1px 2px  rgba(200, 80, 20, 0.03),
    0 4px 12px rgba(160, 50, 10, 0.05);
  backdrop-filter: blur(20px) saturate(1.15) brightness(1.02);
  -webkit-backdrop-filter: blur(20px) saturate(1.15) brightness(1.02);
  transition:
    box-shadow 320ms var(--ease-out),
    border-color 320ms ease;
}
.panel:hover {
  border-color: var(--line-strong);
  box-shadow:
    0 2px 4px  rgba(200, 80, 20, 0.04),
    0 6px 18px rgba(160, 50, 10, 0.06);
}

/* ── Panel 渐变边框描边（内发光） ── */
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    135deg,
    rgba(255, 140, 51, 0.08) 0%,
    transparent 28%,
    transparent 70%,
    rgba(130, 160, 175, 0.05) 100%
  );
  opacity: 0.7;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  padding: 1px;
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* ── Panel 顶层微光 ── */
.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 0%,
    rgba(255, 255, 255, 0.35),
    transparent 60%
  );
  opacity: 0.5;
  transition: opacity 400ms ease;
}
.panel:hover::after { opacity: 0.7; }

.filter-dock, .leaderboard, .main-panel {
  padding: 16px;
  height: 100%;
  overflow-y: auto;
}

/* ══════════════════════════════════════════════════════════
   PANEL HEADINGS
   ══════════════════════════════════════════════════════════ */
.panel-heading, .section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-heading h2, .section-heading h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.panel-heading span, .data-caption {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

/* ── 筛选字段 ── */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.filter-dock .ghost-action { width: 100%; }

/* ══════════════════════════════════════════════════════════
   ENGINEER GRID & CARDS
   ══════════════════════════════════════════════════════════ */
.engineer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(284px, 1fr));
  gap: 16px;
}

.engineer-card {
  position: relative;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 16px;
  min-height: 216px;
  padding: 20px 16px;
  overflow: hidden;
  border: 1.5px solid var(--rarity-line);
  border-radius: var(--radius-lg);

  /* 多层玻璃 + 渐变 */
  background:
    radial-gradient(circle at 0% 0%, var(--rarity-glow), transparent 42%),
    radial-gradient(circle at 100% 100%, rgba(130, 160, 175, 0.03), transparent 50%),
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.96) 0%,
      rgba(252, 250, 248, 0.92) 40%,
      rgba(250, 248, 245, 0.90) 100%
    );
  backdrop-filter: blur(12px) saturate(1.08);
  -webkit-backdrop-filter: blur(12px) saturate(1.08);

  /* 暖色多阶阴影 */
  box-shadow:
    0 1px 2px  rgba(200, 80, 20, 0.04),
    0 4px 8px  rgba(160, 50, 10, 0.05),
    0 8px 20px rgba(120, 30,  0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);

  cursor: pointer;
  transition:
    transform 320ms var(--ease-spring),
    border-color 280ms ease,
    box-shadow 360ms ease;
  animation: cardRise 480ms var(--ease-out) both;
  transform-style: preserve-3d;
  perspective: 1000px;
}

/* 光泽扫过 (hover 触发) */
.engineer-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 28%,
    rgba(255, 255, 255, 0.55) 46%,
    transparent 64%
  );
  transform: translateX(-140%);
  transition: transform 750ms cubic-bezier(0.33, 1, 0.68, 1);
  z-index: 2;
}
.engineer-card:hover::after { transform: translateX(140%); }

/* .engineer-card hover 升级 */
.engineer-card:hover {
  transform: translateY(-6px) rotateX(1.2deg) rotateY(0.4deg);
  border-color: var(--rarity-color);
  box-shadow:
    0 2px 4px  rgba(200, 80, 20, 0.06),
    0 6px 16px rgba(160, 50, 10, 0.09),
    0 14px 36px rgba(120, 30,  0, 0.11),
    0 0 36px var(--rarity-glow, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.engineer-card:active {
  transform: translateY(-2px) scale(0.985);
  transition-duration: 100ms;
}

/* ── 头像节点 ── */
.portrait-node {
  position: relative;
  width: 78px;
  height: 96px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  align-self: start;
  color: #ffffff;
  font-size: 36px;
  font-weight: 900;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.03)),
    linear-gradient(145deg, var(--avatar-a), var(--avatar-b));
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    0 0 24px var(--avatar-glow);
  transition: transform 320ms var(--ease-spring), box-shadow 320ms ease;
}
.engineer-card:hover .portrait-node {
  transform: scale(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 0 32px var(--avatar-glow);
}

/* 稀有度光环 */
.portrait-node::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 16px;
  border: 1px solid var(--rarity-color);
  opacity: 0.32;
  animation: statusBreath 4s ease-in-out infinite;
  transition: opacity 320ms ease;
}
.engineer-card:hover .portrait-node::before {
  opacity: 0.58;
}

/* ── 卡片内容 ── */
.card-main { min-width: 0; }
.card-main h3 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.card-role {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
}

/* ── 指标卡片 ── */
.metric {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: rgba(248, 249, 250, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: border-color 200ms ease, background 200ms ease;
}
.metric:hover {
  border-color: rgba(255, 107, 0, 0.12);
  background: rgba(255, 248, 242, 0.7);
}
.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}
.metric b {
  display: block;
  font-size: 15px;
  overflow-wrap: anywhere;
  font-weight: 700;
}

/* ── 迷你勋章行 ── */
.mini-medals {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: center;
}

.medal-token {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #07111a;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(255, 255, 255, 0.36);
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.85), transparent 18%),
    var(--medal-fill);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.38),
    0 0 20px var(--medal-glow);
  transition: transform 260ms var(--ease-spring);
  will-change: transform;
}
.engineer-card:hover .medal-token {
  transform: scale(1.10);
}
.medal-token::after {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid rgba(7, 17, 26, 0.58);
  border-radius: 5px;
  transform: rotate(45deg);
}

.rarity-legendary .medal-token,
.medal-card.rarity-legendary .medal-token {
  animation: legendaryPulse 3.6s ease-in-out infinite;
}

/* ══════════════════════════════════════════════════════════
   TABS & LEADERBOARD
   ══════════════════════════════════════════════════════════ */
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.tab {
  min-height: 40px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: all 220ms var(--ease-out);
}
.tab:hover {
  color: var(--text-soft);
  background: #ffffff;
  border-color: var(--line);
}
.tab-active {
  color: var(--text);
  border-color: var(--blue);
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(255, 107, 0, 0.05),
    0 2px 8px rgba(0, 0, 0, 0.04);
}

.rank-list { display: grid; gap: 8px; }

.rank-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  transition:
    transform 220ms var(--ease-out),
    border-color 220ms ease,
    background 220ms ease,
    box-shadow 220ms ease;
}
.rank-item:hover {
  transform: translateX(4px);
  border-color: var(--blue);
  background: rgba(255, 248, 242, 0.96);
  box-shadow:
    0 2px 8px rgba(255, 107, 0, 0.06),
    0 4px 16px rgba(200, 80, 20, 0.04);
}

.rank-no {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(241, 243, 245, 0.8);
  font-size: 12px;
  font-weight: 900;
  transition: all 220ms ease;
}
.rank-item:hover .rank-no {
  background: rgba(255, 107, 0, 0.10);
  color: var(--blue);
}
.rank-item.rank-top .rank-no {
  color: #ffffff;
  background: linear-gradient(145deg, #ffb37a, #ff6b00);
  box-shadow: 0 2px 8px rgba(255, 107, 0, 0.20);
}

.rank-copy { min-width: 0; }
.rank-copy strong { display: block; font-size: 14px; }
.rank-copy span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-score {
  color: var(--blue);
  font-size: 20px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  transition: transform 220ms var(--ease-spring);
}
.rank-item:hover .rank-score {
  transform: scale(1.12);
}

/* ══════════════════════════════════════════════════════════
   PROFILE VIEW
   ══════════════════════════════════════════════════════════ */
#profileView {
  overflow-y: auto;
}

.profile-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 396px;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

/* ── Dossier 档案卡 ── */
.dossier {
  min-height: 288px;
  padding: 32px 28px;
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  gap: 32px;
  overflow: hidden;
}
.dossier::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 16% 14%, var(--rarity-glow), transparent 44%);
  transition: opacity 320ms ease;
}

.dossier-portrait {
  position: relative;
  z-index: 1;
  width: 172px;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  align-self: center;
  color: #ffffff;
  font-size: 68px;
  font-weight: 900;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.03)),
    linear-gradient(145deg, var(--avatar-a), var(--avatar-b));
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 0 40px var(--avatar-glow);
  transition: transform 420ms var(--ease-spring), box-shadow 420ms ease;
}
.dossier-portrait:hover {
  transform: scale(1.04);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 0 52px var(--avatar-glow);
}
.dossier-portrait::before {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 20px;
  border: 1px solid var(--rarity-color);
  opacity: 0.42;
  animation: statusBreath 4.2s ease-in-out infinite;
  transition: opacity 320ms ease;
}
.dossier-portrait:hover::before { opacity: 0.68; }

.dossier-copy {
  position: relative;
  z-index: 1;
  align-self: center;
  min-width: 0;
}
.dossier-copy h2 {
  margin: 0 0 8px;
  font-size: clamp(36px, 4.4vw, 56px);
  line-height: 1;
  letter-spacing: -0.02em;
}
.dossier-role {
  margin-bottom: 24px;
  color: var(--blue);
  font-weight: 900;
  font-size: 14px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

/* ── 成就面板 ── */
.achievement-panel {
  padding: 16px;
  height: 100%;
  overflow-y: auto;
}

.score-card {
  padding: 20px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 107, 0, 0.10);
  border-radius: var(--radius-md);
  background: linear-gradient(
    145deg,
    rgba(255, 107, 0, 0.04),
    rgba(255, 255, 255, 0.92)
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition:
    box-shadow 240ms ease,
    border-color 240ms ease;
}
.score-card:hover {
  border-color: rgba(255, 107, 0, 0.18);
  box-shadow:
    0 2px 8px rgba(255, 107, 0, 0.04),
    0 6px 20px rgba(200, 80, 20, 0.05);
}
.score-card span {
  color: var(--muted);
  font-size: 13px;
}
.score-card b {
  display: block;
  margin-top: 8px;
  font-size: 56px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.rarity-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.rarity-stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(248, 249, 250, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition:
    border-color 220ms ease,
    box-shadow 220ms ease;
}
.rarity-stat:hover {
  border-color: var(--rarity-color);
  box-shadow: 0 0 0 1px rgba(255, 107, 0, 0.04);
}
.rarity-stat span {
  color: var(--muted);
  font-size: 12px;
}
.rarity-stat b {
  display: block;
  margin-top: 4px;
  color: var(--rarity-color);
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

/* ── 勋章库 ── */
.medal-vault {
  padding: 16px;
  margin-top: 16px;
  max-height: 360px;
  overflow-y: auto;
  flex-shrink: 0;
}

.medal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 12px;
}

.medal-card {
  position: relative;
  min-height: 160px;
  padding: 20px 16px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  text-align: center;
  border: 1.5px solid var(--rarity-line);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 50% 0%, var(--rarity-glow), transparent 56%),
    linear-gradient(
      160deg,
      rgba(255, 255, 255, 0.94) 0%,
      rgba(250, 249, 247, 0.90) 100%
    );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    0 1px 3px  rgba(200, 80, 20, 0.03),
    0 3px 10px rgba(160, 50, 10, 0.04);
  transition:
    transform 260ms var(--ease-spring),
    border-color 240ms ease,
    box-shadow 280ms ease;
}
.medal-card:hover {
  z-index: 5;
  transform: translateY(-6px) scale(1.03);
  border-color: var(--rarity-color);
  box-shadow:
    0 4px 12px rgba(160, 50, 10, 0.06),
    0 14px 36px rgba(120, 30,  0, 0.09),
    0 0 32px var(--rarity-glow);
}
.medal-card .medal-token {
  width: 64px;
  height: 64px;
  transition: transform 280ms var(--ease-spring);
}
.medal-card:hover .medal-token {
  transform: scale(1.12);
}
.medal-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}
.medal-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

/* ── Tooltip ── */
.tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  width: min(300px, 88vw);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-align: left;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 2px 8px  rgba(200, 80, 20, 0.06),
    0 12px 36px rgba(120, 30,  0, 0.10),
    0 0 24px var(--rarity-glow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 220ms var(--ease-out),
    transform 240ms var(--ease-spring);
}
.tooltip strong {
  display: block;
  margin-bottom: 8px;
  color: var(--rarity-color);
}
.tooltip span {
  display: block;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
}
.medal-card:hover .tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ══════════════════════════════════════════════════════════
   EMPTY / ERROR
   ══════════════════════════════════════════════════════════ */
.empty, .load-error {
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 32px 28px;
  color: var(--muted);
  text-align: center;
  background: rgba(248, 249, 250, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-size: 14px;
}
.load-error {
  display: none;
  margin-bottom: 16px;
  border-color: rgba(255, 77, 79, 0.30);
  color: #c92a2a;
}
.load-error.show { display: block; }

/* ══════════════════════════════════════════════════════════
   MAP
   ══════════════════════════════════════════════════════════ */
.map-container {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
#chinaMap {
  width: 100%;
  height: 100%;
  min-height: 400px;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, #faf8f5, #f0ece6);
  box-shadow:
    0 1px 3px  rgba(200, 80, 20, 0.03),
    0 4px 12px rgba(160, 50, 10, 0.05);
  transition: box-shadow 320ms ease;
}

/* ══════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: modalFadeIn 260ms var(--ease-out) both;
}
.modal-overlay.show {
  display: flex;
}

.modal-dialog {
  width: min(640px, 92vw);
  max-height: 82vh;
  padding: 28px 32px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 4px 16px  rgba(200, 80, 20, 0.05),
    0 12px 40px rgba(120, 30,  0, 0.10),
    0 24px 64px rgba(80,  20,  0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideIn 320ms var(--ease-spring) both;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-shrink: 0;
}
.modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-close {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: all 220ms var(--ease-out);
}
.modal-close:hover {
  color: var(--text);
  background: var(--bg-2);
  border-color: var(--line-strong);
  transform: rotate(90deg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

#rankModalList {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════ */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes cardRise {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes statusBreath {
  0%, 100% { opacity: 0.20; transform: scale(0.985); }
  50%      { opacity: 0.58; transform: scale(1.014); }
}
@keyframes legendaryPulse {
  0%, 100% {
    box-shadow:
      inset 0 1px 1px rgba(255, 255, 255, 0.38),
      0 0 14px rgba(200, 32, 0, 0.18);
  }
  50% {
    box-shadow:
      inset 0 1px 1px rgba(255, 255, 255, 0.50),
      0 0 24px rgba(200, 32, 0, 0.32);
  }
}
@keyframes modalFadeIn {
  from { opacity: 0; }
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(28px) scale(0.95); }
}

/* ══════════════════════════════════════════════════════════
   SKELETON
   ══════════════════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(
    100deg,
    rgba(0, 0, 0, 0.04) 25%,
    rgba(0, 0, 0, 0.02) 50%,
    rgba(0, 0, 0, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card {
  min-height: 216px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 16px;
  background: rgba(255, 255, 255, 0.55);
}
.skeleton-avatar { width: 78px; height: 96px; }
.skeleton-line { height: 14px; margin-bottom: 10px; }
.skeleton-line.short  { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-badge { width: 44px; height: 44px; border-radius: 50%; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 1220px) {
  .hall-layout { grid-template-columns: 264px minmax(0, 1fr); }
  .leaderboard {
    grid-column: 1 / -1;
    height: auto;
    max-height: 380px;
  }
  .profile-layout { grid-template-columns: 1fr; }
}

@media (max-width: 840px) {
  html, body {
    overflow: auto;
    height: auto;
  }
  .app-shell {
    height: auto;
    padding-bottom: 48px;
  }
  .hall-layout { flex: none; }
  .filter-dock, .leaderboard, .main-panel {
    height: auto;
    overflow-y: visible;
  }
  .app-shell { width: min(100% - 24px, 1500px); padding-top: 16px; }
  .system-bar, .hall-layout { grid-template-columns: 1fr; }
  .filter-dock { position: static; }
  .section-heading, .profile-nav { align-items: flex-start; flex-direction: column; }
  .dossier { grid-template-columns: 1fr; }
  .dossier-portrait { width: min(172px, 58vw); }
  .info-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .engineer-grid { grid-template-columns: 1fr; }
  .engineer-card { grid-template-columns: 76px minmax(0, 1fr); }
  .portrait-node { width: 70px; height: 90px; }
  .segmented, .info-grid, .rarity-grid { grid-template-columns: 1fr; }
}
