@font-face {
  font-family: Archivo;
  src: url("/archivo.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/plex-mono.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

/* Riso console tokens from ziming-token-usage. */
:root {
  --bg: #f1eadd;
  --surface: #f7f2e8;
  --surface-sunken: #e8dfce;
  --surface-track: #ded2bd;
  --surface-inverse: #1f1d1a;
  --surface-inverse-hover: #3a3630;
  --text: #1f1d1a;
  --text-2: #555048;
  --text-3: #6f675b;
  --text-inverse: #f1eadd;
  --text-attn: #b83a17;
  --line: rgb(31 29 26 / .13);
  --line-strong: rgb(31 29 26 / .26);
  --status-run: #6493c6;
  --status-run-deep: #3f6e9f;
  --overlay-backdrop: rgb(31 29 26 / .3);
  --shadow-pop: 0 0 0 1px var(--line), 0 16px 40px -16px rgb(31 29 26 / .35);
  --font-cjk: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC";
  --font-sans: Archivo, var(--font-cjk), system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", var(--font-cjk), ui-monospace, monospace;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-pill: 999px;
  --h-md: 30px;
  --h-row: 36px;
  --h-touch: 44px;
  color-scheme: light;
  color: var(--text);
  background: var(--bg);
  font: 13px/1.5 var(--font-sans);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, p, ul, dl, dd { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--status-run-deep); outline-offset: 3px; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { position: fixed; top: var(--sp-2); left: var(--sp-2); z-index: 1; padding: var(--sp-2); background: var(--surface); }

.frame { width: min(1100px, calc(100% - 64px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--line); background: var(--surface); }
.masthead-inner { display: flex; min-height: 54px; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.brand { display: flex; align-items: center; gap: var(--sp-2); text-decoration: none; font-size: 17px; font-weight: 800; letter-spacing: -.04em; }
.sections { display: flex; gap: var(--sp-1); }
.sections a { display: flex; align-items: center; justify-content: center; min-height: var(--h-touch); border-radius: var(--r-sm); padding: 0 var(--sp-3); white-space: nowrap; text-decoration: none; color: var(--text-2); }
.sections a:hover { background: var(--surface-sunken); }
.sections a[aria-current] { background: var(--surface-inverse); color: var(--text-inverse); }

.heading { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-6); padding: 48px 0 var(--sp-8); }
h1 { font-size: clamp(36px, 5.5vw, 62px); font-weight: 800; line-height: 1.04; letter-spacing: -.065em; }
.search { position: relative; width: min(100%, 300px); flex-shrink: 0; }
.search svg { position: absolute; top: 50%; left: var(--sp-3); transform: translateY(-50%); width: 18px; stroke: var(--text-3); stroke-width: 1.5; stroke-linecap: round; pointer-events: none; }
.search input { width: 100%; min-height: var(--h-touch); padding: 0 var(--sp-3) 0 38px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.search input::placeholder { color: var(--text-3); opacity: 1; }
.search input:focus { border-color: var(--line-strong); }

.browse-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) 0; border-top: 1px solid var(--line-strong); }
.filters { display: flex; gap: var(--sp-2); }
.filters select { width: 150px; min-height: var(--h-row); padding: 0 var(--sp-2); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.filters select:hover { border-color: var(--line-strong); }
.section-head { display: flex; align-items: baseline; gap: var(--sp-3); padding: var(--sp-4) 0; border-top: 1px solid var(--line); }
.section-head h2 { font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.count, .feed-time, .date, .code { font-family: var(--font-mono); font-size: 11px; }
.count, .feed-time, .date { color: var(--text-3); }
.feed-time { margin-left: auto; white-space: nowrap; }
.code { overflow: hidden; text-overflow: ellipsis; color: var(--status-run-deep); }
.notice { display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-3); padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text-2); }
.retry { border: 0; background: transparent; color: var(--text-attn); text-decoration: underline; text-underline-offset: 3px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); padding: 0; list-style: none; }
.subgroups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: var(--sp-2); padding: 0; list-style: none; }
.group-link { display: inline-flex; align-items: center; justify-content: space-between; gap: var(--sp-2); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--text); padding: var(--sp-1) var(--sp-3); min-height: var(--h-touch); text-decoration: none; overflow-wrap: anywhere; }
.group-link:hover { background: var(--surface-sunken); border-color: var(--line-strong); }
.subgroup a { display: flex; height: 100%; }
.group-count { flex: none; color: var(--text-3); font: 11px var(--font-mono); }
.empty { padding-block: var(--sp-3); color: var(--text-3); }
.entry { min-width: 0; }
.card { display: flex; flex-direction: column; overflow: hidden; width: 100%; height: 100%; padding: 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-align: left; transition: border-color 160ms ease, background-color 160ms ease; }
.card:hover { border-color: var(--line-strong); background: var(--bg); }
.cover { position: relative; display: grid; place-items: center; width: 100%; overflow: hidden; aspect-ratio: 16 / 9; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(135deg, var(--surface-sunken), var(--surface-sunken) 7px, var(--surface-track) 7px, var(--surface-track) 8px); }
.cover-label { max-width: 90%; color: var(--text-2); font: 12px var(--font-mono); overflow: hidden; text-overflow: ellipsis; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-body { display: grid; grid-template-rows: auto 1fr; gap: var(--sp-2); width: 100%; padding: var(--sp-3); }
.meta { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-1); white-space: nowrap; }
.card-title { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; font-size: 13.5px; font-weight: 600; line-height: 1.45; }
.more { display: block; margin: var(--sp-6) auto 0; padding: 0 var(--sp-6); min-height: var(--h-touch); border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface); }
.more:hover { background: var(--surface-sunken); }

footer { display: flex; justify-content: space-between; gap: var(--sp-3); margin-block: var(--sp-8); padding-top: var(--sp-4); border-top: 1px solid var(--line); color: var(--text-3); font-size: 11px; }
dialog { width: min(670px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); }
dialog::backdrop { background: var(--overlay-backdrop); }
.dialog-bar { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-1) var(--sp-4); }
.close { display: grid; place-items: center; width: var(--h-touch); height: var(--h-touch); padding: 0; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; font-size: 24px; line-height: 1; color: var(--text-2); }
.close:focus-visible { outline-offset: -3px; }
.close:hover { background: var(--surface-sunken); }
.detail-cover img { object-fit: contain; background: var(--surface-sunken); }
.player { display: block; width: 100%; aspect-ratio: 16 / 9; background: var(--surface-inverse); }
.dialog-body { padding: var(--sp-5) var(--sp-6) var(--sp-6); }
.dialog-body h2 { margin: var(--sp-1) 0 0; font-size: clamp(18px, 4vw, 24px); line-height: 1.4; overflow-wrap: anywhere; }
.dialog-body h2:focus { outline: 0; }
.play-note { margin-top: var(--sp-3); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-sunken); color: var(--text-2); font-size: 12px; }
.related { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: baseline; gap: var(--sp-2) var(--sp-3); margin-top: var(--sp-4); }
.related-label { color: var(--text-3); font-size: 12px; }
.related-values { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.related .group-link { min-height: var(--h-row); }

@media (max-width: 950px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .frame { width: calc(100% - 36px); }
  .sections a { padding-inline: var(--sp-2); }
  .heading { align-items: flex-start; flex-direction: column; gap: var(--sp-4); padding: var(--sp-8) 0 var(--sp-6); }
  .search { width: 100%; }
  .browse-bar { flex-direction: column; align-items: stretch; gap: var(--sp-1); padding-bottom: var(--sp-1); }
  .filters label { flex: 1; min-width: 0; }
  .filters select { width: 100%; min-height: var(--h-touch); }
  .search input { font-size: 16px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
}
@media (max-width: 420px) {
  .meta { flex-wrap: wrap; gap: 2px; }
  .meta .code { width: 100%; }
  .card-body { padding: var(--sp-2); }
}
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}
