/* =========================================================
   ArsiPrompt — design system & UI
   ========================================================= */

@font-face {
  font-family: 'Manrope';
  src: url('fonts/manrope-400-normal.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('fonts/instrument-serif-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('fonts/instrument-serif-400-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #f5f1e8;
  --paper-deep: #ece6d8;
  --surface: #fffdf8;
  --ink: #17150f;
  --ink-2: #474339;
  --muted: #6b665a;
  --line: #e2dccd;
  --line-2: #cec6b4;
  --accent: #b83e0c;
  --accent-2: #e2601f;
  --accent-soft: #f8e4d8;
  --forest: #223a2e;
  --gold: #b98c33;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(23, 21, 15, .05);
  --shadow-md: 0 18px 40px -22px rgba(23, 21, 15, .45);
  --shadow-lg: 0 40px 90px -40px rgba(23, 21, 15, .55);
  --topbar-h: 72px;
  --sidebar-w: 268px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--ink); color: #fff8ea; }
h1, h2, h3, h4, p, figure { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 26px;
  padding: 0 28px;
  background: rgba(245, 241, 232, .88);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--ink); color: #fff6e6;
  display: grid; place-items: center;
  font-family: 'Instrument Serif', Georgia, serif; font-style: italic;
  font-size: 23px; line-height: 1; padding-bottom: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.brand-name {
  font-weight: 800; font-size: 17px; letter-spacing: -.035em; white-space: nowrap;
}
.brand-name span { color: var(--accent); }

.search {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  width: min(520px, 100%);
  height: 44px; padding: 0 12px 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.search:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(196, 68, 15, .1);
  color: var(--ink);
}
.search svg { width: 17px; height: 17px; flex: none; }
.search input {
  flex: 1; min-width: 0; height: 100%;
  background: none; border: 0; outline: 0;
  font-size: 14px; font-weight: 500; color: var(--ink);
}
.search input::placeholder { color: var(--muted); font-weight: 500; }
.search kbd, .kbd {
  font-family: inherit; font-size: 11px; font-weight: 700;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px; padding: 1px 6px;
}
.search-clear {
  width: 22px; height: 22px; border-radius: 50%;
  display: none; place-items: center;
  background: var(--paper-deep); color: var(--ink-2);
}
.search-clear svg { width: 12px; height: 12px; }
.search.has-value .search-clear { display: grid; }
.search.has-value kbd { display: none; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative;
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  color: var(--ink-2);
  transition: background .18s, color .18s;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: rgba(23, 21, 15, .06); color: var(--ink); }
.icon-btn.is-fav { color: var(--accent); }
.icon-btn.is-fav svg { fill: currentColor; }
.icon-btn .badge {
  position: absolute; top: 3px; right: 2px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 17px; text-align: center;
  opacity: 0; transform: scale(.6); transition: .18s var(--ease);
}
.icon-btn.has-count .badge { opacity: 1; transform: none; }

.install-btn {
  display: none;
  align-items: center; gap: 7px; flex: none;
  height: 36px; padding: 0 13px 0 11px; border-radius: 999px;
  background: var(--ink); color: #fff7e8;
  font-size: 12px; font-weight: 800; letter-spacing: -.01em;
  box-shadow: var(--shadow-sm);
  transition: .18s var(--ease);
}
.install-btn svg { width: 15px; height: 15px; }
.install-btn:not([hidden]) { display: inline-flex; }
.install-btn:hover { background: var(--accent); transform: translateY(-1px); }

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
  max-width: 1560px;
  margin: 0 auto;
}
.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow: auto;
  padding: 26px 18px 28px 28px;
  display: flex; flex-direction: column; gap: 22px;
  scrollbar-width: thin;
}
.side-block { display: flex; flex-direction: column; gap: 3px; }
.side-label {
  font-size: 10.5px; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted);
  padding: 0 10px; margin-bottom: 8px;
}
.side-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px;
  border-radius: 10px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  text-align: left;
  transition: background .16s, color .16s;
}
.side-item svg { width: 17px; height: 17px; flex: none; opacity: .8; }
.side-item .label { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-item .count {
  margin-left: auto; font-size: 11px; font-weight: 800;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.side-item:hover { background: rgba(23, 21, 15, .055); color: var(--ink); }
.side-item.active { background: var(--ink); color: #fff7e8; }
.side-item.active .count { color: rgba(255, 247, 232, .62); }
.side-item.active svg { opacity: 1; }
.side-item .dot {
  width: 8px; height: 8px; border-radius: 3px; flex: none;
  background: var(--dot, var(--line-2));
  box-shadow: 0 0 0 3px rgba(23, 21, 15, .04);
}
.side-item.active .dot { box-shadow: 0 0 0 3px rgba(255, 255, 255, .12); }
.side-sep { height: 1px; background: var(--line); margin: 6px 10px; }

.side-tip {
  margin-top: auto;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 15px;
  font-size: 12px; line-height: 1.55; color: var(--ink-2);
}
.side-tip b { display: block; font-size: 12px; margin-bottom: 4px; color: var(--ink); }
.side-tip .kbd { font-size: 10px; padding: 0 5px; }

/* ---------- main ---------- */
.main {
  min-width: 0;
  padding: 0 40px 96px 36px;
  border-left: 1px solid var(--line);
  min-height: calc(100vh - var(--topbar-h));
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 40px;
  align-items: center;
  padding: 48px 0 42px;
  border-bottom: 1px solid var(--line);
}
.hero:before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(23, 21, 15, .045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(23, 21, 15, .045) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(120% 100% at 30% 40%, #000 20%, transparent 78%);
  mask-image: radial-gradient(120% 100% at 30% 40%, #000 20%, transparent 78%);
  pointer-events: none;
}
.hero-copy { position: relative; z-index: 1; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .18em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 18px;
}
.eyebrow:before {
  content: ''; width: 22px; height: 1.5px; background: currentColor; border-radius: 2px;
}
.hero h1 {
  font-size: clamp(34px, 4.3vw, 58px);
  font-weight: 800; letter-spacing: -.045em; line-height: 1.01;
  max-width: 16ch;
}
.hero h1 em {
  white-space: nowrap;
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic; font-weight: 400;
  color: var(--accent); letter-spacing: -.01em;
  font-size: 1.05em;
}
.lede {
  margin-top: 18px; max-width: 46ch;
  font-size: 15px; line-height: 1.65; color: var(--ink-2);
}
.hero-stats {
  display: flex; align-items: center; gap: 26px;
  margin-top: 26px; padding-top: 22px;
  border-top: 1px dashed var(--line-2);
}
.stat { display: flex; flex-direction: column; gap: 1px; }
.stat b { font-size: 22px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.stat span { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.collage {
  position: relative; z-index: 1;
  height: 330px;
}
.collage-card {
  position: absolute; overflow: hidden;
  background: var(--surface);
  border-radius: 14px; padding: 7px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(23, 21, 15, .06);
}
.collage-card img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; }
.collage-a { width: 56%; height: 62%; left: 0; top: 16%; transform: rotate(-5deg); z-index: 3; }
.collage-b { width: 47%; height: 52%; right: 2%; top: 2%; transform: rotate(4deg); z-index: 2; }
.collage-c { width: 44%; height: 46%; right: 8%; bottom: 2%; transform: rotate(-2deg); z-index: 1; }
.collage-tag {
  position: absolute; z-index: 4; left: 4%; bottom: 4%;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink); color: #fff6e4;
  font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  padding: 9px 13px; border-radius: 999px;
  box-shadow: var(--shadow-md);
}
.collage-tag i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(226, 96, 31, .25);
}

/* ---------- section head ---------- */
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; padding: 30px 0 6px;
}
.section-head h2 {
  font-size: clamp(24px, 2.5vw, 34px);
  font-weight: 800; letter-spacing: -.035em; line-height: 1.1;
}
.section-head p { margin-top: 6px; color: var(--muted); font-size: 13.5px; max-width: 60ch; }
.head-link {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  font-size: 12.5px; font-weight: 800; color: var(--ink);
  border-bottom: 1.5px solid var(--ink); padding-bottom: 3px;
}
.head-link svg { width: 15px; height: 15px; transition: transform .2s; }
.head-link:hover svg { transform: translateX(4px); }

/* ---------- recent rail ---------- */
.recent-rail { margin: 4px 0 2px; }
.recent-track {
  display: flex; gap: 14px;
  overflow-x: auto; overscroll-behavior-x: contain;
  padding: 14px 2px 18px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.recent-card {
  flex: none; width: 196px;
  scroll-snap-align: start;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  text-align: left;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .2s;
}
.recent-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.recent-card .thumb {
  aspect-ratio: 4 / 3;
  background: var(--paper-deep);
  overflow: hidden;
}
.recent-card .thumb img {
  width: 100%; height: 100%; object-fit: contain; padding: 8px;
}
.recent-card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.recent-card .cat {
  font-size: 9.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recent-card .cat i {
  width: 6px; height: 6px; border-radius: 2px; background: var(--dot, var(--accent)); flex: none;
}
.recent-card h3 {
  font-size: 13.5px; font-weight: 700; letter-spacing: -.02em; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- toolbar ---------- */
.toolbar {
  position: sticky; top: var(--topbar-h); z-index: 40;
  display: flex; align-items: center; gap: 16px;
  padding: 13px 0;
  background: var(--paper);
  box-shadow: 0 1px 0 var(--line);
}
.results-line {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted); font-weight: 600;
}
.results-line b { color: var(--ink); font-weight: 800; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 8px 4px 11px;
  font-size: 11.5px; font-weight: 700; color: var(--ink-2);
}
.filter-chip button { display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: var(--paper-deep); }
.filter-chip svg { width: 10px; height: 10px; }
.tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.select-wrap {
  position: relative; display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  height: 38px; padding-left: 12px;
}
.select-wrap span { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.select-wrap select {
  appearance: none; background: none; border: 0; outline: 0;
  padding: 0 30px 0 8px; height: 100%;
  font-size: 12.5px; font-weight: 700; color: var(--ink);
  cursor: pointer;
}
.select-wrap svg { position: absolute; right: 10px; width: 13px; height: 13px; pointer-events: none; color: var(--muted); }
.view-toggle {
  display: flex; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
.view-toggle button {
  width: 32px; height: 30px; border-radius: 7px;
  display: grid; place-items: center; color: var(--muted);
  transition: .16s;
}
.view-toggle button svg { width: 16px; height: 16px; }
.view-toggle button:hover { color: var(--ink); }
.view-toggle button.active { background: var(--ink); color: #fff6e8; }

/* ---------- cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
.grid.is-list { grid-template-columns: 1fr; gap: 12px; }

.card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform .28s var(--ease), box-shadow .28s var(--ease), border-color .2s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.card.is-open { border-color: var(--ink); }

.thumb {
  position: relative; aspect-ratio: 4 / 3;
  background: var(--paper-deep);
  overflow: hidden;
}
.thumb img {
  width: 100%; height: 100%; object-fit: contain;
  padding: 10px;
  transition: transform .5s var(--ease);
}
.card:hover .thumb img { transform: scale(1.025); }
.thumb-hit { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; cursor: zoom-in; }
.chip-cat {
  position: absolute; z-index: 3; left: 11px; top: 11px;
  display: inline-flex; align-items: center; gap: 6px;
  max-width: calc(100% - 60px);
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(255, 253, 248, .92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(23, 21, 15, .07);
  font-size: 9.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip-cat { pointer-events: none; }
.chip-cat i { width: 6px; height: 6px; border-radius: 2px; background: var(--dot, var(--accent)); flex: none; }
.fav {
  position: absolute; z-index: 4; right: 11px; top: 11px;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 253, 248, .92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(23, 21, 15, .07);
  color: var(--ink-2);
  transition: .18s;
}
.fav svg { width: 16px; height: 16px; }
.fav:hover { background: #fff; color: var(--accent); transform: scale(1.06); }
.fav.on { color: var(--accent); }
.fav.on svg { fill: currentColor; }
.fav.pop { animation: pop .32s var(--ease); }
@keyframes pop { 40% { transform: scale(1.24); } 100% { transform: scale(1); } }

.thumb-actions {
  position: absolute; z-index: 3; left: 11px; right: 11px; bottom: 11px;
  display: flex; gap: 7px;
  opacity: 0; transform: translateY(8px);
  transition: .22s var(--ease);
}
.card:hover .thumb-actions, .card:focus-within .thumb-actions { opacity: 1; transform: none; }
.mini {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px; border-radius: 9px;
  font-size: 11.5px; font-weight: 800;
  background: rgba(255, 253, 248, .94);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(23, 21, 15, .1);
  color: var(--ink);
  transition: .16s;
}
.mini svg { width: 14px; height: 14px; }
.mini:hover { background: #fff; transform: translateY(-1px); }
.mini.primary { background: var(--ink); color: #fff7e9; border-color: var(--ink); }
.mini.primary:hover { background: var(--accent); border-color: var(--accent); }

.card-body { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px 18px; flex: 1; }
.card-kicker {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.card-kicker .cat-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--dot, var(--accent)); flex: none; }
.card-kicker .num { margin-left: auto; color: var(--line-2); font-variant-numeric: tabular-nums; }
.card h3 {
  font-size: 16.5px; font-weight: 700; letter-spacing: -.022em; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-snippet { display: none; }
.card-copy { display: none; }
.card-foot {
  display: flex; align-items: center; gap: 10px;
  margin-top: auto; padding-top: 2px;
}
.meta-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  background: var(--paper); border: 1px solid var(--line);
  padding: 3px 8px; border-radius: 999px;
}
.meta-pill svg { width: 12px; height: 12px; }
.card-open {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 800; color: var(--ink);
}
.card-open svg { width: 14px; height: 14px; transition: transform .2s; }
.card:hover .card-open svg { transform: translateX(3px); }
.new-badge {
  position: absolute; z-index: 3; left: 11px; top: 46px;
  background: var(--accent); color: #fff;
  font-size: 9px; font-weight: 900; letter-spacing: .1em;
  padding: 4px 7px; border-radius: 6px;
}

/* list mode */
.grid.is-list .card { flex-direction: row; align-items: stretch; }
.grid.is-list .thumb { width: 196px; height: 140px; flex: none; aspect-ratio: auto; }
.grid.is-list .thumb img { padding: 0; object-fit: cover; }
.grid.is-list .card-body { padding: 14px 20px; justify-content: center; gap: 6px; }
.grid.is-list .card-snippet {
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; color: var(--muted); font-size: 12.5px; line-height: 1.55; max-width: 70ch;
}
.grid.is-list .card-copy {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: auto; font-size: 12px; font-weight: 800; color: var(--ink-2);
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 5px 11px;
}
.grid.is-list .card-copy svg { width: 13px; height: 13px; }
.grid.is-list .card-copy:hover { border-color: var(--line-2); color: var(--ink); }
.grid.is-list .card-open { margin-left: 12px; }
.grid.is-list .card h3 { -webkit-line-clamp: 1; line-clamp: 1; font-size: 17px; }
.grid.is-list .chip-cat { display: none; }
.grid.is-list .thumb-actions { display: none; }
.grid.is-list .fav { right: 9px; top: 9px; width: 30px; height: 30px; }
.grid.is-list .card-kicker .num { display: none; }

/* ---------- footer ---------- */
.site-foot {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
  margin-top: 56px; padding-top: 26px;
  border-top: 1px solid var(--line);
}
.foot-brand { display: flex; align-items: flex-start; gap: 12px; }
.foot-brand .brand-mark { width: 34px; height: 34px; font-size: 20px; border-radius: 10px; flex: none; }
.foot-brand b { font-size: 14px; font-weight: 800; letter-spacing: -.02em; }
.foot-brand p { margin-top: 3px; color: var(--muted); font-size: 12.5px; }
.foot-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.foot-link { font-size: 12px; font-weight: 800; color: var(--ink-2); border-bottom: 1px solid transparent; padding-bottom: 2px; }
.foot-link:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- empty ---------- */
.empty {
  display: none;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, .55);
  padding: 64px 24px;
  text-align: center;
}
.empty.show { display: block; }
.empty-icon {
  width: 62px; height: 62px; margin: 0 auto 18px;
  border-radius: 18px;
  display: grid; place-items: center;
  background: var(--paper-deep); color: var(--ink);
}
.empty-icon svg { width: 26px; height: 26px; }
.empty h3 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.empty p { margin: 6px auto 0; max-width: 44ch; color: var(--muted); font-size: 13.5px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 12px;
  font-size: 13px; font-weight: 800;
  border: 1px solid transparent;
  transition: .18s var(--ease);
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--ink); color: #fff7e9; }
.btn-primary:hover { background: var(--accent); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--line-2); background: #fff; }
.btn-soft { background: var(--paper-deep); color: var(--ink); }
.btn-soft:hover { background: #e4ddcc; }
.btn-sm { height: 38px; padding: 0 14px; font-size: 12px; border-radius: 10px; }

/* ---------- drawer ---------- */
.drawer-root { position: fixed; inset: 0; z-index: 100; display: none; }
.drawer-root.open { display: block; }
.drawer-backdrop {
  position: absolute; inset: 0;
  background: rgba(23, 21, 15, .42);
  backdrop-filter: blur(3px);
  animation: fade .25s ease;
}
@keyframes fade { from { opacity: 0; } }
.drawer {
  outline: none;
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(720px, 100%);
  display: flex; flex-direction: column;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: slide .34s var(--ease);
}
@keyframes slide { from { transform: translateX(40px); opacity: .4; } }
.drawer-head {
  flex: none; display: flex; align-items: center; gap: 12px;
  height: 66px; padding: 0 18px 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 241, 232, .92);
  backdrop-filter: blur(12px);
}
.drawer-head .d-kicker {
  font-size: 10.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.drawer-head .d-kicker b { color: var(--accent); }
.drawer-tools { margin-left: auto; display: flex; gap: 4px; }
.drawer-scroll { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 22px 26px 30px; }
.d-media {
  background-color: var(--surface);
  background-image:
    linear-gradient(to right, rgba(23, 21, 15, .04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(23, 21, 15, .04) 1px, transparent 1px);
  background-size: 24px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  margin-bottom: 20px;
  display: grid; place-items: center;
}
.d-media img {
  width: auto; max-width: 100%; max-height: 320px;
  object-fit: contain; border-radius: 10px;
  box-shadow: 0 16px 34px -24px rgba(23, 21, 15, .55);
}
.d-title { font-size: clamp(24px, 3vw, 32px); font-weight: 800; letter-spacing: -.035em; line-height: 1.12; }
.d-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.d-actions .btn-primary { flex: 1 1 200px; }

.tabs {
  display: flex; gap: 2px; margin-top: 26px;
  border-bottom: 1px solid var(--line);
}
.tab {
  position: relative; padding: 11px 14px;
  font-size: 12.5px; font-weight: 800; color: var(--muted);
  border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--ink); background: rgba(23, 21, 15, .04); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]:after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px;
  height: 2px; background: var(--accent); border-radius: 2px;
}
.tab-panel { display: none; padding-top: 18px; }
.tab-panel.active { display: block; }

.prompt-tools {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px; font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: .06em; text-transform: uppercase;
}
.switch {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 800; letter-spacing: .02em; text-transform: none; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 10px;
}
.switch input { display: none; }
.switch .knob {
  width: 26px; height: 15px; border-radius: 999px; background: var(--line-2);
  position: relative; transition: .18s;
}
.switch .knob:after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 11px; height: 11px; border-radius: 50%; background: #fff; transition: .18s;
}
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob:after { transform: translateX(11px); }

.prompt-pre {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 18px 20px;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.9; color: #2f2c24;
  white-space: pre-wrap; overflow-wrap: anywhere;
  scrollbar-width: thin;
}
.prompt-pre mark {
  background: var(--accent-soft); color: #8d2f08;
  border-radius: 4px; padding: 0 3px; font-weight: 600;
}
.prompt-pre mark.is-filled {
  background: #dceadc; color: #1c3328;
  box-shadow: inset 0 0 0 1px rgba(34, 58, 46, .12);
}

/* ---------- fill form ---------- */
.fill-form {
  margin-top: 20px;
  padding: 16px 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.fill-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.fill-head h3 {
  font-size: 13.5px; font-weight: 800; letter-spacing: -.02em;
}
.fill-head p {
  margin-top: 3px; font-size: 12px; color: var(--muted); max-width: 46ch; line-height: 1.5;
}
.fill-head .btn { flex: none; }
.fill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 14px;
}
.fill-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fill-field.is-wide { grid-column: 1 / -1; }
.fill-field label {
  font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.fill-field .fill-input {
  width: 100%; min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  padding: 9px 12px;
  font-size: 13.5px; font-weight: 500; color: var(--ink);
  transition: border-color .2s, box-shadow .2s, background .2s;
  resize: vertical;
}
.fill-field textarea.fill-input { min-height: 72px; line-height: 1.5; }
.fill-field .fill-input::placeholder { color: var(--muted); font-weight: 500; opacity: .85; }
.fill-field .fill-input:hover { border-color: var(--line-2); }
.fill-field .fill-input:focus {
  outline: 0;
  border-color: var(--ink);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(196, 68, 15, .1);
}
.fill-field .fill-input.is-set {
  background: #f4f8f4;
  border-color: #b7c8b6;
}
.usage-text { color: var(--ink-2); font-size: 14px; line-height: 1.75; }
.usage-block + .usage-block { margin-top: 16px; }
.usage-block h4 {
  font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 8px;
}
.usage-block ol, .usage-block ul { margin: 0; padding-left: 20px; }
.usage-block li { margin: 6px 0; }
.usage-block p { margin: 8px 0; }

.drawer-foot {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: rgba(245, 241, 232, .94);
  backdrop-filter: blur(12px);
}
.nav-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 42px; padding: 0 13px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 12px; font-weight: 800; color: var(--ink);
  transition: .16s;
}
.nav-btn svg { width: 15px; height: 15px; }
.nav-btn:hover { border-color: var(--line-2); background: #fff; }
.nav-btn:disabled { opacity: .4; cursor: not-allowed; }
.d-pos {
  margin: 0 auto; font-size: 11px; font-weight: 800; letter-spacing: .1em;
  color: var(--muted); text-transform: uppercase; font-variant-numeric: tabular-nums;
}
.foot-copy { display: inline-flex; }

/* ---------- toast ---------- */
.toast-wrap {
  position: fixed; left: 50%; bottom: 26px; z-index: 200;
  transform: translate(-50%, 20px);
  display: flex; align-items: center; gap: 9px;
  background: var(--ink); color: #fff7e8;
  padding: 11px 16px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700;
  box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none;
  transition: .26s var(--ease);
}
.toast-wrap.show { opacity: 1; transform: translate(-50%, 0); }
.toast-wrap svg { width: 16px; height: 16px; color: #c9f27a; }

/* ---------- help dialog ---------- */
dialog.sheet {
  outline: none;
  border: 0; padding: 0; background: transparent;
  max-width: 520px; width: calc(100% - 32px);
}
dialog.sheet::backdrop { background: rgba(23, 21, 15, .45); backdrop-filter: blur(3px); }
.sheet-inner {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}
.sheet-inner h3 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.sheet-inner > p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.shortcuts { display: grid; gap: 8px; margin-top: 18px; }
.shortcut { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 13px; }
.shortcut span { color: var(--ink-2); }
.shortcut .keys { display: flex; gap: 5px; }
.sheet-close { position: absolute; right: 18px; top: 16px; }

/* ---------- mobile filter strip ---------- */
.mobile-filters { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  :root { --sidebar-w: 262px; }
  .side-item { font-size: 13px; gap: 8px; }
  .main { padding-right: 28px; padding-left: 26px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 24px; }
  .collage { height: 290px; }
}

@media (max-width: 1020px) {
  .topbar { gap: 16px; padding: 0 18px; }
  .hero { grid-template-columns: 1fr; }
  .collage { display: none; }
  .main { border-left: 0; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-filters {
    display: flex; gap: 8px; overflow-x: auto;
    padding: 10px 0 8px; margin: 0 -2px;
    scrollbar-width: none; position: sticky; top: var(--topbar-h); z-index: 41;
    background: var(--paper); box-shadow: 0 1px 0 var(--line);
  }
  .mobile-filters::-webkit-scrollbar { display: none; }
  .mchip {
    flex: none; display: inline-flex; align-items: center; gap: 7px;
    height: 34px; padding: 0 13px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--line);
    font-size: 12px; font-weight: 700; color: var(--ink-2);
  }
  .mchip.active { background: var(--ink); border-color: var(--ink); color: #fff7e8; }
  .mchip .count { font-size: 10px; color: var(--muted); font-weight: 800; }
  .mchip.active .count { color: rgba(255, 247, 232, .6); }
  .toolbar { top: calc(var(--topbar-h) + 48px); }
}

@media (max-width: 720px) {
  .topbar {
    height: auto; flex-wrap: wrap; gap: 10px;
    padding: 12px 16px; row-gap: 12px;
  }
  .brand-name { font-size: 16px; }
  .brand-mark { width: 34px; height: 34px; font-size: 21px; }
  .topbar-actions { order: 2; }
  .search { order: 3; width: 100%; height: 42px; }
  .search kbd { display: none; }
  .main { padding: 0 16px 80px; }
  .hero { padding: 28px 0 26px; }
  .hero h1 { max-width: none; }
  .hero-stats { gap: 18px; flex-wrap: wrap; }
  .section-head { padding-top: 22px; flex-direction: column; align-items: flex-start; gap: 10px; }
  .toolbar {
    top: 0; position: static; padding: 10px 0 12px;
    flex-wrap: wrap; gap: 10px;
  }
  .tools { width: 100%; }
  .select-wrap { flex: 1; }
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .grid.is-list .thumb { width: 128px; min-height: 116px; }
  .grid.is-list .card-body { padding: 12px 14px; }
  .grid.is-list .card h3 { font-size: 15px; }
  .thumb-actions { opacity: 1; transform: none; left: auto; right: 10px; bottom: 10px; }
  .thumb-actions .mini:not(.primary) { display: none; }
  .card-open { display: inline-flex; }
  .drawer-head { height: 60px; padding: 0 12px 0 16px; }
  .drawer-scroll { padding: 16px 16px 24px; }
  .d-media img { max-height: 230px; }
  .d-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .d-actions .btn { width: 100%; }
  .d-actions .btn-primary { grid-column: 1 / -1; }
  .fill-head { flex-direction: column; }
  .fill-head .btn { align-self: flex-start; }
  .fill-grid { grid-template-columns: 1fr; }
  .recent-card { width: 168px; }
  .install-btn { height: 34px; padding: 0 11px 0 9px; font-size: 11.5px; }
  .drawer-foot { padding: 10px 12px; }
  .nav-btn span { display: none; }
  .nav-btn { padding: 0 12px; }
  .toast-wrap { bottom: 18px; }
}

@media (max-width: 440px) {
  .hero h1 { font-size: 31px; }
  .lede { font-size: 14px; }
  .stat b { font-size: 19px; }
  .grid.is-list .thumb { display: none; }
  .site-foot { flex-direction: column; gap: 16px; }
  .install-btn span { display: none; }
  .install-btn { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .fill-form { padding: 14px 12px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
