/* ============================================
   全职法师·人生重开模拟器 —— 明亮热血风
   ============================================ */
:root {
  --c-ink: #2b2b4a;
  --c-main: #ff6a1a;
  --c-main-d: #e8500a;
  --c-gold: #ffc93c;
  --c-sky: #2fa8ff;
  --c-sky-d: #0f7edb;
  --c-red: #ff4d4f;
  --c-green: #3fbf6f;
  --c-purple: #9b59e0;
  --c-pink: #ff7ab8;
  --c-card: #ffffff;
  --c-line: #ffd9a8;
  --radius: 18px;
  --shadow: 0 8px 24px rgba(255, 122, 26, .18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  color: var(--c-ink);
  background: linear-gradient(165deg, #fff8ea 0%, #e9f6ff 55%, #ffe9d6 100%);
  overflow-x: hidden;
}

/* ---------- 背景装饰 ---------- */
.bg-decor { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.sun {
  position: absolute; top: -90px; right: -90px; width: 280px; height: 280px;
  background: radial-gradient(circle, #fff3b0 0%, #ffd84d 55%, rgba(255, 216, 77, 0) 72%);
  border-radius: 50%;
  animation: sunpulse 5s ease-in-out infinite;
}
@keyframes sunpulse { 0%,100% { transform: scale(1); opacity:.9 } 50% { transform: scale(1.07); opacity:1 } }
.rays {
  position: absolute; top: -160px; right: -160px; width: 520px; height: 520px;
  background: repeating-conic-gradient(from 0deg, rgba(255,190,60,.18) 0deg 6deg, transparent 6deg 14deg);
  border-radius: 50%;
  animation: spin 60s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }
.spark {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #ffd54a 60%, transparent 75%);
  animation: float 7s ease-in-out infinite;
  filter: drop-shadow(0 0 6px #ffd54a);
}
@keyframes float {
  0%,100% { transform: translateY(0) scale(1); opacity:.85 }
  50% { transform: translateY(-34px) scale(1.25); opacity:1 }
}
.ring {
  position: absolute; border-radius: 50%;
  border: 2px dashed rgba(47, 168, 255, .35);
  animation: spin 40s linear infinite;
}
.r1 { width: 380px; height: 380px; left: -120px; bottom: -120px; }
.r2 { width: 260px; height: 260px; right: -60px; bottom: 10%; animation-direction: reverse; }

/* ---------- 应用容器 ---------- */
.app {
  position: relative; z-index: 1;
  max-width: 560px; margin: 0 auto; min-height: 100vh;
  padding: 28px 18px 40px;
  display: flex; flex-direction: column;
}
.view { display: none; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 18px; animation: fadeUp .5s ease both; }
.view.active { display: flex; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px) } to { opacity: 1; transform: none } }

/* ---------- 开始界面 ---------- */
.logo-block { text-align: center; }
.logo-badge {
  display: inline-block; padding: 6px 22px; margin-bottom: 10px;
  background: linear-gradient(135deg, var(--c-main), #ffb347);
  color: #fff; font-weight: 900; font-size: 15px; letter-spacing: 6px;
  border-radius: 999px; box-shadow: 0 6px 16px rgba(255, 106, 26, .35);
  transform: rotate(-4deg);
}
.game-title {
  font-size: 58px; font-weight: 900; letter-spacing: 8px; line-height: 1.1;
  color: var(--c-main);
  -webkit-text-stroke: 2px #fff;
  text-shadow: 0 4px 0 #fff, 0 8px 18px rgba(255, 106, 26, .35);
}
.game-sub { font-size: 22px; font-weight: 900; letter-spacing: 10px; color: var(--c-sky-d); margin-top: 4px; }
.game-desc { margin-top: 14px; color: #7a6a58; font-size: 14px; line-height: 1.8; }
.tip { margin-top: 6px; font-size: 12px; color: #b08d5f; letter-spacing: 1px; }

.btn {
  border: none; cursor: pointer; font-family: inherit;
  border-radius: 14px; font-weight: 800; transition: all .18s ease;
}
.btn:active { transform: scale(.96); }
.btn-primary {
  background: linear-gradient(135deg, var(--c-main), #ffa033);
  color: #fff; padding: 16px 30px; font-size: 17px; letter-spacing: 3px;
  box-shadow: 0 8px 20px rgba(255, 106, 26, .4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(255, 106, 26, .5); }
.btn-big { font-size: 19px; }
.btn-ghost {
  background: rgba(255,255,255,.75); color: var(--c-sky-d);
  border: 2px solid var(--c-sky); padding: 10px 22px; font-size: 14px;
}
.btn-ghost:hover { background: var(--c-sky); color: #fff; }
.btn-small { padding: 7px 16px; font-size: 13px; }
.btn-group { display: flex; flex-direction: column; gap: 12px; align-items: center; width: 100%; }
.btn-row { display: flex; gap: 12px; }

/* ---------- 抽卡动画 ---------- */
.draw-card { perspective: 900px; width: 240px; height: 330px; }
.draw-inner {
  width: 100%; height: 100%; position: relative;
  transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.2,.9,.3,1.2);
}
.draw-card.flip .draw-inner { transform: rotateY(180deg); }
.draw-front, .draw-back {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: 20px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 18px;
}
.draw-front {
  background: linear-gradient(160deg, #fff7e6, #ffe3bd);
  border: 3px solid var(--c-gold);
  box-shadow: 0 10px 30px rgba(255, 180, 40, .35);
  animation: cardpulse 1.6s ease-in-out infinite;
}
@keyframes cardpulse { 0%,100% { transform: scale(1) } 50% { transform: scale(1.04) } }
.draw-label { font-weight: 900; letter-spacing: 6px; color: #c07f1a; font-size: 15px; }
.draw-circle {
  width: 110px; height: 110px; border-radius: 50%;
  border: 4px dashed var(--c-gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: var(--c-main);
  animation: spin 6s linear infinite;
}
.draw-back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #fff, #fff3e0);
  border: 3px solid var(--c-line);
  box-shadow: var(--shadow);
}
.rarity-badge {
  padding: 5px 20px; border-radius: 999px; color: #fff;
  font-size: 14px; font-weight: 900; letter-spacing: 4px;
  box-shadow: 0 4px 10px rgba(0,0,0,.18);
}
.rarity-badge.传说 { background: linear-gradient(135deg, #ffd54a, #ff9800); }
.rarity-badge.精英 { background: linear-gradient(135deg, #4fc3f7, #1e88e5); }
.rarity-badge.普通 { background: linear-gradient(135deg, #bdbdbd, #8d8d8d); }
.draw-name { font-size: 30px; font-weight: 900; color: var(--c-ink); }
.draw-title { font-size: 13px; color: #a0602a; letter-spacing: 1px; }
.draw-magic { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.magic-tag {
  background: linear-gradient(135deg, var(--c-purple), #7a5ce0);
  color: #fff; font-size: 12px; padding: 4px 12px; border-radius: 999px;
}
.magic-tag.m-火系 { background: linear-gradient(135deg, #ff7043, #e53935); }
.magic-tag.m-雷系 { background: linear-gradient(135deg, #ffd54a, #ffa000); }
.magic-tag.m-冰系 { background: linear-gradient(135deg, #4fc3f7, #1976d2); }
.magic-tag.m-风系 { background: linear-gradient(135deg, #81d4fa, #29b6f6); }
.magic-tag.m-光系, .magic-tag.m-圣系 { background: linear-gradient(135deg, #fff176, #ffb300); color:#6d4c00; }
.magic-tag.m-暗影系, .magic-tag.m-死亡系, .magic-tag.m-亡灵系 { background: linear-gradient(135deg, #7e57c2, #4527a0); }
.magic-tag.m-水系, .magic-tag.m-土系 { background: linear-gradient(135deg, #26c6da, #00897b); }
.magic-tag.m-召唤系 { background: linear-gradient(135deg, #ff8a65, #d84315); }
.magic-tag.m-治愈系 { background: linear-gradient(135deg, #aed581, #689f38); }
.magic-tag.m-血系 { background: linear-gradient(135deg, #ef5350, #b71c1c); }
.magic-tag.m-图腾系, .magic-tag.m-图腾之力, .magic-tag.m-自然系 { background: linear-gradient(135deg, #66bb6a, #2e7d32); }
/* 稀有系：金色描边 + 角标 */
.magic-tag.magic-rare { box-shadow: 0 0 0 2px #ffd700, 0 0 12px rgba(255, 215, 0, .55); position: relative; }
.magic-tag .rare-dot {
  font-style: normal; display: inline-block; margin-left: 5px; padding: 0 5px;
  background: #ffd700; color: #5a3a00; font-size: 10px; font-weight: 900;
  border-radius: 999px; line-height: 14px; vertical-align: 1px;
}
.magic-item.magic-item-rare { border-color: #ffd700; background: linear-gradient(135deg, #fffbe8, #fff3cd); box-shadow: 0 0 10px rgba(255, 215, 0, .25); }
.magic-item .m-rare-tip { font-size: 10px; color: #9c6b00; background: #ffe9a8; padding: 1px 8px; border-radius: 8px; white-space: nowrap; }
.magic-item.magic-item-rare .m-name { color: #a06a00; }

/* ---------- 魔法系成长面板 ---------- */
.magic-panel { margin-top: 12px; }
.magic-head { font-weight: 900; font-size: 15px; margin-bottom: 8px; }
.magic-head-sub { font-size: 11px; color: #c08a5a; font-weight: 600; margin-left: 6px; }
.magic-line { display: flex; flex-direction: column; gap: 6px; }
.magic-item {
  display: flex; align-items: center; gap: 8px; background: #fff8ef;
  border: 1px solid #ffe3c2; border-radius: 12px; padding: 6px 12px;
}
.magic-item .m-seq {
  width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--c-gold), var(--c-main));
  color: #fff; font-size: 12px; font-weight: 900; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.magic-item .m-name { font-weight: 900; font-size: 14px; white-space: nowrap; }
.magic-item .m-cat { font-size: 11px; color: #b08a6a; background: #fff1e0; padding: 1px 8px; border-radius: 8px; }
.magic-item .m-desc { font-size: 12px; color: #8a7a6a; flex: 1; }
.magic-empty { font-size: 13px; color: #b0a294; font-style: italic; }
.awaken-chip {
  display: inline-block; margin: 4px 6px 0 0; padding: 3px 10px; border-radius: 10px;
  background: linear-gradient(135deg, #fff3c9, #ffe0a8); border: 1px solid #ffd27a;
  color: #9c5a12; font-size: 12px; font-weight: 700;
}
.end-magic { margin-top: 10px; }

/* ---------- 灵物与伙伴（灵种/契约兽） ---------- */
.sp-panel { margin-top: 12px; }
.sp-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-grid + .sp-grid { margin-top: 8px; }
.sp-item {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 2px solid var(--c-line); border-radius: 12px;
  padding: 6px 12px 6px 6px; box-shadow: 0 2px 6px rgba(120, 80, 30, .08);
}
.sp-seed { border-color: #bfe8ff; }
.sp-pet { border-color: #ffd6b8; }
.sp-icon {
  width: 26px; height: 26px; border-radius: 50%; color: #fff;
  font-size: 13px; font-weight: 900; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .18);
}
.sp-name { font-weight: 900; font-size: 13px; color: var(--c-main-d); }
.sp-at { font-style: normal; font-size: 11px; color: #b0a090; }
.sp-empty { font-size: 12px; color: #b0a294; font-style: italic; padding: 2px 0; }
.seed-chip, .pet-chip {
  display: inline-block; margin: 4px 6px 0 0; padding: 3px 10px; border-radius: 10px;
  font-size: 12px; font-weight: 700;
}
.seed-chip { background: #e6f6ff; border: 1px solid #9fd8f5; color: #14709b; }
.pet-chip { background: #fff0e6; border: 1px solid #ffc9a3; color: #b0551a; }

/* ---------- 游戏界面 ---------- */
.game-head { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.char-chip {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 2px solid var(--c-line);
  padding: 8px 16px; border-radius: 999px; box-shadow: var(--shadow);
}
.chip-name { font-weight: 900; font-size: 16px; color: var(--c-main-d); }
.chip-camp {
  background: var(--c-sky); color: #fff; font-size: 11px;
  padding: 2px 10px; border-radius: 999px; font-weight: 700;
}
.head-right { display: flex; gap: 8px; align-items: center; }
.age-chip, .stage-chip {
  background: #fff; border: 2px solid var(--c-line);
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
}
.age-chip b { color: var(--c-main); font-size: 16px; }
.stage-chip { background: linear-gradient(135deg, var(--c-main), #ffb347); color: #fff; border: none; }

.panel {
  background: var(--c-card); border: 2px solid var(--c-line);
  border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; padding: 14px;
}
.stats-panel { padding: 12px 14px; }
.stats-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tier-badge {
  background: linear-gradient(135deg, var(--c-purple), #8e44ad);
  color: #fff; font-weight: 900; font-size: 13px;
  padding: 5px 14px; border-radius: 10px; white-space: nowrap;
}
.realm-bar {
  flex: 1; position: relative; height: 18px; background: #f2e4d2;
  border-radius: 999px; overflow: hidden;
}
.realm-bar i {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: linear-gradient(90deg, #8e44ad, #c39bd3);
  border-radius: 999px; transition: width .8s ease;
}
.realm-bar em {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-style: normal; font-size: 10px; font-weight: 800; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.icon-btn {
  border: 2px solid var(--c-sky); background: #fff; color: var(--c-sky-d);
  width: 30px; height: 30px; border-radius: 10px; font-weight: 900; cursor: pointer;
}
.icon-btn:hover { background: var(--c-sky); color: #fff; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 14px; }
.stat-item { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.stat-name { width: 30px; color: #8a6a4a; font-weight: 700; flex-shrink: 0; }
.stat-bar { flex: 1; height: 10px; background: #f4e8d8; border-radius: 999px; overflow: hidden; }
.stat-bar i { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .8s ease; }
.stat-val { width: 30px; text-align: right; font-weight: 800; color: var(--c-ink); font-size: 11px; }
.sb-fight i { background: linear-gradient(90deg, #ff8a50, #ff4d4f); }
.sb-wealth i { background: linear-gradient(90deg, #ffd54a, #ff9800); }
.sb-fame i { background: linear-gradient(90deg, #ff7ab8, #ec407a); }
.sb-moral i { background: linear-gradient(90deg, #66bb6a, #2e9e5b); }
.sb-charm i { background: linear-gradient(90deg, #f48fb1, #ec407a); }
.sb-health i { background: linear-gradient(90deg, #81d4fa, #2fa8ff); }
.sb-talent i { background: linear-gradient(90deg, #ce93d8, #9b59e0); }

/* ---------- 事件卡 ---------- */
.event-card {
  background: linear-gradient(160deg, #fff, #fff6e8);
  border: 3px solid var(--c-line); border-radius: var(--radius);
  box-shadow: var(--shadow); width: 100%; padding: 20px;
  animation: fadeUp .45s ease both;
}
.event-tag-row { display: flex; gap: 8px; margin-bottom: 10px; }
.event-stage, .event-tag {
  font-size: 12px; font-weight: 800; padding: 3px 12px; border-radius: 999px;
}
.event-stage { background: linear-gradient(135deg, var(--c-sky), var(--c-sky-d)); color: #fff; }
.event-tag { background: #fff3d6; color: #c07f1a; border: 1px solid #ffd9a8; }
.event-title { font-size: 22px; font-weight: 900; margin-bottom: 8px; color: var(--c-ink); line-height: 1.4; }
.event-desc { font-size: 14px; line-height: 1.9; color: #6d5a48; margin-bottom: 16px; }
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice-btn {
  width: 100%; text-align: left; font-family: inherit;
  background: #fff; border: 2px solid #ffe0bd; border-radius: 12px;
  padding: 12px 14px; font-size: 14px; color: var(--c-ink); cursor: pointer;
  transition: all .15s ease; font-weight: 600; line-height: 1.6;
}
.choice-btn:hover {
  border-color: var(--c-main); background: #fff4e8;
  transform: translateX(4px); box-shadow: 0 4px 12px rgba(255,106,26,.2);
}
.choice-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.choice-btn .c-arrow { color: var(--c-main); font-weight: 900; margin-right: 6px; }

/* ---------- 结果横幅 ---------- */
.banner {
  position: fixed; left: 50%; top: 12%; transform: translateX(-50%) scale(.8);
  background: linear-gradient(135deg, #ffd54a, #ff9800); color: #fff;
  font-weight: 900; font-size: 18px; padding: 14px 34px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(255, 152, 0, .5);
  opacity: 0; pointer-events: none; z-index: 50; letter-spacing: 4px;
  text-align: center; white-space: nowrap;
}
.banner.show { animation: bannerpop 2.2s ease forwards; }
@keyframes bannerpop {
  0% { opacity: 0; transform: translateX(-50%) scale(.6) }
  12% { opacity: 1; transform: translateX(-50%) scale(1.08) }
  20% { transform: translateX(-50%) scale(1) }
  82% { opacity: 1 }
  100% { opacity: 0; transform: translateX(-50%) scale(.95) }
}

/* ---------- 履历 ---------- */
.history-panel h4 { font-size: 15px; margin-bottom: 10px; color: var(--c-sky-d); }
.history-item {
  display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #ffe0bd;
  font-size: 13px; line-height: 1.6;
}
.history-item:last-child { border-bottom: none; }
.h-age { color: var(--c-main); font-weight: 900; white-space: nowrap; }
.h-event { flex: 1; }
.h-choice { color: #8a6a4a; font-size: 12px; }
.delta { display: inline-block; font-size: 11px; font-weight: 800; margin-left: 4px; border-radius: 6px; padding: 0 5px; }
.delta.plus { background: #e6f7ec; color: #2e9e5b; }
.delta.minus { background: #ffecec; color: #e53935; }
.tierup {
  display: inline-block; background: linear-gradient(135deg, var(--c-purple), #8e44ad);
  color: #fff; font-size: 11px; font-weight: 900; border-radius: 999px; padding: 2px 10px;
  animation: pop .5s ease;
}
@keyframes pop { from { transform: scale(.5) } to { transform: scale(1) } }

/* ---------- 结局 ---------- */
.end-card {
  width: 100%; text-align: center;
  background: linear-gradient(160deg, #fff, #fff6e8);
  border: 3px solid var(--c-line); border-radius: 22px;
  box-shadow: var(--shadow); padding: 30px 22px;
  animation: fadeUp .6s ease both;
}
.end-icon {
  width: 96px; height: 96px; margin: 0 auto 14px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c-gold), var(--c-main));
  color: #fff; font-size: 44px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px rgba(255, 106, 26, .4);
}
.end-title { font-size: 30px; font-weight: 900; color: var(--c-main-d); letter-spacing: 4px; margin-bottom: 12px; }
.end-desc { font-size: 14px; line-height: 2; color: #6d5a48; text-align: left; }

/* ---------- 图鉴 ---------- */
.page-head {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
}
.page-title { font-size: 24px; font-weight: 900; color: var(--c-main-d); letter-spacing: 4px; }
.gallery-tabs { display: flex; gap: 8px; width: 100%; }
.tab {
  flex: 1; padding: 10px; border: 2px solid var(--c-sky); background: #fff;
  color: var(--c-sky-d); border-radius: 12px; font-weight: 800; font-size: 14px; cursor: pointer;
}
.tab.active { background: var(--c-sky); color: #fff; }
.tab-panel { display: none; width: 100%; flex-direction: column; gap: 12px; }
.tab-panel.active { display: flex; }
.char-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.char-card {
  background: #fff; border: 2px solid var(--c-line); border-radius: 14px;
  padding: 12px; cursor: pointer; transition: all .15s ease;
}
.char-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.char-card.unseen { filter: grayscale(1); opacity: .55; }
.char-card .cc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cc-name { font-weight: 900; font-size: 15px; }
.cc-rarity { font-size: 10px; color: #fff; padding: 2px 8px; border-radius: 999px; font-weight: 800; }
.cc-rarity.传说 { background: linear-gradient(135deg,#ffd54a,#ff9800); }
.cc-rarity.精英 { background: linear-gradient(135deg,#4fc3f7,#1e88e5); }
.cc-rarity.普通 { background: #9e9e9e; }
.cc-title { font-size: 11px; color: #a0602a; }
.cc-camp { font-size: 10px; color: #fff; background: var(--c-sky); display: inline-block; padding: 1px 8px; border-radius: 999px; margin-top: 4px; }
.char-detail {
  background: #fff; border: 3px solid var(--c-line); border-radius: 18px;
  padding: 18px; width: 100%; box-shadow: var(--shadow);
}
.char-detail h3 { font-size: 22px; color: var(--c-main-d); margin-bottom: 4px; }
.char-detail .cd-title { color: #a0602a; font-size: 13px; margin-bottom: 10px; }
.char-detail p { font-size: 13px; line-height: 1.9; color: #6d5a48; }
.endings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.ending-card {
  background: #fff; border: 2px solid var(--c-line); border-radius: 14px;
  padding: 14px; text-align: center;
}
.ending-card.unseen { filter: grayscale(1); opacity: .5; }
.ending-card .ed-icon {
  width: 46px; height: 46px; margin: 0 auto 8px; border-radius: 50%;
  color: #fff; font-weight: 900; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
}
.ending-card .ed-title { font-weight: 900; font-size: 14px; }

/* 战绩表 */
.record-row {
  background: #fff; border: 2px solid var(--c-line); border-radius: 12px;
  padding: 10px 12px; display: flex; justify-content: space-between; align-items: center;
  font-size: 13px;
}
.record-row .rr-char { font-weight: 900; }
.record-row .rr-end { color: var(--c-main-d); font-weight: 800; }
.record-row .rr-time { color: #b0a090; font-size: 11px; }
.empty-tip { text-align: center; color: #b0a090; padding: 30px 0; font-size: 14px; }

/* ---------- 履历弹层 ---------- */
.hist-overlay {
  position: fixed; inset: 0; background: rgba(30, 26, 50, .5);
  display: none; align-items: center; justify-content: center;
  z-index: 60; padding: 20px; backdrop-filter: blur(3px);
}
.hist-overlay.show { display: flex; animation: fadeUp .3s ease; }
.hist-box {
  background: #fff; border: 3px solid var(--c-line); border-radius: 18px;
  width: 100%; max-width: 520px; max-height: 72vh; overflow-y: auto;
  padding: 16px 18px; box-shadow: 0 16px 40px rgba(0,0,0,.3);
}
.hist-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.hist-head h4 { font-size: 16px; color: var(--c-sky-d); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: rgba(43, 43, 74, .9); color: #fff; font-size: 14px;
  padding: 10px 22px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: all .3s ease; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 480px) {
  .game-title { font-size: 44px; }
  .app { padding: 20px 12px 30px; }
  .char-grid, .endings-grid { grid-template-columns: 1fr; }
}

/* ---------- 模式选择 ---------- */
.btn-gold {
  background: linear-gradient(135deg, #ffd54a, #ffb300); color: #5d3a00;
  border: none; box-shadow: 0 6px 16px rgba(255, 179, 0, .35);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(255, 179, 0, .45); }
.mode-tip { font-size: 12px; color: #b09060; margin: 0 0 10px; text-align: center; }

/* ---------- 人物档案卡（全新人生） ---------- */
.persona-card {
  width: 100%; max-width: 520px;
  background: linear-gradient(160deg, #fff, #fff6e8);
  border: 3px solid var(--c-line); border-radius: 22px;
  box-shadow: var(--shadow); padding: 24px 22px;
  animation: fadeUp .5s ease both, cardpulse 3s ease-in-out infinite;
  text-align: left;
}
.p-label {
  text-align: center; color: var(--c-main); font-weight: 900;
  letter-spacing: 3px; font-size: 15px; margin-bottom: 14px;
}
.p-head { border-bottom: 2px dashed #ffe0bd; padding-bottom: 14px; margin-bottom: 14px; }
.p-name-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.p-name { font-size: 30px; font-weight: 900; color: var(--c-main-d); letter-spacing: 2px; }
#p-name-input {
  flex: 1; min-width: 0;
  font-size: 24px; font-weight: 900; letter-spacing: 3px; color: var(--c-main-d);
  background: #fff8ec; border: 2px dashed #ffc48a; border-radius: 12px;
  padding: 8px 14px; outline: none; transition: border-color .2s;
}
#p-name-input:focus { border-color: var(--c-main); background: #fff; }
.btn-small {
  font-size: 12px; padding: 8px 12px; border-radius: 10px; white-space: nowrap;
  background: linear-gradient(135deg, #ffd54a, #ffb300); color: #5d3a00;
  border: none; box-shadow: 0 3px 8px rgba(255, 179, 0, .3); cursor: pointer;
}
.btn-small:hover { transform: translateY(-1px); }
.p-gender {
  font-size: 12px; color: #fff; background: var(--c-sky);
  padding: 2px 12px; border-radius: 999px; font-weight: 800;
}
.p-tags { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.p-origin {
  font-size: 12px; font-weight: 800; color: #7a4d14;
  background: #fff3d6; border: 1px solid #ffd9a8;
  padding: 3px 12px; border-radius: 999px;
}
.p-talent { font-size: 12px; font-weight: 900; color: #fff; padding: 3px 12px; border-radius: 999px; }
.p-talent.t-绝世天才 { background: linear-gradient(135deg, #ffd54a, #ff9800); box-shadow: 0 0 10px rgba(255, 179, 0, .6); }
.p-talent.t-天才 { background: linear-gradient(135deg, #b39ddb, #7e57c2); }
.p-talent.t-出众 { background: linear-gradient(135deg, #4fc3f7, #1e88e5); }
.p-talent.t-平凡 { background: #9e9e9e; }
.p-magic { display: flex; gap: 6px; flex-wrap: wrap; }
.p-story { font-size: 14px; line-height: 1.95; color: #6d5a48; margin-bottom: 12px; }
.p-goals { font-size: 13px; color: #c07f1a; font-weight: 700; margin-bottom: 14px; }
.p-stats-head {
  font-size: 13px; font-weight: 900; color: var(--c-sky-d);
  margin-bottom: 8px; letter-spacing: 2px;
}

/* 魔法系补充色 */
.magic-tag.m-空间系 { background: linear-gradient(135deg, #9575cd, #5e35b1); }
.magic-tag.m-毒系 { background: linear-gradient(135deg, #81c784, #388e3c); }

/* 战绩模式标签 */
.rr-mode {
  display: inline-block; font-size: 10px; font-weight: 800;
  padding: 1px 7px; border-radius: 999px; margin-left: 4px; color: #fff;
}
.rr-mode.m-original { background: linear-gradient(135deg, #ffd54a, #ff9800); }
.rr-mode.m-custom { background: var(--c-sky); }

/* 图鉴说明 */
.gallery-note {
  font-size: 12px; color: #8a6a4a; background: #fff8ec;
  border: 1px dashed #ffd9a8; border-radius: 10px;
  padding: 8px 12px; line-height: 1.7; margin-bottom: 4px;
}

/* ---------- 设定弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(30, 26, 50, .5);
  display: none; align-items: center; justify-content: center;
  z-index: 70; padding: 20px; backdrop-filter: blur(3px);
}
.overlay.show { display: flex; animation: fadeUp .3s ease; }
.overlay-box {
  background: #fff; border: 3px solid var(--c-line); border-radius: 18px;
  width: 100%; max-width: 540px; max-height: 76vh; overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0,0,0,.3); animation: fadeUp .35s ease;
}
.overlay-head {
  position: sticky; top: 0; display: flex; justify-content: space-between;
  align-items: center; padding: 14px 18px; background: #fff;
  border-bottom: 1px solid #ffe3c2; border-radius: 15px 15px 0 0;
  z-index: 2;
}
.overlay-head h2 { font-size: 17px; color: var(--c-main-d); }
.overlay-close {
  width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
  background: #fff1e0; color: var(--c-main-d); font-size: 18px; line-height: 1;
  font-weight: 900; flex-shrink: 0;
}
.overlay-close:hover { background: var(--c-main); color: #fff; }
.settings-body { padding: 14px 18px 20px; }
.sett-sec { margin-bottom: 16px; }
.sett-sec h3 { font-size: 14px; color: var(--c-main-d); margin-bottom: 8px; letter-spacing: 1px; }
.sett-sec ul { padding-left: 18px; }
.sett-sec li { font-size: 13px; line-height: 1.9; color: #6d5a48; }
.sett-line { font-size: 13px; font-weight: 700; color: var(--c-ink); line-height: 1.9; }
.sett-note { font-size: 12px; color: #a08a74; margin-top: 4px; line-height: 1.7; }
.sett-magic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sett-magic {
  background: #fff8ef; border: 1px solid #ffe3c2; border-radius: 12px;
  padding: 8px 10px; display: flex; flex-direction: column; gap: 4px;
}
.sett-magic em { font-style: normal; font-size: 11px; color: #b08a6a; font-weight: 700; }
.sett-magic p { font-size: 11px; color: #8a7a6a; line-height: 1.6; }
.sett-section-title { font-size: 14px; font-weight: 700; color: var(--c-main); margin: 12px 0 6px; padding-bottom: 4px; border-bottom: 2px dashed var(--c-line); }

/* ---------- 手机端适配（横向 < 620px） ---------- */
@media (max-width: 620px) {
  .app { padding: 16px 12px 26px; gap: 14px; }
  .game-title { font-size: 40px; }
  .game-sub { font-size: 18px; letter-spacing: 7px; }
  .game-desc { font-size: 13px; }

  /* 按钮触屏友好 */
  .btn { padding: 12px 18px; font-size: 15px; }
  .btn-big { font-size: 17px; padding: 14px 20px; }
  .btn-row { width: 100%; gap: 10px; }
  .btn-row .btn { flex: 1; padding: 10px 6px; font-size: 14px; }
  .mode-tip { font-size: 11px; line-height: 1.6; }
  .tip { font-size: 11px; line-height: 1.6; }

  /* 人物档案卡 */
  .persona-card { padding: 16px 14px; border-radius: 18px; }
  .p-name-row { flex-wrap: wrap; }
  #p-name-input { font-size: 20px; letter-spacing: 2px; padding: 8px 10px; }
  .btn-small { padding: 9px 12px; font-size: 12px; }
  .p-story { font-size: 13px; line-height: 1.85; }
  .p-name { font-size: 26px; }

  /* 游戏界面 */
  .game-head { flex-wrap: wrap; gap: 8px; }
  .chip-name { font-size: 15px; }
  .age-chip, .stage-chip { font-size: 11px; padding: 5px 9px; }
  .panel { padding: 12px; }
  .stats-grid { gap: 6px 10px; }
  .stat-name { width: 26px; }
  .stat-val { width: 26px; }
  .realm-bar { height: 10px; }

  /* 事件卡 */
  .event-card { padding: 16px 14px; }
  .event-title { font-size: 18px; }
  .event-desc { font-size: 13.5px; line-height: 1.85; }
  .choice-btn { padding: 13px 14px; font-size: 13.5px; line-height: 1.7; min-height: 46px; }

  /* 魔法成长线 */
  .magic-item { flex-wrap: wrap; padding: 7px 10px; }
  .magic-item .m-desc { flex-basis: 100%; margin-left: 30px; }
  .magic-head { font-size: 14px; }
  .magic-head-sub { display: block; margin-left: 0; margin-top: 3px; }

  /* 结局 */
  .end-card { padding: 22px 16px; }
  .end-title { font-size: 24px; letter-spacing: 3px; }
  .end-desc { font-size: 13.5px; line-height: 1.95; }

  /* 图鉴 / 战绩 */
  .page-title { font-size: 20px; letter-spacing: 3px; }
  .gallery-tabs .tab { flex: 1; padding: 9px 4px; font-size: 13px; white-space: nowrap; }
  .char-card, .ending-card { padding: 12px; }
  .cc-name { font-size: 14px; }
  .record-row { flex-wrap: wrap; gap: 4px 8px; }
  .rr-end { width: 100%; }

  /* 履历 */
  .history-item { flex-wrap: wrap; gap: 3px 8px; }
  .h-event { flex-basis: 100%; }

  /* 弹层 */
  .hist-box, .overlay-box { max-height: 88vh; padding: 0; }
  .hist-box { padding: 14px; }
  .overlay { padding: 10px; align-items: flex-end; }
  .overlay-box { max-height: 92vh; border-radius: 18px 18px 0 0; }
  .settings-body { padding: 12px 14px 18px; }
  .sett-magic-grid { grid-template-columns: 1fr; }
  .sett-sec li { font-size: 12.5px; line-height: 1.85; }

  /* Toast */
  .toast { font-size: 13px; bottom: 22px; max-width: 88vw; text-align: center; }
}

/* 小屏（< 380px）微调 */
@media (max-width: 380px) {
  .game-title { font-size: 34px; }
  .game-sub { font-size: 16px; letter-spacing: 5px; }
  .stats-grid { grid-template-columns: 1fr; }
  .p-tags { gap: 6px; }
  .btn-row { gap: 6px; }
  .btn-row .btn { font-size: 12.5px; padding: 9px 4px; }
  .end-title { font-size: 21px; }
}

/* ============ 登录 / 存档 / 排行榜 ============ */
.login-row { display: flex; gap: 8px; width: 100%; max-width: 340px; }
.login-row input {
  flex: 1; min-width: 0; padding: 12px 14px; font-size: 15px; text-align: center;
  border: 2px solid #ffd9a8; border-radius: 12px; background: #fff8ef; color: var(--c-ink);
  outline: none; transition: border-color .2s;
}
.login-row input:focus { border-color: var(--c-main); }
.login-row .btn { flex-shrink: 0; }

.home-head {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; max-width: 420px; padding: 4px 2px;
}
.home-player-tag { font-size: 14px; color: var(--c-ink); font-weight: 700; }
.home-player-tag b { color: var(--c-main); }

.slot-list { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 8px; }
.slot-empty {
  text-align: center; font-size: 13px; color: #b09060; line-height: 1.8;
  padding: 18px 10px; border: 1px dashed #ffd9a8; border-radius: 12px; background: #fff8ef;
}
.slot-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: #fff8ef; border: 1px solid #ffe3c2; border-radius: 12px; padding: 10px 12px;
}
.slot-info { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.slot-char { font-size: 15px; font-weight: 800; color: var(--c-main-d); }
.slot-mode { font-size: 11px; padding: 2px 6px; border-radius: 6px; font-weight: 700; }
.slot-mode.m-custom { background: #ffe9d6; color: #c07f1a; }
.slot-mode.m-original { background: #fdebd0; color: #b07a2a; }
.slot-meta { font-size: 12px; color: #8a7a6a; }
.slot-live { font-size: 11px; color: #2e9e6b; font-weight: 700; }
.slot-done { font-size: 11px; color: #a08a74; }
.slot-dead { font-size: 11px; color: #c0392b; font-weight: 700; }
.slot-ops { display: flex; gap: 6px; flex-shrink: 0; }

/* 排行榜 */
.lb-box { max-width: 560px; }
.lb-list { padding: 12px 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.lb-loading { text-align: center; color: #b09060; font-size: 13px; padding: 20px 0; }
.lb-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: #fff8ef; border: 1px solid #ffe3c2; border-radius: 12px; font-size: 13px;
}
.lb-row.lb-me { background: #fff0d9; border-color: var(--c-main); box-shadow: 0 0 0 1px var(--c-main); }
.lb-badge { width: 30px; height: 30px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.lb-badge.lb-num { font-size: 14px; font-weight: 900; color: #a08a74; }
.lb-name { font-weight: 800; color: var(--c-main-d); min-width: 64px; }
.lb-you { font-style: normal; color: var(--c-main); font-size: 11px; }
.lb-char { color: #6d5a48; min-width: 60px; }
.lb-end { flex: 1; color: #a08a74; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-tier { font-weight: 800; color: #b07a2a; font-size: 13px; }
.lb-fame { color: #2e9e6b; font-size: 12px; font-weight: 700; }

@media (max-width: 640px) {
  .slot-row { flex-direction: column; align-items: stretch; }
  .slot-ops { justify-content: flex-end; }
  .lb-row { flex-wrap: wrap; row-gap: 4px; }
  .lb-end { flex-basis: 100%; order: 9; white-space: normal; }
}
