/* 《你也修仙？》样式
 * 四套主题：浅蓝（默认）/ 浅绿（灵气浓郁）/ 浅金（顶级体质）/ 暗红（入魔）
 */
:root {
  --bg-top: #eef6fb;
  --bg-bot: #f9fcff;
  --line: #d7e6f2;
  --line-soft: #e6f0f7;
  --ink: #26333d;
  --ink-2: #5b6f80;
  --ink-3: #8698a6;
  --accent: #3d5a73;
  --card: rgba(255, 255, 255, .72);
  --good: #2f7a52;
  --bad: #b4453c;
  --special: #8a6d2f;
  --shadow: 0 1px 3px rgba(31, 51, 64, .06);
}

body.theme-green {
  --bg-top: #eef7f0; --bg-bot: #f8fdfa;
  --line: #d3e8d8; --line-soft: #e4f2e8;
}
body.theme-gold {
  --bg-top: #fbf6e6; --bg-bot: #fefcf4;
  --line: #ecd9a4; --line-soft: #f6edcf;
}
body.theme-dark {
  --bg-top: #2a1416; --bg-bot: #1a0d0e;
  --line: #6b2f33; --line-soft: #3d1d20;
  --ink: #f0dada; --ink-2: #c9a0a0; --ink-3: #9c7a7a;
  --card: rgba(255, 235, 235, .06);
  --accent: #d98a8a;
  --good: #7fc39c; --bad: #e2746c; --special: #dcb46a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
}

body {
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bot));
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  transition: background-color .8s ease, color .8s ease;
}

.stage { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.stage.hidden { display: none; }
#stage-game { display: flex; flex-direction: column; align-items: stretch; padding: 0; min-height: 100vh; }

/* 登录页背景（水墨仙山） */
#stage-name {
  background: linear-gradient(180deg, rgba(255,255,255,.88), rgba(255,255,255,.92)),
    url("img/bg-mountain.png") center / cover no-repeat;
}

.wrap { width: 100%; max-width: 900px; }
.wrap-narrow { width: 100%; max-width: 460px; }

.eyebrow {
  font-size: 12px; letter-spacing: .12em; color: var(--ink-3);
  text-transform: none; margin: 0 0 .5rem;
}
h1 { font-size: 32px; font-weight: 500; margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 22px; font-weight: 500; margin: 0 0 .5rem; }
.lede { color: var(--ink-2); margin: 0 0 1.5rem; font-size: 14px; }
.hint { color: var(--ink-3); font-size: 12px; margin: .75rem 0 0; min-height: 18px; }
.note { color: var(--ink-3); font-size: 12px; margin-top: 2rem; line-height: 1.7; }

.row { display: flex; gap: 8px; margin-top: 1rem; }

input[type=text] {
  flex: 1; padding: .6rem .8rem; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink);
  font-family: inherit;
}
input[type=text]:focus { outline: none; border-color: var(--accent); }

button {
  padding: .6rem 1.1rem; font-size: 14px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.on { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }

/* ---------- 灵根卡 ---------- */
.talent-card {
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); padding: 1.5rem; box-shadow: var(--shadow);
}
.talent-card.t-UR { border-width: 2px; border-color: #c9a86a; }
.talent-card.t-SSR { border-color: #9db8cc; }
.talent-card.t-C { border-style: dashed; }
.tc-tier { font-size: 12px; letter-spacing: .1em; color: var(--ink-3); }
.tc-name { font-size: 24px; font-weight: 500; margin: .25rem 0 .5rem; }
.tc-desc { color: var(--ink-2); font-size: 14px; margin: 0 0 1rem; }
.tc-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.tc-stat {
  font-size: 12px; padding: .2rem .5rem; border-radius: 6px;
  background: var(--line-soft); color: var(--ink-2);
}

/* 灵根卡上的附带体质 */
.tc-cons { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.tc-ck { font-size: 12px; color: var(--ink-3); margin-bottom: .4rem; }
.tc-ci { font-size: 13px; color: var(--ink-2); margin-bottom: .3rem; line-height: 1.5; }
.tc-none { font-size: 13px; color: var(--ink-3); }
.p-sub { font-size: 12px; color: var(--ink-3); margin-top: .15rem; }

/* ---------- 专注 ---------- */
.focus-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.focus-item {
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  padding: 1rem; cursor: pointer; transition: border-color .15s;
}
.focus-item:hover { border-color: var(--accent); }
.fi-name { font-weight: 500; margin-bottom: .25rem; }
.fi-desc { font-size: 13px; color: var(--ink-2); }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .75rem 1.25rem; border-bottom: 1px solid var(--line);
  background: var(--card); backdrop-filter: blur(6px);
}
.tb-left { min-width: 150px; }
.tb-name { font-weight: 500; }
.tb-realm { color: var(--ink-2); font-size: 13px; margin-left: .5rem; }
.tb-mid { flex: 1; }
.tb-right { text-align: right; min-width: 130px; }
.tb-sub { font-size: 12px; color: var(--ink-3); display: block; }
.tb-chip {
  font-size: 12px; padding: .15rem .5rem; border-radius: 6px;
  background: var(--line-soft); color: var(--ink-2);
}

.bar {
  height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden;
}
.bar.slim { height: 4px; margin-top: .25rem; }
.bar-fill { height: 100%; background: var(--accent); transition: width .3s ease; }
.bar-fill.life { background: #6b8f78; }
.bar-fill.hp { background: #b4453c; }
.bar-fill.devil { background: var(--bad); }

/* ---------- 主体 ---------- */
.layout { flex: 1; display: grid; grid-template-columns: 240px 1fr 240px; min-height: 0; }

.panel {
  border-right: 1px solid var(--line); padding: 1.25rem;
  overflow-y: auto; background: var(--card);
}
.panel.right-panel { border-right: none; border-left: 1px solid var(--line); }
.p-block { margin-bottom: 1.1rem; }
.p-label { font-size: 12px; color: var(--ink-3); margin-bottom: .15rem; }
.p-value { font-size: 14px; }
.p-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1.1rem; }
.p-cell { border: 1px solid var(--line-soft); border-radius: 8px; padding: .45rem .6rem; }
.pc-k { font-size: 11px; color: var(--ink-3); }
.pc-v { font-size: 15px; font-variant-numeric: tabular-nums; }

.logwrap { padding: 1.25rem; overflow-y: auto; min-height: 0; }
.log { max-width: 640px; }
.log-line { margin-bottom: .7rem; font-size: 14px; line-height: 1.7; }
.log-y { color: var(--ink-3); font-size: 11px; margin-right: .5rem; font-variant-numeric: tabular-nums; }
.log-line.good .log-t { color: var(--good); }
.log-line.bad .log-t { color: var(--bad); }
.log-line.special .log-t { color: var(--special); font-weight: 500; }
.log-line.choice .log-t { color: var(--accent); }

/* ---------- 操作 ---------- */
.actions {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 1.25rem; border-top: 1px solid var(--line); background: var(--card);
}
.act-group { display: flex; align-items: center; gap: 6px; }
.act-group.right { justify-content: flex-end; }
.act-label { font-size: 12px; color: var(--ink-3); margin-right: .25rem; }

/* ---------- 结算 ---------- */
.end-card {
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); padding: 1.5rem; box-shadow: var(--shadow);
}
.ec-row { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid var(--line-soft); }
.ec-row:last-child { border-bottom: none; }
.ec-k { color: var(--ink-2); font-size: 14px; }
.ec-v { font-variant-numeric: tabular-nums; }

/* ---------- 附近道友 / 行囊 ---------- */
.nearby-list, .items-list { display: flex; flex-direction: column; gap: 6px; }
.nearby-item {
  border: 1px solid var(--line-soft); border-radius: 8px; padding: .4rem .6rem;
}
.nearby-item b { font-size: 13px; }
.item-row {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-soft); border-radius: 8px; padding: .35rem .5rem;
  font-size: 13px;
}
.item-row span:first-child { flex: 1; }
.mini-btn {
  padding: .1rem .5rem; font-size: 12px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer;
}
.mini-btn:hover { border-color: var(--accent); }
.slim-btn {
  width: 100%; margin-top: .5rem; padding: .4rem; font-size: 13px;
  border: 1px solid var(--accent); border-radius: 8px;
  background: var(--card); color: var(--accent); cursor: pointer;
}
.slim-btn:hover { background: var(--accent); color: #fff; }

/* ---------- 速度详情 / 专注下拉 ---------- */
.speed-detail { cursor: help; color: var(--ink-3); font-size: 11px; position: relative; }
.speed-wrap { display: flex; align-items: center; gap: 6px; }

/* 自定义 tooltip（速度明细 + 体质效果） */
.tip-box, .cons-tip {
  display: none; position: absolute; z-index: 20;
  background: var(--ink); color: var(--bg-bot);
  font-size: 12px; line-height: 1.6; padding: .5rem .7rem;
  border-radius: 8px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.speed-detail:hover .tip-box { display: block; left: 18px; top: -4px; }
.tip-row { display: flex; justify-content: space-between; gap: 1rem; }
.tip-total { border-top: 1px solid rgba(255,255,255,.2); margin-top: .2rem; padding-top: .2rem; font-weight: 500; }

/* 体质悬停 */
.cons-wrap { position: relative; }
.cons-item { position: relative; cursor: help; border-bottom: 1px dashed var(--ink-3); }
.cons-item:hover .cons-tip { display: block; left: 0; top: 1.4rem; white-space: normal; max-width: 220px; }
.cons-eff { display: block; color: var(--special, #8a6d2f); margin-top: .2rem; }

select {
  width: 100%; padding: .4rem .6rem; font-size: 13px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink);
}
select:focus { outline: none; border-color: var(--accent); }

/* ---------- 日志工具栏 ---------- */
.log-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .6rem; gap: 8px; flex-wrap: wrap;
}
.log-btns { display: flex; align-items: center; gap: 6px; }
.log-jump {
  width: 70px; padding: .15rem .4rem; font-size: 12px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); color: var(--ink);
}

/* ---------- 白驹过隙 年推进进度条 ---------- */
.year-meter {
  position: relative; height: 14px; margin-bottom: .8rem;
  background: var(--line-soft); border-radius: 7px; overflow: hidden;
}
.year-meter-fill {
  height: 100%; width: 0%;
  background: var(--accent);
  animation: year-fill 5s linear infinite;
}
.year-meter-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--ink-2); letter-spacing: .2em; pointer-events: none;
}
@keyframes year-fill {
  from { width: 0%; }
  to { width: 100%; }
}

/* 游戏内背景（水墨仙山，低透明度叠底） */
#stage-game {
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.94)),
    url("img/bg-mountain.png") center / cover no-repeat fixed;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 200px 1fr; }
  .panel.right-panel { display: none; }
}
@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  .panel { border-right: none; border-bottom: 1px solid var(--line); }
  .panel.right-panel { display: block; border-left: none; border-top: 1px solid var(--line); }
  .topbar { flex-wrap: wrap; gap: .5rem; }
  h1 { font-size: 26px; }
}
