:root {
  --bg-deep: #090b10;
  --panel-bg: rgba(14, 17, 24, 0.88);
  --panel-edge: rgba(196, 152, 74, 0.42);
  --panel-edge-strong: rgba(235, 190, 102, 0.72);
  --gold: #ebc06c;
  --gold-soft: #b89452;
  --text-main: #efe9dc;
  --text-dim: #9aa0ad;
  --crimson: #d9383a;
  --mana: #2f7ae5;
  --q-common: #d9dde5;
  --q-fine: #4be384;
  --q-rare: #4da6ff;
  --q-epic: #c77dff;
  --q-legend: #ff8c38;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font);
  user-select: none;
}

#game {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#world {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  outline: none;
}

.vignette {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, transparent 56%, rgba(4, 5, 8, 0.65) 100%);
}

.hud-panel {
  position: absolute;
  background: var(--panel-bg);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 224, 158, 0.12);
  backdrop-filter: blur(8px);
}

/* 顶部栏 */
.topbar {
  position: absolute;
  top: 8px;
  left: 10px;
  right: 10px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: linear-gradient(180deg, rgba(22, 24, 32, 0.94), rgba(11, 13, 19, 0.88));
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  z-index: 45;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-seal {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: linear-gradient(145deg, #b83227, #5b110d);
  border: 1px solid #f2c46d;
  color: #ffe8b3;
  font-weight: 800;
  font-size: 14px;
}

.brand strong {
  display: block;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.brand small {
  display: block;
  font-size: 10px;
  color: var(--text-dim);
}

.realm-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(8, 10, 14, 0.72);
  border: 1px solid rgba(196, 152, 74, 0.28);
  font-size: 12px;
}

.realm-badge .pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ae388;
  box-shadow: 0 0 8px #4ae388;
}

.realm-badge b { color: var(--gold); }

.top-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn {
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid var(--panel-edge);
  background: rgba(25, 29, 40, 0.88);
  color: var(--text-main);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.tool-btn:hover {
  border-color: var(--panel-edge-strong);
  background: rgba(45, 42, 34, 0.92);
}

.tool-btn.back-btn {
  border-color: rgba(235, 192, 108, 0.55);
  color: var(--gold);
}

/* 左上人物名片 */
#hero-card {
  top: 60px;
  left: 10px;
  width: 222px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 12;
}

.hero-crest {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 30%, #c94b35, #47120e);
  border: 1px solid var(--panel-edge-strong);
  font-size: 18px;
  font-weight: 800;
  color: #fde3a4;
}

.hero-meta { flex: 1; min-width: 0; }
.hero-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.hero-title-row strong {
  font-size: 13px;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-title-row em {
  font-style: normal;
  font-size: 11px;
  color: #6fe79c;
  font-weight: 700;
}

.meter {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin-bottom: 4px;
}

.meter.wide { height: 8px; margin: 4px 0 2px; }
.meter > i { display: block; height: 100%; width: 100%; transition: width 0.15s ease; }
.meter.red > i { background: linear-gradient(90deg, #a61e22, #f2544b); }
.meter.blue > i { background: linear-gradient(90deg, #1b4f9c, #4ca2ff); }

.hero-meta > span {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
}

/* 右上地图框 */
#map-card {
  top: 60px;
  right: 10px;
  width: 194px;
  padding: 8px;
  z-index: 12;
}

.map-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.map-header h1 {
  margin: 0;
  font-size: 13px;
  color: var(--gold);
}

.map-header span {
  font-size: 11px;
  color: #84d9a5;
}

#minimap {
  display: block;
  width: 176px;
  height: 126px;
  border: 1px solid rgba(196, 152, 74, 0.35);
  border-radius: 4px;
  background: #0c1015;
  cursor: pointer;
}

.map-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-dim);
}

.mini-btn {
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--panel-edge);
  background: rgba(34, 38, 50, 0.9);
  color: var(--gold);
  font-size: 11px;
  cursor: pointer;
}

/* 右侧悬赏追踪 */
#quest-card {
  top: 254px;
  right: 10px;
  width: 194px;
  padding: 9px 10px;
  z-index: 12;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--gold-soft);
  margin-bottom: 4px;
}

.panel-heading em { font-style: normal; color: var(--text-dim); }
#quest-card strong { display: block; font-size: 13px; color: var(--gold); margin-bottom: 4px; }
#quest-card p { margin: 0 0 8px; font-size: 11.5px; line-height: 1.45; color: var(--text-main); }

.quest-nav-btn {
  width: 100%;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid var(--panel-edge);
  background: linear-gradient(180deg, rgba(94, 58, 22, 0.65), rgba(45, 29, 13, 0.85));
  color: #f9dc98;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.quest-nav-btn:hover { border-color: var(--panel-edge-strong); }

/* 锁定目标栏 */
#target-banner {
  position: absolute;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  width: 248px;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(15, 13, 18, 0.9);
  border: 1px solid rgba(226, 98, 72, 0.65);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  z-index: 13;
}

.target-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.target-top strong { color: #ffcf9e; }
.target-top span {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(217, 56, 58, 0.25);
  color: #ff9c9c;
}

#target-hp-text {
  display: block;
  text-align: center;
  font-size: 10.5px;
  color: var(--text-dim);
}

/* 中央公告 & 提示 */
#center-banner {
  pointer-events: none;
  position: absolute;
  top: 120px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #ffe39a;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.92), 0 0 22px rgba(255, 150, 42, 0.45);
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 15;
}

#center-banner.show { opacity: 1; }

#toast-stack {
  pointer-events: none;
  position: absolute;
  top: 152px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  z-index: 16;
}

.toast-item {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(12, 15, 22, 0.88);
  border: 1px solid rgba(235, 192, 108, 0.45);
  font-size: 12px;
  color: #fff3d2;
  animation: toast-rise 2.4s forwards;
}

@keyframes toast-rise {
  0% { opacity: 0; transform: translateY(6px); }
  12% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* 左下日志盒 */
#log-box {
  left: 10px;
  bottom: 112px;
  width: 280px;
  height: 114px;
  display: flex;
  flex-direction: column;
  padding: 5px 8px;
  z-index: 12;
}

.log-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.log-tab {
  padding: 1px 7px;
  border-radius: 3px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
}

.log-tab.active {
  background: rgba(235, 192, 108, 0.2);
  color: var(--gold);
}

.save-badge {
  margin-left: auto;
  font-size: 10px;
  color: #7ee3a2;
}

#log-list {
  flex: 1;
  overflow-y: auto;
  padding-top: 4px;
  font-size: 11px;
  line-height: 1.45;
}

#log-list .log-row { margin-bottom: 2px; color: #d5d8e0; }
#log-list .log-row.combat { color: #ffae9e; }
#log-list .log-row.loot { color: #ffd97d; }
#log-list .log-row.quest { color: #7ae5ff; }

#control-hint {
  pointer-events: none;
  position: absolute;
  left: 50%;
  bottom: 112px;
  transform: translateX(-50%);
  padding: 3px 10px;
  border-radius: 4px;
  background: rgba(10, 12, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  z-index: 11;
}

/* 底部 1.76 主控台 */
#bottom-hud {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  height: 98px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(180deg, rgba(22, 23, 30, 0.95), rgba(10, 11, 15, 0.96));
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65);
  z-index: 20;
}

.orb-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.orb {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 2px solid var(--gold-soft);
  background: #101218;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.85), 0 0 12px rgba(0, 0, 0, 0.5);
}

.orb-liquid {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  transition: height 0.2s ease;
}

.hp-orb .orb-liquid { background: linear-gradient(180deg, #eb4c42, #7a0e12); }
.mp-orb .orb-liquid { background: linear-gradient(180deg, #4ba3ff, #113a85); }

.orb-label, .orb b {
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 4px #000;
}

.orb-label { font-size: 10px; opacity: 0.9; letter-spacing: 0.08em; }
.orb b { font-size: 11px; }

.quick-pot {
  position: relative;
  width: 38px;
  height: 48px;
  border-radius: 6px;
  border: 1px solid var(--panel-edge);
  background: rgba(18, 22, 30, 0.92);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}

.quick-pot kbd { font-size: 9px; color: var(--text-dim); }
.quick-pot b { font-size: 11px; color: var(--gold); }

.pot-gem {
  width: 14px;
  height: 16px;
  border-radius: 6px 6px 8px 8px;
}

.pot-gem.red { background: radial-gradient(circle at 35% 30%, #ff8b80, #b31919); }
.pot-gem.blue { background: radial-gradient(circle at 35% 30%, #80c9ff, #1650b3); }

.center-console {
  flex: 1;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.console-top {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: var(--text-dim);
}

.console-top b { color: var(--gold); }
.gold-pill b { color: #ffd45e; }
.stone-pill b { color: #8ad8ff; }

.pause-chip {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  font-size: 11px;
  cursor: pointer;
}

.skill-dock {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.skill-btn {
  position: relative;
  height: 44px;
  border-radius: 5px;
  border: 1px solid var(--panel-edge);
  background: linear-gradient(180deg, #252936, #13161e);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}

.skill-btn.locked { opacity: 0.42; filter: grayscale(0.8); }
.skill-btn kbd {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 9px;
  color: var(--text-dim);
}

.skill-glyph { font-size: 15px; line-height: 1.1; }
.skill-glyph.slash { color: #f6d57a; }
.skill-glyph.thrust { color: #67d6ff; }
.skill-glyph.moon { color: #a7c9ff; }
.skill-glyph.fire { color: #ff7940; }

.skill-btn b { font-size: 10.5px; font-weight: 600; margin-top: 1px; }

.cd-mask {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 10, 0.72);
  transform-origin: bottom;
  transform: scaleY(0);
}

.xp-rail {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: #0c0e13;
  border: 1px solid rgba(196, 152, 74, 0.35);
  overflow: hidden;
}

.xp-rail > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8e6118, #f2c85b);
  transition: width 0.2s ease;
}

.xp-rail > span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  color: #fff5db;
  text-shadow: 0 1px 2px #000;
}

.drawer-dock {
  display: grid;
  grid-template-columns: repeat(2, 78px);
  gap: 6px;
}

.drawer-btn {
  height: 36px;
  border-radius: 5px;
  border: 1px solid var(--panel-edge);
  background: linear-gradient(180deg, #27231e, #151419);
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.drawer-btn kbd {
  font-size: 10px;
  color: var(--text-dim);
}

/* 弹窗 & 开屏 */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 11, 0.78);
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 40;
}

.modal-backdrop[hidden] { display: none !important; }

.modal-dialog {
  width: min(760px, 94vw);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  background: #12151d;
  border: 1px solid var(--panel-edge-strong);
  border-radius: 10px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
  overflow: hidden;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(196, 152, 74, 0.28);
  background: rgba(24, 26, 35, 0.9);
}

.modal-head h2 { margin: 0; font-size: 16px; color: var(--gold); }

.close-x {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--panel-edge);
  background: transparent;
  color: var(--text-main);
  font-size: 18px;
  cursor: pointer;
}

.modal-content {
  padding: 16px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.55;
}

/* 开屏面板 */
.welcome-card {
  width: min(560px, 92vw);
  padding: 26px 28px;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 0%, rgba(160, 65, 32, 0.22), transparent 58%), #12151e;
  border: 1px solid var(--panel-edge-strong);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.9);
  text-align: center;
}

.welcome-crest {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(235, 192, 108, 0.45);
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}

.welcome-card h2 {
  margin: 0 0 8px;
  font-size: 32px;
  letter-spacing: 0.18em;
  color: #ffe29f;
  text-shadow: 0 2px 18px rgba(240, 120, 40, 0.35);
}

.welcome-sub {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-dim);
}

.welcome-pillars {
  list-style: none;
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  text-align: left;
  display: grid;
  gap: 8px;
  font-size: 12.5px;
}

.welcome-pillars span { color: var(--gold); margin-right: 6px; }

.welcome-form {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.welcome-form label { font-size: 13px; color: var(--gold); }
.welcome-form input {
  width: 180px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--panel-edge);
  background: #0b0d13;
  color: var(--text-main);
  font-size: 14px;
  text-align: center;
}

.welcome-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.primary-btn {
  padding: 10px 24px;
  border-radius: 6px;
  border: 1px solid #ffd882;
  background: linear-gradient(180deg, #c74729, #7d1f11);
  color: #fff3d2;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.ghost-btn {
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid var(--panel-edge);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
}

.save-summary {
  margin: 12px 0 0;
  font-size: 12px;
  color: #8ee5ae;
}

/* 弹窗内部表格与格子 */
.split-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
}

.equip-grid, .bag-grid {
  display: grid;
  gap: 8px;
}

.equip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bag-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.slot-card, .item-card {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(24, 28, 38, 0.9);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-card.q-common, .slot-card.q-common { border-color: rgba(217, 221, 229, 0.35); }
.item-card.q-fine, .slot-card.q-fine { border-color: rgba(75, 227, 132, 0.55); }
.item-card.q-rare, .slot-card.q-rare { border-color: rgba(77, 166, 255, 0.65); }
.item-card.q-epic, .slot-card.q-epic { border-color: rgba(199, 125, 255, 0.72); }
.item-card.q-legend, .slot-card.q-legend {
  border-color: rgba(255, 140, 56, 0.88);
  box-shadow: inset 0 0 12px rgba(255, 140, 56, 0.18);
}

.q-text-common { color: var(--q-common); }
.q-text-fine { color: var(--q-fine); }
.q-text-rare { color: var(--q-rare); }
.q-text-epic { color: var(--q-epic); }
.q-text-legend { color: var(--q-legend); }

.item-actions {
  margin-top: auto;
  display: flex;
  gap: 5px;
  padding-top: 4px;
}

.act-btn {
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--panel-edge);
  background: rgba(44, 41, 32, 0.9);
  color: var(--gold);
  font-size: 11px;
  cursor: pointer;
}

.act-btn.sell { color: #f6b289; border-color: rgba(246, 178, 137, 0.45); }
.stat-list { display: grid; gap: 6px; padding: 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.04); }
.stat-row { display: flex; justify-content: space-between; font-size: 13px; }
.stat-row b { color: var(--gold); }

.shop-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.world-map-wrap {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.map-node {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--panel-edge);
  background: rgba(255, 255, 255, 0.04);
}
.map-node.current { border-color: #6fe79c; background: rgba(65, 180, 110, 0.12); }

@media (max-width: 960px) {
  #log-box, #control-hint { display: none; }
  .drawer-dock { grid-template-columns: repeat(2, 62px); }
  .split-grid, .world-map-wrap, .shop-list { grid-template-columns: 1fr; }
  .bag-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
