/* QIVD Viewer — visual language follows q-ivd.github.io (qivd-interactive.css). */

:root {
  --text: #1f2937;
  --muted: #5f6368;
  --faint: #9aa1ab;
  --border: #e4e7ec;
  --border-strong: #d3d9e1;
  --card: #ffffff;
  --soft: #f5f7fa;
  --band: #f5f5f5;
  --stage: #0d0f12;
  --accent: #1769aa;
  --accent-ink: #0f4f82;
  --accent-soft: #e8f1fb;
  --answer: #e67700;
  --answer-ink: #a34f00;
  --answer-soft: #fff4e6;
  --answer-line: #ffd8a8;
  --g-object: #1769aa;
  --g-object-soft: #e8f1fb;
  --g-action: #0b7a5f;
  --g-action-soft: #e3f5ef;
  --g-other: #6f42c1;
  --g-other-soft: #f1ebfc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 2px 6px rgba(16, 24, 40, 0.06), 0 18px 40px rgba(16, 24, 40, 0.12);
  --sans: 'Noto Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Google Sans', 'Noto Sans', system-ui, sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 9rem;
}

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

html.is-modal {
  overflow: hidden;
}

svg {
  fill: currentColor;
}

a {
  color: var(--accent);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
  font-family: inherit;
  font-size: 0.72rem;
  line-height: 1.4;
  text-align: center;
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

:focus-visible {
  outline: 3px solid rgba(23, 105, 170, 0.45);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Intro ---------- */

.intro {
  background:
    radial-gradient(1200px 380px at 85% -10%, rgba(230, 119, 0, 0.07), transparent 60%),
    radial-gradient(900px 420px at 0% 0%, rgba(23, 105, 170, 0.08), transparent 60%),
    var(--soft);
  border-bottom: 1px solid var(--border);
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
  padding-top: 2.4rem;
  padding-bottom: 2.1rem;
}

.intro-title {
  margin: 0 0 0.7rem;
  font-family: var(--display);
  font-size: clamp(2rem, 1.4rem + 2vw, 2.9rem);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.intro-lead {
  max-width: 46rem;
  margin: 0 0 1.2rem;
  font-size: 1.04rem;
  line-height: 1.6;
  color: #3c4450;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.4rem;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem 0.5rem 0.85rem;
  border-radius: 999px;
  background: #363636;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}

.link-btn svg {
  width: 1.15rem;
  height: 1.15rem;
}

.link-btn:hover {
  background: #1f2329;
  transform: translateY(-1px);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2.2rem;
  margin: 0;
}

.stats div {
  display: flex;
  flex-direction: column-reverse;
}

.stats dt {
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.stats dd {
  margin: 0;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.steps {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--muted);
}

.step strong {
  display: block;
  margin-bottom: 0.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 1.95rem;
  bottom: -0.62rem;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--faint);
  border-bottom: 2px solid var(--faint);
  transform: rotate(45deg);
  background: transparent;
}

.step-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.step-icon svg {
  width: 1.2rem;
  height: 1.2rem;
}

.stats dd.modalities {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.45rem;
}

.mod {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.mod svg {
  width: 0.95em;
  height: 0.95em;
  color: var(--accent);
}

.mod-sep {
  color: var(--faint);
}

.step-mods {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.45rem;
}

.mod-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.08rem 0.5rem 0.08rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
}

.mod-chip svg {
  width: 0.85rem;
  height: 0.85rem;
  color: var(--accent);
}

.step-answer .step-icon {
  background: var(--answer-soft);
  color: var(--answer);
}

.link-btn .arxiv-mark {
  width: 0.9rem;
  height: 1.2rem;
}

.account {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  white-space: nowrap;
  color: var(--text);
}

.account img {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
}

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  padding-top: 0.6rem;
  padding-bottom: 3rem;
}

/* ---------- Filters ---------- */

.filters {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  margin-top: 1rem;
  padding: 0.3rem 0.4rem 1rem 0;
  scrollbar-width: thin;
}

.filters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.filters-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 500;
}

.filters-head .filters-close,
.filters .filters-foot {
  display: none;
}

.facet {
  padding: 0.95rem 0 1rem;
  border-top: 1px solid var(--border);
}

.facet h3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.facet-sub {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--answer-ink);
  font-variant-numeric: tabular-nums;
}

.facet-hint {
  margin: -0.3rem 0 0.6rem;
  font-size: 0.8rem;
  color: var(--faint);
}

.facet-group + .facet-group {
  margin-top: 0.55rem;
}

.facet-group-title {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--faint);
}

.facet-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  margin: 0;
  padding: 0.3rem 0.45rem;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 0.9rem;
  text-align: left;
  color: var(--text);
  isolation: isolate;
  transition: background 0.12s ease, opacity 0.12s ease;
}

.facet-row:hover {
  background: var(--soft);
}

.facet-row .bar {
  position: absolute;
  left: 0.45rem;
  right: 0.45rem;
  bottom: 0.12rem;
  height: 2px;
  border-radius: 1px;
  background: #eef1f5;
  z-index: -1;
}

.facet-row .bar i {
  display: block;
  height: 100%;
  border-radius: 1px;
  background: var(--g, var(--accent));
  opacity: 0.5;
  transition: width 0.25s ease;
}

.facet-box {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.05rem;
  height: 1.05rem;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: #fff;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.facet-box svg {
  width: 0.85rem;
  height: 0.85rem;
  color: #fff;
  opacity: 0;
}

.facet-row[aria-checked='true'] .facet-box {
  border-color: var(--g, var(--accent));
  background: var(--g, var(--accent));
}

.facet-row[aria-checked='true'] .facet-box svg {
  opacity: 1;
}

.facet-row[aria-checked='true'] .facet-name {
  font-weight: 600;
}

.facet-row.is-empty {
  opacity: 0.45;
}

.facet-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facet-num {
  flex: none;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.facet-row.is-radio .facet-box {
  border-radius: 50%;
}

.facet-row.is-radio[aria-checked='true'] .facet-box {
  background: #fff;
  border-width: 5px;
}

.facet-row.is-radio[aria-checked='true'] .facet-box svg {
  display: none;
}

.g-object { --g: var(--g-object); --g-soft: var(--g-object-soft); }
.g-action { --g: var(--g-action); --g-soft: var(--g-action-soft); }
.g-other { --g: var(--g-other); --g-soft: var(--g-other-soft); }

.hist {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 46px;
  padding: 0 9px;
}

.hist i {
  flex: 1;
  min-height: 0;
  border-radius: 2px 2px 0 0;
  background: #d9dee5;
  transition: height 0.25s ease, background 0.15s ease;
}

.hist i.is-in {
  background: var(--answer-line);
}

.hist i.is-in.is-peak {
  background: #ffc078;
}

.range {
  position: relative;
  height: 1.7rem;
  margin: 0;
}

.range::before,
.range-fill {
  content: '';
  position: absolute;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
}

.range::before {
  left: 9px;
  right: 9px;
  background: #e5e9ef;
}

.range-fill {
  background: var(--answer);
}

.range input[type='range'] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.range input[type='range']:focus {
  outline: none;
}

.range input[type='range']::-webkit-slider-runnable-track {
  height: 100%;
  background: none;
  border: 0;
}

.range input[type='range']::-moz-range-track {
  height: 100%;
  background: none;
  border: 0;
}

.range input[type='range']::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: calc((1.7rem - 18px) / 2);
  border: 2px solid var(--answer);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.25);
  cursor: grab;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
}

.range input[type='range']::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--answer);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.25);
  cursor: grab;
  pointer-events: auto;
}

.range input[type='range']:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(230, 119, 0, 0.25);
}

.range input[type='range']:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 4px rgba(230, 119, 0, 0.25);
}

.range-scale {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
  font-size: 0.72rem;
  color: var(--faint);
}

/* ---------- Toolbar ---------- */

.results {
  min-width: 0;
  outline: none;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -0.5rem 0.6rem;
  padding: 1rem 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
}

.toolbar.is-stuck {
  box-shadow: 0 10px 18px -16px rgba(16, 24, 40, 0.35);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search > svg {
  position: absolute;
  left: 0.95rem;
  width: 1.3rem;
  height: 1.3rem;
  color: var(--faint);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 3rem;
  padding: 0 3rem 0 2.9rem;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  font-size: 1rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search input::placeholder {
  color: var(--faint);
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(23, 105, 170, 0.14);
  outline: none;
}

.search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  width: 1.1rem;
  height: 1.1rem;
  background: no-repeat center / 1.1rem url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%239aa1ab'%3E%3Cpath d='M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z'/%3E%3C/svg%3E");
  cursor: pointer;
}

.search-kbd {
  position: absolute;
  right: 0.9rem;
  pointer-events: none;
}

.search input:focus ~ .search-kbd,
.search input:not(:placeholder-shown) ~ .search-kbd {
  display: none;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.count {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.count strong {
  color: var(--text);
  font-weight: 600;
}

.sort select {
  height: 2.25rem;
  padding: 0 2rem 0 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235f6368'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 0.55rem center / 1.2rem;
  font-size: 0.86rem;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.sort select:hover,
.chip-btn:hover,
.ghost-btn:hover,
.icon-btn:hover {
  background-color: var(--soft);
}

.chip-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.35rem;
  height: 2.25rem;
  padding: 0 0.85rem 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 0.86rem;
  white-space: nowrap;
}

.chip-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--muted);
}

.filters-open {
  display: none;
}

.badge-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.active {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
  padding: 0.18rem 0.35rem 0.18rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--g-soft, var(--accent-soft));
  color: var(--g, var(--accent));
  font-size: 0.8rem;
  font-weight: 600;
}

.pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill button {
  display: grid;
  place-items: center;
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
}

.pill button:hover {
  background: rgba(0, 0, 0, 0.08);
}

.pill button svg {
  width: 0.85rem;
  height: 0.85rem;
}

.pill.is-time {
  --g: var(--answer-ink);
  --g-soft: var(--answer-soft);
}

.pill.is-query,
.pill.is-short {
  --g: var(--text);
  --g-soft: #eef1f5;
}

.text-btn {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
}

.text-btn:hover {
  text-decoration: underline;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 0.86rem;
  text-decoration: none;
  white-space: nowrap;
}

.ghost-btn svg {
  width: 1.05rem;
  height: 1.05rem;
  color: var(--muted);
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.6rem;
  padding: 0.5rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.primary-btn:hover {
  background: var(--accent-ink);
}

.icon-btn {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
  color: var(--text);
}

.icon-btn svg {
  width: 1.3rem;
  height: 1.3rem;
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ---------- Status ---------- */

.status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin: 1rem 0 2rem;
  padding: 2.5rem 1.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--soft);
  text-align: center;
  color: var(--muted);
}

.status h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text);
}

.status p {
  max-width: 36rem;
  margin: 0;
}

.status .status-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.status.is-gate {
  border-style: solid;
  background: linear-gradient(180deg, #fff, var(--soft));
}

.status .status-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.status .status-icon svg {
  width: 1.6rem;
  height: 1.6rem;
}

.is-blocked .layout {
  grid-template-columns: minmax(0, 1fr);
}

.is-blocked .filters,
.is-blocked .toolbar,
.is-blocked .scrim {
  display: none !important;
}

.is-blocked .status {
  margin-top: 1.5rem;
}

/* ---------- Grid & cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 1.15rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  animation: card-in 0.35s ease both;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card:focus-visible {
  outline: 3px solid rgba(23, 105, 170, 0.55);
  outline-offset: 2px;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #1a1e24;
}

.thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.07) 40%, transparent 60%) #1d2229;
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}

.thumb.is-ready::before,
.thumb.is-failed::before {
  animation: none;
}

@keyframes shimmer {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -120% 0;
  }
}

.thumb img,
.thumb video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb img {
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.5s ease;
}

.thumb.is-ready img {
  opacity: 1;
}

.card:hover .thumb img {
  transform: scale(1.03);
}

.thumb video {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.thumb video.is-playing {
  opacity: 1;
}

.thumb-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.45);
}

.thumb-fallback svg {
  width: 2.4rem;
  height: 2.4rem;
}

.thumb::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 45%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.45), transparent);
  pointer-events: none;
}

.badge {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: calc(100% - 1.1rem);
  padding: 0.2rem 0.6rem 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(13, 15, 18, 0.72);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.badge::before {
  content: '';
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--g, #fff);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.tpill {
  position: absolute;
  right: 0.55rem;
  bottom: 0.7rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.14rem 0.5rem 0.14rem 0.35rem;
  border-radius: 999px;
  background: var(--answer);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.tpill svg {
  width: 0.85rem;
  height: 0.85rem;
}

.dur {
  position: absolute;
  left: 0.6rem;
  bottom: 0.75rem;
  z-index: 2;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.mini {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  height: 4px;
  background: rgba(255, 255, 255, 0.22);
}

.mini-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: #fff;
}

.mini-win {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 216, 168, 0.55);
}

.mini-mark {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 10px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--answer);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.play-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  margin: -1.45rem 0 0 -1.45rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.play-hint svg {
  width: 1.6rem;
  height: 1.6rem;
  margin-left: 0.12rem;
}

.card:hover .play-hint,
.card:focus-visible .play-hint {
  opacity: 1;
  transform: none;
}

.card.is-previewing .play-hint {
  opacity: 0;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.75rem 0.9rem 0.8rem;
}

.card-q,
.card-a {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.card-q {
  font-size: 0.97rem;
  font-weight: 600;
  line-height: 1.38;
  -webkit-line-clamp: 2;
}

.card-a {
  font-size: 0.86rem;
  line-height: 1.42;
  color: var(--muted);
  -webkit-line-clamp: 2;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.35rem;
  font-size: 0.76rem;
}

.short-chip {
  overflow: hidden;
  max-width: 75%;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--answer-soft);
  color: var(--answer-ink);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.short-chip.is-na {
  background: #f1f3f5;
  color: var(--faint);
  font-weight: 500;
}

.card-id {
  flex: none;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

mark {
  padding: 0 0.08em;
  border-radius: 3px;
  background: #ffe8a3;
  color: inherit;
}

.card.is-skeleton {
  pointer-events: none;
  animation: none;
}

.sk-line {
  height: 0.8rem;
  border-radius: 4px;
  background: linear-gradient(100deg, #eef1f5 30%, #f7f8fa 50%, #eef1f5 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}

.sk-line + .sk-line {
  margin-top: 0.45rem;
}

.more {
  display: flex;
  justify-content: center;
  padding: 1.5rem 0 0.5rem;
}

.sentinel {
  width: 1px;
  height: 1px;
}

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--border);
  background: var(--band);
  font-size: 0.9rem;
  color: var(--muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 2rem;
  padding-top: 2rem;
  padding-bottom: 2.4rem;
}

.footer h2 {
  margin: 0 0 0.7rem;
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
}

.footer p {
  margin: 0 0 0.7rem;
  line-height: 1.6;
}

.bib {
  position: relative;
}

.bib pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  color: #374151;
}

.bib-copy {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  min-height: 1.9rem;
  padding: 0.2rem 0.75rem;
  font-size: 0.78rem;
}

/* ---------- Viewer dialog ---------- */

.viewer {
  width: min(1200px, calc(100vw - 2.5rem));
  max-width: none;
  max-height: calc(100vh - 2.5rem);
  margin: auto;
  padding: 0;
  overflow-y: auto;
  border: 0;
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  overscroll-behavior: contain;
}

.viewer[open] {
  animation: viewer-in 0.22s ease-out;
}

@keyframes viewer-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
}

.viewer::backdrop {
  background: rgba(13, 15, 18, 0.62);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.viewer-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.75rem 1.3rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
}

.viewer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.7rem 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--g-soft, var(--accent-soft));
  color: var(--g, var(--accent));
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.cat-chip::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

.viewer-id {
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.viewer-nav {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.4rem;
}

.viewer-pos {
  min-width: 5.5rem;
  font-size: 0.82rem;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

#v-close {
  margin-left: 0.35rem;
}

.viewer-main {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  padding: 1.2rem 1.3rem 0.6rem;
}

.viewer-keys {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.4rem;
  margin: 0;
  padding: 0.4rem 1.3rem 1.1rem;
  font-size: 0.76rem;
  color: var(--faint);
}

.viewer-keys kbd + kbd {
  margin-left: -0.15rem;
}

.viewer-keys kbd:not(:first-child) {
  margin-left: 0.6rem;
}

.viewer-keys kbd + kbd:not(:first-child) {
  margin-left: 0;
}

/* Player (ported from the project page's ClipPlayer) */

.player {
  min-width: 0;
}

.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: var(--stage);
}

.stage video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--stage);
  cursor: pointer;
}

.stage-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 2;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  background: rgba(13, 15, 18, 0.72);
  color: #fff;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.flash {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.24rem 0.7rem 0.24rem 0.5rem;
  border-radius: 999px;
  background: var(--answer);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.flash svg {
  width: 1rem;
  height: 1rem;
}

.flash.is-on {
  opacity: 1;
  transform: none;
}

.sound {
  position: absolute;
  right: 0.6rem;
  bottom: 0.6rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.38rem 0.8rem 0.38rem 0.6rem;
  border: 0;
  border-radius: 999px;
  background: rgba(13, 15, 18, 0.72);
  color: #fff;
  font-size: 0.8rem;
  line-height: 1;
}

.sound svg {
  width: 1.15rem;
  height: 1.15rem;
}

.sound.is-muted {
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.bigplay {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: none;
  place-items: center;
  width: 3.6rem;
  height: 3.6rem;
  margin: -1.8rem 0 0 -1.8rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}

.bigplay svg {
  width: 2rem;
  height: 2rem;
  margin-left: 0.15rem;
}

.bigplay.is-replay svg {
  margin-left: 0;
}

.stage.is-paused .bigplay {
  display: grid;
}

.stage.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 2.2rem;
  height: 2.2rem;
  margin: -1.1rem 0 0 -1.1rem;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.stage.is-paused.is-loading::after {
  display: none;
}

.stage-error {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(13, 15, 18, 0.85);
  color: #fff;
  font-size: 0.92rem;
  text-align: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.timeline {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.play-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
}

.play-btn svg {
  width: 1.2rem;
  height: 1.2rem;
}

.play-btn:hover {
  background: var(--soft);
}

.track {
  position: relative;
  flex: 1;
  height: 2.6rem;
  cursor: pointer;
  touch-action: none;
  outline-offset: 2px;
}

.track::before,
.track-fill,
.track-win {
  position: absolute;
  top: 0.75rem;
  height: 6px;
  border-radius: 3px;
}

.track::before {
  content: '';
  left: 0;
  right: 0;
  background: #e9ecef;
}

.track-win {
  right: 0;
  background: var(--answer-line);
  border-radius: 0 3px 3px 0;
}

.track-fill {
  left: 0;
  width: 0;
  background: var(--accent);
}

.track-marker {
  position: absolute;
  top: 0.3rem;
  width: 3px;
  height: 1.05rem;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--answer);
}

.track-label {
  position: absolute;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.72rem;
  line-height: 1;
  color: var(--answer-ink);
}

.track-marker.is-end .track-label {
  left: auto;
  right: -1px;
  transform: none;
}

.track-marker.is-start .track-label {
  left: -1px;
  transform: none;
}

.time {
  flex: none;
  min-width: 6.2em;
  text-align: right;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Conversation panel */

.chat {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.who {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.who svg {
  width: 1.05rem;
  height: 1.05rem;
}

.bubble {
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 4px 14px 14px 14px;
  background: var(--soft);
  font-size: 1.06rem;
  line-height: 1.45;
}

.msg-ai .bubble {
  min-height: 3.4rem;
  background: var(--card);
  border-style: dashed;
  border-color: var(--faint);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.msg-ai.is-answered .bubble {
  background: var(--answer-soft);
  border-style: solid;
  border-color: var(--answer-line);
}

.msg-ai.is-answered .who {
  color: var(--answer-ink);
}

.msg-ai.is-waiting .answer,
.msg-ai.is-answered .wait {
  display: none;
}

.msg-ai.is-answered .answer {
  display: block;
  animation: pop 0.35s ease-out;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.wait {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.reveal-btn {
  margin-left: auto;
  font-size: 0.82rem;
}

.dots {
  display: inline-flex;
  gap: 0.2rem;
}

.dots i {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--faint);
  animation: blink 1.2s infinite ease-in-out;
}

.dots i:nth-child(2) {
  animation-delay: 0.2s;
}

.dots i:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, auto));
  justify-content: start;
  gap: 0.4rem 1.6rem;
  margin: 0.1rem 0 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.facts dt {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}

.facts dd {
  margin: 0.1rem 0 0;
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

#v-ts {
  color: var(--answer-ink);
}

#v-file {
  font-weight: 500;
  color: var(--muted);
}

.hint {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.hint svg {
  flex: none;
  width: 1rem;
  height: 1rem;
}

.viewer.is-unmuted .hint {
  display: none;
}

.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.player-col {
  min-width: 0;
}

.player-extras {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 1.6rem;
  margin-top: 0.15rem;
  padding-left: 2.85rem;
}

.advance-note {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding-bottom: 0.2rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.advance-note:empty {
  display: none;
}

.advance-note::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}

.advance-note.is-counting::after {
  animation: advance-fill var(--hold, 1.5s) linear forwards;
}

@keyframes advance-fill {
  to {
    transform: scaleX(1);
  }
}

.chip-btn.icon-only {
  padding: 0 0.6rem;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.switch-track {
  position: relative;
  width: 2rem;
  height: 1.1rem;
  border-radius: 999px;
  background: #ced4da;
  transition: background 0.2s ease;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.switch[aria-checked='true'] .switch-track {
  background: var(--accent);
}

.switch[aria-checked='true'] .switch-track::after {
  transform: translateX(0.9rem);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 1000;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  background: #1f2329;
  color: #fff;
  font-size: 0.88rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
  animation: toast-in 0.2s ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(13, 15, 18, 0.45);
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .filters {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    width: min(340px, 88vw);
    max-height: none;
    margin: 0;
    padding: 1rem 1.1rem;
    background: #fff;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.18);
    transform: translateX(-104%);
    transition: transform 0.25s ease;
    visibility: hidden;
  }

  .filters.is-open {
    transform: none;
    visibility: visible;
  }

  .filters-head .filters-close {
    display: grid;
  }

  .filters .filters-foot {
    position: sticky;
    bottom: -1rem;
    display: block;
    margin: 0 -1.1rem -1rem;
    padding: 1.4rem 1.1rem 1rem;
    background: linear-gradient(to top, #fff 72%, rgba(255, 255, 255, 0));
  }

  .filters-done {
    width: 100%;
  }

  .filters-open {
    display: inline-flex;
  }
}

@media (max-width: 900px) {
  .intro-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.4rem;
  }

  .steps {
    flex-direction: row;
    gap: 0.6rem;
    overflow-x: auto;
    padding-bottom: 0.2rem;
    scrollbar-width: none;
  }

  .step {
    flex: 1 0 15rem;
  }

  .step:not(:last-child)::after {
    display: none;
  }

  .viewer {
    width: 100vw;
    height: 100%;
    max-height: none;
    margin: 0;
    border-radius: 0;
  }

  .viewer-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    padding: 0.8rem 0.9rem 0.6rem;
  }

  .viewer-head {
    padding: 0.6rem 0.7rem 0.55rem 0.9rem;
  }

  .viewer-keys {
    display: none;
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .wrap {
    padding: 0 0.9rem;
  }

  .intro-grid {
    padding-top: 1.5rem;
    padding-bottom: 1.3rem;
  }

  .intro-lead {
    font-size: 0.96rem;
    line-height: 1.55;
  }

  .stat-modalities {
    flex-basis: 100%;
  }

  .stats dd.modalities {
    font-size: 1.1rem;
  }

  .link-btn {
    padding: 0.42rem 0.85rem 0.42rem 0.7rem;
    font-size: 0.85rem;
  }

  .stats {
    gap: 0.5rem 1.4rem;
  }

  .stats dd {
    font-size: 1.2rem;
  }

  .steps {
    display: none;
  }

  .toolbar {
    margin: 0 -0.9rem 0.5rem;
    padding: 0.7rem 0.9rem 0.6rem;
  }

  .search input {
    height: 2.75rem;
    font-size: 16px;
  }

  .search-kbd {
    display: none;
  }

  .toolbar-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .count {
    order: 3;
    flex-basis: 100%;
    font-size: 0.84rem;
  }

  .random-label {
    display: none;
  }

  #random {
    padding: 0 0.6rem;
  }

  .sort {
    flex: 1 1 0;
    min-width: 0;
  }

  .sort select {
    width: 100%;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
  }

  .card-body {
    padding: 0.55rem 0.65rem 0.65rem;
  }

  .card-q {
    font-size: 0.88rem;
    -webkit-line-clamp: 3;
  }

  .card-a {
    display: none;
  }

  .badge {
    top: 0.4rem;
    left: 0.4rem;
    padding: 0.14rem 0.45rem 0.14rem 0.4rem;
    font-size: 0.64rem;
  }

  .tpill {
    right: 0.4rem;
    bottom: 0.55rem;
    font-size: 0.66rem;
  }

  .dur {
    display: none;
  }

  .card-foot {
    font-size: 0.7rem;
  }

  .play-hint {
    display: none;
  }

  .viewer-pos {
    min-width: 0;
  }

  .viewer-id {
    display: none;
  }

  .stage-badge {
    display: none;
  }

  .bubble {
    font-size: 0.98rem;
  }

  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .facts div:last-child {
    grid-column: 1 / -1;
  }

  .player-extras {
    padding-left: 0;
  }
}

@media (hover: none) {
  .card:hover {
    transform: none;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  }

  .card:hover .thumb img {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
