:root {
  color-scheme: light;
  --paper: #f8f6f0;
  --paper-bright: #fffdf8;
  --ink: #27231e;
  --muted: #6e655b;
  --rule: #e3dcd0;
  --accent: #a4371d;
  --accent-bright: #bd4728;
  --accent-paper: #f4e5dc;
  --type: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --editorial: "Songti SC", "Noto Serif CJK SC", "SimSun", Georgia, serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --prompt-height: 240px;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; background: var(--paper); color: var(--ink); font-family: var(--type); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, pre:focus-visible, summary:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 4px; }
main:focus { outline: none; }
h1, h2, h3, p, ul, pre { margin: 0; }
img, video, iframe { display: block; border: 0; max-width: 100%; }
.screen-reader-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; z-index: 10; top: 8px; left: 12px; padding: 12px 16px; background: var(--paper-bright); transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--rule); background: var(--paper-bright); }
.header-inner {
  max-width: 1472px;
  min-height: 76px;
  padding: 0 44px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: max-content minmax(230px, 483px) 1fr;
  align-items: center;
  gap: clamp(18px, 3vw, 44px);
}
.brand { width: fit-content; display: flex; align-items: center; gap: 11px; font-size: 15px; font-weight: 690; white-space: nowrap; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff8ee;
  background: var(--accent-bright);
  font: 700 17px var(--mono);
  letter-spacing: -2px;
  padding-right: 2px;
}
.search {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  padding: 0 10px 0 14px;
  height: 42px;
  border: 1px solid #e6dfd3;
  border-radius: 8px;
}
.search:focus-within { border-color: var(--accent-bright); }
.search-icon { width: 13px; height: 13px; flex: 0 0 13px; border: 1.5px solid #796d60; border-radius: 50%; position: relative; margin: -2px 2px 0 0; }
.search-icon::after { content: ""; position: absolute; width: 5px; height: 1.5px; background: #796d60; transform: rotate(45deg); right: -4px; bottom: -2px; }
.search input { border: 0; min-width: 0; flex: 1; background: transparent; color: var(--ink); font-size: 13px; height: 100%; outline: none; }
.search input::placeholder { color: #71665b; }
.search kbd { color: #6e6256; border: 1px solid var(--rule); min-width: 21px; height: 22px; border-radius: 4px; text-align: center; font: 12px/20px var(--mono); }
.header-links { justify-self: end; display: flex; gap: clamp(14px, 2.5vw, 27px); }
.header-links a, .personal-trigger { color: var(--muted); font-size: 13px; white-space: nowrap; }
.header-links a[aria-current] { color: var(--accent); font-weight: 660; }
.personal-trigger { background: transparent; border: none; padding: 0; cursor: pointer; }
.header-links span { margin-left: 4px; color: var(--accent); }
.header-links a:hover, .personal-trigger:hover, .breadcrumb:hover, .reset-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.layout {
  max-width: 1472px;
  min-height: calc(100vh - 77px);
  margin: 0 auto;
  padding: 0 44px;
}
.filter-navigation {
  display: grid;
  gap: 7px;
  padding: 19px 0;
  border-bottom: 1px solid var(--rule);
}
.nav-group { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 13px; align-items: start; }
.nav-group h2 {
  font-size: 12px;
  line-height: 34px;
  font-weight: 700;
  color: var(--muted);
}
.nav-options { display: flex; flex-wrap: wrap; gap: 5px 7px; }
.nav-item {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 10px;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  line-height: 1.35;
}
.nav-item:hover { background: var(--paper-bright); color: var(--accent); }
.nav-item[aria-current] { border-color: #e6cfc0; color: var(--accent); background: var(--accent-paper); font-weight: 680; }
.facet-count { color: #7c6e60; font-size: .88em; font-weight: 500; font-variant-numeric: tabular-nums; }

main { padding: 26px 0 56px; min-width: 0; }
main:has(.entry-navigation):not(:has(.entry-grid)) { max-width: 1060px; margin-inline: auto; }
.page-heading h1 {
  font: 800 clamp(2.25rem, 4.7vw, 4.25rem)/1.17 var(--editorial);
  letter-spacing: -.065em;
  overflow-wrap: anywhere;
}
.page-heading > p { margin-top: 13px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.load-state { color: var(--muted); font-size: 14px; padding: 24px 0; }

.preview-frame { position: relative; overflow: hidden; background: #171d2d; isolation: isolate; }
.preview-frame :is(iframe, img, video) { width: 100%; height: 100%; }
.preview-detail { border-radius: 12px; }
.preview-detail iframe { height: clamp(285px, 44vw, 540px); }
.preview-detail :is(img, video) { object-fit: contain; max-height: 680px; }
.preview-card { aspect-ratio: 16 / 9; border-radius: 7px; }
.preview-card video { object-fit: contain; }

.results-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px 11px; margin-bottom: 17px; }
.results-heading h1 { font-size: clamp(1.25rem, 2vw, 1.6rem); letter-spacing: -.045em; }
.result-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.reset-link { margin-left: auto; color: var(--accent); font-size: 13px; }
.entry-grid {
  --card-columns: 3;
  --card-gap: 17px;
  display: grid;
  grid-template-columns: repeat(var(--card-columns), minmax(0, 1fr));
  gap: var(--card-gap);
  align-items: start;
}
.av-grid { align-items: stretch; grid-auto-rows: 1fr; }
@supports (width: round(down, 100%, 1px)) {
  :is(.av-grid, .entry-grid:has(.video-card)) {
    --column-width: round(down, (100% - (var(--card-columns) - 1) * var(--card-gap)) / var(--card-columns), 1px);
    grid-template-columns: repeat(var(--card-columns), var(--column-width));
  }
}
.entry-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  border-radius: 11px;
  background: var(--paper-bright);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.entry-card:focus-within, .entry-card:hover { border-color: #c39e8a; box-shadow: 0 5px 18px #4534220d; }
.media-detail-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.preview-detail.preview-audio { background: #f0ece3; padding: 14px; }
.preview-audio audio { display: block; width: 100%; }
.card-body {
  --card-padding-inline: 17px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 16px 44px 40px 22px 42px;
  gap: 6px;
  min-width: 0;
  padding: 16px var(--card-padding-inline);
}
:is(.av-grid, .video-card) .card-body {
  --prompt-height: 112px;
  gap: 10px;
}
.video-card .card-body { grid-template-rows: 44px auto 40px 22px var(--prompt-height) 42px; }
.av-grid .entry-card:not(.video-card) .card-body {
  flex: 1;
  grid-template-rows: 44px 16px 40px 22px var(--text-track, minmax(var(--prompt-height), 1fr)) 42px;
}
.av-grid .entry-card:not(.video-card) .card-text { height: 100%; }
@supports (width: 1cqi) {
  .av-grid > .entry-card { container-type: inline-size; }
  .av-grid .entry-card:not(.video-card) .card-body {
    --preview-height: calc((100cqi - 2 * var(--card-padding-inline)) * 9 / 16);
    /* Give the prompt the space that the preview would use, minus the media label row. */
    --text-track: calc(var(--prompt-height) + var(--preview-height) - 16px);
  }
}
.card-labels { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; line-height: 16px; }
.card-category { color: var(--accent); font-weight: 700; }
.card-body h2 { font-size: 18px; letter-spacing: -.025em; line-height: 22px; overflow-wrap: anywhere; }
.card-title, .card-summary { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.card-title:hover { color: var(--accent); text-decoration: underline; text-underline-offset: .19em; }
.card-arrow { margin-inline-start: .36em; color: var(--accent); font-size: .86em; }
.card-summary { font-size: 13px; color: var(--muted); line-height: 20px; overflow-wrap: anywhere; }
.card-body > .tags { flex-wrap: nowrap; overflow: auto hidden; scrollbar-width: none; }
.card-body > .tags li { flex: none; white-space: nowrap; }
.card-actions { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 8px; }
.card-variant {
  min-width: 0;
  width: 100%;
  padding: 6px 9px;
  border: 1px solid #d6bcac;
  border-radius: 6px;
  background: var(--paper-bright);
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
}
.card-text, .prompt-block, .code-block {
  width: 100%;
  min-width: 0;
  height: var(--prompt-height);
  overflow: auto;
  scrollbar-gutter: stable;
  padding: 12px 13px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: #f5f1e8;
  color: #41392f;
  font: 12px/1.72 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}
.card-text code, .prompt-block code, .code-block code { font: inherit; }
.card-code, .code-block { background: #161a25; color: #f3edf3; }
.prompt-block { background: var(--paper-bright); }
.tags { padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 5px; }
.tags li { font-size: 10px; line-height: 1.4; padding: 4px 7px; color: #645548; background: #f3eee6; border-radius: 4px; }
.empty-state { border-block: 1px solid var(--rule); padding: 30px 0; }
.empty-state h2 { font-size: 16px; }
.empty-state p { color: var(--muted); font-size: 13px; margin-top: 9px; }

.breadcrumb { display: inline-block; color: var(--accent); font-size: 13px; margin-bottom: 21px; }
.detail-heading h1 { font-size: clamp(2rem, 4.3vw, 3.7rem); letter-spacing: -.048em; }
.detail-heading .detail-meta { display: flex; flex-wrap: wrap; gap: 8px 15px; margin: 0 0 10px; color: var(--accent); font-weight: 640; font-size: 12px; }
.detail-meta time { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.detail-heading .tags { margin-top: 13px; }
.effect-section, .detail-section { margin-top: 29px; }
.detail-section { border-top: 1px solid var(--rule); padding-top: 16px; }
.detail-section > h2 { margin-bottom: 12px; font-size: 18px; }
.copy-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; margin-bottom: 11px; }
.copy-heading h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.copy-button {
  padding: 7px 11px;
  background: var(--paper-bright);
  color: var(--accent);
  border: 1px solid #d6bcac;
  border-radius: 6px;
  font-weight: 630;
  font-size: 12px;
  cursor: pointer;
}
.copy-button { margin-left: auto; }
.copy-button:hover { background: var(--accent-paper); }
.card-copy {
  grid-column: 2;
  grid-row: 1;
  height: 42px;
  margin-left: 0;
  padding: 8px 12px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fffdf8;
  white-space: nowrap;
}
.card-copy:hover { border-color: #8a2814; background: #8a2814; }
.copy-heading .copy-button { min-height: 42px; }
.code-language { color: var(--muted); font: 11px var(--mono); }
.copy-field { position: fixed; left: -10000px; top: 0; }
.usage-text, .sources { color: var(--muted); font-size: 14px; line-height: 1.8; }
.usage-text { white-space: pre-line; }
.sources { padding-left: 19px; }
.sources li + li { margin-top: 5px; }
.sources a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.prompt-versions { margin-top: 14px; }
.prompt-versions > summary { padding: 9px 0; font-size: 13px; font-weight: 640; color: var(--accent); cursor: pointer; }
.prompt-versions .detail-section { margin-top: 12px; }
#personal-dialog { width: min(440px, calc(100% - 30px)); padding: 22px; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper-bright); color: var(--ink); }
#personal-dialog::backdrop { background: #26231d70; }
.personal-dialog-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.personal-dialog-heading h2 { font-size: 19px; }
#personal-dialog p { margin: 12px 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
#personal-dialog label { display: block; margin: 15px 0 8px; font-size: 13px; font-weight: 650; }
#personal-file { max-width: 100%; font-size: 13px; }
.entry-navigation { display: flex; flex-wrap: wrap; column-gap: 18px; }
.collection-link { color: var(--muted); }

@media (max-width: 1150px) {
  .header-inner, .layout { padding-inline: 30px; }
}
@media (max-width: 920px) {
  .header-inner { grid-template-columns: max-content minmax(140px, 1fr) auto; }
  .entry-grid { --card-columns: 2; }
}
@media (max-width: 700px) {
  .header-inner { grid-template-columns: 1fr auto; gap: 12px; padding: 13px 16px; min-height: auto; }
  .header-inner .search { grid-column: 1 / -1; grid-row: 2; }
  .search kbd { display: none; }
  .brand { font-size: 14px; }
  .brand-mark { width: 30px; height: 30px; font-size: 15px; }
  .layout { padding: 0 16px; }
  .filter-navigation { padding: 12px 0; gap: 8px; }
  .nav-group { grid-template-columns: 29px minmax(0, 1fr); gap: 6px; }
  .nav-options { gap: 3px; }
  .nav-item { padding-inline: 7px; font-size: 12px; }
  main { padding: 19px 0 38px; }
  .page-heading h1 { font-size: clamp(2.1rem, 9vw, 3.4rem); }
  .page-heading > p { margin-top: 9px; font-size: 13px; }
  .entry-grid { --card-gap: 13px; }
  .card-body { --card-padding-inline: 13px; padding: 13px var(--card-padding-inline); }
  .card-body h2 { font-size: 17px; }
}
@media (max-width: 520px) {
  .header-links { gap: 10px; }
  .header-links a, .personal-trigger { font-size: 12px; }
  .entry-grid { --card-columns: 1; }
}
@media (max-width: 420px) {
  .header-inner { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .header-inner .search { grid-row: 3; }
  .header-links { justify-self: start; gap: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
