/* =================《曙光之刃》样式 ================= */
:root {
  --bg: #10141d;
  --panel: #1a2130;
  --panel2: #222b40;
  --line: #313c55;
  --text: #e9e6dd;
  --dim: #8b94a8;
  --gold: #ffb340;
  --hp: #4caf50;
  --mp: #42a5f5;
  --exp: #c9a227;
  --bad: #ff6b6b;
  --good: #6fdd8b;
  --r-common: #b0b6bf;
  --r-uncommon: #5fd35f;
  --r-rare: #4da3ff;
  --r-epic: #c05fff;
  --r-legendary: #ffb340;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1d2740 0%, var(--bg) 60%);
  color: var(--text);
  line-height: 1.55;
  padding-bottom: 40px;
}
#app { max-width: 940px; margin: 0 auto; padding: 12px; }

/* ---------- 顶栏 ---------- */
#topbar {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 10px;
}
.tb-left { flex: 1; min-width: 0; }
.tb-name { font-weight: 700; font-size: 17px; margin-bottom: 6px; }
.tb-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.gold { color: var(--gold); font-weight: 700; font-size: 16px; white-space: nowrap; }
.icon-btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; font-size: 16px; cursor: pointer; padding: 4px 8px; }
.lv-chip {
  background: var(--gold); color: #201500; font-size: 12px; font-weight: 700;
  border-radius: 20px; padding: 1px 8px; vertical-align: middle;
}

/* ---------- 进度条 ---------- */
.bar {
  position: relative; height: 18px; background: #0c0f16; border: 1px solid var(--line);
  border-radius: 9px; overflow: hidden; margin-bottom: 4px;
}
.bar-fill { height: 100%; border-radius: 8px; transition: width 0.35s ease; }
.hp-bar  .bar-fill { background: linear-gradient(90deg, #2e7d32, var(--hp)); }
.mp-bar  .bar-fill { background: linear-gradient(90deg, #1565c0, var(--mp)); }
.exp-bar .bar-fill { background: linear-gradient(90deg, #8a6d1d, var(--exp)); }
.ehp-bar .bar-fill { background: linear-gradient(90deg, #b71c1c, #ef5350); }
.rage-bar .bar-fill { background: linear-gradient(90deg, #b8860b, #ffd54f); box-shadow: 0 0 8px rgba(255,213,79,0.5); }
.bar-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.8);
}

/* ---------- 导航 ---------- */
#tabs { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.tab-btn {
  flex: 1; min-width: 90px; padding: 9px 6px; font-size: 14px; font-weight: 600;
  background: var(--panel); color: var(--dim); border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer; transition: 0.15s;
}
.tab-btn.active { background: var(--panel2); color: var(--gold); border-color: var(--gold); }
.tab-btn.disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- 面板 ---------- */
.view { display: none; }
.view.active { display: block; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 12px;
}
.panel h2 { font-size: 17px; margin-bottom: 10px; }
.panel h2 small, .dim { color: var(--dim); font-size: 13px; font-weight: 400; }
.panel h3 { font-size: 15px; margin-bottom: 6px; }
.hint {
  background: #232d18; border: 1px solid #4a5a2e; color: #c8e6a0;
  border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 10px;
}
.warn {
  background: #3a2718; border: 1px solid #6e4a2e; color: #ffd7a0;
  border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 8px 0;
}
.good { color: var(--good); }
.bad { color: var(--bad); }

/* ---------- 按钮 ---------- */
.btn {
  padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; transition: 0.15s; font-family: inherit;
}
.btn:hover:not(.disabled) { border-color: var(--gold); }
.btn.primary { background: #2c4a2f; border-color: #4caf50; }
.btn.gold { background: #4a3512; border-color: var(--gold); color: var(--gold); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.skill { border-color: #4a5a8a; }
.btn.potion { border-color: #2e5a4a; }
.btn.disabled { opacity: 0.45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }

/* ---------- 冒险 / 区域 ---------- */
.zone-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.zone-chip {
  padding: 6px 12px; font-size: 13px; border-radius: 20px; cursor: pointer;
  background: var(--panel2); color: var(--text); border: 1px solid var(--line); font-family: inherit;
}
.zone-chip.sel { border-color: var(--gold); color: var(--gold); font-weight: 700; }
.zone-chip.locked { opacity: 0.45; }
.zone-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.zone-icon { font-size: 44px; line-height: 1; }
.mob-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.mob-card {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; text-align: center; font-size: 13px; min-width: 86px;
}
.mob-emoji { font-size: 34px; line-height: 1.2; }
.boss-card {
  display: flex; align-items: center; gap: 12px; background: #2b1a1a;
  border: 1px solid #6e3030; border-radius: 12px; padding: 10px 14px; margin: 6px 0 4px;
}
.boss-emoji { font-size: 44px; }
.auto-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--dim); cursor: pointer; margin-left: 6px; }
.auto-toggle input { width: 16px; height: 16px; cursor: pointer; }

/* ---------- 战斗 ---------- */
.combat-wrap { display: flex; flex-direction: column; gap: 10px; }
.enemy-panel { text-align: center; }
.enemy-sprite { font-size: 72px; line-height: 1.1; margin: 4px 0; position: relative; display: inline-block; min-width: 120px; }
.enemy-sprite.boss { filter: drop-shadow(0 0 18px rgba(255, 60, 60, 0.55)); animation: floaty 2.4s ease-in-out infinite; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.enemy-name { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.enemy-panel .bar { max-width: 420px; margin: 0 auto 6px; }
.enemy-stats { font-size: 12.5px; margin-top: 4px; }
.player-mini { position: relative; }
.pm-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.buff-tag {
  display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 12px;
  background: #233047; border: 1px solid #3d5578; margin: 2px 4px 0 0;
}
.buff-tag.burn { background: #3a2015; border-color: #7a4a2a; color: #ffb08a; }

/* M1:敌人意图横幅 */
.intent-banner {
  background: #1d2a3d; border: 1px solid #3d5578; border-radius: 10px;
  padding: 7px 12px; font-size: 14px; margin-bottom: 10px;
}
.intent-banner.danger {
  background: #3d1d1d; border-color: #8f3d3d; color: #ffb0b0;
  animation: dangerPulse 1.2s ease-in-out infinite;
}
@keyframes dangerPulse { 0%,100% { box-shadow: 0 0 0 rgba(255,60,60,0); } 50% { box-shadow: 0 0 14px rgba(255,60,60,0.5); } }

/* M1:防御 / 必杀按钮 */
.btn.guard { border-color: #3d7a8f; background: #16303a; }
.btn.ult {
  border-color: #b8860b; background: #3d2f10; color: #ffd54f; font-weight: 800;
}
.btn.ult:not(.disabled) { box-shadow: 0 0 12px rgba(255,213,79,0.4); }
.lv-tag { color: var(--gold); font-size: 11px; }
.auto-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.preset-select {
  padding: 6px 10px; background: #0e1219; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font-family: inherit; font-size: 13px;
}

/* 云端冲突提示条 */
.conflict-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #3d2a10; border: 1px solid #b8860b; color: #ffd7a0;
  border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-size: 13.5px;
}

/* M2:装备机制词缀 / 元素 / 套装 */
.mech-line { font-size: 12.5px; color: #7fd0ff; margin-top: 3px; }
.mech-name { font-weight: 700; }
.elem-line { font-size: 12.5px; margin-top: 3px; font-weight: 600; }
.set-line { font-size: 12.5px; color: var(--gold); margin-top: 3px; }
.elem-chip {
  font-size: 12px; border: 1px solid currentColor; border-radius: 12px;
  padding: 1px 8px; vertical-align: middle; margin-left: 6px; opacity: 0.9;
}

/* M3:天赋树 */
.trees-wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.talent-tree {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px;
}
.talent-tree h3 { margin-bottom: 4px; }
.talent-grid { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.talent-node {
  background: #141b28; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; transition: 0.15s;
}
.talent-node.has { border-color: var(--gold); background: #1d2333; }
.talent-node.locked { opacity: 0.45; }
.tn-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.talent-node .btn { margin-top: 6px; width: 100%; }

/* M3:试炼场 */
.trial-row { margin-bottom: 10px; }
.trial-bar { max-width: 100%; height: 22px; }
.trial-row b { font-size: 14px; }
.action-panel .action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 8px; }
.action-panel .action-grid.pots { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.action-panel .btn small { font-weight: 400; color: var(--dim); }
.log-panel { max-height: 230px; display: flex; flex-direction: column; }
.log-title { font-size: 13px; color: var(--dim); margin-bottom: 6px; }
.combat-log { overflow-y: auto; flex: 1; font-size: 13.5px; display: flex; flex-direction: column; gap: 2px; }
.log-line { padding: 2px 4px; border-radius: 6px; }
.log-line.good { color: var(--good); }
.log-line.bad { color: var(--bad); }
.log-line.sys { color: var(--gold); font-weight: 600; }
.log-line.skill { color: #7fb2ff; }
.log-line.burn { color: #ffab6b; }

/* 浮动伤害数字 */
.float-dmg {
  position: absolute; top: 8px; font-size: 22px; font-weight: 800; color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,.9); pointer-events: none; z-index: 5;
  animation: floatUp 1s ease-out forwards; white-space: nowrap;
}
.float-dmg.crit { color: #ffd740; font-size: 28px; }
.float-dmg.bad { color: #ff7070; }
.float-dmg.heal { color: #7dff9a; }
.float-dmg.burn { color: #ffab6b; font-size: 18px; }
.float-dmg.skill { color: #7fb2ff; }
@keyframes floatUp { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-46px); opacity: 0; } }
.shake { animation: shake 0.3s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

/* ---------- 稀有度 ---------- */
.r-common { color: var(--r-common); }
.r-uncommon { color: var(--r-uncommon); }
.r-rare { color: var(--r-rare); }
.r-epic { color: var(--r-epic); }
.r-legendary { color: var(--r-legendary); }
.r-border-common { border-color: #4a5058; }
.r-border-uncommon { border-color: #3d6b3d; }
.r-border-rare { border-color: #2f5a8f; }
.r-border-epic { border-color: #6b3d8f; box-shadow: 0 0 8px rgba(192,95,255,0.18); }
.r-border-legendary { border-color: #8f6b1f; box-shadow: 0 0 10px rgba(255,179,64,0.25); }
.rarity-chip { font-size: 11.5px; font-weight: 700; border: 1px solid currentColor; border-radius: 12px; padding: 1px 8px; }

/* ---------- 角色 ---------- */
.stat-table { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin-bottom: 10px; }
.stat-row {
  display: flex; justify-content: space-between; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; font-size: 13.5px;
}
.points-panel { background: #26304a; border: 1px solid #3d5578; border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.slot-card {
  display: flex; gap: 10px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; cursor: pointer; transition: 0.15s;
}
.slot-card:hover { background: #2a3550; }
.slot-card.empty { opacity: 0.6; border-style: dashed; }
.slot-icon { font-size: 32px; }
.item-stats { font-size: 12px; color: #b9c2d4; margin: 2px 0; }
.enh-tag { color: var(--gold); }

/* ---------- 背包 ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip {
  padding: 5px 12px; font-size: 12.5px; border-radius: 18px; cursor: pointer;
  background: var(--panel2); border: 1px solid var(--line); color: var(--dim); font-family: inherit;
}
.chip.sel { color: var(--gold); border-color: var(--gold); }
.item-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.item-card {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; font-weight: 700; }
.bag-row {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; margin-bottom: 6px; font-size: 13.5px; flex-wrap: wrap;
}

/* ---------- 技能 ---------- */
.skill-card {
  display: flex; gap: 12px; align-items: flex-start; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px;
}
.skill-card.unknown { opacity: 0.55; }
.skill-card.known { border-color: #3d5a4a; }
.skill-icon { font-size: 30px; }
.skill-body { flex: 1; }

/* ---------- 村庄 ---------- */
.village-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.facility { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.facility .btn { margin-top: 8px; }
.facility select {
  width: 100%; padding: 8px; background: #0e1219; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; font-family: inherit;
}
.enhance-info { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; margin-bottom: 8px; }
.frag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.frag-chip {
  padding: 5px 12px; border-radius: 18px; font-size: 13px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--dim);
}
.frag-chip.got { color: var(--epic, #c05fff); border-color: #6b3d8f; background: #2a1d3a; font-weight: 700; }

/* ---------- 遮罩层(标题/剧情/战利品/死亡) ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(5, 8, 14, 0.82); backdrop-filter: blur(3px); padding: 16px;
}
.overlay.hidden { display: none; }
.overlay-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  max-width: 560px; width: 100%; padding: 24px 26px; text-align: center;
  max-height: 86vh; overflow-y: auto;
}
#title-overlay .overlay-box { border-color: var(--gold); }
.game-title { font-size: 40px; font-weight: 800; color: var(--gold); text-shadow: 0 0 24px rgba(255,179,64,0.45); margin: 6px 0 2px; }
.game-sub { color: var(--dim); margin-bottom: 18px; }
.title-icon { font-size: 58px; }
#title-name {
  width: 100%; padding: 10px 12px; font-size: 15px; text-align: center;
  background: #0e1219; color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 12px; font-family: inherit;
}
.title-btns { display: flex; flex-direction: column; gap: 10px; }
.title-btns .btn { padding: 12px; font-size: 15px; }
.foot-note { margin-top: 14px; font-size: 12px; color: var(--dim); }
.restore-row { display: flex; gap: 8px; margin-top: 4px; }
.restore-row input {
  flex: 1; padding: 10px 12px; font-size: 14px; text-align: center;
  background: #0e1219; color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; font-family: inherit; text-transform: uppercase;
}

/* 云端同步状态圆点 */
.sync-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #4a5058; display: inline-block;
}
.sync-dot.ok { background: var(--good); box-shadow: 0 0 6px rgba(111,221,139,0.6); }
.sync-dot.err { background: var(--bad); box-shadow: 0 0 6px rgba(255,107,107,0.6); }
.cloud-code {
  font-family: "SF Mono", Menlo, Consolas, monospace; letter-spacing: 1px;
  color: var(--gold); font-size: 15px;
}
.file-btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; }
.file-btn input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%;
}

/* 剧情 */
.story-box { text-align: left; }
.story-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
#story-icon { font-size: 40px; }
#story-speaker { font-size: 18px; font-weight: 800; color: var(--gold); }
#story-text { font-size: 15.5px; min-height: 84px; margin-bottom: 14px; }
.story-foot { display: flex; justify-content: space-between; align-items: center; }
#story-progress { color: var(--dim); font-size: 12.5px; }

/* 战利品 */
#loot-list { margin: 12px 0 16px; display: flex; flex-direction: column; gap: 6px; }
.loot-line { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 14.5px; }

/* 死亡 */
#death-overlay .overlay-box { border-color: #6e3030; }
.death-icon { font-size: 54px; margin-bottom: 8px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #0e1219; border: 1px solid var(--gold); color: var(--text);
  border-radius: 12px; padding: 10px 18px; font-size: 14px; z-index: 200;
  opacity: 0; pointer-events: none; transition: 0.25s; max-width: 86vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 560px) {
  .enemy-sprite { font-size: 56px; }
  .game-title { font-size: 30px; }
  #topbar { flex-direction: column; }
  .tb-right { flex-direction: row; align-items: center; }
  .item-list { grid-template-columns: 1fr; }
}
