/* ============ 三国大冒险 · 主题样式 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --red: #c62828; --red-dark: #8e0000; --gold: #f5c542; --gold-dark: #c8971f;
  --ink: #2b1a0e; --paper: #fdf6e8; --panel: #fffaf0;
  --wei: #4a6fa5; --shu: #2e9e5b; --wu: #d84343; --qun: #9a6ab0;
}
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #1a0e08 url() ;
  background: radial-gradient(1200px 800px at 50% -10%, #4a2013 0%, #241008 55%, #140a05 100%);
  color: var(--ink); min-height: 100vh;
  display: flex; justify-content: center;
}
#app { width: 100%; max-width: 480px; min-height: 100vh; position: relative; }
.page { min-height: 100vh; position: relative; }
.page-inner { padding: 20px 22px 40px; }

/* ---------- 登录/注册 ---------- */
.auth-bg {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
  padding: 30px 26px 20px;
  background:
    radial-gradient(400px 300px at 85% 12%, rgba(245,197,66,.18), transparent),
    radial-gradient(500px 400px at 10% 80%, rgba(198,40,40,.25), transparent);
}
.game-title { text-align: center; margin-bottom: 30px; }
.game-title h1 {
  font-size: 52px; letter-spacing: 6px; color: var(--gold);
  text-shadow: 0 0 18px rgba(245,197,66,.5), 0 3px 0 #7a5200, 0 6px 14px rgba(0,0,0,.7);
  font-family: "STKaiti", "KaiTi", serif;
}
.game-title .subtitle { color: #e8d5ae; letter-spacing: 4px; margin-top: 8px; font-size: 14px; }
.auth-panel {
  background: linear-gradient(180deg, rgba(60,30,15,.92), rgba(40,20,10,.95));
  border: 1px solid rgba(245,197,66,.45); border-radius: 14px; padding: 22px 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-tabs button {
  flex: 1; padding: 10px; border: 1px solid rgba(245,197,66,.4); background: transparent;
  color: #d9c08a; font-size: 16px; border-radius: 8px; cursor: pointer; letter-spacing: 2px;
}
.auth-tabs button.active { background: var(--red); color: #fff; border-color: var(--red); }
.auth-panel input {
  width: 100%; padding: 13px 14px; margin-bottom: 12px; border-radius: 8px;
  border: 1px solid rgba(245,197,66,.35); background: rgba(0,0,0,.35); color: #ffe9b8;
  font-size: 15px; outline: none;
}
.auth-panel input::placeholder { color: #8f7a55; }
.btn-main {
  width: 100%; margin-top: 8px; padding: 14px; font-size: 18px; letter-spacing: 4px;
  color: #fff; background: linear-gradient(180deg, #e53935, var(--red-dark));
  border: 1px solid #ffb84c; border-radius: 10px; cursor: pointer;
  box-shadow: 0 4px 0 #5c0000, 0 6px 16px rgba(0,0,0,.4);
}
.btn-main:active { transform: translateY(2px); box-shadow: 0 2px 0 #5c0000; }
.btn-main.gold { background: linear-gradient(180deg, #ffd54f, var(--gold-dark)); color: #4a2c00; text-shadow: none; }
.btn-main small { font-size: 12px; letter-spacing: 0; font-weight: normal; }
.auth-tip { text-align: center; color: #c9a96a; font-size: 12px; margin-top: 14px; }
.copyright { text-align: center; color: #6f5a3c; font-size: 11px; margin-top: 26px; line-height: 1.8; }

.page-title { text-align: center; color: var(--gold); font-size: 26px; letter-spacing: 4px; margin-bottom: 18px; font-family: "STKaiti","KaiTi",serif; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.hint { color: #c9a96a; font-size: 13px; text-align: center; margin-bottom: 12px; line-height: 1.8; }
.page-inner input, .sub input {
  width: 100%; padding: 13px 14px; margin-bottom: 10px; border-radius: 8px;
  border: 1px solid rgba(245,197,66,.35); background: rgba(0,0,0,.35); color: #ffe9b8; font-size: 15px;
}
.btn-back {
  display: block; margin: 18px auto 0; background: transparent; color: #c9a96a;
  border: 1px solid rgba(245,197,66,.4); padding: 10px 34px; border-radius: 20px; cursor: pointer;
}

/* ---------- 选区 ---------- */
.server-list { display: flex; flex-direction: column; gap: 12px; }
.server-item {
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(180deg, rgba(60,30,15,.9), rgba(40,20,10,.95));
  border: 1px solid rgba(245,197,66,.4); border-radius: 10px; padding: 16px 18px;
  cursor: pointer; color: #f3e2bb;
}
.server-item:active { background: var(--red); }
.server-item .s-name { font-size: 16px; }
.server-item .s-tag { font-size: 11px; padding: 3px 10px; border-radius: 10px; background: #2e9e5b; color: #fff; }
.server-item .s-tag.hot { background: var(--red); }
.server-item .s-count { color: #b79a63; font-size: 12px; }

/* ---------- 创角阵营 ---------- */
.faction-pick { display: flex; gap: 10px; margin-bottom: 14px; }
.faction-card {
  flex: 1; text-align: center; padding: 14px 4px 12px; border-radius: 10px; cursor: pointer;
  background: rgba(0,0,0,.35); border: 2px solid transparent; color: #e8d5ae; font-size: 12px;
}
.faction-card p { font-size: 13px; margin: 6px 0 4px; }
.faction-card span { color: #a98f5f; font-size: 11px; display: block; }
.faction-card .faction-icon {
  width: 52px; height: 52px; margin: 0 auto; border-radius: 50%; font-size: 26px; line-height: 52px;
  font-family: "STKaiti","KaiTi",serif; color: #fff;
}
.faction-card.wei .faction-icon { background: var(--wei); }
.faction-card.shu .faction-icon { background: var(--shu); }
.faction-card.wu .faction-icon { background: var(--wu); }
.faction-card.active { border-color: var(--gold); background: rgba(245,197,66,.12); }

/* ---------- 主城 ---------- */
.top-bar {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 10px 12px; background: linear-gradient(180deg, rgba(20,10,5,.95), rgba(40,20,10,.85));
  border-bottom: 1px solid rgba(245,197,66,.4);
}
.player-info { display: flex; gap: 10px; cursor: pointer; }
.avatar {
  width: 52px; height: 52px; border-radius: 10px; background: linear-gradient(135deg, #8e5b2c, #4a2c12);
  border: 2px solid var(--gold); color: var(--gold); font-size: 24px; text-align: center; line-height: 50px;
  font-family: "STKaiti","KaiTi",serif;
}
.player-name { color: #ffe9b8; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.faction-badge { font-size: 10px; padding: 1px 6px; border-radius: 8px; color: #fff; background: var(--wei); }
.lv-line { color: #c9a96a; font-size: 12px; margin: 2px 0; }
.lv-line .power b { color: var(--gold); }
.exp-bar { width: 130px; height: 6px; background: rgba(0,0,0,.5); border-radius: 3px; overflow: hidden; }
.exp-bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #ffd54f, #ff8f00); }
.res-group { display: flex; flex-direction: column; gap: 4px; }
.res { font-size: 12px; color: #ffe9b8; background: rgba(0,0,0,.4); border-radius: 10px; padding: 2px 10px; min-width: 100px; display: flex; align-items: center; gap: 4px; }
.res b { color: #fff; }
.notice {
  display: flex; align-items: center; gap: 8px; margin: 8px 10px 0; padding: 6px 10px;
  background: rgba(0,0,0,.4); border-radius: 8px; border: 1px solid rgba(245,197,66,.25);
}
.notice span { background: var(--red); color: #fff; font-size: 11px; border-radius: 4px; padding: 2px 6px; flex-shrink: 0; }
.notice-roll { overflow: hidden; flex: 1; }
.notice-roll p { color: #ffe9b8; font-size: 12px; white-space: nowrap; animation: roll 18s linear infinite; }
@keyframes roll { 0% { transform: translateX(100%); } 100% { transform: translateX(-100%); } }

.city-area { padding: 14px 12px 90px; }
.city-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.building {
  position: relative; text-align: center; padding: 18px 4px 12px; border-radius: 12px; cursor: pointer;
  background: linear-gradient(180deg, rgba(70,35,18,.95), rgba(45,22,10,.95));
  border: 1px solid rgba(245,197,66,.45); color: #f3e2bb; font-size: 14px; letter-spacing: 2px;
  box-shadow: 0 4px 10px rgba(0,0,0,.35);
}
.building:active { transform: scale(.96); }
.building .b-ico { font-size: 34px; margin-bottom: 6px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.building span { display: block; }
.red-dot { position: absolute; top: 8px; right: 12px; width: 10px; height: 10px; background: #ff3b30; border-radius: 50%; display: none; }
.red-dot.show { display: block; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.city-caption { text-align: center; color: #8f7a55; font-size: 12px; margin-top: 18px; letter-spacing: 3px; }

.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px;
  display: flex; background: linear-gradient(180deg, rgba(50,25,12,.98), rgba(28,14,6,.98));
  border-top: 2px solid rgba(245,197,66,.5); z-index: 50;
}
.bottom-nav button {
  flex: 1; background: none; border: none; color: #b79a63; padding: 8px 0 10px; cursor: pointer; font-size: 12px;
}
.bottom-nav button i { display: block; font-style: normal; font-size: 22px; margin-bottom: 2px; }
.bottom-nav button.active { color: var(--gold); }

/* ---------- 子页面 ---------- */
.page.sub { background: radial-gradient(900px 700px at 50% -5%, #3a1a0e 0%, #1d0d06 60%, #120803 100%); padding-bottom: 30px; }
.sub-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; }
.sub-head h2 { color: var(--gold); font-size: 20px; letter-spacing: 3px; font-family: "STKaiti","KaiTi",serif; }
.btn-back2 {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(245,197,66,.5);
  background: rgba(0,0,0,.4); color: var(--gold); font-size: 22px; cursor: pointer; line-height: 1;
}

.filter-tabs { display: flex; gap: 8px; padding: 4px 14px 10px; }
.filter-tabs button {
  flex: 1; padding: 8px 0; border-radius: 16px; border: 1px solid rgba(245,197,66,.35);
  background: rgba(0,0,0,.35); color: #d9c08a; cursor: pointer; font-size: 14px;
}
.filter-tabs button.active { background: var(--gold); color: #4a2c00; border-color: var(--gold); font-weight: bold; }

.hero-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 4px 14px 20px; }
.hero-card {
  border-radius: 12px; padding: 10px 6px 8px; text-align: center; color: #fff; position: relative;
  overflow: hidden; border: 2px solid #666; background: linear-gradient(180deg, rgba(50,30,15,.9), rgba(25,12,6,.95));
}
/* 资质边框：200金 / 180紫 / 150蓝 */
.hero-card.apt-200 { border-color: var(--gold); box-shadow: 0 0 12px rgba(245,197,66,.4); background: linear-gradient(180deg, #6b4a12, #2a1806); }
.hero-card.apt-180 { border-color: #b388ff; box-shadow: 0 0 10px rgba(179,136,255,.3); background: linear-gradient(180deg, #3d2a5e, #1a1028); }
.hero-card.apt-150 { border-color: #4a90d9; background: linear-gradient(180deg, #1e3a5c, #0e1c2c); }
.hero-card .h-faction { position: absolute; top: 4px; left: 6px; font-size: 10px; padding: 1px 6px; border-radius: 6px; color: #fff; z-index: 2; }
.hero-card .h-apt { position: absolute; top: 4px; right: 6px; font-size: 10px; padding: 1px 6px; border-radius: 6px; z-index: 2; color: #fff; font-weight: bold; }
.hero-card .h-apt.a200 { background: linear-gradient(180deg, #ffd54f, #c8971f); color: #4a2c00; }
.hero-card .h-apt.a180 { background: linear-gradient(180deg, #b388ff, #7c4dff); }
.hero-card .h-apt.a150 { background: linear-gradient(180deg, #64b5f6, #1976d2); }
.hero-card .h-face {
  width: 100%; aspect-ratio: 3/4; margin: 6px auto 4px; border-radius: 8px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; position: relative;
  background: radial-gradient(circle at 50% 40%, rgba(255,255,255,.15), rgba(0,0,0,.3));
}
.hero-card .h-face img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.hero-card .h-face .h-fallback { width: 64px; height: 64px; border-radius: 50%; font-size: 30px; line-height: 64px;
  font-family: "STKaiti","KaiTi",serif; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,.6); }
.hero-card .h-name { font-size: 15px; margin-bottom: 2px; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.hero-card .h-stars { color: var(--gold); font-size: 11px; letter-spacing: 1px; }
.hero-card .h-level { color: #d9c08a; font-size: 11px; margin-top: 3px; }
.hero-card .btn-up {
  margin-top: 6px; width: 90%; padding: 5px 0; font-size: 11px; border: none; border-radius: 12px;
  background: linear-gradient(180deg, #ffd54f, var(--gold-dark)); color: #4a2c00; cursor: pointer; font-weight: bold;
}
.hero-card .btn-up:disabled { background: #555; color: #999; cursor: not-allowed; }
.hero-list.small { grid-template-columns: repeat(3, 1fr); max-height: 300px; overflow-y: auto; }

/* ---------- 阵容布阵 ---------- */
.formation-power { text-align: center; color: #ffe9b8; font-size: 15px; margin-bottom: 12px; }
.formation-power b { color: var(--gold); font-size: 20px; }
.formation-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 16px; margin-bottom: 14px;
}
.form-slot {
  position: relative; aspect-ratio: 3/4; border-radius: 12px; overflow: hidden; cursor: pointer;
  border: 2px dashed rgba(245,197,66,.4); background: rgba(0,0,0,.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.form-slot .slot-no { position: absolute; top: 4px; left: 6px; font-size: 10px; color: #8f7a55; z-index: 2; }
.form-slot .plus { font-size: 30px; color: #8f7a55; }
.form-slot .plus-text { font-size: 11px; color: #8f7a55; margin-top: 4px; }
.form-slot.filled { border-style: solid; border-color: var(--gold); }
.form-slot.filled img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.form-slot.filled .h-fallback { width: 54px; height: 54px; border-radius: 50%; font-size: 26px; line-height: 54px;
  font-family: "STKaiti","KaiTi",serif; color: #fff; }
.form-slot .form-name {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 2; font-size: 11px; padding: 3px 0;
  background: rgba(0,0,0,.65); color: #ffe9b8; text-align: center;
}
.formation-btns { display: flex; gap: 12px; padding: 0 16px; }
.formation-btns .btn-main { flex: 1; margin-top: 0; }
.sub-sub-title { color: var(--gold); font-size: 15px; padding: 14px 16px 4px; letter-spacing: 2px; }
.hero-card.selectable:active { transform: scale(.95); }
.hero-card.in-formation::after {
  content: '已上阵'; position: absolute; top: 34%; left: 50%; transform: translate(-50%,-50%) rotate(-12deg);
  background: rgba(46,158,91,.9); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 4px; z-index: 3;
}

/* ---------- 招募 ---------- */
.recruit-stage { text-align: center; padding: 16px 14px 8px; }
.recruit-circle {
  width: 130px; height: 130px; margin: 10px auto 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff7043, #b71c1c 70%);
  border: 4px solid var(--gold); color: #fff; font-size: 56px; line-height: 122px;
  font-family: "STKaiti","KaiTi",serif; text-shadow: 0 3px 8px rgba(0,0,0,.6);
  box-shadow: 0 0 30px rgba(245,197,66,.4);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.05); box-shadow: 0 0 45px rgba(245,197,66,.6); } }
.recruit-btns { display: flex; gap: 12px; padding: 0 20px; }
.recruit-btns .btn-main { line-height: 1.5; }

/* ---------- 冲关塔 / 副本 ---------- */
.tower-panel, .dungeon-panel {
  margin: 10px 16px; padding: 20px 16px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(60,30,15,.9), rgba(40,20,10,.95));
  border: 1px solid rgba(245,197,66,.4); text-align: center;
}
.tower-floor { color: #ffe9b8; margin-bottom: 16px; }
.tower-floor span { font-size: 13px; color: #c9a96a; display: block; }
.tower-floor b { font-size: 44px; color: var(--gold); font-family: "STKaiti","KaiTi",serif; }
.vs-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 16px; }
.vs-card { flex: 1; background: rgba(0,0,0,.4); border-radius: 10px; padding: 12px 4px; }
.vs-card span { display: block; font-size: 12px; color: #c9a96a; margin-bottom: 4px; }
.vs-card b { font-size: 22px; color: #7fd4a0; }
.vs-card.enemy b { color: #ff8a80; }
.vs { color: var(--red); font-weight: bold; font-size: 20px; text-shadow: 0 1px 3px #000; }
.stage-title { color: var(--gold); font-size: 20px; margin-bottom: 14px; font-family: "STKaiti","KaiTi",serif; letter-spacing: 2px; }
.chapter-track { padding: 4px 16px 20px; }
.chapter-item {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; margin-bottom: 8px;
  background: rgba(0,0,0,.35); border-radius: 10px; border: 1px solid rgba(245,197,66,.25); color: #e8d5ae; font-size: 14px;
}
.chapter-item.current { border-color: var(--gold); background: rgba(245,197,66,.1); }
.chapter-item .st { color: #2e9e5b; font-size: 12px; }
.chapter-item.current .st { color: var(--gold); }

/* ---------- 福利 ---------- */
.welfare-list { padding: 8px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.welfare-card {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: linear-gradient(180deg, rgba(60,30,15,.92), rgba(40,20,10,.95));
  border: 1px solid rgba(245,197,66,.4); border-radius: 12px; padding: 16px;
}
.welfare-card.hot { border-color: var(--gold); box-shadow: 0 0 16px rgba(245,197,66,.25); }
.w-info h3 { color: #ffe9b8; font-size: 16px; margin-bottom: 6px; }
.w-info p { color: #c9a96a; font-size: 12px; }
.btn-claim {
  min-width: 84px; padding: 10px 12px; border: none; border-radius: 20px; cursor: pointer;
  background: linear-gradient(180deg, #ffd54f, var(--gold-dark)); color: #4a2c00; font-weight: bold; font-size: 14px;
}
.btn-claim:disabled { background: #444; color: #888; cursor: not-allowed; }
.online-bar { width: 100%; height: 8px; background: rgba(0,0,0,.5); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.online-bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #4fc3f7, #29b6f6); }
.online-text { font-size: 11px; color: #8f7a55; }

/* ---------- 弹窗 / 提示 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.modal.show { display: flex; }
.modal-box {
  width: 100%; max-width: 400px; max-height: 85vh; overflow-y: auto; text-align: center;
  background: linear-gradient(180deg, #4a2412, #2a130a); border: 2px solid var(--gold);
  border-radius: 16px; padding: 22px 18px;
}
.modal-box h2 { color: var(--gold); font-size: 24px; margin-bottom: 14px; font-family: "STKaiti","KaiTi",serif; letter-spacing: 3px; }
.battle-log {
  text-align: left; background: rgba(0,0,0,.4); border-radius: 10px; padding: 12px; margin-bottom: 12px;
  max-height: 220px; overflow-y: auto; color: #e8d5ae; font-size: 13px; line-height: 2;
}
.battle-reward { color: #7fd4a0; font-size: 14px; margin-bottom: 14px; line-height: 1.9; }
.toast {
  position: fixed; top: 18%; left: 50%; transform: translateX(-50%) translateY(-10px);
  background: rgba(0,0,0,.85); color: #ffe9b8; padding: 12px 26px; border-radius: 24px;
  font-size: 14px; z-index: 200; opacity: 0; pointer-events: none; transition: all .3s;
  border: 1px solid rgba(245,197,66,.5); max-width: 85%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
