:root {
  --bg: #0c1317;
  --panel: rgba(15, 25, 32, 0.88);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #eaf2eb;
  --muted: #91a4a2;
  --accent: #f2b84b;
  --accent-strong: #ff8552;
  --grid: rgba(255, 255, 255, 0.06);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.36);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(242, 184, 75, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 133, 82, 0.16), transparent 22%),
    linear-gradient(135deg, #091015 0%, #101b20 48%, #0a1217 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 90%);
}

.app-shell {
  width: min(1400px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h1,
.hero-copy h2,
.panel-heading h3,
.tips-box h4,
.log-panel h4,
.inventory-sections h4 {
  margin: 0;
  font-family: "Trebuchet MS", "Microsoft YaHei", sans-serif;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 12px;
}

.version-badge {
  display: inline-flex;
  align-items: center;
  margin: 0 0 10px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(242, 184, 75, 0.24);
  background: rgba(242, 184, 75, 0.08);
  color: #d8e3dc;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.topbar-stats,
.layout,
.hero-actions,
.panel-heading,
.route-actions,
.raid-status-grid,
.inventory-sections,
.profile-summary {
  display: grid;
  gap: 14px;
}

.topbar-stats {
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  width: min(560px, 100%);
}

.layout {
  grid-template-columns: 1.1fr 1.2fr 1fr;
  grid-template-areas:
    "hero hero live"
    "map map live"
    "inventory market live";
  align-items: start;
}

.panel {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel::after {
  content: "";
  position: absolute;
  inset: auto -30% -70% auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 184, 75, 0.14), transparent 70%);
}

.hero-panel { grid-area: hero; display: flex; justify-content: space-between; gap: 24px; align-items: end; }
.map-panel { grid-area: map; }
.live-panel { grid-area: live; min-height: 100%; }
.inventory-panel { grid-area: inventory; }
.market-panel { grid-area: market; }

.hero-copy { max-width: 720px; }
.hero-copy p:last-child { margin-bottom: 0; color: var(--muted); line-height: 1.7; }
.hero-actions { grid-template-columns: 1fr; min-width: 180px; }

.button {
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease;
}

.button:hover:enabled { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: 0.45; }
.button-primary { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%); color: #101417; }
.button-secondary { background: rgba(255, 255, 255, 0.06); color: var(--text); }

.panel-heading {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 16px;
}

.panel-heading.compact { margin-bottom: 10px; }

.status-pill,
.stat-chip,
.summary-card,
.status-card,
.loot-card,
.tips-box,
.map-node,
.empty-state,
.current-encounter {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.status-pill {
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--accent);
  font-weight: 700;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
}

.map-mode-switch {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.map-mode-btn {
  min-width: 112px;
  padding: 10px 16px;
}

.map-mode-btn.is-active {
  border-color: rgba(242, 184, 75, 0.4);
  background: linear-gradient(135deg, rgba(242, 184, 75, 0.2), rgba(255, 133, 82, 0.16));
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 50%;
}

.spawn { background: #7bc4ff; }
.loot { background: #78d59a; }
.hot { background: #ff9558; }
.exit { background: #ffdf7b; }

.map-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 14px;
}

.map-grid-visual {
  display: block;
}

.map-canvas {
  position: relative;
  min-height: 460px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(10, 20, 22, 0.4), rgba(5, 11, 14, 0.65)),
    radial-gradient(circle at 20% 30%, rgba(120, 213, 154, 0.16), transparent 24%),
    radial-gradient(circle at 75% 25%, rgba(123, 196, 255, 0.14), transparent 20%),
    radial-gradient(circle at 68% 72%, rgba(255, 149, 88, 0.14), transparent 24%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.02) 25%, transparent 25%) 0 0 / 36px 36px,
    linear-gradient(225deg, rgba(255, 255, 255, 0.02) 25%, transparent 25%) 0 0 / 36px 36px;
}

.map-canvas-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.05) 47%, transparent 53%, transparent 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 26%, transparent 74%, rgba(255, 255, 255, 0.03));
  opacity: 0.75;
}

.map-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-link {
  fill: none;
  stroke: rgba(255, 255, 255, 0.26);
  stroke-width: 0.65;
  stroke-linecap: round;
}

.map-link.is-route {
  stroke: rgba(242, 184, 75, 0.95);
  stroke-width: 1.05;
  filter: drop-shadow(0 0 6px rgba(242, 184, 75, 0.35));
}

.map-arrow-head {
  fill: rgba(242, 184, 75, 0.95);
}

.map-node {
  min-height: 112px;
  padding: 16px;
  border-radius: 20px;
  text-align: left;
  color: var(--text);
}

.map-node.clickable:not(:disabled) { cursor: pointer; }
.map-node.clickable:not(:disabled):hover { border-color: rgba(242, 184, 75, 0.7); }
.map-node:disabled { opacity: 1; }
.map-node.type-spawn { box-shadow: inset 0 0 0 1px rgba(123, 196, 255, 0.25); }
.map-node.type-loot { box-shadow: inset 0 0 0 1px rgba(120, 213, 154, 0.2); }
.map-node.type-hot { box-shadow: inset 0 0 0 1px rgba(255, 149, 88, 0.2); }
.map-node.type-exit { box-shadow: inset 0 0 0 1px rgba(255, 223, 123, 0.24); }
.map-node.state-queued { background: linear-gradient(180deg, rgba(242, 184, 75, 0.18), rgba(255, 255, 255, 0.04)); }
.map-node.state-active { background: linear-gradient(180deg, rgba(255, 108, 95, 0.28), rgba(255, 255, 255, 0.04)); }
.map-node.state-cleared { opacity: 0.72; }

.map-node-visual {
  position: absolute;
  width: 132px;
  min-height: 0;
  padding: 14px 14px 12px;
  transform: translate(-50%, -50%);
  z-index: 1;
  backdrop-filter: blur(12px);
}

.map-node-visual.is-next-step {
  border-color: rgba(242, 184, 75, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(242, 184, 75, 0.28),
    0 0 0 3px rgba(242, 184, 75, 0.12),
    0 12px 26px rgba(242, 184, 75, 0.16);
}

.map-node-visual.is-pulsing {
  animation: map-node-pulse 1.8s ease-out infinite;
}

.node-route-hint {
  display: inline-flex;
  align-items: center;
  margin-bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(242, 184, 75, 0.16);
  border: 1px solid rgba(242, 184, 75, 0.34);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

@keyframes map-node-pulse {
  0% {
    box-shadow:
      inset 0 0 0 1px rgba(255, 108, 95, 0.36),
      0 0 0 0 rgba(255, 108, 95, 0.3),
      0 10px 24px rgba(255, 108, 95, 0.18);
  }
  70% {
    box-shadow:
      inset 0 0 0 1px rgba(255, 108, 95, 0.46),
      0 0 0 14px rgba(255, 108, 95, 0),
      0 14px 30px rgba(255, 108, 95, 0.22);
  }
  100% {
    box-shadow:
      inset 0 0 0 1px rgba(255, 108, 95, 0.36),
      0 0 0 0 rgba(255, 108, 95, 0),
      0 10px 24px rgba(255, 108, 95, 0.18);
  }
}

.node-name,
.loot-card p {
  display: block;
  margin: 0 0 10px;
  font-weight: 700;
}

.node-meta,
.loot-card span,
.stat-chip span,
.summary-card span,
.status-card span {
  color: var(--muted);
  font-size: 12px;
}

.route-builder {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.route-summary { max-width: 72%; }
#route-preview { line-height: 1.7; }
.route-actions { grid-template-columns: repeat(2, minmax(120px, 1fr)); align-self: end; }
.loadout-planner {
  flex: 1 1 340px;
  min-width: 300px;
}

.loadout-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.loadout-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 132px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-align: left;
}

.loadout-card.is-active {
  border-color: rgba(255, 196, 107, 0.45);
  background: linear-gradient(180deg, rgba(255, 196, 107, 0.16), rgba(255, 255, 255, 0.05));
  box-shadow: 0 12px 28px rgba(255, 196, 107, 0.12);
}

.loadout-card:disabled {
  opacity: 0.75;
  cursor: default;
}

.loadout-card strong {
  font-size: 15px;
}

.loadout-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.loadout-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.loadout-stat {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 11px;
}

.stat-chip,
.summary-card,
.status-card {
  padding: 14px;
  border-radius: 18px;
}

.stat-chip strong,
.summary-card strong,
.status-card strong,
.loot-card strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.raid-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.progress-wrap { margin: 18px 0; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); }
.progress-bar { height: 12px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.08); }

#raid-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-strong) 100%);
  transition: width 420ms ease;
}

.current-encounter { padding: 14px 16px; border-radius: 18px; margin-bottom: 16px; }
.decision-panel {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
}

.decision-panel.is-replacement-mode {
  border-color: rgba(255, 196, 107, 0.26);
  background:
    linear-gradient(180deg, rgba(255, 196, 107, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.035);
}

.decision-context {
  margin-bottom: 14px;
  color: #d3ddd6;
  line-height: 1.6;
}

.decision-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.decision-actions.is-replacement-layout {
  grid-template-columns: 1fr;
}

.decision-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 96px;
  text-align: left;
}

.decision-action strong {
  font-size: 14px;
}

.decision-action span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.decision-action.is-risky {
  background: linear-gradient(135deg, rgba(255, 149, 88, 0.22), rgba(255, 255, 255, 0.06));
  color: var(--text);
}

.decision-action.is-escape {
  background: linear-gradient(135deg, rgba(123, 196, 255, 0.18), rgba(255, 255, 255, 0.06));
  color: var(--text);
}

.decision-action.is-muted {
  background: rgba(255, 255, 255, 0.05);
}

.decision-action.is-pending {
  border-color: rgba(255, 196, 107, 0.45);
  background: linear-gradient(135deg, rgba(255, 196, 107, 0.2), rgba(255, 255, 255, 0.08));
  box-shadow: 0 10px 24px rgba(255, 196, 107, 0.16);
}

.decision-action:disabled:not(.is-pending) {
  opacity: 0.32;
  filter: saturate(0.7);
}

.decision-action.is-pending:disabled {
  opacity: 1;
  cursor: progress;
}

.decision-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.decision-panel.is-hidden {
  display: none;
}

.replacement-shell,
.replacement-preview,
.replacement-options,
.replacement-metrics {
  display: grid;
  gap: 12px;
}

.replacement-preview,
.replacement-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.replacement-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.replacement-card .section-kicker {
  margin-bottom: 10px;
}

.replacement-card .loot-card {
  min-height: 100%;
}

.replacement-summary-card {
  display: grid;
  gap: 12px;
}

.replacement-bag p {
  margin: 0 0 10px;
  color: #d3ddd6;
  font-weight: 700;
}

.replacement-option {
  min-height: 112px;
}

.replacement-option.is-recommended {
  border-color: rgba(255, 196, 107, 0.48);
  background: linear-gradient(135deg, rgba(255, 196, 107, 0.22), rgba(255, 255, 255, 0.08));
  box-shadow: 0 12px 28px rgba(255, 196, 107, 0.14);
}

.container-feed { margin-bottom: 16px; }
.history-panel { margin-bottom: 16px; }
.log-panel { min-height: 320px; }
.raid-log { display: grid; gap: 10px; max-height: 480px; overflow: auto; }
.raid-log p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: #cfdbd4;
  line-height: 1.5;
}

.log-loot-tag {
  display: inline-flex;
  align-items: center;
  margin: 0 2px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.04);
  font-weight: 700;
  vertical-align: baseline;
}

.inventory-sections { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-list { display: grid; gap: 10px; }

.loot-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
}

.loot-card-item {
  position: relative;
  overflow: hidden;
  border-width: 1px;
}

.loot-card-item::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.9;
}

.loot-rarity-badge,
.loot-inline-chip,
.loot-inline-note {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
}

.loot-rarity-badge {
  margin-top: 2px;
  padding: 7px 10px;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.03);
  font-weight: 700;
}

.loot-inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.loot-inline-chip,
.loot-inline-note {
  padding: 7px 10px;
}

.loot-inline-chip {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #dfe8e2;
}

.loot-inline-chip.is-empty,
.loot-inline-note {
  color: var(--muted);
}

.rarity-tone-common {
  border-color: rgba(159, 176, 171, 0.28);
  background: linear-gradient(135deg, rgba(159, 176, 171, 0.09), rgba(255, 255, 255, 0.03));
}

.rarity-tone-common::before {
  background: linear-gradient(90deg, rgba(159, 176, 171, 0.2), transparent 42%);
}

.rarity-tone-rare {
  border-color: rgba(123, 196, 255, 0.35);
  background: linear-gradient(135deg, rgba(123, 196, 255, 0.14), rgba(255, 255, 255, 0.03));
}

.rarity-tone-rare::before {
  background: linear-gradient(90deg, rgba(123, 196, 255, 0.22), transparent 42%);
}

.rarity-tone-epic {
  border-color: rgba(255, 184, 107, 0.36);
  background: linear-gradient(135deg, rgba(255, 184, 107, 0.14), rgba(255, 255, 255, 0.03));
}

.rarity-tone-epic::before {
  background: linear-gradient(90deg, rgba(255, 184, 107, 0.22), transparent 42%);
}

.rarity-tone-legendary {
  border-color: rgba(255, 226, 125, 0.44);
  background: linear-gradient(135deg, rgba(255, 226, 125, 0.16), rgba(255, 255, 255, 0.03));
  box-shadow: inset 0 0 0 1px rgba(255, 226, 125, 0.1), 0 12px 30px rgba(255, 226, 125, 0.06);
}

.rarity-tone-legendary::before {
  background: linear-gradient(90deg, rgba(255, 226, 125, 0.24), transparent 42%);
}

.empty-state { padding: 16px; border-radius: 16px; color: var(--muted); }
.profile-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
.tips-box { padding: 16px; border-radius: 20px; color: #d3ddd6; line-height: 1.6; }
.tips-box p { margin: 0 0 8px; }
.tips-box p:last-child { margin-bottom: 0; }

.rarity-common { color: #9fb0ab; }
.rarity-rare { color: #7bc4ff; }
.rarity-epic { color: #ffb86b; }
.rarity-legendary { color: #ffe27d; }

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "hero hero"
      "map live"
      "inventory market";
  }
  .topbar { flex-direction: column; }
  .topbar-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-panel { flex-direction: column; align-items: stretch; }
}

@media (max-width: 760px) {
  .app-shell { width: min(100vw - 16px, 100%); padding-top: 16px; }
  .layout {
    grid-template-columns: 1fr;
    grid-template-areas: "hero" "map" "live" "inventory" "market";
  }
  .map-grid,
  .decision-actions,
  .loadout-options,
  .inventory-sections,
  .replacement-preview,
  .replacement-metrics,
  .route-actions,
  .profile-summary,
  .raid-status-grid,
  .topbar-stats {
    grid-template-columns: 1fr;
  }
  .map-mode-switch { flex-direction: column; }
  .map-mode-btn { width: 100%; }
  .map-canvas { min-height: 540px; }
  .map-node-visual { width: 116px; padding: 12px 12px 10px; }
  .route-builder { flex-direction: column; }
  .route-summary { max-width: none; }
}
