/* ============ 华夏万世录 · 国风主题 ============ */
:root {
  --bg: #14100b;
  --bg-card: #1f1912;
  --bg-deep: #0e0b07;
  --gold: #c9a86a;
  --gold-light: #e8cf9a;
  --red: #a33b2e;
  --text: #e8ddc8;
  --text-dim: #9c8d72;
  --line: rgba(201, 168, 106, .25);
  --rar1: #9a9a9a;  /* 普通 */
  --rar2: #5b8dd9;  /* 稀有 */
  --rar3: #a05fd9;  /* 史诗 */
  --rar4: #e8b64c;  /* 传说 */
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: radial-gradient(ellipse at 50% -10%, #2a2016 0%, var(--bg) 55%, var(--bg-deep) 100%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Serif SC", serif;
  max-width: 560px; margin: 0 auto;
  min-height: 100vh; position: relative; overflow-x: hidden;
}

.hide { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }

/* ---------- 顶部 ---------- */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
}
.logo {
  font-size: 22px; letter-spacing: 6px; color: var(--gold-light);
  text-shadow: 0 0 18px rgba(201, 168, 106, .35);
  font-weight: 600;
}
.header-info { display: flex; gap: 8px; }
.chip {
  font-size: 12px; color: var(--gold);
  border: 1px solid var(--line); border-radius: 20px;
  padding: 4px 10px; background: rgba(201,168,106,.06);
}

/* ---------- 主区 ---------- */
.main { padding: 4px 14px 130px; }

/* ---------- 抽卡页 ---------- */
.draw-hero {
  text-align: center; padding: 30px 0 10px;
}
.draw-hero .hero-title {
  font-size: 18px; color: var(--gold-light); letter-spacing: 8px; margin-bottom: 6px;
}
.draw-hero .hero-sub { font-size: 12px; color: var(--text-dim); letter-spacing: 3px; }
.draw-hero .hero-user { font-size: 13px; color: var(--gold-light); letter-spacing: 3px; margin-top: 6px; }
.draw-buttons {
  display: flex; gap: 12px; justify-content: center; margin: 26px 0 10px;
}
.btn {
  padding: 12px 26px; border-radius: 8px; font-size: 16px; letter-spacing: 4px;
  transition: transform .1s, box-shadow .2s; user-select: none;
}
.btn:active { transform: scale(.96); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #241a0c; font-weight: 600;
  box-shadow: 0 4px 18px rgba(201,168,106,.3);
}
.btn-primary:disabled { opacity: .5; box-shadow: none; }
.btn-ghost {
  border: 1px solid var(--line); color: var(--gold);
  background: rgba(201,168,106,.05);
}
.prob-tip {
  text-align: center; font-size: 11px; color: var(--text-dim); margin-top: 14px; line-height: 1.9;
}

/* ---------- 卡牌 ---------- */
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 8px; }
.card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 12px; position: relative; overflow: hidden;
  animation: cardIn .4s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.card .c-rarity {
  position: absolute; top: 0; left: 0; right: 0; height: 6px;
}
.card.r1 .c-rarity { background: var(--rar1); }
.card.r2 .c-rarity { background: var(--rar2); }
.card.r3 .c-rarity { background: var(--rar3); }
.card.r4 .c-rarity { background: var(--rar4); box-shadow: 0 0 12px var(--rar4); }

/* 详情弹层稀有度条 */
.detail-panel { position: relative; overflow: hidden; }
.detail-rarity { position: absolute; top: 0; left: 0; right: 0; height: 6px; }
.detail-rarity.r1 { background: var(--rar1); }
.detail-rarity.r2 { background: var(--rar2); }
.detail-rarity.r3 { background: var(--rar3); }
.detail-rarity.r4 { background: var(--rar4); box-shadow: 0 0 12px var(--rar4); }
.card .c-name { font-size: 16px; color: var(--gold-light); letter-spacing: 2px; margin-bottom: 4px; }
.card .c-desc { font-size: 12px; color: var(--text-dim); line-height: 1.6; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .c-meta { font-size: 11px; color: var(--text-dim); display: flex; gap: 6px; align-items: center; }
.tag { border: 1px solid var(--line); border-radius: 3px; padding: 1px 6px; font-size: 10px; color: var(--gold); }
.rar-label { font-size: 11px; font-weight: 600; }
.card.r1 .rar-label { color: var(--rar1); }
.card.r2 .rar-label { color: var(--rar2); }
.card.r3 .rar-label { color: var(--rar3); }
.card.r4 .rar-label { color: var(--rar4); }
.card .c-no { font-size: 10px; color: #6d5f47; margin-top: 6px; }

/* ---------- 集册 ---------- */
.album-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 2px 12px; font-size: 13px; color: var(--text-dim);
}
.album-head b { color: var(--gold-light); font-size: 18px; margin: 0 2px; }
.album-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.a-card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 8px; text-align: center; position: relative; overflow: hidden;
}
.a-card .a-rarity { position: absolute; top: 0; left: 0; right: 0; height: 6px; }
.a-card.r1 .a-rarity { background: var(--rar1); }
.a-card.r2 .a-rarity { background: var(--rar2); }
.a-card.r3 .a-rarity { background: var(--rar3); }
.a-card.r4 .a-rarity { background: var(--rar4); box-shadow: 0 0 10px var(--rar4); }
.a-card .a-name { font-size: 13px; color: var(--gold-light); margin-top: 4px; letter-spacing: 1px; }
.a-card .a-tags { font-size: 10px; color: var(--text-dim); margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.a-card.locked { opacity: .45; filter: grayscale(1); }
.a-card.locked .a-name { color: var(--text-dim); }
.a-card .a-count { position: absolute; top: 8px; right: 8px; font-size: 10px; color: var(--gold); }

/* ---------- 组合 ---------- */
.combo-head { padding: 12px 2px 6px; color: var(--text-dim); font-size: 13px; }
.combo-list { display: flex; flex-direction: column; gap: 12px; }
.combo-item {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px; padding: 14px;
}
.combo-clickable { cursor: pointer; transition: border-color .15s, background .15s; }
.combo-clickable:active { border-color: var(--gold); background: rgba(201,168,106,.08); }
.combo-item .co-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.combo-item .co-name { font-size: 15px; color: var(--gold-light); letter-spacing: 2px; }
.combo-item .co-need { font-size: 12px; color: var(--text-dim); line-height: 1.8; margin-bottom: 8px; }
.combo-item .co-need .have { color: var(--gold); }
.combo-item .co-foot { display: flex; justify-content: space-between; align-items: center; }
.co-cost { font-size: 12px; color: var(--text-dim); }
.co-btn { font-size: 13px; padding: 7px 16px; border-radius: 6px; letter-spacing: 2px; }
.co-btn.ready { background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: #241a0c; font-weight: 600; }
.co-btn.locked { border: 1px solid var(--line); color: var(--text-dim); }
.co-btn.done { border: 1px solid var(--line); color: var(--gold); }
.co-summary { font-size: 11px; color: var(--text-dim); margin-top: 6px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hidden-tip { font-size: 12px; color: var(--red); border: 1px dashed rgba(163,59,46,.5); border-radius: 8px;
  padding: 10px 12px; margin-top: 12px; line-height: 1.7; }

/* ---------- 我的 ---------- */
.mine-head { text-align: center; padding: 26px 0 16px; }
.mine-nick { font-size: 20px; color: var(--gold-light); letter-spacing: 4px; margin-bottom: 4px; }
.mine-sub { font-size: 12px; color: var(--text-dim); }
.mine-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.m-stat { background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 8px; text-align: center; }
.m-stat .num { font-size: 22px; color: var(--gold-light); font-weight: 600; }
.m-stat .lab { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.mine-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.btn-block { width: 100%; }
.btn-line { border: 1px solid var(--line); color: var(--gold); background: rgba(201,168,106,.05); }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px;
  display: flex; background: rgba(14, 11, 7, .95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); z-index: 50;
}
.tab {
  flex: 1; padding: 13px 0 16px; font-size: 14px; letter-spacing: 3px; color: var(--text-dim);
  transition: color .2s;
}
.tab.active { color: var(--gold-light); }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.panel {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px;
  width: 100%; max-width: 480px; max-height: 82vh; overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
}
.login-panel { padding: 30px 24px; text-align: center; }
.panel-title { color: var(--gold-light); font-size: 24px; letter-spacing: 10px; margin-bottom: 8px; }
.panel-sub { color: var(--text-dim); font-size: 12px; letter-spacing: 3px; margin-bottom: 22px; }
.input {
  width: 100%; padding: 12px 14px; border-radius: 8px; font-size: 15px;
  background: var(--bg-deep); border: 1px solid var(--line); color: var(--text);
  margin-bottom: 14px; outline: none;
}
.input:focus { border-color: var(--gold); }
.login-tip { font-size: 11px; color: var(--text-dim); margin-top: 12px; }

/* 详情弹层 */
.detail-panel { padding: 22px 20px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.detail-name { font-size: 20px; color: var(--gold-light); letter-spacing: 3px; }
.detail-no { font-size: 11px; color: #6d5f47; margin-top: 4px; }
.detail-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.detail-desc { font-size: 13px; color: var(--text-dim); line-height: 1.8; margin-bottom: 16px; }
.prompt-block { margin-bottom: 14px; }
.prompt-block .pb-title {
  font-size: 12px; color: var(--gold); display: flex; justify-content: space-between;
  margin-bottom: 6px; align-items: center;
}
.prompt-block .pb-title .copy { cursor: pointer; border: 1px solid var(--line); border-radius: 4px;
  padding: 2px 8px; font-size: 11px; color: var(--gold); }
.prompt-block .pb-title .copy:active { background: rgba(201,168,106,.15); }
.prompt-text {
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 12px; line-height: 1.8; color: var(--text);
  word-break: break-all; max-height: 140px; overflow-y: auto;
}
.detail-platforms { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.pf-btn { flex: 1; min-width: 88px; text-align: center; font-size: 13px; padding: 10px 6px;
  border-radius: 6px; border: 1px solid var(--line); color: var(--gold); background: rgba(201,168,106,.05); }
.pf-btn:active { background: rgba(201,168,106,.15); }
.detail-close { margin-top: 18px; }

/* 抽卡结果弹层 */
.draw-panel { padding: 22px 16px; }
.draw-title { text-align: center; color: var(--gold-light); font-size: 16px; letter-spacing: 6px; margin-bottom: 16px; }
.draw-results { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.draw-results.ten { grid-template-columns: repeat(2, 1fr); }
.draw-new { font-size: 10px; color: var(--gold); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; margin-left: 6px; }
.draw-foot { display: flex; gap: 10px; margin-top: 18px; }

/* 传说特效 */
.legend-effect {
  position: fixed; inset: 0; z-index: 200; pointer-events: none;
  background: radial-gradient(circle at 50% 40%, rgba(232,182,76,.28), transparent 70%);
  animation: legendFlash 2.2s ease both;
}
.legend-effect::after {
  content: "传 说"; position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%);
  font-size: 42px; letter-spacing: 14px; color: var(--gold-light);
  text-shadow: 0 0 30px var(--gold), 0 0 60px var(--gold);
  animation: legendPulse 2.2s ease both;
}
@keyframes legendFlash { 0% { opacity: 0; } 12% { opacity: 1; } 70% { opacity: .5; } 100% { opacity: 0; } }
@keyframes legendPulse { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.6); } 20% { opacity: 1; transform: translate(-50%,-50%) scale(1.1); } 60% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.25); } }

/* 加载 */
.loading {
  position: fixed; inset: 0; z-index: 300; background: var(--bg-deep);
  display: flex; align-items: center; justify-content: center;
}
.loading-text { color: var(--gold); letter-spacing: 8px; font-size: 14px; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* Toast */
#toast {
  position: fixed; top: 18%; left: 50%; transform: translateX(-50%);
  background: rgba(20,16,11,.92); border: 1px solid var(--line); color: var(--gold-light);
  padding: 10px 22px; border-radius: 8px; font-size: 14px; z-index: 400;
  opacity: 0; transition: opacity .3s; pointer-events: none; white-space: nowrap;
}
#toast.show { opacity: 1; }

/* ---------- 分享战绩弹层 ---------- */
.share-panel { padding: 20px 16px; }
.share-title { text-align: center; color: var(--gold-light); font-size: 16px; letter-spacing: 6px; margin-bottom: 14px; }
.share-loading { text-align: center; color: var(--text-dim); font-size: 13px; letter-spacing: 3px; padding: 70px 0; }
.share-img { width: 100%; display: block; border-radius: 10px; border: 1px solid var(--line); }
.share-foot { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.share-foot .btn { display: block; text-align: center; text-decoration: none; }
.share-tip { text-align: center; font-size: 11px; color: var(--text-dim); margin-top: 10px; }
