/* 合成黄馨仪 — 样式 */
:root {
  --bg: #0a0610;
  --ink: #f7eefc;
  --muted: #b39bc7;
  --pink: #ff5fd2;
  --gold: #ffd24a;
  --card: rgba(28, 16, 40, 0.72);
  --line: rgba(255, 255, 255, 0.12);
  --radius: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: -8%;
  background-image: url("../assets/bg.jpg");
  background-size: cover;
  background-position: center;
  filter: blur(34px) saturate(1.35);
  opacity: 0.55;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(60% 45% at 18% 8%, rgba(255, 95, 210, 0.28), transparent 70%),
    radial-gradient(55% 40% at 88% 92%, rgba(255, 150, 70, 0.22), transparent 70%),
    linear-gradient(180deg, rgba(8, 4, 14, 0.35), rgba(8, 4, 14, 0.86));
  z-index: -1;
}

.page {
  width: min(1000px, 100%);
  margin: 0 auto;
  padding: 18px 16px 40px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
  color: #2a0b22;
  background: linear-gradient(140deg, #ffb3ef, #ff8a3d);
  box-shadow: 0 8px 26px rgba(255, 95, 210, 0.45);
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.06em;
  background: linear-gradient(92deg, #ffe9fb, #ff9ae8 45%, #ffcd7a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-size: 13px;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease;
  font-family: inherit;
}

.chip:hover { background: rgba(255, 255, 255, 0.13); }
.chip:active { transform: scale(0.96); }
.chip.primary {
  border-color: rgba(255, 95, 210, 0.55);
  background: linear-gradient(120deg, rgba(255, 95, 210, 0.28), rgba(255, 160, 90, 0.26));
}
.chip.off { opacity: 0.55; }

/* ---------- 布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: auto minmax(230px, 320px);
  gap: 20px;
  justify-content: center;
  align-items: start;
}

.stage {
  width: min(100%, 420px);
  width: min(calc((100dvh - 210px) * 0.6462), 420px, 100%);
  max-width: 420px;
  min-width: 0;
  margin: 0 auto;
}

/* ---------- HUD ---------- */
.hud {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.stat {
  flex: 1 1 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 9px 14px;
  backdrop-filter: blur(10px);
  min-width: 0;
}

.stat .label, .next .label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.12em;
}

.stat strong {
  display: block;
  font-size: 26px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.stat.small { flex: 0 1 auto; }
.stat.small strong { font-size: 18px; color: #ffd9f6; }

.next {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 7px 10px 5px;
  backdrop-filter: blur(10px);
}

#nextCv { width: 56px; height: 56px; display: block; }

/* ---------- 棋盘 ---------- */
.board {
  position: relative;
  width: 100%;
  aspect-ratio: 420 / 650;
  border-radius: var(--radius);
  overflow: hidden;
  background: #120a1c;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 95, 210, 0.12),
    0 0 60px rgba(255, 95, 210, 0.16) inset;
  touch-action: none;
  cursor: pointer;
}

.board canvas { display: block; width: 100%; height: 100%; }

.combo {
  position: absolute;
  top: 96px;
  right: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  color: #2a0b22;
  background: linear-gradient(120deg, #ffd24a, #ff8ae0);
  box-shadow: 0 8px 24px rgba(255, 140, 220, 0.45);
  transform: translateY(-6px) scale(0.9);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
  pointer-events: none;
}

.combo.show { opacity: 1; transform: translateY(0) scale(1); }

/* ---------- 结束浮层 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(60% 50% at 50% 40%, rgba(30, 8, 40, 0.72), rgba(6, 3, 10, 0.9));
  backdrop-filter: blur(6px);
  z-index: 5;
  animation: fade 0.28s ease;
}

.overlay[hidden] { display: none; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.overlay .card {
  text-align: center;
  padding: 26px 30px;
  border-radius: 20px;
  background: rgba(24, 12, 34, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.overlay h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: 0.14em; color: #ffd9f6; }
.overlay .big {
  margin: 0;
  font-size: 46px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(100deg, #fff, #ffb3ef 55%, #ffd24a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.overlay .sub { margin: 4px 0 16px; color: var(--muted); font-size: 13px; }
.overlay .tip { margin: 10px 0 0; font-size: 11px; color: rgba(255, 255, 255, 0.45); }

.btn {
  appearance: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #2a0b22;
  background: linear-gradient(120deg, #ffd24a, #ff8ae0);
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(255, 130, 220, 0.4);
}

.btn:active { transform: scale(0.97); }

.help {
  margin: 12px 2px 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- 侧栏 / 合成表 ---------- */
.side {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  backdrop-filter: blur(12px);
}

.side h2 {
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: 0.18em;
  color: #ffd9f6;
}

.chain {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chain li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink);
  padding: 3px 6px;
  border-radius: 12px;
  transition: background 0.2s ease;
}

.chain li:hover { background: rgba(255, 255, 255, 0.06); }

.chain .idx {
  font-size: 10px;
  color: var(--muted);
  width: 14px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.chain .dot {
  border-radius: 50%;
  flex: none;
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 0 2px var(--c), 0 0 12px var(--c);
}

.chain .name { flex: 1 1 auto; }
.chain .gain {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.note {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
  padding-top: 10px;
}

.note b { color: var(--gold); }

footer {
  margin-top: 26px;
  text-align: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.32);
  letter-spacing: 0.08em;
}

/* ---------- 响应式 ---------- */
@media (max-width: 880px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { order: 2; display: none; }
  .side.open { display: block; }
  .page { padding: 14px 12px 30px; }
  .brand h1 { font-size: 19px; }
  .stat strong { font-size: 22px; }
}

@media (max-width: 420px) {
  .hud { gap: 8px; }
  .stat { padding: 8px 10px; }
  .brand p { display: none; }
}
