/* HoloTrend design system: the "kissaten" theme. Tokens and components; design/styles.css is a copy.
   An old Japanese coffee shop. After hours (dark) is espresso wood; by day (light) a white counter with
   steamed-milk panels. The chart is the menu board, rank 1 is today's order ticket, the week's totals
   are a till receipt. Custard pudding yellow is the one loud colour (rank 1 and primary actions);
   melon soda green means up, new or free; cherry red means live. */

:root {
  color-scheme: dark;
  /* After hours (dark, default) */
  --bg: #1e1510;
  --surface: #2a1d16;
  --surface-2: #38281e;
  --line: #4f3b2d;
  --line-strong: #6e5541;
  --text: #f6ead8;
  --muted: #c3ab90;
  --custard: #f2c75c;
  --on-custard: #2a1a10;
  --custard-edge: #f2c75c;
  --accent-text: #f2c75c;
  --up: #7ad7a6;
  --down: #f39483;
  --live: #ff6a5f;
  --focus: #a9d9ff;
  --paper: #f3e6cf;
  --on-paper: #2a1a10;
  --paper-muted: #6a5141;
  --lift: 0 18px 36px -22px rgb(0 0 0 / 0.75);
  /* Older names, kept so admin markup and inline styles keep working */
  --marigold: var(--custard);
  --on-marigold: var(--on-custard);

  --display: "Dela Gothic One", "Zen Maru Gothic", system-ui, sans-serif;
  --body: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", system-ui, sans-serif;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --r-chip: 999px; --r-cover: 8px; --r-panel: 18px;
  --page: 1240px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #ffffff; --surface: #fbf6ee; --surface-2: #f3e9da; --line: #e7dac6; --line-strong: #cdb79c;
    --text: #2b1a11; --muted: #6d5545; --accent-text: #875600; --custard-edge: #d9a63a;
    --up: #1b7450; --down: #b03d2c; --live: #c92a25; --focus: #1f5fbf;
    --paper: #fffaf1; --on-paper: #2b1a11; --paper-muted: #6d5545;
    --lift: 0 16px 32px -22px rgb(60 35 15 / 0.45);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff; --surface: #fbf6ee; --surface-2: #f3e9da; --line: #e7dac6; --line-strong: #cdb79c;
  --text: #2b1a11; --muted: #6d5545; --accent-text: #875600; --custard-edge: #d9a63a;
  --up: #1b7450; --down: #b03d2c; --live: #c92a25; --focus: #1f5fbf;
  --paper: #fffaf1; --on-paper: #2b1a11; --paper-muted: #6d5545;
  --lift: 0 16px 32px -22px rgb(60 35 15 / 0.45);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 500 16px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-text); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; letter-spacing: 0; }
h1 { font: 900 clamp(1.9rem, 4vw, 2.7rem)/1.15 var(--body); }
/* The signboard face is only for the date heading (day and month) and the rank numerals. */
h1.dated { font: 400 clamp(1.8rem, 4.2vw, 2.9rem)/1.15 var(--display); }
h2 { font: 900 1.45rem/1.25 var(--body); }
h3 { font: 900 1.08rem/1.3 var(--body); }
p { margin: 0; max-width: 68ch; }
kbd { font: 700 0.8em/1 var(--body); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: 2px 6px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: var(--page); margin: 0 auto; padding: 0 var(--s4); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Site header ---------- */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; gap: var(--s3) var(--s5); min-height: 68px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { font: 400 1.35rem/1 var(--display); text-decoration: none; display: flex; align-items: baseline; gap: 4px; }
.brand b { background: var(--custard); color: var(--on-custard); padding: 4px 8px 5px; border-radius: 8px; font-weight: 400; }
.brand:hover { color: inherit; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; }
.nav a { text-decoration: none; padding: 7px 12px; color: var(--muted); font-weight: 700; border-radius: 999px; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--text); color: var(--bg); }
.head-actions { display: flex; gap: var(--s2); align-items: center; }

/* Search field and its results */
.search { position: relative; margin-left: auto; flex: 0 1 250px; min-width: 0; }
.search::before {
  content: ""; position: absolute; left: 13px; top: 50%; width: 16px; height: 16px; translate: 0 -50%; pointer-events: none;
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5' fill='none' stroke='%23000' stroke-width='2.6'/%3E%3Cpath d='M15.5 15.5 21 21' stroke='%23000' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5' fill='none' stroke='%23000' stroke-width='2.6'/%3E%3Cpath d='M15.5 15.5 21 21' stroke='%23000' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.search input[type="search"] { width: 100%; border-radius: 999px; padding: 9px 36px 9px 38px; background: var(--bg); }
.search input::-webkit-search-cancel-button { display: none; }
.search .key { position: absolute; right: 10px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.search:focus-within .key { display: none; }
.search-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: min(420px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; padding: 6px; box-shadow: var(--lift);
}
.search-pop[hidden] { display: none; }
.search-pop ul { list-style: none; margin: 0; padding: 0; }
.search-pop .group-label { font-size: 0.78rem; font-weight: 700; color: var(--muted); padding: 8px 10px 4px; }
.search-pop [role="option"] { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 10px; cursor: pointer; }
.search-pop [role="option"][aria-selected="true"], .search-pop [role="option"]:hover { background: var(--surface-2); }
.search-pop [role="option"][aria-selected="true"] { box-shadow: inset 3px 0 0 var(--text); }
.search-pop .pic { flex: none; width: 36px; height: 36px; border-radius: 8px; overflow: hidden; background: color-mix(in oklab, hsl(var(--ph-h, 30) 55% 50%) 26%, var(--surface-2)); }
.search-pop .pic.round { border-radius: 50%; }
.search-pop .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.search-pop .txt { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.search-pop .txt b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-pop .txt span { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-status { font-size: 0.86rem; color: var(--muted); padding: 8px 10px; }
.search-status:empty { display: none; }
.search-pop ul:not(:empty) + .search-status { border-top: 2px dotted var(--line); margin-top: 4px; }

/* Theme toggle: a round coaster. The icon is the theme you switch to. */
.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); cursor: pointer;
  box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px var(--line);
}
.theme-toggle:hover { color: var(--accent-text); border-color: var(--muted); }
.theme-toggle .to-dark { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .to-dark { display: inline; }
  :root:not([data-theme="dark"]) .theme-toggle .to-light { display: none; }
}
:root[data-theme="light"] .theme-toggle .to-dark { display: inline; }
:root[data-theme="light"] .theme-toggle .to-light { display: none; }
:root[data-theme="dark"] .theme-toggle .to-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .to-light { display: inline; }

/* ---------- Buttons and chips ---------- */
.btn {
  font: 700 0.95rem/1 var(--body); padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); color: var(--text); background: var(--surface-2); }
.btn.primary { background: var(--custard); color: var(--on-custard); border-color: var(--custard-edge); }
.btn.primary:hover { background: color-mix(in oklab, var(--custard) 88%, var(--on-custard)); color: var(--on-custard); }
.btn.quiet { background: transparent; }
.btn.small { padding: 7px 13px; font-size: 0.86rem; }
.btn:disabled { opacity: 0.5; cursor: default; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: 700 0.82rem/1 var(--body); padding: 6px 10px; border-radius: var(--r-chip);
  border: 1px solid var(--line-strong); background: transparent; color: var(--muted); white-space: nowrap;
}
button.chip { cursor: pointer; padding: 8px 13px; font-size: 0.86rem; }
button.chip:hover { border-color: var(--muted); color: var(--text); }
/* Pressed chips are cream on espresso (or the reverse by day): custard stays reserved for rank 1. */
button.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.owned { color: var(--text); background: var(--surface-2); border-color: transparent; }
.chip.free { color: var(--up); border-color: currentColor; background: transparent; }
.chip .count { opacity: 0.7; margin-left: 2px; }

/* ---------- Movement marks ---------- */
.move { font: 700 0.85rem/1 var(--body); display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.move.up { color: var(--up); } .move.down { color: var(--down); } .move.same { color: var(--muted); }
.move.new { background: var(--up); color: var(--bg); padding: 4px 8px; border-radius: 999px; font-size: 0.74rem; }
.rising { font: 700 0.74rem/1 var(--body); color: var(--accent-text); border: 1px solid currentColor; padding: 3px 8px; border-radius: 999px; }

/* ---------- Covers and avatars ---------- */
.cover {
  --h: 30; aspect-ratio: 3 / 4; border-radius: var(--r-cover);
  background: linear-gradient(160deg, hsl(var(--h) 45% 40%), hsl(calc(var(--h) + 40) 50% 22%));
  color: #fff; font: 900 0.62rem/1.15 var(--body); padding: 6px; display: flex; align-items: flex-end;
  overflow: hidden; flex: none; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.06);
}
.cover.wide { aspect-ratio: 460 / 215; }
.avatars { display: flex; }
.avatar {
  --h: 30; width: var(--av, 30px); height: var(--av, 30px); border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; overflow: hidden;
  background: hsl(var(--h) 50% 72%); color: #2a1a10; border: 2px solid var(--bg);
  font: 700 calc(var(--av, 30px) * 0.34)/1 var(--body); text-align: center; margin-left: -8px;
}
.avatars .avatar:first-child { margin-left: 0; }
.avatar.more { background: var(--surface-2); color: var(--text); }
.avatar.lg { width: 96px; height: 96px; font-size: 2rem; margin: 0; }

/* YouTube stills */
.thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge { position: absolute; z-index: 3; font: 700 0.74rem/1 var(--body); padding: 5px 8px; border-radius: 999px; background: rgb(20 12 8 / 0.78); color: #fff; }
.badge.live { left: 8px; top: 8px; background: #c4261f; }
.badge:not(.live) { right: 8px; bottom: 8px; }

/* ---------- 7-day strip: one bar per day, height = members who played ---------- */
.strip { display: flex; align-items: flex-end; gap: 3px; height: 34px; }
.strip i { width: 9px; background: var(--muted); opacity: 0.5; border-radius: 3px 3px 0 0; height: calc(var(--v) * 1%); min-height: 2px; }
.strip i:last-child { background: var(--custard); opacity: 1; }
.strip.big { height: 120px; gap: 4px; } .strip.big i { width: 100%; flex: 1; }

/* ---------- Page heads, day bar and filters ---------- */
.daybar { display: flex; align-items: end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; padding: var(--s6) 0 var(--s4); }
.daybar .pager { display: flex; gap: var(--s2); flex-wrap: wrap; }
.daybar p { margin-top: 6px; }
.pagehead { padding: var(--s6) 0 var(--s4); }
.pagehead h1 { font: 900 clamp(1.9rem, 4vw, 2.7rem)/1.15 var(--body); }
.pagehead p { margin-top: 6px; }
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  padding: var(--s3) var(--s4); margin-bottom: var(--s5);
}
.filters .group { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.filters .label { font-size: 0.86rem; color: var(--muted); font-weight: 700; }
.filters .tools { margin-left: auto; }
.filters > p { margin: 0; }

/* Segmented control (list / covers) */
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg); }
.seg-btn { font: 700 0.86rem/1 var(--body); padding: 7px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--text); color: var(--bg); }

/* "Pick one for me" answer */
.pick-note { margin: calc(-1 * var(--s3)) 0 var(--s5); padding: 10px 16px; border-radius: 14px; background: var(--surface-2); max-width: none; }
.pick-note .muted { margin-left: 8px; }
.pick-note:empty { display: none; }
.pick-note a { font-weight: 700; }
.picked { outline: 3px solid var(--custard-edge); outline-offset: 3px; border-radius: 12px; }
@media (prefers-reduced-motion: no-preference) {
  .picked .rank, .picked .tile-rank { animation: stamp 0.5s cubic-bezier(.3, 1.6, .6, 1); }
  @keyframes stamp { from { transform: scale(1.5) rotate(-6deg); } }
}

/* ---------- Layout ---------- */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s6); align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: var(--s4) var(--s5); }
.panel + .panel, .receipt-wrap + .panel { margin-top: var(--s4); }
.panel h3 { margin-bottom: var(--s3); display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }
.panel-more { margin-top: var(--s2); font-weight: 700; }
.section { padding: var(--s7) 0 0; }
.section.first { padding-top: var(--s4); }
.section > h2, .section-head { margin-bottom: var(--s2); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4); flex-wrap: wrap; }
.section-head a { font-weight: 700; }
.section > .lede { color: var(--muted); margin-bottom: var(--s4); }
.count-note { font: 500 0.9rem var(--body); margin-left: 6px; }

/* ---------- Live rail ---------- */
.rail { margin: 0 0 var(--s5); }
.rail-head { display: flex; align-items: baseline; gap: var(--s2) var(--s4); flex-wrap: wrap; margin-bottom: var(--s3); }
.rail-head h2 { font-size: 1.25rem; display: flex; align-items: center; gap: 10px; position: relative; }
.rail-track {
  list-style: none; margin: 0; padding: 2px 2px var(--s3); display: grid; grid-auto-flow: column; grid-auto-columns: 248px;
  gap: var(--s4); overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: thin;
}
.rail-item { scroll-snap-align: start; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.rail-body { display: flex; gap: 10px; align-items: center; padding: 10px 12px 6px; flex: 1; min-width: 0; }
.rail-body .avatar { margin: 0; border: 0; }
.rail-text { min-width: 0; line-height: 1.3; }
.rail-text .who-name { font-weight: 700; text-decoration: none; }
.rail-text .game-name { display: block; color: var(--muted); font-size: 0.88rem; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-text a:hover { text-decoration: underline; color: var(--text); }
.rail-item .watch { align-self: flex-start; margin: 4px 12px 12px; }
.rail-item.unowned { opacity: 0.45; }
.rail-quiet { display: flex; gap: 10px; align-items: center; color: var(--muted); padding: 10px 16px; border: 1px dashed var(--line-strong); border-radius: 999px; margin: 0 0 var(--s5); max-width: none; }
.rail-quiet a { color: var(--text); font-weight: 700; margin-left: 4px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--live); flex: none; }
.live-dot.idle { background: var(--line-strong); }
/* Steam rising from the live cup */
.steam { position: absolute; left: -2px; top: -14px; width: 13px; height: 14px; display: flex; justify-content: space-between; pointer-events: none; }
.steam i { width: 2px; height: 9px; border-radius: 2px; background: var(--muted); opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .live-dot:not(.idle) { animation: pulse 1.6s ease-in-out infinite; }
  .steam i { animation: steam 2.4s ease-in-out infinite; }
  .steam i:nth-child(2) { animation-delay: 0.8s; }
  .steam i:nth-child(3) { animation-delay: 1.6s; }
}
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes steam { 0% { opacity: 0; transform: translateY(6px) scaleY(0.6); } 40% { opacity: 0.55; } 100% { opacity: 0; transform: translateY(-6px) translateX(1px) scaleY(1.1); } }

/* ---------- The chart: rank 1 ticket ---------- */
.top {
  background: var(--custard); color: var(--on-custard); border-radius: 22px;
  display: grid; grid-template-columns: auto 160px minmax(0, 1fr); gap: var(--s5); padding: var(--s5) var(--s6); align-items: center;
  -webkit-mask: radial-gradient(circle 13px at 0 50%, #0000 97%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 13px at 100% 50%, #0000 97%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle 13px at 0 50%, #0000 97%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 13px at 100% 50%, #0000 97%, #000) right / 51% 100% no-repeat;
}
.top .rank { font: 400 8.5rem/0.85 var(--display); padding-right: var(--s5); border-right: 2px dashed rgb(42 26 16 / 0.35); align-self: stretch; display: flex; align-items: center; }
.top .cover { width: 160px; box-shadow: 0 0 0 3px var(--on-custard); }
.top h2 { font: 900 clamp(1.7rem, 3.4vw, 2.6rem)/1.15 var(--body); }
.top h2 a { text-decoration: none; } .top h2 a:hover { color: inherit; text-decoration: underline; }
.top .why { margin: var(--s2) 0 var(--s3); font-weight: 700; }
.top .row-meta { display: flex; gap: var(--s4); align-items: center; flex-wrap: wrap; }
.top .move.up, .top .move.down, .top .move.same { color: var(--on-custard); }
.top .move.new { background: var(--on-custard); color: var(--custard); }
.top .rising { color: var(--on-custard); }
.top .chip { color: var(--on-custard); border-color: rgb(42 26 16 / 0.4); }
.top .chip.owned { background: rgb(42 26 16 / 0.12); border-color: transparent; }
.top .chip.free { color: var(--on-custard); }
.top .avatar { border-color: var(--custard); }
.top .strip i { background: var(--on-custard); opacity: 0.3; } .top .strip i:last-child { opacity: 1; }
.top .btn { background: var(--on-custard); color: #f6ead8; border-color: transparent; }
.top a:focus-visible { outline-color: var(--on-custard); }
.top.unowned { opacity: 0.55; }
.top .cover.ph { color: var(--on-custard); }

/* The menu: dotted leaders between rows. */
.chart { list-style: none; margin: var(--s3) 0 0; padding: 0; }
.chart li {
  display: grid; align-items: center; gap: var(--s4);
  grid-template-columns: 56px 52px 48px minmax(0, 1fr) 84px 118px; row-gap: var(--s2);
  padding: var(--s3); border-bottom: 2px dotted var(--line); border-radius: 12px;
}
.chart li:hover { background: var(--surface); }
.chart li:last-child { border-bottom: 0; }
.chart li > .rank, .chart li > .move, .chart li > .cover { grid-row: 1 / span 2; }
.chart li > .info { align-self: end; }
.chart li > .strip, .chart li > .avatars { grid-row: 1 / span 2; }
.chart li > .chips { grid-column: 4; grid-row: 2; align-self: start; }
.chart li > .cover { width: 48px; }
.chart .rank { font: 400 2rem/1 var(--display); text-align: right; color: var(--muted); }
.chart li:nth-child(-n+2) .rank { color: var(--text); }
.chart .title { font: 900 1.08rem/1.25 var(--body); text-decoration: none; display: block; }
.chart .sub { font-size: 0.85rem; color: var(--muted); }
.chart .sub .reason::before { content: ". "; }
.chart li.unowned { opacity: 0.42; }
.chart li.unowned .title::after { content: " (not on your platforms)"; font: 500 0.8rem var(--body); }

/* The cover wall: the same chart as tiles. */
.chart-view[data-view="list"] .wall, .chart-view[data-view="covers"] .chart { display: none; }
.wall { list-style: none; margin: var(--s5) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s5) var(--s4); }
.tile { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tile-art, .arrival-art { position: relative; display: block; }
.tile .cover, .arrival .cover { width: 100%; border-radius: 12px; }
.tile-rank {
  position: absolute; left: 0; top: 0; z-index: 3; font: 400 1.5rem/1 var(--display);
  background: var(--bg); color: var(--text); padding: 7px 12px 9px 10px; border-bottom-right-radius: 14px;
}
.tile-body { display: flex; justify-content: space-between; gap: var(--s2); align-items: baseline; }
.tile .title { font: 900 1rem/1.25 var(--body); text-decoration: none; min-width: 0; }
.tile.unowned { opacity: 0.42; }

/* ---------- Side lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: var(--s3); align-items: center; padding: var(--s2) 0; border-top: 2px dotted var(--line); }
.list li:first-child { border-top: 0; }
.list .cover { width: 34px; font-size: 0; }
.list .what { flex: 1; min-width: 0; }
.list .what a { text-decoration: none; }
.list .what a:hover b { text-decoration: underline; }
.list .what b { display: block; font-weight: 700; line-height: 1.3; }
.list .what span { font-size: 0.83rem; color: var(--muted); }

/* ---------- Today's receipt ---------- */
.receipt-wrap { filter: drop-shadow(0 10px 14px rgb(0 0 0 / 0.18)); }
.receipt {
  --zz: 9px;
  background: var(--paper); color: var(--on-paper); padding: var(--s5) var(--s5) calc(var(--s5) + var(--zz));
  border-radius: 6px 6px 0 0;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(2 * var(--zz)) 100%;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(2 * var(--zz)) 100%;
}
.receipt header { text-align: center; padding-bottom: var(--s3); border-bottom: 2px dashed rgb(42 26 16 / 0.3); }
.receipt-brand { font: 400 1.1rem/1 var(--display); display: block; margin-bottom: 6px; }
.receipt h3 { font-size: 1rem; }
.receipt header p { font-size: 0.85rem; color: var(--paper-muted); margin: 2px auto 0; }
.receipt-lines { margin: 0; padding: var(--s3) 0; display: grid; gap: 6px; }
.receipt-lines + .receipt-lines { border-top: 2px dashed rgb(42 26 16 / 0.3); }
.receipt-lines div { display: flex; align-items: baseline; gap: 8px; }
.receipt-lines dt { flex: 1; display: flex; align-items: baseline; gap: 6px; font-size: 0.92rem; min-width: 0; }
.receipt-lines dt::after { content: ""; flex: 1; min-width: 12px; border-bottom: 2px dotted rgb(42 26 16 / 0.35); }
.receipt-lines dd { margin: 0; font-weight: 900; }
.receipt-extra dt { flex-direction: column; gap: 0; font-size: 0.82rem; color: var(--paper-muted); }
.receipt-extra dt::after { display: none; }
.receipt-extra dt span { font-size: 0.95rem; font-weight: 700; color: var(--on-paper); }
.receipt-extra dd { white-space: nowrap; align-self: flex-end; }
.receipt a { color: inherit; text-decoration: none; }
.receipt a:hover { text-decoration: underline; color: inherit; }
.receipt a:focus-visible { outline-color: #1f5fbf; }
.receipt-note { font-size: 0.8rem; color: var(--paper-muted); padding-top: var(--s3); border-top: 2px dashed rgb(42 26 16 / 0.3); }
.receipt header + .receipt-note { border-top: 0; }
/* The page's one orchestrated motion: the receipt prints when the chart loads. */
@media (prefers-reduced-motion: no-preference) {
  .receipt { animation: print 0.9s 0.2s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes print { from { clip-path: inset(0 0 100% 0); translate: 0 -10px; } to { clip-path: inset(0 0 -20px 0); translate: 0 0; } }
}

/* ---------- Shelves ---------- */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s4); }
.shelf.wide { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--s5) var(--s4); }
.shelf a { text-decoration: none; display: block; }
.shelf .cover { width: 100%; font-size: 0.9rem; padding: 10px; border-radius: 12px; }
.shelf a:hover .cover { outline: 3px solid var(--line-strong); outline-offset: 2px; }
.shelf b { display: block; margin-top: var(--s2); line-height: 1.3; font-weight: 900; }
.shelf span { font-size: 0.83rem; color: var(--muted); }

/* ---------- Upcoming: a timeline by day and hour ---------- */
.onair { margin-bottom: var(--s5); }
.onair h2 { font-size: 1.25rem; display: flex; align-items: center; gap: 10px; margin-bottom: var(--s3); }
.timeline-day { margin-top: var(--s6); }
.timeline-day > h2 { font-size: 1.3rem; padding-bottom: var(--s2); border-bottom: 2px solid var(--text); }
.timeline-day > h2 .muted { font: 500 0.9rem var(--body); margin-left: 6px; }
.timeline { list-style: none; margin: var(--s4) 0 0; padding: 0; }
.timeline-hour { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: var(--s4); position: relative; padding-bottom: var(--s4); }
.timeline-hour::before { content: ""; position: absolute; left: 22px; top: 34px; bottom: 4px; border-left: 2px dotted var(--line-strong); }
.timeline-hour:last-child::before { display: none; }
.hour { font: 900 1.15rem/1 var(--body); padding-top: 14px; }
.timeline-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.entry {
  display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: var(--s4); align-items: center;
  padding: 10px 14px 10px 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
}
.entry .cover { width: 120px; border-radius: 10px; }
.entry-art { display: block; }
.entry-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.entry .title { font: 900 1.05rem/1.25 var(--body); text-decoration: none; }
.entry .title:hover { text-decoration: underline; }
.entry-who { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.92rem; flex-wrap: wrap; }
.entry-who .avatar { margin: 0; border: 0; font-size: 0.55rem; }
.entry-who a { text-decoration: none; }
.entry-who a:hover { text-decoration: underline; }
.entry-stream { color: var(--muted); font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-when { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.entry-when .rel { font-weight: 900; }
.entry-when .live-text { color: var(--live); display: inline-flex; align-items: center; gap: 6px; }
.entry.is-live { border-color: var(--live); }
.entry.unowned { opacity: 0.45; }

/* ---------- New arrivals ---------- */
.arrivals { list-style: none; margin: var(--s4) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: var(--s6) var(--s5); }
.arrivals.compact { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--s5) var(--s4); }
.arrival { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.arrival-body { display: flex; flex-direction: column; gap: 6px; }
.arrival .title { font: 900 1.15rem/1.25 var(--body); text-decoration: none; }
.arrival .title:hover { text-decoration: underline; }
.arrivals.compact .title { font-size: 1rem; }
.brought { display: flex; gap: 8px; align-items: center; font-size: 0.92rem; }
.brought .avatar { margin: 0; border: 0; }
.brought a { font-weight: 700; }
.arrival.unowned { opacity: 0.45; }
@media (min-width: 900px) {
  .arrivals:not(.compact) .arrival:first-child { grid-column: span 2; }
  .arrivals:not(.compact) .arrival:first-child .title { font-size: 1.5rem; }
}

/* ---------- Archive calendar ---------- */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.weekday { font-weight: 700; font-size: 0.8rem; color: var(--muted); padding: 0 6px 2px; }
.day { min-height: 112px; border-radius: 12px; padding: 6px; display: flex; flex-direction: column; gap: 5px; text-decoration: none; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.day.blank { background: none; border: 0; }
.day.empty-day { background: transparent; border-style: dashed; color: var(--muted); }
.day-num { font-weight: 900; font-size: 0.85rem; line-height: 1; }
.day .cover { width: 100%; border-radius: 6px; font-size: 0; padding: 0; }
.day-game { font-size: 0.74rem; font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
a.day:hover { border-color: var(--line-strong); color: var(--text); background: var(--surface-2); }
.day.today { box-shadow: inset 0 0 0 2px var(--text); }
.leaders .what span { display: block; }

/* ---------- Detail pages ---------- */
.crumbs { font-size: 0.9rem; margin-bottom: var(--s2); }
.crumbs a { font-weight: 700; }
.title-h1 { font: 900 clamp(1.9rem, 4vw, 2.9rem)/1.12 var(--body); overflow-wrap: anywhere; }
.jp-name { font-weight: 700; color: var(--muted); font-size: 1.1rem; margin-top: 4px; }
.hero { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s6); padding: var(--s6) 0; align-items: end; }
.game-hero { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); align-items: center; }
.hero-art .cover { width: 100%; border-radius: 18px; font-size: 1.2rem; padding: 14px; box-shadow: 0 0 0 1px var(--line), var(--lift); }
.hero .facts, .facts { display: flex; gap: var(--s4) var(--s6); flex-wrap: wrap; margin: var(--s5) 0; align-items: center; }
.fact b { font: 900 2rem/1 var(--body); display: block; }
.fact span { font-size: 0.85rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.rank-fact b { font: 400 2.6rem/1 var(--display); }
.rank-fact.is-first { background: var(--custard); color: var(--on-custard); padding: 10px 16px 12px; border-radius: 14px; }
.rank-fact.is-first span, .rank-fact.is-first .move { color: var(--on-custard); }
.actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.history { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s4); }
.history .panel + .panel { margin-top: 0; }
.rankchart { margin: 0; }
.rankchart-plot { position: relative; height: 120px; margin: 10px 4px 0 48px; }
.rankchart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.rankchart .grid { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 2 4; }
.rankchart .line { fill: none; stroke: var(--text); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.rankchart .dot { stroke: var(--text); stroke-width: 7; stroke-linecap: round; }
.rankchart .dot.today { stroke: var(--accent-text); stroke-width: 12; }
.rankchart-y { position: absolute; left: -48px; width: 40px; text-align: right; translate: 0 -50%; font-size: 0.74rem; font-weight: 700; color: var(--muted); }
.rankchart-none { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; max-width: none; }
.rankchart-x { display: flex; justify-content: space-between; margin-top: 8px; }
.rankchart .rankchart-x { margin-left: 48px; }
table.plain { width: 100%; border-collapse: collapse; }
table.plain th { text-align: left; font-weight: 700; color: var(--muted); font-size: 0.85rem; padding: var(--s2); border-bottom: 2px dotted var(--line); }
table.plain td { padding: var(--s3) var(--s2); border-bottom: 2px dotted var(--line); vertical-align: middle; }
.tablewrap { overflow-x: auto; position: relative; }
.who { display: flex; gap: var(--s2); align-items: center; }
.who .avatar { margin: 0; border: 0; }

/* Member page */
.member-hero { display: grid; grid-template-columns: 120px minmax(0, 1fr) minmax(0, 300px); gap: var(--s6); align-items: center; padding: var(--s6) 0; }
.member-hero .avatar.lg { width: 120px; height: 120px; border: 4px solid var(--surface-2); }
.feature { display: flex; flex-direction: column; gap: 4px; text-decoration: none; padding: 12px 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.feature:hover { border-color: var(--line-strong); color: var(--text); }
.feature .cover { width: 100%; border-radius: 12px; margin-bottom: 6px; font-size: 0.9rem; padding: 10px; }
.feature-label { font-weight: 700; font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.feature.is-live { border-color: var(--live); }
.feature.is-live .feature-label { color: var(--live); }
.feature-game { font: 900 1.15rem/1.25 var(--body); }

/* Members index */
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s3); list-style: none; padding: 0; margin: var(--s3) 0 0; }
.member-card { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3); border: 1px solid var(--line); border-radius: 18px; background: var(--surface); text-decoration: none; height: 100%; }
.member-card:hover { border-color: var(--line-strong); color: var(--text); background: var(--surface-2); }
.member-card .avatar { margin: 0; border: 0; font-size: 1rem; }
.member-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.member-text b { font-weight: 900; }
.member-text .jp { font-size: 0.8rem; color: var(--muted); }
.member-text .status { font-size: 0.83rem; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.member-text .live-line { display: flex; gap: 6px; align-items: center; color: var(--live); font-weight: 700; }
.member-card .member-game { width: 40px; border-radius: 6px; font-size: 0; }
.member-card.is-live { border-color: var(--live); }

/* Search page */
.search-page { display: flex; gap: var(--s2); max-width: 560px; }
.search-page input { flex: 1; }
.results .cover { width: 40px; }
.results .avatar { width: 40px; height: 40px; border: 0; }
.search-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: var(--s5); }
.search-cols h2 { margin-bottom: var(--s3); }

/* ---------- Forms ---------- */
.form { max-width: 760px; }
fieldset { border: 0; border-top: 2px dotted var(--line); margin: 0; padding: var(--s5) 0; }
legend { font: 900 1.2rem var(--body); padding: 0; float: left; width: 100%; margin-bottom: var(--s1); }
fieldset > p { clear: both; color: var(--muted); margin-bottom: var(--s3); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--s2); clear: both; }
.check { display: flex; gap: var(--s2); align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.check:has(input:checked) { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.check input { accent-color: var(--text); width: 18px; height: 18px; }
input[type="search"], input[type="text"], select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 9px 12px; min-width: 0;
}
input::placeholder { color: var(--muted); opacity: 1; }
.savebar { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: var(--s3) 0; display: flex; gap: var(--s3); align-items: center; }

/* ---------- Admin queue ---------- */
.match { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: var(--s5); align-items: center; }
.match .guess { display: flex; gap: var(--s3); align-items: center; }
.match .guess .cover { width: 54px; font-size: 0; }
.conf { font: 900 1.4rem/1 var(--body); }
.conf.low { color: var(--down); } .conf.mid { color: var(--accent-text); }
.quote { font-size: 0.92rem; border-left: 3px solid var(--custard-edge); padding-left: var(--s3); color: var(--muted); }

/* ---------- Footer ---------- */
.site-foot { margin-top: var(--s8); border-top: 2px dotted var(--line); padding: var(--s5) 0 var(--s7); font-size: 0.88rem; color: var(--muted); }
.site-foot .wrap { display: flex; gap: var(--s5); justify-content: space-between; flex-wrap: wrap; }
.sample { background: var(--surface-2); font-size: 0.82rem; text-align: center; padding: 6px var(--s4); color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .nav { order: 3; flex-basis: 100%; }
  .site-head .wrap { row-gap: 6px; }
}
@media (max-width: 1100px) {
  .cols, .search-cols { grid-template-columns: minmax(0, 1fr); }
  .archive-cols aside { max-width: 480px; }
}
@media (max-width: 1020px) {
  .chart li { grid-template-columns: 44px 48px 44px minmax(0, 1fr) 84px; }
  .chart li > .avatars { display: none; }
  .chart li > .cover { width: 44px; }
  .match { grid-template-columns: 1fr; gap: var(--s3); }
  .member-hero { grid-template-columns: 96px minmax(0, 1fr); gap: var(--s5); }
  .member-hero .avatar.lg { width: 96px; height: 96px; }
  .member-hero .feature { grid-column: 1 / -1; max-width: 420px; }
  .game-hero { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
  .game-hero .hero-art { max-width: 460px; }
}
@media (max-width: 760px) {
  .history { grid-template-columns: minmax(0, 1fr); }
  .entry { grid-template-columns: 96px minmax(0, 1fr); }
  .entry .cover { width: 96px; }
  .entry-when { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: flex-start; gap: 6px 12px; flex-wrap: wrap; text-align: left; }
  .entry-when .btn { margin-left: auto; }
  .filters .tools { margin-left: 0; }
}
@media (max-width: 640px) {
  .site-head .wrap { gap: 8px var(--s3); }
  .brand { margin-right: auto; }
  .search { order: 2; flex-basis: 100%; margin-left: 0; }
  .nav { order: 3; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin: 0 calc(-1 * var(--s4)); padding-left: var(--s4); padding-right: var(--s4); scrollbar-width: none; }
  .head-actions .wide-only { display: none; }
  .top { grid-template-columns: auto minmax(0, 1fr); gap: var(--s4); padding: var(--s4) var(--s5); }
  .top .rank { font-size: 4.8rem; padding-right: var(--s4); }
  .top > .cover { width: 96px; justify-self: start; grid-column: 2; grid-row: 1; }
  .top > .body { grid-column: 1 / -1; }
  .chart li { grid-template-columns: 34px 40px minmax(0, 1fr) auto; gap: var(--s3); padding: var(--s3) var(--s2); }
  .chart li > .strip { display: none; }
  .chart .rank { font-size: 1.5rem; }
  .chart li > .move { grid-column: 4; grid-row: 1; }
  .chart li > .cover { grid-column: 2; width: 40px; }
  .chart li > .info { grid-column: 3; grid-row: 1; }
  .chart li > .chips { grid-column: 3 / -1; }
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s3); }
  .tile-rank { font-size: 1.15rem; padding: 5px 9px 7px 8px; }
  .tile-body { flex-direction: column; gap: 4px; }
  .hero { grid-template-columns: 110px minmax(0, 1fr); gap: var(--s4); align-items: start; }
  .hero .cover { width: 110px; font-size: 0.8rem; }
  .game-hero { grid-template-columns: minmax(0, 1fr); }
  .game-hero .cover { width: 100%; }
  .facts { gap: var(--s4) var(--s5); }
  .member-hero { grid-template-columns: 72px minmax(0, 1fr); gap: var(--s4); align-items: start; }
  .member-hero .avatar.lg { width: 72px; height: 72px; font-size: 1.4rem; }
  .rail-track { grid-auto-columns: 78%; }
  .rail-quiet { border-radius: 16px; align-items: flex-start; }
  .rail-quiet .live-dot { margin-top: 8px; }
  .timeline-hour { grid-template-columns: 1fr; gap: 6px; }
  .timeline-hour::before { display: none; }
  .hour { padding-top: 0; }
  .entry { grid-template-columns: 80px minmax(0, 1fr); gap: var(--s3); padding: 8px 10px 10px 8px; }
  .entry .cover { width: 80px; }
  .calendar { gap: 3px; }
  .weekday { padding: 0 2px; font-size: 0.7rem; }
  .day { min-height: 0; padding: 3px; gap: 3px; border-radius: 8px; }
  .day-game { display: none; }
  .day-num { font-size: 0.75rem; padding: 2px; }
  .day.empty-day, a.day:not(.has-top) { min-height: 44px; }
  .filters { padding: var(--s3); }
  /* One scrolling row per filter group, so the tray does not push the chart off the first screen. */
  .filters .group { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s3)); padding: 2px var(--s3); max-width: calc(100% + 2 * var(--s3)); }
  .filters .group .label { flex: none; }
  .nav { padding-right: 56px; -webkit-mask: linear-gradient(to right, #000 85%, #0000); mask: linear-gradient(to right, #000 85%, #0000); }
  .nav a { padding: 7px 11px; }
  .search-page { flex-wrap: wrap; }
}

/* Chart rows without rank and movement (member page) */
.chart.simple li { grid-template-columns: 48px minmax(0, 1fr) 84px auto; }
.chart.simple li > .cover, .chart.simple li > .strip, .chart.simple li > .info { grid-row: auto; grid-column: auto; align-self: center; }
@media (max-width: 640px) { .chart.simple li { grid-template-columns: 40px minmax(0, 1fr) auto; } }
