/* 星座.wiki · 白紫机甲风
   基色：浅薰衣草白 + 深紫文字/边框 + 紫能量线
   圆角统一，禁 clip-path；标签药丸 pad>=3.5px 10px */

:root {
  --bg: #f6f4ff;
  --bg2: #ece7fb;
  --card: #ffffff;
  --ink: #2c1b47;
  --ink2: #5b4a78;
  --ink3: #8b7ba8;
  --purple: #6b3fd4;
  --purple-d: #3d1f75;
  --purple-l: #a988f0;
  --line: #ded4f5;
  --line2: #c9b9ee;
  --ok: #1f9d6b;
  --warn: #d97706;
  --danger: #d63864;
  --shadow: 0 2px 4px rgba(61, 31, 117, .06), 0 10px 28px rgba(61, 31, 117, .09);
  --r: 18px;
  --r-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(circle at 12% -8%, #e3d8ff 0%, transparent 42%),
    radial-gradient(circle at 88% 4%, #dff0ff 0%, transparent 38%),
    radial-gradient(circle at 50% 100%, #efe6ff 0%, transparent 46%);
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: var(--purple); text-decoration: none; }

/* ---------- 外壳 ---------- */
.shell { max-width: 1120px; margin: 0 auto; padding: 0 16px 88px; }

header.top {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(246, 244, 255, .84);
  border-bottom: 1px solid var(--line);
}
.top-in {
  max-width: 1120px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: .5px; color: var(--purple-d); }
.brand .orb {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff 0 14%, var(--purple-l) 30%, var(--purple) 72%, var(--purple-d) 100%);
  box-shadow: 0 0 0 1px var(--line2), 0 0 14px rgba(107, 63, 212, .5);
}
.brand small { font-weight: 500; color: var(--ink3); font-size: 11.5px; letter-spacing: 0; }
.top-spacer { flex: 1; }

/* 资源条 */
.res { display: flex; gap: 8px; align-items: center; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line2);
  font-size: 12.5px; font-weight: 700; color: var(--purple-d);
  box-shadow: 0 1px 2px rgba(61,31,117,.05);
  white-space: nowrap;
}
.chip b { font-variant-numeric: tabular-nums; }
.chip .dotp { width: 7px; height: 7px; border-radius: 50%; background: var(--purple); box-shadow: 0 0 8px var(--purple); }

/* 窄屏：资源条换行成单独一行，避免 390 宽被顶栏挤爆 */
@media (max-width: 620px) {
  .top-in { padding: 10px 12px; gap: 8px; }
  .brand { font-size: 15px; }
  .brand small { font-size: 10px; }
  .brand .orb { width: 22px; height: 22px; }
  .chip { padding: 5px 9px; font-size: 11.5px; }
}
@media (max-width: 460px) {
  .top-in { flex-wrap: wrap; row-gap: 8px; }
  .top-spacer { display: none; }
  .res { width: 100%; justify-content: space-between; }
  .rank-chip .rank-score { display: none; }
}

/* ---------- Tab bar ---------- */
.tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow); margin: 16px 0 18px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; border: 0; cursor: pointer;
  padding: 9px 18px; border-radius: 999px;
  background: transparent; color: var(--ink2);
  font-size: 14px; font-weight: 700; font-family: inherit;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .18s, color .18s, transform .18s;
  white-space: nowrap;
}
.tab .n { font-size: 11px; font-weight: 700; color: var(--ink3); background: var(--bg2); padding: 2px 7px; border-radius: 999px; }
.tab:hover { background: var(--bg2); }
.tab[aria-selected="true"] {
  background: linear-gradient(135deg, var(--purple) 0%, #8b5cf6 60%, #a78bfa 100%);
  color: #fff; box-shadow: 0 4px 14px rgba(107, 63, 212, .38);
}
.tab[aria-selected="true"] .n { background: rgba(255,255,255,.22); color: #fff; }

@media (max-width: 620px) {
  /* 手机上不横滑：五个版块自动换行，全部可见（禁藏项） */
  .tabs { flex-wrap: wrap; justify-content: center; border-radius: 20px; row-gap: 5px; overflow: visible; }
  .tab { padding: 8px 14px; font-size: 13.5px; }
}

/* ---------- 通用块 ---------- */
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow);
  padding: 20px;
}
.panel + .panel { margin-top: 16px; }
.panel-h { display: flex; align-items: baseline; gap: 10px; margin: 0 0 14px; }
.panel-h h2 { margin: 0; font-size: 16.5px; color: var(--purple-d); letter-spacing: .3px; }
.panel-h .sub { font-size: 12px; color: var(--ink3); }
.hint { font-size: 12.5px; line-height: 1.75; color: var(--ink2); }
.hint strong { color: var(--purple-d); }
.tiny { font-size: 11.5px; color: var(--ink3); }

.btn {
  border: 0; cursor: pointer; font-family: inherit; font-weight: 800;
  border-radius: 999px; padding: 13px 30px; font-size: 15px;
  color: #fff; background: linear-gradient(135deg, var(--purple-d), var(--purple) 55%, #9b6cf3);
  box-shadow: 0 6px 20px rgba(107, 63, 212, .34), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .14s, box-shadow .14s, filter .14s;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(107,63,212,.42); }
.btn:active { transform: translateY(1px) scale(.994); }
.btn:disabled { filter: grayscale(.55) opacity(.6); cursor: not-allowed; transform: none; box-shadow: none; }
.btn.ghost {
  background: #fff; color: var(--purple);
  border: 1.4px solid var(--line2); box-shadow: 0 1px 3px rgba(61,31,117,.07);
}
.btn.ghost:hover { background: #faf7ff; }
.btn.sm { padding: 8px 16px; font-size: 13px; }

/* ---------- 抽卡区 ---------- */
.gacha-stage {
  position: relative; border-radius: 22px; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 0%, #3a2170 0%, #1c0f3a 46%, #0c0620 100%);
  border: 1px solid #4b2d8a;
  box-shadow: 0 18px 48px rgba(45, 23, 90, .34), inset 0 1px 0 rgba(255,255,255,.09);
  padding: 26px 20px 24px;
  color: #e9e2ff;
  text-align: center;
  min-height: 300px;
}
#starfield { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-in { position: relative; z-index: 2; }
.pack-count { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: #b39dff; }
.pack-big {
  font-size: 46px; font-weight: 900; line-height: 1.05; margin: 6px 0 2px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff, #c9b6ff 62%, #8f74e8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(150, 110, 255, .55));
}
.pack-big small { font-size: 20px; color: #a992ea; -webkit-text-fill-color: #a992ea; font-weight: 700; }
.timer { font-size: 12.5px; color: #a496c9; margin-bottom: 16px; font-variant-numeric: tabular-nums; }
.stage-note { margin-top: 12px; font-size: 11.8px; color: #9d8fc4; line-height: 1.7; }

/* 抽卡结果 */
.pull-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px;
  margin-top: 18px;
}
@media (max-width: 720px) { .pull-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* ---------- 星卡 ---------- */
.star-card {
  position: relative; text-align: left; cursor: pointer;
  border-radius: var(--r-sm); padding: 11px;
  background: linear-gradient(168deg, #241442 0%, #150c2a 100%);
  border: 1px solid #4a2f86;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 4px 14px rgba(20, 8, 40, .35);
  color: #ece6ff; overflow: hidden;
  transition: transform .16s, box-shadow .16s;
  animation: cardIn .42s cubic-bezier(.2,.9,.3,1.2) both;
}
.star-card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(20,8,40,.5); }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.94); } }

.star-card[data-r="LR"] { border-color: #ffd76a; box-shadow: 0 0 0 1px #ffd76a59, 0 0 26px rgba(255, 205, 86, .34), inset 0 1px 0 rgba(255,255,255,.12); }
.star-card[data-r="UR"] { border-color: #ff9de0; box-shadow: 0 0 0 1px #ff9de059, 0 0 22px rgba(255, 130, 210, .3), inset 0 1px 0 rgba(255,255,255,.1); }
.star-card[data-r="SSR"] { border-color: #b18cff; box-shadow: 0 0 0 1px #b18cff4d, 0 0 20px rgba(150, 110, 255, .28); }
.star-card[data-r="SR"] { border-color: #6fc9ff; }
.star-card[data-r="R"] { border-color: #7ee0c0; }
.star-card[data-r="UC"] { border-color: #8f7bbd; }
.star-card[data-r="C"] { border-color: #4a3a6e; }

.sc-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.badge {
  display: inline-block; padding: 3.5px 10px; border-radius: 999px;
  font-size: 10.5px; font-weight: 900; letter-spacing: .1em;
  background: rgba(255,255,255,.1); color: #ddd3ff; border: 1px solid rgba(255,255,255,.16);
}
.badge[data-r="LR"] { background: linear-gradient(135deg,#ffe9a8,#ffc93c); color: #533a00; border-color: #ffdf82; }
.badge[data-r="UR"] { background: linear-gradient(135deg,#ffd0ee,#ff85d0); color: #5c0038; border-color: #ffb3e6; }
.badge[data-r="SSR"] { background: linear-gradient(135deg,#ddc9ff,#a97bff); color: #2e0a63; border-color: #c9acff; }
.badge[data-r="SR"] { background: #163a52; color: #8fdcff; border-color: #3d7f9f; }
.badge[data-r="R"] { background: #123c33; color: #8bebc9; border-color: #2f7a63; }
.sc-con { font-size: 10.5px; color: #9c8cc4; font-weight: 700; letter-spacing: .04em; }

.sc-vis {
  position: relative; height: 78px; border-radius: 10px; margin-bottom: 9px;
  background: radial-gradient(ellipse at 50% 60%, #241640 0%, #0a0517 100%);
  border: 1px solid rgba(255,255,255,.08); overflow: hidden;
  display: grid; place-items: center;
}
.sc-vis canvas { display: block; width: 100%; height: 100%; }
.sc-name { font-size: 14.5px; font-weight: 900; letter-spacing: .2px; line-height: 1.25; }
.sc-sub { font-size: 11px; color: #ada0cc; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin-top: 8px; }
.sc-stats div { background: rgba(255,255,255,.05); border-radius: 6px; padding: 3px 4px; text-align: center; }
.sc-stats span { display: block; font-size: 8.6px; color: #8d7db2; letter-spacing: .06em; }
.sc-stats b { font-size: 12.5px; font-variant-numeric: tabular-nums; color: #e4dbff; }
.sc-new {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  font-size: 9.4px; font-weight: 900; letter-spacing: .06em;
  padding: 2.5px 7px; border-radius: 999px;
  background: linear-gradient(135deg, #ff5d8f, #ff9f43); color: #fff;
  box-shadow: 0 2px 8px rgba(255, 93, 143, .45);
}
.star-card.locked { filter: grayscale(1) brightness(.5); }
.star-card.locked .sc-name { color: #7f74a0; }

/* ---------- 图鉴 ---------- */
.dex-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.progress { flex: 1 1 220px; height: 9px; border-radius: 999px; background: var(--bg2); overflow: hidden; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--purple), #a78bfa); box-shadow: 0 0 10px rgba(107,63,212,.5); }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 9px; }
.dex-cell {
  cursor: pointer; text-align: left; border-radius: var(--r-sm); padding: 10px 11px;
  background: #fff; border: 1px solid var(--line);
  transition: transform .14s, border-color .14s, box-shadow .14s;
}
.dex-cell:hover { transform: translateY(-2px); border-color: var(--line2); box-shadow: var(--shadow); }
.dex-cell .dc-ab { font-size: 10.5px; font-weight: 800; color: var(--ink3); letter-spacing: .08em; }
.dex-cell .dc-cn { font-size: 14px; font-weight: 900; color: var(--purple-d); margin: 1px 0 5px; }
.dex-cell .dc-cnt { font-size: 11px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.dex-cell .progress { height: 5px; margin-top: 6px; }
.dex-cell.done { background: linear-gradient(160deg, #f3ecff, #fff); border-color: var(--line2); }
.dex-cell.done::after { content: "★"; position: absolute; }

/* ---------- 对战 ---------- */
.slots { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 8px; margin: 14px 0; }
@media (max-width: 720px) { .slots { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.slot {
  min-height: 92px; border-radius: var(--r-sm); border: 1.5px dashed var(--line2);
  background: #fbf9ff; display: grid; place-items: center; cursor: pointer;
  font-size: 12px; color: var(--ink3); text-align: center; padding: 8px;
}
.slot.filled { border-style: solid; border-color: var(--purple-l); background: linear-gradient(160deg,#f6f0ff,#fff); color: var(--purple-d); }
.slot .sl-name { font-weight: 800; font-size: 12.5px; }
.slot .sl-meta { font-size: 10.5px; color: var(--ink2); }
.log { background: #1a1030; color: #d9d0f5; border-radius: var(--r-sm); padding: 12px 14px; font-size: 12.5px; line-height: 1.9; max-height: 210px; overflow: auto; font-variant-numeric: tabular-nums; }
.log b { color: #ffd76a; }
.log .win { color: #7ee0c0; font-weight: 800; }
.log .lose { color: #ff9db4; font-weight: 800; }

/* ---------- 表 ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.tbl th { color: var(--purple-d); font-size: 12px; letter-spacing: .04em; background: #faf8ff; }
table.tbl td.num { font-variant-numeric: tabular-nums; }
table.tbl tr:last-child td { border-bottom: 0; }

/* ---------- 弹层 ---------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 90; display: none;
  background: rgba(28, 15, 58, .55); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 20px;
}
.modal-wrap.on { display: flex; }
.modal {
  background: var(--card); border-radius: 20px; border: 1px solid var(--line);
  max-width: 460px; width: 100%; max-height: 84vh; overflow: auto;
  box-shadow: 0 24px 70px rgba(28, 15, 58, .4); padding: 22px;
}
.modal h3 { margin: 0 0 4px; color: var(--purple-d); font-size: 18px; }
.modal .close { float: right; border: 0; background: var(--bg2); color: var(--ink2); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 16px; line-height: 1; }

/* ---------- 页脚 ---------- */
footer {
  border-top: 1px solid var(--line); margin-top: 26px; padding: 18px 0 8px;
  font-size: 11.5px; color: var(--ink3); line-height: 1.9;
}
footer a { color: var(--ink2); text-decoration: underline; text-underline-offset: 2px; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--purple-d); color: #fff; padding: 11px 20px; border-radius: 999px;
  font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s; z-index: 120;
  box-shadow: 0 10px 26px rgba(61,31,117,.4);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }
.grid > *, .grid2 > *, .pull-grid > *, .dex-grid > *, .slots > * { min-width: 0; }
