/* ── 凡尘问道 · 黑金 / 鎏金双主题 ─────────────────────────── */
:root {
  --gold: #d4af37;
  --gold-bright: #f5d678;
  --gold-dim: #8a6d2f;
  --danger: #c0584a;
  --ok: #5fa85f;

  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
}

/* 暗色（默认·墨夜鎏金） */
:root[data-theme="dark"] {
  --bg: #07070b;
  --bg-grad1: rgba(212, 175, 55, 0.10);
  --bg-grad2: rgba(212, 175, 55, 0.06);
  --panel: rgba(20, 18, 24, 0.92);
  --panel-2: rgba(0, 0, 0, 0.28);
  --panel-edge: #2a2418;
  --text: #e8dfc8;
  --text-dim: #9a8f74;
  --inset: rgba(212, 175, 55, 0.12);
}

/* 亮色（云宣纸·淡金） */
:root[data-theme="light"] {
  --bg: #f3ede0;
  --bg-grad1: rgba(180, 140, 40, 0.14);
  --bg-grad2: rgba(180, 140, 40, 0.08);
  --panel: rgba(255, 252, 245, 0.95);
  --panel-2: rgba(120, 95, 30, 0.06);
  --panel-edge: #d8c79c;
  --text: #463a22;
  --text-dim: #8a7a52;
  --gold: #a8842c;
  --gold-bright: #b8860b;
  --gold-dim: #c9b272;
  --inset: rgba(168, 132, 44, 0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: "Noto Serif SC", "STKaiti", "KaiTi", "SimSun", serif;
  color: var(--text);
  background:
    radial-gradient(ellipse 60% 40% at 50% -5%, var(--bg-grad1), transparent 70%),
    radial-gradient(ellipse 50% 35% at 85% 105%, var(--bg-grad2), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  transition: background-color 0.4s, color 0.4s;
}

.hidden { display: none !important; }
.gold { color: var(--gold-bright); }

/* ── 鎏金面板（圆角 + 金角） ─────────────────────────────── */
.ornate {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px var(--inset), 0 8px 28px rgba(0, 0, 0, 0.35);
}
.ornate::before, .ornate::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border-color: var(--gold);
  border-style: solid;
  opacity: 0.8;
}
.ornate::before { top: 6px; left: 6px; border-width: 2px 0 0 2px; border-top-left-radius: 6px; }
.ornate::after { bottom: 6px; right: 6px; border-width: 0 2px 2px 0; border-bottom-right-radius: 6px; }

.panel { padding: 22px; }
.panel-title, .sub-title {
  font-weight: normal;
  letter-spacing: 5px;
  color: var(--gold);
  text-align: center;
}
.panel-title {
  font-size: 15px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--inset);
}
.sub-title { font-size: 14px; margin: 22px 0 12px; letter-spacing: 3px; text-align: left; }

/* ── 按钮 ────────────────────────────────────────────────── */
.btn {
  font-family: inherit; font-size: 14px; letter-spacing: 3px;
  padding: 9px 18px; cursor: pointer; transition: all 0.2s;
  background: transparent; border: 1px solid var(--gold-dim); color: var(--gold);
  border-radius: var(--radius-sm);
}
.btn:hover { border-color: var(--gold-bright); color: var(--gold-bright); box-shadow: 0 0 12px var(--inset); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
.btn-gold {
  background: linear-gradient(160deg, var(--gold), var(--gold-dim));
  color: #1a1408; border: 1px solid var(--gold-bright); font-weight: bold;
}
.btn-gold:hover { filter: brightness(1.12); }
.btn-gold:disabled:hover { filter: none; }
.btn-ghost { border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--gold); box-shadow: none; }
.btn-block { display: block; width: 100%; margin-top: 12px; }
.btn-sm { padding: 5px 12px; font-size: 12px; letter-spacing: 2px; border-radius: var(--radius-sm); }

.theme-toggle {
  background: var(--panel-2); border: 1px solid var(--panel-edge); color: var(--gold);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 16px;
  transition: all 0.2s;
}
.theme-toggle:hover { border-color: var(--gold); transform: rotate(20deg); }

/* ── 登录界面 ─────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-panel { width: 390px; padding: 44px 40px; position: relative; }
.auth-panel .theme-toggle { position: absolute; top: 16px; right: 16px; }

.game-title {
  font-size: 52px; font-weight: normal; text-align: center; letter-spacing: 10px;
  background: linear-gradient(180deg, var(--gold-bright) 10%, var(--gold) 45%, var(--gold-dim) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 30px var(--inset);
}
.game-subtitle { text-align: center; color: var(--text-dim); letter-spacing: 6px; font-size: 13px; margin: 10px 0 28px; }

.auth-tabs { display: flex; border-bottom: 1px solid var(--inset); margin-bottom: 22px; }
.auth-tab {
  flex: 1; background: none; border: none; font-family: inherit; font-size: 15px;
  letter-spacing: 4px; color: var(--text-dim); padding: 10px; cursor: pointer;
}
.auth-tab.active { color: var(--gold-bright); border-bottom: 2px solid var(--gold); margin-bottom: -1px; }

.auth-form label { display: block; font-size: 13px; color: var(--text-dim); letter-spacing: 4px; margin: 14px 0 6px; }
.auth-form input {
  width: 100%; background: var(--panel-2); border: 1px solid var(--panel-edge);
  color: var(--text); font-family: inherit; font-size: 15px; padding: 11px 12px;
  outline: none; border-radius: var(--radius-sm);
}
.auth-form input:focus { border-color: var(--gold-dim); box-shadow: 0 0 8px var(--inset); }
.auth-form .btn-block { margin-top: 26px; padding: 12px; font-size: 16px; }
.auth-error { color: var(--danger); font-size: 13px; text-align: center; margin-top: 14px; min-height: 18px; }

/* ── 游戏界面 ─────────────────────────────────────────────── */
.game-wrap { max-width: 1320px; margin: 0 auto; padding: 18px; }
.game-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; margin-bottom: 18px;
  background: var(--panel); border: 1px solid var(--panel-edge);
  border-radius: var(--radius-lg); box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.header-title {
  font-size: 24px; letter-spacing: 6px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-dim));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.header-info { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.header-info .stones b { color: var(--gold-bright); font-size: 16px; }

.game-grid { display: grid; grid-template-columns: 290px 1fr 300px; gap: 18px; align-items: start; }

/* 角色立绘 */
.avatar-frame {
  position: relative; width: 168px; height: 168px; margin: 4px auto 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, var(--panel-2), transparent 70%);
  border: 1px solid var(--inset); display: flex; align-items: center; justify-content: center;
}
.avatar { width: 150px; height: 150px; }
.avatar-state {
  position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  font-size: 12px; letter-spacing: 2px; color: var(--gold);
  background: var(--panel); padding: 2px 12px; border-radius: 999px; border: 1px solid var(--panel-edge);
}

.char-name { text-align: center; font-size: 22px; letter-spacing: 3px; }
.char-realm { text-align: center; font-size: 16px; margin: 6px 0 2px; letter-spacing: 2px; }
.char-root { text-align: center; font-size: 13px; color: var(--text-dim); }
.char-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 12px 0 4px; }
.chip {
  font-size: 11px; letter-spacing: 1px; color: var(--gold);
  background: var(--panel-2); border: 1px solid var(--inset);
  padding: 3px 9px; border-radius: 999px;
}

.qi-block { margin: 14px 0 18px; }
.qi-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.qi-bar { height: 14px; background: var(--panel-2); border: 1px solid var(--panel-edge); border-radius: 999px; overflow: hidden; }
.qi-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold), var(--gold-bright));
  background-size: 200% 100%; animation: shimmer 3s linear infinite; transition: width 0.5s;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.qi-rate { font-size: 12px; color: var(--text-dim); margin-top: 6px; text-align: right; }
.bt-hint { font-size: 12px; color: var(--text-dim); text-align: center; margin-top: 10px; min-height: 16px; }

/* 标签页 */
.tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--inset); margin-bottom: 16px; }
.tab {
  background: none; border: none; font-family: inherit; font-size: 15px; letter-spacing: 3px;
  color: var(--text-dim); padding: 8px 20px; cursor: pointer;
}
.tab.active { color: var(--gold-bright); border-bottom: 2px solid var(--gold); margin-bottom: -1px; }

/* 探险 / 副本 */
.exp-active {
  text-align: center; padding: 18px; margin-bottom: 18px;
  border: 1px dashed var(--gold-dim); background: var(--panel-2); border-radius: var(--radius);
}
.exp-active-title { font-size: 15px; letter-spacing: 1px; }
.exp-countdown { font-size: 30px; color: var(--gold-bright); margin: 10px 0; letter-spacing: 3px; font-variant-numeric: tabular-nums; }

.dungeon-cat { margin-bottom: 18px; }
.dungeon-cat h4 {
  font-size: 13px; font-weight: normal; letter-spacing: 3px; color: var(--gold-dim);
  margin-bottom: 10px; padding-left: 4px; border-left: 3px solid var(--gold-dim);
}
.dungeon-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dungeon-card {
  border: 1px solid var(--panel-edge); padding: 15px; background: var(--panel-2);
  border-radius: var(--radius); transition: border-color .2s, transform .15s; position: relative;
}
.dungeon-card:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.dungeon-card.locked { opacity: .45; }
.dungeon-card h3 { font-size: 16px; font-weight: normal; letter-spacing: 1px; color: var(--gold); }
.dungeon-card .d-meta { font-size: 12px; color: var(--text-dim); margin: 4px 0 8px; }
.dungeon-card p { font-size: 12.5px; color: var(--text-dim); line-height: 1.6; min-height: 40px; }
.dungeon-card .btn { margin-top: 10px; width: 100%; }
.d-badge {
  position: absolute; top: 10px; right: 10px; font-size: 10px; letter-spacing: 1px;
  padding: 2px 7px; border-radius: 999px; border: 1px solid var(--gold-dim); color: var(--gold);
}
.d-badge.first { color: var(--ok); border-color: var(--ok); }

/* 背包 / 坊市 / 装备列表 */
.item-list { display: flex; flex-direction: column; gap: 10px; }
.item-row {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--panel-edge); background: var(--panel-2);
  padding: 12px 16px; border-radius: var(--radius);
}
.item-row .item-info { flex: 1; }
.item-row .item-name { font-size: 15px; color: var(--gold); letter-spacing: 1px; }
.item-row .item-name b { color: var(--text); font-size: 13px; margin-left: 8px; }
.item-row .item-desc { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.item-row .item-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.empty-hint { text-align: center; color: var(--text-dim); padding: 36px 0; font-size: 14px; letter-spacing: 2px; }

/* 装备槽位 */
.equip-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.slot-card {
  border: 1px solid var(--panel-edge); border-radius: var(--radius); padding: 14px 12px;
  text-align: center; background: var(--panel-2); min-height: 110px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
}
.slot-card .slot-label { font-size: 12px; color: var(--text-dim); letter-spacing: 2px; }
.slot-card .slot-name { font-size: 15px; letter-spacing: 1px; }
.slot-card .slot-empty { color: var(--text-dim); font-size: 13px; }
.slot-card .slot-affix { font-size: 11px; color: var(--text-dim); }

.equip-affixes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.equip-affixes .aff { font-size: 11px; color: var(--ok); }
.equip-affixes .aff.match { color: var(--gold-bright); }

.tech-intro { font-size: 13px; color: var(--text-dim); line-height: 1.7; margin-bottom: 14px; }

/* 衣坊 / 换装 */
.wardrobe-slot { margin-bottom: 18px; }
.wardrobe-slot h4 {
  font-size: 13px; font-weight: normal; letter-spacing: 3px; color: var(--gold-dim);
  margin-bottom: 10px; padding-left: 4px; border-left: 3px solid var(--gold-dim);
}
.cos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.cos-cell {
  border: 1px solid var(--panel-edge); border-radius: var(--radius); background: var(--panel-2);
  padding: 12px 8px; text-align: center; transition: border-color .2s;
}
.cos-cell:hover { border-color: var(--gold-dim); }
.cos-cell.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--inset); }
.cos-swatch {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--inset);
  margin-bottom: 8px; font-size: 11px; color: var(--text-dim);
}
.cos-swatch.none { background: var(--panel-2); }
.cos-name { font-size: 13px; letter-spacing: 1px; margin-bottom: 8px; }
.cos-tag { font-size: 12px; color: var(--gold-bright); letter-spacing: 1px; }
.item-row.tech-active { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--inset); }
.practicing { font-size: 12px; color: var(--gold-bright); letter-spacing: 2px; align-self: center; }
.tier-tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid currentColor; margin-right: 6px; }

/* 排行榜 */
.rank-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rank-table th, .rank-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--inset); }
.rank-table th { color: var(--gold-dim); font-weight: normal; letter-spacing: 2px; }
.rank-table tr:nth-child(-n+3) td:first-child { color: var(--gold-bright); font-weight: bold; }

/* 道闻录 */
.event-log { list-style: none; max-height: 600px; overflow-y: auto; }
.event-log li { font-size: 13px; line-height: 1.7; padding: 8px 2px; border-bottom: 1px dashed var(--inset); }
.event-log li .time { color: var(--text-dim); font-size: 11px; margin-right: 6px; }
.event-log::-webkit-scrollbar { width: 5px; }
.event-log::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 999px; }

/* 提示浮窗 */
.toast {
  position: fixed; left: 50%; top: 64px; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--gold); color: var(--gold-bright);
  padding: 12px 28px; font-size: 14px; letter-spacing: 1px; z-index: 99;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); border-radius: var(--radius);
  animation: toastIn .25s ease-out; max-width: 80vw; text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast.error { border-color: var(--danger); color: var(--danger); }

@media (max-width: 1080px) {
  .game-grid { grid-template-columns: 270px 1fr; }
  .log-panel { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .game-grid { grid-template-columns: 1fr; }
  .dungeon-grid, .equip-slots { grid-template-columns: 1fr; }
  .game-header { flex-direction: column; gap: 10px; }
}
