/* 明代木刻/卷轴风 UI 系统:多层木框+金线+角饰+微浮雕,汉字金框徽(禁 emoji/图标字体) */

:root {
  /* 色板 */
  --paper: #efe3c8;
  --paper-dim: #e6d6b2;
  --ink: #211812;
  --wood: #3a2a1c;
  --wood-deep: #241812;
  --zhu: #a8322a;
  --zhu-hi: #c24a30;
  --gold: #c9a227;
  --gold-hi: #e6c766;
  --qing: #3f6f6a;
  --zhe: #8a5a2e;
  --text-hi: #f4ead2;
  --text-de: #2b2016;
  --disabled: #8a7d63;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--wood-deep);
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", serif;
  color: var(--text-de);
  user-select: none;
}

#app { width: 100%; height: 100%; position: relative; }

.screen { position: absolute; inset: 44px 0 0 0; display: flex; flex-direction: column; }

button { font-family: inherit; cursor: pointer; }

/* ---------- 可复用组件 ---------- */

/* 木牌按钮:木纹底+金线内框+微浮雕 */
.btn {
  position: relative;
  background:
    repeating-linear-gradient(90deg, rgba(58, 42, 28, 0.05) 0 3px, transparent 3px 7px),
    linear-gradient(180deg, #f4e9cd, var(--paper-dim));
  border: 2px solid var(--wood);
  border-radius: 4px;
  box-shadow:
    inset 0 0 0 1px var(--gold),
    inset 0 1px 0 rgba(255, 240, 200, 0.6),
    inset 0 -2px 0 rgba(58, 42, 28, 0.25),
    0 2px 0 var(--wood-deep);
  color: var(--text-de);
  transition: transform 0.06s, filter 0.1s, box-shadow 0.1s;
}
.btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 0 0 1px var(--gold),
    inset 0 2px 4px rgba(58, 42, 28, 0.4);
}
.btn.disabled, .btn:disabled {
  opacity: 0.5; cursor: not-allowed; filter: grayscale(0.7);
  transform: none;
}

/* 汉字金框徽(图标格) */
.icon-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex: none;
  font-size: 15px; font-weight: bold; line-height: 1;
  color: var(--gold-hi);
  background:
    radial-gradient(circle at 35% 30%, rgba(230, 199, 102, 0.25), transparent 60%),
    linear-gradient(160deg, #4a3626, var(--wood-deep));
  border: 1.5px solid var(--gold);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(230, 199, 102, 0.35), 0 1px 2px rgba(0, 0, 0, 0.4);
  text-shadow: 0 1px 1px #000;
}
.icon-badge.round { border-radius: 50%; }
.icon-badge.sm { width: 20px; height: 20px; font-size: 12px; }

/* 木刻角饰(四个 L 形金线角) */
.corner { position: absolute; width: 14px; height: 14px; pointer-events: none; z-index: 2; }
.corner::before, .corner::after { content: ''; position: absolute; background: var(--gold); }
.corner::before { width: 100%; height: 2px; }
.corner::after { width: 2px; height: 100%; }
.corner.tl { top: 3px; left: 3px; }
.corner.tl::before { top: 0; left: 0; } .corner.tl::after { top: 0; left: 0; }
.corner.tr { top: 3px; right: 3px; }
.corner.tr::before { top: 0; right: 0; } .corner.tr::after { top: 0; right: 0; }
.corner.bl { bottom: 3px; left: 3px; }
.corner.bl::before { bottom: 0; left: 0; } .corner.bl::after { bottom: 0; left: 0; }
.corner.br { bottom: 3px; right: 3px; }
.corner.br::before { bottom: 0; right: 0; } .corner.br::after { bottom: 0; right: 0; }

/* 木框容器 */
.wood-frame {
  position: relative;
  border: 3px solid var(--wood);
  border-radius: 5px;
  box-shadow:
    inset 0 0 0 1px var(--gold),
    inset 0 0 18px rgba(58, 42, 28, 0.18),
    0 4px 14px rgba(20, 12, 6, 0.4);
  background:
    repeating-linear-gradient(0deg, rgba(58, 42, 28, 0.04) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, var(--paper), var(--paper-dim));
}

/* 列表行 */
.list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(201, 162, 39, 0.45);
  transition: background 0.12s;
}
.list-row:hover { background: rgba(201, 162, 39, 0.14); }

/* 图标格(背包/装备) */
.icon-slot {
  position: relative;
  width: 56px; height: 56px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #4a3626, var(--wood-deep));
  border: 2px solid var(--wood);
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px var(--gold), 0 2px 4px rgba(0, 0, 0, 0.35);
  color: var(--gold-hi); font-size: 24px; font-weight: bold;
  text-shadow: 0 1px 2px #000;
}
.icon-slot .slot-count {
  position: absolute; right: -6px; bottom: -6px;
  min-width: 20px; height: 20px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  background: var(--zhu); color: var(--text-hi);
  font-size: 12px; border: 1px solid var(--gold); border-radius: 3px;
}

/* ---------- 顶部菜单栏(暗木卷轴横条) ---------- */
.topbar {
  position: relative;
  height: 44px; flex: none;
  display: flex; align-items: center; gap: 6px;
  padding: 0 18px;
  background:
    repeating-linear-gradient(90deg, rgba(201, 162, 39, 0.05) 0 4px, transparent 4px 10px),
    linear-gradient(180deg, #4a3626, var(--wood-deep));
  border-bottom: 2px solid var(--gold);
  box-shadow: inset 0 1px 0 rgba(201, 162, 39, 0.6), 0 3px 10px rgba(0, 0, 0, 0.5);
  z-index: 30;
}
.topbar::before, .topbar::after {
  /* 两端卷轴木轴 */
  content: ''; position: absolute; top: 3px; bottom: 3px; width: 10px;
  background: linear-gradient(90deg, #241812, #5a4630 50%, #241812);
  border: 1px solid var(--gold);
  border-radius: 5px;
}
.topbar::before { left: 3px; }
.topbar::after { right: 3px; }
.topbar-title {
  color: var(--text-hi); font-size: 17px; letter-spacing: 3px;
  text-shadow: 0 1px 0 #000; margin: 0 10px 0 8px; font-weight: bold;
}
.topbar-group { display: flex; gap: 6px; align-items: center; }
.topbar-sep { width: 1px; height: 24px; background: rgba(201, 162, 39, 0.55); margin: 0 8px; }
.topbar-spacer { flex: 1; }
.topbar-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; font-size: 13px; letter-spacing: 1px;
  color: var(--text-hi);
  background:
    repeating-linear-gradient(90deg, rgba(201, 162, 39, 0.06) 0 3px, transparent 3px 7px),
    linear-gradient(180deg, #54402c, #3a2a1c);
  border: 1.5px solid rgba(201, 162, 39, 0.7);
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(230, 199, 102, 0.3), 0 2px 0 rgba(0, 0, 0, 0.4);
  text-shadow: 0 1px 1px #000;
}
.topbar-notice {
  position: absolute; top: -7px; right: -7px;
  min-width: 18px; height: 18px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; border: 1px solid #f1d58c;
  background: var(--zhu-hi); color: #fff7df;
  font-size: 10px; line-height: 1; letter-spacing: 0;
  box-shadow: 0 2px 5px rgba(20, 12, 6, 0.55);
}
.topbar-notice[hidden] { display: none; }
.topbar-btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.topbar-btn:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5); }
.topbar-btn.open {
  background: linear-gradient(180deg, var(--zhu-hi), var(--zhu));
  border-color: var(--gold-hi);
  color: #fff;
}

/* ---------- 标题画面 ---------- */
.title-screen { align-items: center; justify-content: center; background: #1a1008; }
.title-cover {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
}
.title-cover.fallback { background: linear-gradient(180deg, #3a1618, #8a2e1e 55%, #c26a2e); }
.title-mask { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(20, 10, 4, 0.35) 30%, rgba(20, 10, 4, 0.62)); }
.title-logo {
  position: relative; z-index: 2; text-align: center; margin-top: -8vh;
}
.title-logo h1 {
  font-size: 64px; letter-spacing: 10px; color: var(--paper); font-weight: bold;
  text-shadow: 0 0 18px rgba(200, 60, 30, 0.9), 0 3px 0 #5a1408, 0 6px 12px #000;
}
.title-logo p {
  margin-top: 12px; color: #f0d9a8; letter-spacing: 6px; font-size: 18px;
  text-shadow: 0 2px 4px #000;
}
.title-menu { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 14px; margin-top: 6vh; }
.title-btn {
  width: 260px; padding: 12px 0; font-size: 20px; letter-spacing: 8px; text-align: center;
  border-width: 3px;
}

/* ---------- 剧情对话框 ---------- */
.dlg-box {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 26px; width: min(860px, 86%);
  min-height: 128px;
  display: flex; gap: 14px; align-items: flex-start;
  z-index: 40; cursor: pointer;
  padding: 16px 20px;
  border: 3px solid var(--wood);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--gold), 0 6px 24px rgba(0, 0, 0, 0.5);
  background:
    repeating-linear-gradient(0deg, rgba(58, 42, 28, 0.04) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, rgba(244, 233, 205, 0.98), rgba(230, 214, 178, 0.98));
}
.dlg-portrait {
  width: 84px; height: 108px; object-fit: contain;
  border: 2px solid var(--wood); border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--gold);
  background: #d8cdb4;
  flex: none;
}
.dlg-right { flex: 1; }
.dlg-name {
  display: inline-block; color: var(--text-hi); background: linear-gradient(180deg, var(--zhu-hi), var(--zhu));
  padding: 2px 12px; border-radius: 3px; font-size: 15px; letter-spacing: 2px;
  border: 1px solid var(--gold); text-shadow: 0 1px 1px #000;
}
.dlg-text { margin-top: 8px; font-size: 17px; line-height: 1.65; min-height: 48px; }
.dlg-next { text-align: right; color: var(--zhe); font-size: 13px; animation: blink 1.1s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

/* ---------- 统一弹窗/面板系统 ---------- */
.modal-mask {
  position: absolute; inset: 0; z-index: 60;
  background: rgba(20, 12, 6, 0.5);
  display: flex; align-items: center; justify-content: center;
}
.modal-panel {
  width: min(640px, 88%); max-height: 84%; overflow: auto;
  padding: 22px 26px 18px;
  border: 3px solid var(--wood);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--gold), inset 0 0 24px rgba(58, 42, 28, 0.16), 0 8px 30px rgba(20, 12, 6, 0.55);
  background:
    repeating-linear-gradient(0deg, rgba(58, 42, 28, 0.04) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, var(--paper), var(--paper-dim));
  position: relative;
}
.modal-title {
  position: relative;
  font-size: 20px; letter-spacing: 6px; color: var(--zhu); font-weight: bold;
  text-align: center; padding: 0 30px 8px; margin: -4px 0 12px;
}
.modal-title::before, .modal-title::after {
  content: ''; position: absolute; top: 50%; width: 22px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.modal-title::before { left: 0; }
.modal-title::after { right: 0; transform: scaleX(-1); }
.modal-title {
  border-bottom: 2px solid var(--gold);
}
.modal-body { font-size: 15px; line-height: 1.7; }
.modal-foot { display: flex; justify-content: center; gap: 12px; margin-top: 16px; }
.modal-btn { padding: 8px 30px; font-size: 16px; letter-spacing: 3px; }
.panel-close {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text-hi);
  background: linear-gradient(160deg, #54402c, var(--wood));
  border: 1.5px solid var(--gold); border-radius: 4px;
  cursor: pointer; text-shadow: 0 1px 1px #000;
}
.panel-close:hover { filter: brightness(1.2); }
.tutorial-line { margin: 7px 0; }

.formation-row {
  display: flex; align-items: center; gap: 10px;
  border: 2px solid var(--wood); border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.6);
  padding: 10px 14px; margin: 8px 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.35);
}
.formation-row:hover { border-color: var(--zhu); background: rgba(201, 162, 39, 0.12); }
.formation-row.current { border-color: var(--gold); background: rgba(201, 162, 39, 0.2); }
/* 法宝二选一的木刻物件图:压在名目左侧。缺图时这一格根本不渲染,不留空位。 */
.pick-art {
  flex: 0 0 auto; width: 84px; height: 84px;
  border: 1px solid var(--wood); box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.45);
  background-size: cover; background-position: center;
}
.formation-name { font-size: 17px; font-weight: bold; letter-spacing: 2px; }
.formation-desc { font-size: 13px; color: #5a4a38; margin-top: 3px; }

/* 背包/面板网格 */
.bag-grid { display: flex; flex-wrap: wrap; gap: 12px; padding: 6px 2px; }
.bag-item { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 72px; }
.bag-item-name { font-size: 12px; color: var(--text-de); text-align: center; }

.hero-row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid rgba(201, 162, 39, 0.45); }
.hero-face { width: 56px; height: 68px; object-fit: contain; border: 2px solid var(--wood); border-radius: 4px; box-shadow: inset 0 0 0 1px var(--gold); background: #d8cdb4; }
.hero-info { flex: 1; }
.hero-name { font-size: 16px; font-weight: bold; letter-spacing: 2px; display: flex; align-items: center; gap: 8px; }
.hero-lv { font-size: 12px; color: var(--zhe); flex: 1; min-width: 0; }
.hero-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px 10px; margin-top: 6px; }
.stat-cell { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.stat-cell .icon-badge { width: 20px; height: 20px; font-size: 12px; }
.stat-btn {
  width: 20px; height: 20px; padding: 0;
  font-size: 13px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
/* 文字钮(推荐加点/上阵):内容撑宽,不再被 20px 挤成竖排 */
.stat-btn.wide { width: auto; min-width: 34px; height: 22px; padding: 0 9px; font-size: 12px; letter-spacing: 1px; flex: none; }
.panel-note { font-size: 12px; color: #6a5a48; margin-top: 10px; text-align: center; }

.lv-row {
  display: flex; gap: 10px; align-items: baseline;
  border-bottom: 1px dashed var(--gold); padding: 7px 2px;
}
.lv-name { width: 110px; font-weight: bold; }
.lv-up { color: var(--zhu); }
.lv-skill { color: var(--qing); font-size: 13px; }
.lv-growth-note {
  margin: 10px 0 0; padding: 9px 12px;
  color: #563c28; background: rgba(201, 162, 39, 0.10);
  border-left: 3px solid var(--zhu); font-size: 13px; line-height: 1.65;
}
.lv-growth-note.final { font-size: 15px; color: var(--zhu); }

/* ---------- 轻提示 ---------- */
/* top:104px:避开战斗行动顺序条(~44-90px)与小世界提示条,不再叠字 */
.toast {
  position: absolute; top: 104px; left: 50%; transform: translate(-50%, -8px);
  z-index: 70; max-width: 70%;
  background: rgba(36, 24, 18, 0.94); color: var(--text-hi);
  border: 1px solid var(--gold); border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(230, 199, 102, 0.3), 0 4px 14px rgba(0, 0, 0, 0.5);
  padding: 10px 22px; font-size: 15px; letter-spacing: 1px;
  opacity: 0; transition: opacity 0.35s, transform 0.35s;
  pointer-events: none; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* 战场态势全文：贴在右上常驻条下方，左边留给指令预览 */
.toast.rule-toast { left: auto; right: 16px; top: 184px; max-width: 380px; text-align: left; line-height: 1.6; transform: translateY(-8px); }
.toast.rule-toast.show { transform: none; }

/* ---------- 章回卡(三借递进) ---------- */
/* 全屏压暗 + 宣纸卷轴:两端木轴、左侧朱印字号、宋体标题——沿用顶栏/木框同一套语汇 */
.chapter-card {
  position: absolute; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20, 12, 6, 0.62);
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.chapter-card.out { opacity: 0; }
.chapter-inner {
  position: relative;
  display: grid; grid-template-columns: auto auto; align-items: center;
  column-gap: 22px; row-gap: 6px;
  padding: 26px 52px;
  border: 3px solid var(--wood); border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--gold), 0 10px 40px rgba(0, 0, 0, 0.6);
  background:
    repeating-linear-gradient(0deg, rgba(58, 42, 28, 0.04) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, var(--paper), var(--paper-dim));
  animation: bannerIn 0.3s ease;
}
.chapter-inner::before, .chapter-inner::after {
  /* 卷轴两端木轴 */
  content: ''; position: absolute; top: -7px; bottom: -7px; width: 12px;
  background: linear-gradient(90deg, #241812, #5a4630 50%, #241812);
  border: 1px solid var(--gold); border-radius: 6px;
}
.chapter-inner::before { left: -8px; }
.chapter-inner::after { right: -8px; }
.chapter-seal {
  grid-row: 1 / 3;
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: bold; color: var(--text-hi);
  background: linear-gradient(160deg, var(--zhu-hi), var(--zhu));
  border: 2px solid var(--gold); border-radius: 6px;
  box-shadow: inset 0 0 0 2px rgba(244, 234, 210, 0.35), 0 2px 6px rgba(0, 0, 0, 0.4);
  text-shadow: 0 1px 2px #000;
  transform: rotate(-4deg);
}
.chapter-title {
  font-size: 34px; letter-spacing: 8px; font-weight: bold; color: var(--ink);
  white-space: nowrap;
}
.chapter-sub { font-size: 15px; letter-spacing: 3px; color: var(--zhe); white-space: nowrap; }

.source-credit{position:fixed;bottom:0;left:0;right:0;font-size:10px;text-align:center;color:#c8b58f;z-index:1;pointer-events:none}.source-credit a{color:inherit;pointer-events:auto}
