:root {
  --ink: #efe9dc;
  --muted: #9a9284;
  --line: rgba(239, 233, 220, .16);
  --panel: rgba(10, 9, 9, .78);
  --red: #b3261e;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: #040404; color: var(--ink); overflow: hidden;
  font: 14px/1.55 "Segoe UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
header { position: fixed; left: 22px; top: 16px; pointer-events: none; }
h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: .14em; }
#hint { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

#loading { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); width: 220px; text-align: center;
  color: var(--muted); font-size: 12px; }
#loadbar { display: block; height: 2px; margin-top: 6px; background: var(--red); width: 0; transition: width .2s; }

#rail { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 2px;
  max-width: calc(100% - 24px); overflow-x: auto; padding: 4px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; backdrop-filter: blur(8px); }
#rail button { all: unset; cursor: pointer; padding: 6px 12px; border-radius: 7px; color: var(--muted);
  font-size: 13px; white-space: nowrap; }
#rail button:hover { color: var(--ink); background: rgba(255, 255, 255, .06); }
#rail button.on { color: var(--ink); background: rgba(179, 38, 30, .35); }

#tools { position: fixed; right: 20px; top: 16px; display: flex; gap: 8px; }
#tools button, .row button { cursor: pointer; padding: 6px 12px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; }
#tools button:hover, .row button:hover { border-color: rgba(239, 233, 220, .4); }
#tools button[aria-pressed="false"] { color: var(--muted); }
button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

#card { position: fixed; right: 20px; top: 64px; width: 320px; max-height: calc(100% - 150px); overflow: auto;
  padding: 16px 18px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  backdrop-filter: blur(10px); }
#card[hidden] { display: none; }
#card-close { all: unset; position: absolute; right: 10px; top: 6px; cursor: pointer; font-size: 20px; color: var(--muted);
  padding: 2px 8px; }
h2 { margin: 0; font-size: 20px; font-weight: 600; }
.muted { color: var(--muted); font-size: 12px; margin: 2px 0 8px; }
#c-count { margin: 6px 0 8px; font-size: 15px; }
#c-count b { color: #e9c46a; font-size: 22px; font-weight: 600; padding: 0 2px; }
#c-list { list-style: none; margin: 0 0 8px; padding: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
#c-list li { display: grid; grid-template-columns: 84px 36px 1fr; gap: 6px; padding: 3px 0; border-top: 1px solid var(--line); }
#c-list li small { color: var(--muted); grid-column: 3; margin-top: -4px; }
#c-list.seasons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px 8px; }
#c-list.seasons li { display: block; border: 0; padding: 1px 0; }
.row { display: flex; gap: 8px; margin-top: 10px; }
.row button { background: rgba(179, 38, 30, .30); }
.row button[hidden] { display: none; }

@media (max-width: 760px) {
  #card { left: 12px; right: 12px; top: auto; bottom: 70px; width: auto; max-height: 46%; }
  #tools { top: auto; bottom: 62px; right: 12px; }
  #hint { display: none; }
}
