/* Shared chrome. Surfaces are the game's own plates: panels are the cardshop frame sprite
   stretched by its recorded 9-slice border, and the page sits on the cardshop backdrop from
   the same bundle. Art is only placed at native size where it is an icon or a button. */

:root {
  --bg: #0a0c11;
  --surface: #12151d;
  --surface-2: #171b25;
  --edge: rgba(255, 255, 255, 0.08);
  --gold: #d9b46a;
  --gold-dim: rgba(217, 180, 106, 0.42);
  --ink: #f4f3f0;
  --ink-dim: #c2c6d2;
  --ink-faint: #9298a8;
  --R: #a9bccf;
  --SR: #7db9f5;
  --SSR: #ffc857;
  --UR: #cf9bf0;
  --maxw: 1420px;
  --plate: url("assets/ui/bg-frame-white-12.webp");
  --backdrop: url("assets/ui/bg-cardpool-back-03.webp");
  font-family: "Hiragino Sans", "Yu Gothic", -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

/* Any layer we toggle with .hidden must actually hide: a CSS display rule otherwise
   overrides the attribute. */
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  font-size: clamp(14px, 0.55vw + 12.6px, 16px);
  line-height: 1.65;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* the cardshop backdrop, held well under the text so it reads as room, not wallpaper */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--backdrop) center / cover no-repeat, var(--bg);
  opacity: 0.2;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(10, 12, 17, 0.35), rgba(10, 12, 17, 0.9) 62%, var(--bg));
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; }
input, select { font: inherit; color: var(--ink); }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: clamp(14px, 2vw, 26px); }
.label { font-size: 12px; letter-spacing: 0.02em; color: var(--gold); opacity: 0.72; }
.mono { font-variant-numeric: tabular-nums; }
.empty { color: var(--ink-faint); font-size: 13px; }
/* the "these names are ours, not official" line, used on both pages */
.jpnote { margin: 10px 0 0; font-size: 12px; color: var(--ink-faint); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px clamp(14px, 2.2vw, 28px);
  background: linear-gradient(180deg, rgba(11, 14, 20, 0.97), rgba(11, 14, 20, 0.86));
  border-bottom: 1px solid var(--gold-dim);
  flex-wrap: wrap;
}
.topbar .brand { font-size: 15px; letter-spacing: 0.01em; white-space: nowrap; }
.topbar .brand small { color: var(--gold); font-size: 11px; letter-spacing: 0.18em; margin-left: 8px; opacity: 0.75; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav a { position: relative; padding: 7px 14px; color: var(--ink-dim); font-size: 14px; }
.nav a::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  background: var(--gold);
  opacity: 0;
  transition: opacity 0.15s;
}
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); font-weight: 600; }
.nav a.on::after { opacity: 1; }

/* language switch */
.seg { display: inline-flex; padding: 2px; gap: 2px; background: rgba(8, 10, 15, 0.75); border: 1px solid var(--edge); border-radius: 8px; }
.seg button { padding: 4px 11px; border-radius: 6px; font-size: 13px; color: var(--ink-faint); line-height: 1.4; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: #262c3a; color: var(--gold); font-weight: 600; }

/* ---------- surfaces ---------- */
.panel {
  border: 9px solid transparent;
  border-image: var(--plate) 30 40 / 9px 12px;
  background: linear-gradient(180deg, rgba(24, 28, 38, 0.97), rgba(15, 18, 25, 0.97)) padding-box;
  padding: clamp(14px, 1.6vw, 20px);
}
.panel > h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--gold);
}
.panel > h3::after { content: ""; height: 1px; flex: 1; background: linear-gradient(90deg, var(--gold-dim), transparent); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 5px;
  background: rgba(8, 10, 15, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  font-size: 13px;
  color: var(--ink-dim);
}

/* ---------- buttons ---------- */
.gbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 6px;
  background: linear-gradient(180deg, #232838, #171b25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 1px 0 rgba(0, 0, 0, 0.5);
  color: var(--ink);
  font-size: 14px;
  transition: background 0.15s, box-shadow 0.15s;
}
.gbtn:hover:not(:disabled) { background: linear-gradient(180deg, #2b3244, #1c2130); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 0 1px var(--gold-dim); }
.gbtn:active:not(:disabled) { transform: translateY(1px); }
.gbtn:disabled { opacity: 0.4; cursor: not-allowed; }
.gbtn.sm { padding: 6px 12px; font-size: 13px; }

/* the real cardshop buttons, at their native 380x120 aspect */
.pullbtn { position: relative; display: block; padding: 0; width: 240px; transition: filter 0.15s, transform 0.1s; }
.pullbtn img { width: 100%; }
.pullbtn span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
}
.pullbtn:hover:not(:disabled) { filter: brightness(1.08); }
.pullbtn:active:not(:disabled) { transform: translateY(2px); }
.pullbtn:disabled { filter: grayscale(0.85) brightness(0.5); cursor: not-allowed; }

.iconbtn { display: inline-grid; place-items: center; padding: 0; opacity: 0.85; transition: opacity 0.15s, transform 0.12s; }
.iconbtn img { width: 100%; height: 100%; }
.iconbtn:hover { opacity: 1; }
.iconbtn:active { transform: scale(0.93); }
.iconbtn:disabled { opacity: 0.25; cursor: not-allowed; }

/* ---------- rarity ---------- */
.rank-R { --rc: var(--R); }
.rank-SR { --rc: var(--SR); }
.rank-SSR { --rc: var(--SSR); }
.rank-UR { --rc: var(--UR); }
.rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #0b0d12;
  background: var(--rc, #8fa3bf);
}
.rank.ghost { color: var(--rc); background: transparent; box-shadow: inset 0 0 0 1px var(--rc); }
.rankimg { height: 22px; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.8)); }
.rankimg.lg { height: 34px; }

svg.i { width: 1em; height: 1em; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; display: block; }

@media (min-width: 1700px) {
  :root { --maxw: 1580px; }
}

@media (max-width: 900px) {
  .topbar { gap: 10px; }
  .pullbtn { width: 46%; max-width: 230px; }
  .panel { padding: 15px 16px; }
}

@media (max-width: 560px) {
  .topbar .brand small { display: none; }
  .nav { gap: 2px; }
  .nav a { padding: 6px 9px; font-size: 13px; }
}
