:root {
  color-scheme: dark;
  --bg: #0e0e10;
  --surface: #1c1c1f;
  --surface2: #232328;
  --hover: #2a2a3a;
  --border: #2a2a2e;
  --primary: #5383ff;
  --green: #00d084;
  --red: #ff4e50;
  --orange: #ff8a00;
  --sky: #63b8ff;
  --text: #f2f2f5;
  --muted: #9e9eb1;
  --alert-bg: #3d331a;
  --alert-text: #ffd571;
  --raise: var(--surface);
  --card: var(--surface);
  --line: var(--border);
  --win: var(--green);
  --loss: var(--red);
  --gold: var(--orange);
  --gold-2: #ffd571;
  --blue: #a9bcff;
  font-family: Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: clip; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
button, summary, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; object-fit: cover; }
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.up { color: var(--green); }
.down { color: var(--red); }

.app { min-height: 100vh; }
.wrap { width: min(1080px, calc(100% - 24px)); margin: 0 auto; }

.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #1c1c1f;
  border-bottom: 1px solid var(--border);
}
.head-inner { padding: 12px 0 10px; }
.brand-name { display: flex; align-items: baseline; gap: 8px; }
h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.brand-kicker { color: var(--primary); font-size: 11px; font-weight: 700; }
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  align-self: center;
}
.lede { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.facts li {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: #232328;
  border: 1px solid var(--border);
  color: #c9c9d4;
}
.banner {
  margin: 0;
  padding: 8px 16px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--alert-text);
  background: var(--alert-bg);
}

.page { padding: 12px 0 48px; display: grid; gap: 16px; }
.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  display: grid;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.frow { display: flex; gap: 8px; align-items: flex-start; }
.flabel {
  flex: 0 0 64px;
  padding-top: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.bands, .ranks, .roles, .styles { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.bands button, .ranks button, .roles button, .styles button {
  border: 1px solid #2a2a2e;
  background: #2a2a2e;
  color: #c9c9d4;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.bands button { display: inline-flex; gap: 6px; align-items: baseline; }
.bands small { font-weight: 500; opacity: 0.7; }
.bands button[aria-pressed="true"],
.ranks button[aria-pressed="true"],
.roles button[aria-pressed="true"],
.styles button[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.allies { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.allies > p, .quiet, .hint { color: var(--muted); font-size: 11px; }
.ally-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ally-head h3 { font-size: 13px; font-weight: 800; }
.ally-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: #16233f;
  border: 1px solid #2a3f6e;
  border-radius: 999px;
  padding: 2px 8px;
}
.ally-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ally {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 6px;
  min-width: 0;
}
.ally .role-name { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--muted); }
.ally button[data-ally-slot] {
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  color: #a9bcff;
  font-size: 12px;
  font-weight: 700;
  min-width: 0;
}
.ally button[data-ally-slot] b { color: var(--text); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ally button[aria-pressed="true"] { color: var(--primary); }
.ally button[data-clear-ally] {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 0;
}
.ally button[data-clear-ally]:hover { color: var(--red); }
.ally-panel {
  background: #232328;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 8px;
}
.ally-filter {
  width: 100%;
  border: 1px solid var(--border);
  background: #0b0b0d;
  border-radius: 6px;
  padding: 8px 10px;
  outline: none;
}
.ally-filter:focus { border-color: var(--primary); }
.ally-choices { display: flex; flex-wrap: wrap; gap: 6px; max-height: 240px; overflow: auto; }
.ally-choices button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: 4px 8px 4px 4px;
  font-size: 12px;
  font-weight: 700;
}
.ally-choices button:hover { background: #2a2a3a; }

.answers-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.answers-head p { margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.comp { margin-top: 4px; color: #a9bcff; font-size: 12px; font-weight: 700; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.card {
  display: grid;
  grid-template-columns: auto auto 1fr;
  grid-template-areas: "ord face who" "stats stats stats" "tags tags tags";
  gap: 0;
  text-align: left;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  min-width: 0;
}
.card:hover { background: var(--hover); }
.card.on { box-shadow: inset 3px 0 0 #5383ff, 0 1px 2px rgba(0, 0, 0, 0.35); }
.ord {
  grid-area: ord;
  align-self: center;
  width: 32px;
  margin-left: 12px;
  font-size: 28px;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  color: #5a5a66;
  text-align: center;
}
.card:first-child .ord, .cards .card:nth-child(1) .ord { color: var(--orange); }
.face, .hero, .ban-icon, .tiny, .item, .spell, .rune-icon, .tree {
  background: #141419;
  border-radius: 8px;
}
.face { grid-area: face; width: 48px; height: 48px; margin: 12px 0 0 8px; }
.who { grid-area: who; min-width: 0; padding: 12px 12px 0 10px; display: grid; gap: 4px; }
.who b { font-size: 15px; font-weight: 800; }
.who small, .profile h2 small { color: var(--muted); font-size: 12px; font-weight: 600; }
.scoreline { display: flex; align-items: center; gap: 8px; }
.scoreline span { color: var(--muted); font-size: 11px; }
.scoreline .num { font-size: 20px; font-weight: 900; }
.profile .scoreline .num { font-size: 22px; }
.stat4 {
  grid-area: stats;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
  border-top: 1px solid var(--border);
  background: #17171a;
}
.stat4 span {
  padding: 8px 4px;
  text-align: center;
  min-width: 0;
  border-left: 1px solid var(--border);
}
.stat4 span:first-child { border-left: 0; }
.stat4 small { display: block; color: var(--muted); font-size: 10px; font-weight: 600; }
.stat4 b { display: block; margin-top: 2px; font-size: 13px; font-weight: 800; }
.tags { grid-area: tags; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
.tags em {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  color: #a9bcff;
  background: #232328;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}
.tags em.fit {
  color: #1a0e00;
  font-weight: 900;
  border: 0;
  background: linear-gradient(90deg, #ff8a00, #ffd571);
}
.viewing {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
  padding: 2px 8px;
}

.grade {
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  border: 0;
  border-radius: 4px;
  padding: 3px 6px;
  background: #9e9eb1;
  color: #141419;
}
.grade.S\+ { background: linear-gradient(90deg, #ff4e50, #ff8a00); color: #fff; }
.grade.S { background: #ff8a00; color: #1a0e00; }
.grade.A { background: #5383ff; color: #fff; }
.grade.B { background: #63b8ff; color: #06182b; }

.card-empty, .empty-board, .boot {
  margin-top: 12px;
  background: var(--surface);
  border: 1px dashed #3a3a40;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
}
.empty-board p, .card-empty p, .boot { color: var(--text); font-weight: 700; font-size: 14px; }
.card-empty, .empty-board { display: grid; gap: 12px; justify-items: center; }
.card-empty button, .empty-board button {
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
}

.board {
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: inset 3px 0 0 #5383ff, 0 1px 2px rgba(0, 0, 0, 0.35);
}
.profile { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero { width: 80px; height: 80px; border-radius: 8px; }
.profile h2 { font-size: 24px; font-weight: 900; }
.profile h2 small { display: inline; margin-left: 6px; }
.eyebrow { color: #a9bcff; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; }
.stats {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 0;
}
.stats div {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}
.stats dt { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; }
.stats dd { margin: 4px 0 0; font-size: 16px; font-weight: 800; }
.reason {
  margin-top: 12px;
  background: #12291c;
  border: 1px solid #1e4630;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
}
.reason b { font-weight: 800; }
.highlights { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }

.sections { display: grid; gap: 18px; margin-top: 8px; }
.sections h3 { font-size: 14px; font-weight: 800; margin: 8px 0; }
.ban-list { display: grid; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.ban {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 12px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
}
.ban:first-child { border-top: 0; }
.ban.must { background: #2a1515; }
.ban div { display: grid; gap: 2px; min-width: 0; }
.ban strong { font-size: 13px; }
.ban em {
  font-style: normal;
  justify-self: start;
  font-size: 10px;
  font-weight: 800;
  border-radius: 4px;
  padding: 2px 6px;
  background: #3a3a40;
  color: #c9c9d4;
}
.ban.must em { background: var(--red); color: #fff; }
.ban p, .path small, .slot small { margin: 0; color: var(--muted); font-size: 12px; }
.ban-icon { width: 32px; height: 32px; border-radius: 8px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; }
.ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px 4px 4px;
  letter-spacing: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}
.tiny { width: 28px; height: 28px; border-radius: 6px; }

.split { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 16px; }
.runes { display: grid; gap: 12px; }
.runes > div, .slot, .path, .skills > div, .spell-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.runes p, .spells, .skills, .path-row, .rune-row, .meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tree, .rune-icon { width: 34px; height: 34px; border-radius: 50%; }
.rune { width: 72px; display: grid; justify-items: center; gap: 4px; text-align: center; }
.rune small { color: var(--text); font-size: 10px; font-weight: 700; line-height: 1.3; }
.copy {
  margin-top: 12px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 14px;
}
.copy.done { background: var(--green); color: #06230f; }
.code {
  margin: 10px 0 0;
  padding: 10px;
  overflow: auto;
  color: #9fb4ff;
  background: #0b0b0d;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 11px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.spell { width: 40px; height: 40px; border-radius: 4px; }
.slots, .fork { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.slots { margin-bottom: 8px; }
.slot, .path { display: grid; gap: 6px; justify-items: start; }
.slot .item, .path .item { width: 32px; height: 32px; border-radius: 4px; }
.arrow { color: #5a5a66; font-style: normal; }
.skills { display: flex; gap: 8px; align-items: stretch; }
.skills > div { flex: 1; display: grid; gap: 6px; }
.skill {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  background: #232328;
  border: 1px solid var(--border);
  font-weight: 900;
}
.method {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.method summary {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.method summary:hover { background: var(--surface2); }
.method p { margin: 0 16px 10px; color: #c9c9d4; font-size: 12px; line-height: 1.7; }
.method p:first-of-type { margin-top: 4px; }
.foot-note { text-align: center; color: var(--muted); font-size: 11px; }

@media (max-width: 800px) {
  .frow { flex-direction: column; gap: 6px; }
  .flabel { flex-basis: auto; padding-top: 0; }
  .cards, .split, .stats, .ally-row, .slots, .fork { grid-template-columns: 1fr; }
  .ally-row, .slots, .stats { grid-template-columns: 1fr 1fr; }
  .facts { display: grid; grid-template-columns: 1fr 1fr; }
  .skills { flex-direction: column; }
}
