:root {
  --bg: #f5f3ef; --panel: #fffdf9; --ink: #1d1c1a; --muted: #5f5a53; --faint: #8b857c;
  --line: #e3ded5; --fill: #efeae1; --accent: #b4432c;
  --ss: #b4432c; --el: #3f6c8f; --sh: #8a7a3c; --good: #2d6a4f; --bar: #3f6c8f; --on: #fff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) {
  --bg: #161514; --panel: #1f1e1c; --ink: #ece8e1; --muted: #b3ada4; --faint: #8a847b;
  --line: #34322e; --fill: #2a2826; --accent: #e07a5f;
  --ss: #c4553c; --el: #4f7fa3; --sh: #9a8a48; --good: #6fcf97; --bar: #6b9cc4; --on: #161514;
  color-scheme: dark; } }
:root[data-theme=dark] {
  --bg: #161514; --panel: #1f1e1c; --ink: #ece8e1; --muted: #b3ada4; --faint: #8a847b;
  --line: #34322e; --fill: #2a2826; --accent: #e07a5f;
  --ss: #c4553c; --el: #4f7fa3; --sh: #9a8a48; --good: #6fcf97; --bar: #6b9cc4; --on: #161514;
  color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; }
a { color: inherit; }
header.site { border-bottom: 1px solid var(--line); background: var(--panel); }
header.site .in { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; gap: 24px; align-items: baseline; }
header.site .brand { font-weight: 700; letter-spacing: -0.01em; font-size: 17px; text-decoration: none; }
header.site .build { margin-left: auto; color: var(--faint); font-size: 12px; }
footer.site { display: none; color: var(--faint); font-size: 12px; text-align: center; padding: 0 12px 24px; }
main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; }
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 18px; margin: 28px 0 10px; }
.sub { color: var(--muted); margin: 0; }
.controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 18px 0 12px; }
.group { display: flex; gap: 6px; align-items: center; }
.group .lbl { color: var(--faint); font-size: 13px; margin-right: 2px; }
.pill { font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 999px; padding: 3px 11px; cursor: pointer; }
.pill.on { background: var(--ink); color: var(--on); border-color: var(--ink); }
select, input[type=search] { color: var(--ink); font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; width: 220px; background: var(--panel); }
select.sortby { display: none; width: auto; padding: 5px 8px; }
.count { color: var(--faint); font-size: 13px; margin-left: auto; }
.tablewrap { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: clip; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--faint); font-weight: 600; position: sticky; top: 0; z-index: 2; background: var(--panel); box-shadow: inset 0 -1px 0 var(--line); }
th:first-child, td:first-child, th.l, td.l { text-align: left; }
td.name { font-weight: 600; }
td.name a { text-decoration: none; }
td.name small { display: block; font-weight: 400; color: var(--faint); font-size: 12px; }
.tier { font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 4px; color: #fff; }
.tier.Superstar { background: var(--ss); } .tier.Elite { background: var(--el); } .tier.Shining { background: var(--sh); }

/* Roster index: up to 1,280 px wide, every column fits from 1,024 px up. */
body.wide main, body.wide header.site .in { max-width: 1280px; }
table.roster th { user-select: none; }
table.roster th button.sort { all: unset; cursor: pointer; }
table.roster th button.sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
table.roster th[aria-sort] { color: var(--ink); }
table.roster tbody tr { cursor: pointer; }
table.roster tbody tr:hover, table.roster tbody tr:hover td.name { background: var(--fill); }
table.roster th, table.roster td { padding-left: clamp(4px, 0.55vw, 10px); padding-right: clamp(4px, 0.55vw, 10px); }
table.roster td.name { white-space: normal; min-width: 9em; }
table.roster td.hi { font-weight: 700; color: var(--good); }
table.roster td.sep, table.roster th.sep { border-left: 1px solid var(--line); }
table.roster td.name, table.roster th:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; }
table.roster thead th:first-child { z-index: 3; }
/* A scrolling frame captures position: sticky. Where the table fits, the frame clips and the header sticks to
   the window; below that it scrolls both ways inside the window and the header sticks to the frame. The 72 px
   leaves room for the page's bottom padding, so the frame's top never scrolls off screen. */
.rosterwrap { overflow: auto; max-height: calc(100dvh - 72px); }
@media (min-width: 1024px) { .rosterwrap { overflow: clip; max-height: none; } }
@media (max-width: 1100px) {
  body.wide main { padding-left: 12px; padding-right: 12px; }
  table.roster { font-size: 13px; }
  table.roster th { font-size: 11px; }
  table.roster td.name { min-width: 8em; }
}

/* Character page */
a.back { color: var(--muted); font-size: 14px; text-decoration: none; }
.hero { margin: 10px 0 6px; }
.hero .facts { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-top: 20px; }
.card h2 { margin-top: 0; }
.bars2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; }
.bar { display: grid; grid-template-columns: 96px 1fr 44px; gap: 8px; align-items: center; font-size: 13px; padding: 2px 0; }
.bar .track { position: relative; height: 10px; background: var(--fill); border-radius: 3px; }
.bar .val { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bar); border-radius: 3px; }
.bar .med { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .55; }
.bar .n { text-align: right; font-weight: 600; }
.legend { font-size: 12px; color: var(--faint); margin-top: 8px; }
.note { color: var(--muted); margin: 0 0 8px; }
.kit td { white-space: normal; text-align: left; vertical-align: top; }
.kit th { text-align: left; }
.kit td.name { width: 150px; white-space: nowrap; }
.kit td.tag { white-space: nowrap; color: var(--muted); font-size: 13px; }
.kit td.how { width: 26%; }
.kit small { display: block; color: var(--faint); font-size: 12px; margin-top: 4px; }

/* Theme button: shows the icon of the theme a click switches to. */
.theme { margin-left: 12px; align-self: center; display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--muted); cursor: pointer; }
.theme:hover { color: var(--ink); }
.theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme .i-sun { display: none; }
:root[data-theme=dark] .theme .i-sun { display: block; } :root[data-theme=dark] .theme .i-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .theme .i-sun { display: block; } :root:not([data-theme=light]) .theme .i-moon { display: none; } }

/* Phones */
@media (max-width: 700px) {
  header.site .in { padding: 10px 14px; gap: 10px; }
  header.site .build { display: none; }
  .theme { margin-left: auto; }
  footer.site { display: block; }
  main { padding: 16px 12px 16px; }  /* the footer below adds its own space; keeps the roster frame on screen */
  h1 { font-size: 22px; }
  .controls { gap: 10px; }
  .group { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; padding-bottom: 2px; }
  .pill { padding: 6px 12px; }
  input[type=search] { width: 100%; flex: 1 1 100%; padding: 8px 10px; }
  select.sortby { display: inline-block; padding: 7px 8px; }
  .count { margin-left: 0; }
  th, td { padding: 8px 7px; }
  table.roster td.name { max-width: 128px; }
  .tablewrap { border-radius: 6px; }
  .bars2 { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 92px 1fr 40px; padding: 4px 0; }
  .kit thead { display: none; }
  .kit tr { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .kit td { display: block; border: 0; padding: 2px 0; width: auto !important; white-space: normal !important; }
  .kit td.name { font-size: 16px; }
  .kit td:nth-child(2) { display: inline-block; margin-right: 10px; }
  .kit td.how { color: var(--muted); font-size: 13px; margin-top: 4px; }
  .kit td.how::before { content: "How to use: "; color: var(--faint); }
}
