@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-wdth.woff2") format("woff2-variations"), url("/assets/fonts/archivo-wdth.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
/* Accents of the Latin languages other than English and French. */
@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-latin-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-vietnamese.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono.woff2") format("woff2-variations"), url("/assets/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0a0a0b;
  --bg-2: #131315;
  --bg-3: #1c1c1f;
  --line: #2b2b2f;
  --line-2: #3d3d42;
  --text: #f5f3ed;
  --muted: #aeaca4;
  --accent: #ff5a1f;
  --accent-2: #ff7a4a;
  --accent-ink: #0a0a0b;
  --gutter: clamp(16px, 2.2vw, 32px);
  --radius: 5px;
  --head-h: 60px;
  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", "Noto Sans", "PingFang SC", "Hiragino Sans", "Apple SD Gothic Neo", "Malgun Gothic", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--head-h) + 16px); }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img, video { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.1; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
code, pre { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: var(--radius); }
.skip:focus { top: 8px; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg-3); text-decoration: none; font-weight: 600; font-size: .92rem; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.btn:hover { background: #26262a; border-color: #55555b; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-outline { background: transparent; }
.btn-wide { width: 100%; min-height: 48px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn[disabled] { opacity: .6; cursor: progress; }

.btn-copy { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius); background: rgba(16, 16, 18, .82); color: var(--text); font-size: .8rem; font-weight: 600; cursor: pointer; backdrop-filter: blur(6px); transition: background .15s, color .15s, border-color .15s; }
.btn-copy:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn-copy.is-done { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-copy-main { min-height: 42px; padding: 0 16px; font-size: .92rem; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-short { display: none; }
.btn-copy-main:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); }
.link-arrow { color: var(--text); font-weight: 600; font-size: .92rem; text-underline-offset: 3px; text-decoration-color: var(--accent); }
.link-arrow:hover { color: var(--accent-2); }
.link-quiet { color: var(--muted); font-size: .86rem; text-underline-offset: 3px; }
.link-quiet:hover { color: var(--text); }

/* ---- Header ---- */
.site-head { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 28px; height: var(--head-h); padding: 0 var(--gutter); background: rgba(10, 10, 11, .88); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--accent); flex: none; }
.logo-mark { display: block; flex: none; }
.brand-word { color: var(--text); font-weight: 800; font-stretch: 78%; font-size: 1.32rem; letter-spacing: -.005em; text-transform: uppercase; }
.brand-word span { color: var(--muted); font-weight: 700; }
.main-nav { display: flex; gap: 20px; }
.main-nav a { color: var(--muted); text-decoration: none; font-size: .94rem; font-weight: 500; padding: 4px 0; border-bottom: 2px solid transparent; white-space: nowrap; }
.main-nav a:hover { color: var(--text); }
.main-nav a[aria-current] { color: var(--text); border-bottom-color: var(--accent); }
.head-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; flex: none; }
.lang { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .86rem; padding: 6px; }
.lang:hover { color: var(--text); }

/* ---- Hero ---- */
.hero { position: relative; display: flex; align-items: flex-end; min-height: min(78vh, 780px); padding: clamp(32px, 6vw, 72px) var(--gutter) clamp(28px, 4vw, 44px); overflow: hidden; background: var(--bg-2); isolation: isolate; }
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(10, 10, 11, .96) 2%, rgba(10, 10, 11, .55) 38%, rgba(10, 10, 11, .08) 72%), linear-gradient(to right, rgba(10, 10, 11, .66), rgba(10, 10, 11, 0) 64%); }
.hero-inner { max-width: 1120px; }
.hero h1 { font-weight: 800; font-stretch: 68%; font-size: clamp(3.1rem, 9.4vw, 9rem); line-height: .96; letter-spacing: -.012em; text-transform: uppercase; text-wrap: balance; }
.hero-sub { margin-top: 20px; max-width: 34em; font-size: clamp(1.02rem, 1.5vw, 1.26rem); line-height: 1.45; color: #e7e5de; text-wrap: pretty; }
.hero-stats { display: flex; gap: clamp(22px, 3.4vw, 44px); margin: 24px 0 0; }
.hero-stats div { display: flex; flex-direction: column-reverse; }
.hero-stats dd { margin: 0; font-weight: 800; font-stretch: 75%; font-size: clamp(1.7rem, 3vw, 2.5rem); line-height: 1; font-variant-numeric: tabular-nums; }
.hero-stats dt { color: var(--muted); font-size: .86rem; margin-top: 3px; }
.hero-credit { position: absolute; right: var(--gutter); bottom: clamp(28px, 4vw, 44px); display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; background: rgba(10, 10, 11, .72); border: 1px solid var(--line-2); border-radius: 999px; font-size: .86rem; text-decoration: none; backdrop-filter: blur(10px); max-width: min(46vw, 560px); }
.hero-credit:hover { border-color: var(--accent); }
.hero-credit-cta { color: var(--accent-2); font-weight: 600; white-space: nowrap; }

/* ---- Avatars ---- */
.avatar { flex: none; border-radius: 50%; object-fit: cover; background: var(--bg-3); }
.avatar-empty { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); border: 1px solid var(--line-2); }

/* ---- Chips & filters ---- */
.cat-strip { display: flex; gap: 6px; padding: 16px var(--gutter) 4px; overflow-x: auto; scrollbar-width: none; }
.cat-strip::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); text-decoration: none; font-size: .87rem; font-weight: 500; white-space: nowrap; transition: color .15s, border-color .15s; }
.chip small { color: #85837c; font-size: .76rem; font-variant-numeric: tabular-nums; }
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip[aria-current] { color: var(--accent-ink); background: var(--text); border-color: var(--text); font-weight: 600; }
.chip[aria-current] small { color: #55544f; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
main > .chip-row { padding: 0 var(--gutter) 10px; }

.filters { position: sticky; top: var(--head-h); z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px var(--gutter); background: rgba(10, 10, 11, .9); backdrop-filter: blur(14px); }
.filter-search { display: flex; align-items: center; gap: 8px; flex: 1 1 280px; min-height: 40px; padding: 0 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); }
.filter-search:focus-within { border-color: var(--line-2); outline: 2px solid var(--accent); outline-offset: 1px; }
.filter-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font-size: .94rem; }
.filter-search input::placeholder { color: #8b8981; }
.filter-select select { min-height: 40px; padding: 0 30px 0 12px; background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23aeaca4'/%3E%3C/svg%3E") no-repeat right 11px center / 9px; border: 1px solid var(--line); border-radius: var(--radius); font-size: .9rem; appearance: none; cursor: pointer; max-width: 210px; }
.filter-select select:hover { border-color: var(--line-2); }
.filter-toggle { display: inline-flex; cursor: pointer; }
.filter-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.filter-toggle span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); font-size: .9rem; color: var(--muted); white-space: nowrap; }
.filter-toggle input:checked + span { color: var(--accent-ink); background: var(--text); border-color: var(--text); font-weight: 600; }
.filter-toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.filter-count { margin-left: auto; color: var(--muted); font-size: .86rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- Gallery ----
   Rows are 1/16th of a column, so a tile's height comes from its real aspect ratio with no JavaScript. */
.gallery-wrap { container-type: inline-size; padding: 6px var(--gutter) 0; }
.gallery { --cols: 2; --gap: 6px; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-auto-rows: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols) / 16); grid-auto-flow: dense; column-gap: var(--gap); }
@container (max-width: 559px) { .gallery { --cols: 1; } }
@container (min-width: 820px) { .gallery { --cols: 3; } }
@container (min-width: 1180px) { .gallery { --cols: 4; } }
@container (min-width: 1760px) { .gallery { --cols: 5; } }

.tile { position: relative; grid-row-end: span var(--r, 9); margin-bottom: var(--gap); overflow: hidden; border-radius: var(--radius); background: var(--bg-3); }
.tile-link { position: absolute; inset: 0; display: block; color: var(--text); text-decoration: none; }
.tile-poster, .tile-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-video { opacity: 0; transition: opacity .3s; }
.tile.is-playing .tile-video { opacity: 1; }
.tile-link::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .82) 0, rgba(0, 0, 0, .28) 34%, rgba(0, 0, 0, 0) 58%); pointer-events: none; }
.tile-tags { position: absolute; z-index: 2; top: 8px; left: 8px; display: flex; gap: 4px; max-width: calc(100% - 96px); }
.tag { padding: 2px 7px; background: rgba(10, 10, 11, .72); border-radius: 3px; font-size: .72rem; font-weight: 600; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; backdrop-filter: blur(6px); }
.tag-icon, .tag-time { flex: none; }
.tag-time { font-variant-numeric: tabular-nums; }
.tile-meta { position: absolute; z-index: 2; left: 10px; right: 10px; bottom: 9px; display: flex; flex-direction: column; gap: 1px; }
.tile-title { font-weight: 600; font-size: .95rem; line-height: 1.22; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.tile-author { color: #d8d6cf; font-size: .8rem; }
.tile-copy { position: absolute; z-index: 3; top: 7px; right: 7px; opacity: 0; transform: translateY(-3px); transition: opacity .15s, transform .15s, background .15s, color .15s; }
.tile:hover .tile-copy, .tile-copy:focus-visible, .tile-copy.is-done { opacity: 1; transform: none; }
@media (hover: none) { .tile-copy { opacity: 1; transform: none; } }
.tile-link:focus-visible { outline-offset: -3px; }

.load-more { padding: 18px var(--gutter) 8px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 72px var(--gutter); text-align: center; color: var(--muted); }
.empty-title { color: var(--text); font-size: 1.4rem; font-weight: 700; }
.empty-page { min-height: 62vh; justify-content: center; }
.empty-page h1 { color: var(--text); font-weight: 800; font-stretch: 70%; font-size: clamp(2.6rem, 7vw, 5rem); text-transform: uppercase; }

/* ---- Page headers ---- */
.page-head { padding: clamp(28px, 5vw, 60px) var(--gutter) clamp(16px, 2.4vw, 26px); max-width: 980px; }
.page-head h1, .prose h1 { font-weight: 800; font-stretch: 70%; font-size: clamp(2.5rem, 6.4vw, 5.4rem); line-height: 1.02; letter-spacing: -.008em; text-transform: uppercase; text-wrap: balance; }
.kicker { color: var(--accent-2); font-size: .85rem; font-weight: 600; margin-bottom: 8px; }
.lead { margin-top: 12px; max-width: 42em; color: #d2d0c8; font-size: clamp(1rem, 1.3vw, 1.15rem); text-wrap: pretty; }
.page-head .link-arrow { display: inline-block; margin-top: 12px; }
.author-head { display: flex; align-items: center; gap: clamp(16px, 2.4vw, 28px); }
.credit-handle { color: var(--muted); }
.author-count { margin: 4px 0 12px; color: var(--muted); font-size: .92rem; }

.snippet { margin-top: 18px; padding: 12px 14px; max-width: 720px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.snippet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; color: var(--muted); font-size: .84rem; }
.snippet code { display: block; font-size: .9rem; line-height: 1.5; }

/* ---- Prompt page ---- */
.prompt-page { display: grid; grid-template-columns: minmax(0, 7fr) minmax(360px, 5fr); gap: clamp(18px, 2.6vw, 40px); padding: clamp(14px, 2vw, 26px) var(--gutter) 0; align-items: start; }
.prompt-page.is-portrait { grid-template-columns: minmax(0, 5fr) minmax(360px, 6fr); }
.prompt-media { position: sticky; top: calc(var(--head-h) + 14px); }
.prompt-media video { width: 100%; height: auto; max-height: calc(100vh - var(--head-h) - 28px); margin-inline: auto; background: #000; border-radius: var(--radius); }
.prompt-page.is-portrait .prompt-media video { width: auto; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; color: var(--muted); font-size: .86rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs a + a::before { content: "/"; margin-right: 6px; color: #66655f; }
.prompt-body h1 { font-weight: 800; font-stretch: 74%; font-size: clamp(2rem, 3.4vw, 3.2rem); line-height: 1; letter-spacing: -.004em; text-wrap: balance; }

.credit-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding: 12px; background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.credit-who { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.credit-who span { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.credit-who small { color: var(--muted); font-size: .78rem; }
.credit-who strong { font-size: 1.08rem; }
.credit-who:hover strong { color: var(--accent-2); }
.credit-handle { font-size: .88rem; }

.prompt-box { margin-top: 18px; }
.prompt-box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.prompt-box h2 { font-size: 1.05rem; font-weight: 700; }
.prompt-box h3 { font-size: .95rem; font-weight: 600; color: var(--muted); }
.prompt-box pre, .builder-output pre, .code-block pre { margin: 0; padding: 14px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); font-size: .86rem; line-height: 1.62; white-space: pre-wrap; overflow-wrap: anywhere; }
.prompt-box > pre { max-height: 56vh; overflow-y: auto; }
.negative { margin-top: 14px; }
.placeholders { display: grid; gap: 8px; margin-bottom: 10px; padding: 12px; border: 1px dashed var(--line-2); border-radius: var(--radius); }
.placeholders p { color: var(--muted); font-size: .86rem; }
.placeholders label { display: grid; grid-template-columns: minmax(70px, auto) 1fr; align-items: center; gap: 10px; font-size: .86rem; font-weight: 600; }
.placeholders input { min-height: 36px; padding: 0 10px; background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--radius); }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 18px; margin: 20px 0 0; }
.facts dt { color: var(--muted); font-size: .78rem; }
.facts dd { margin: 0; font-weight: 500; font-size: .94rem; }
.facts a { text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.facts a:hover { color: var(--accent-2); }
.used-techniques { margin-top: 22px; }
.used-techniques h2 { margin-bottom: 8px; font-size: .95rem; font-weight: 700; }
.prompt-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }

.related { margin-top: clamp(30px, 5vw, 56px); }
.related h2 { padding: 0 var(--gutter) 6px; font-weight: 800; font-stretch: 74%; font-size: clamp(1.5rem, 2.8vw, 2.2rem); }

/* ---- Authors ---- */
.author-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; padding: 0 var(--gutter); }
.author-card { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; transition: border-color .15s; }
.author-card:hover { border-color: var(--accent); }
.author-card span { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.author-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.author-card small { color: var(--muted); font-size: .84rem; }
.author-card em { color: var(--accent-2); font-style: normal; font-size: .82rem; font-weight: 600; margin-top: 2px; }

/* ---- Techniques ---- */
.group-nav { padding: 0 var(--gutter); }
.tech-group { padding: clamp(26px, 4vw, 44px) var(--gutter) 0; }
.tech-group h2 { margin-bottom: 12px; font-weight: 800; font-stretch: 72%; font-size: clamp(1.8rem, 3.2vw, 2.8rem); text-transform: uppercase; }
.tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 6px; }
.tech-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.tech-card h3 { font-size: 1.08rem; font-weight: 700; }
.tech-card h3 a { text-decoration: none; }
.tech-card h3 a:hover { color: var(--accent-2); }
.tech-card p { color: #c9c7bf; font-size: .92rem; line-height: 1.45; }
.tech-card code { color: var(--muted); font-size: .78rem; line-height: 1.5; }
.tech-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 4px; }
.tech-foot .link-arrow { font-size: .84rem; }

/* ---- Builder ---- */
.builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr); gap: clamp(18px, 3vw, 40px); padding: 0 var(--gutter); align-items: start; }
.builder-form { display: grid; gap: 12px; }
.builder-selects { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.builder-output { position: sticky; top: calc(var(--head-h) + 14px); }
.builder-output h2 { font-size: 1.05rem; }
.builder-output pre { min-height: 240px; font-size: .92rem; }

/* ---- Forms ---- */
.form-page { max-width: 760px; }
.stack-form { display: grid; gap: 16px; padding: 0 var(--gutter); max-width: 760px; }
.field { display: grid; gap: 5px; }
.field > span { font-weight: 600; font-size: .9rem; }
.field > small { color: var(--muted); font-size: .82rem; }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; padding: 9px 12px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); font-size: 1rem; }
.field textarea { font-family: var(--mono); font-size: .9rem; line-height: 1.55; resize: vertical; }
.field select { appearance: none; padding-right: 30px; background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23aeaca4'/%3E%3C/svg%3E") no-repeat right 11px center / 9px; cursor: pointer; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field input[type="file"] { padding: 9px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tabs { display: flex; gap: 4px; padding: 4px; margin: 0; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.tabs label { flex: 1; cursor: pointer; }
.tabs input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tabs span { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 8px; border-radius: 3px; color: var(--muted); font-weight: 600; font-size: .92rem; text-align: center; }
.tabs input:checked + span { background: var(--text); color: var(--bg); }
.tabs input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
[data-mode] { display: grid; gap: 16px; }
.radio-set { display: grid; gap: 8px; padding: 0; margin: 0; border: 0; }
.radio-set label, .check { display: flex; align-items: flex-start; gap: 10px; font-size: .94rem; cursor: pointer; }
.radio-set input, .check input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.hp { position: absolute; left: -9999px; }
.form-error { color: #ff9a85; font-size: .92rem; }
.form-done { padding: 0 var(--gutter); display: grid; gap: 14px; justify-items: start; }
.submit-preview { width: 100%; max-height: 340px; background: #000; border-radius: var(--radius); }
progress { width: 100%; height: 8px; accent-color: var(--accent); }

/* ---- Prose ---- */
.prose { max-width: 760px; padding: clamp(28px, 5vw, 60px) var(--gutter) 0; }
.prose-wide { max-width: 980px; }
.prose h2 { margin: 34px 0 10px; font-size: 1.5rem; font-weight: 700; }
.prose p { margin-top: 12px; color: #d9d7cf; }
.prose ul { display: grid; gap: 6px; margin-top: 12px; }
.prose code { padding: 1px 5px; background: var(--bg-3); border-radius: 3px; font-size: .86em; }
.code-block { position: relative; margin-top: 12px; }
.code-block .btn-copy { position: absolute; top: 8px; right: 8px; }
.code-block pre { padding-right: 90px; }

/* ---- Footer ---- */
.site-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 28px; margin-top: clamp(40px, 6vw, 72px); padding: 22px var(--gutter); border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.foot-brand { display: flex; align-items: center; gap: 12px; color: var(--accent); }
.foot-brand p { color: var(--muted); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-foot a { text-decoration: none; }
.site-foot a:hover { color: var(--text); text-decoration: underline; }

/* ---- Admin ---- */
.admin-head { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 12px var(--gutter); background: var(--bg-2); border-bottom: 1px solid var(--line); font-size: .92rem; }
.admin-head a { text-decoration: none; }
.admin-head a:hover { color: var(--accent-2); }
.admin-main { padding: 20px var(--gutter) 60px; }
.admin-main h1 { margin-bottom: 14px; font-size: 1.6rem; }
.admin-main h2 { margin: 16px 0 6px; font-size: 1rem; }
.admin-main .stack-form { padding: 0; }
.admin-login { max-width: 420px; margin: 12vh auto; padding: 0 var(--gutter); display: grid; gap: 16px; }
.admin-login .stack-form { padding: 0; }
.admin-actions { margin-bottom: 14px; }
.admin-list { display: grid; gap: 6px; }
.admin-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; padding: 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.admin-row:hover { border-color: var(--accent); }
.admin-row img, .admin-noposter { width: 150px; height: 90px; object-fit: cover; background: var(--bg-3); border-radius: 3px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .8rem; }
.admin-row span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.admin-row small { color: var(--muted); }
.admin-row em { color: #c9c7bf; font-style: normal; font-size: .86rem; }
.admin-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.admin-pre { margin: 0; padding: 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); font-size: .82rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-tech { margin: 10px 0 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .86rem; }
.admin-narrow { max-width: 840px; display: grid; gap: 12px; }
.admin-ok { color: #8fe3a2; }
.admin-reports { display: grid; gap: 10px; }
.admin-reports li { display: grid; gap: 6px; padding: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.admin-reports li.is-open { border-left: 3px solid var(--accent); }

/* ---- Small screens ---- */
@media (max-width: 1100px) {
  :root { --head-h: 100px; }
  .site-head { flex-wrap: wrap; height: auto; padding-block: 10px 0; gap: 0 16px; }
  .main-nav { order: 3; width: 100%; padding: 6px 0 2px; overflow-x: auto; scrollbar-width: none; }
}
@media (max-width: 960px) {
  .prompt-page, .prompt-page.is-portrait { grid-template-columns: minmax(0, 1fr); }
  .prompt-media { position: static; }
  .prompt-media video, .prompt-page.is-portrait .prompt-media video { max-height: 78vh; width: auto; max-width: 100%; }
  .builder { grid-template-columns: minmax(0, 1fr); }
  .builder-output { position: static; }
  .admin-item { grid-template-columns: minmax(0, 1fr); }
  .filters { position: static; }
  .hero-credit { position: static; margin-top: 18px; max-width: 100%; align-self: flex-start; }
  .hero { flex-direction: column; align-items: flex-start; justify-content: flex-end; }
}
@media (max-width: 720px) {
  :root { --head-h: 0px; }
  .site-head { position: static; }
  .btn-long { display: none; }
  .btn-short { display: inline; }
}
@media (max-width: 560px) {
  body { font-size: 15.5px; }
  .brand-word { font-size: 1.14rem; }
  .btn-submit { min-height: 36px; padding: 0 12px; font-size: .86rem; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .filter-select, .filter-select select { flex: 1 1 auto; width: 100%; max-width: none; }
  .filter-select { flex: 1 1 40%; }
  .filter-count { margin-left: 0; width: 100%; }
  .hero { min-height: 74vh; }
  .hero-credit-cta { display: none; }
  .author-head { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* ---- Languages ---- */
.lang-menu { position: relative; }
.lang-menu summary { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 9px; color: var(--muted); font-size: .88rem; font-weight: 600; white-space: nowrap; border-radius: var(--radius); cursor: pointer; list-style: none; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover, .lang-menu[open] summary { color: var(--text); background: var(--bg-2); }
.lang-menu ul { position: absolute; z-index: 60; top: calc(100% + 6px); inset-inline-end: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px; width: min(540px, calc(100vw - 24px)); max-height: min(72vh, 540px); padding: 8px; overflow: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(0, 0, 0, .6); }
.lang-menu a { display: block; padding: 7px 10px; color: var(--text); font-size: .92rem; text-align: start; text-decoration: none; border-radius: 3px; }
.lang-menu a:hover { background: var(--bg-3); }
.lang-menu a[aria-current] { color: var(--accent-2); font-weight: 700; }
@media (max-width: 640px) {
  .lang-menu summary span { display: none; }
  .lang-menu ul { position: fixed; top: calc(var(--head-h) + 4px); inset-inline: 12px; width: auto; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
.lang-hint { position: fixed; z-index: 70; inset-block-end: 14px; inset-inline-start: 14px; display: flex; align-items: center; gap: 2px; padding: 3px 4px 3px 14px; font-size: .92rem; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 999px; box-shadow: 0 10px 30px rgba(0, 0, 0, .55); }
.lang-hint a { color: var(--text); font-weight: 600; text-decoration: none; }
.lang-hint button { width: 28px; height: 28px; color: var(--muted); font-size: 1.1rem; line-height: 1; background: none; border: 0; cursor: pointer; }

.prompt-versions { margin-bottom: 10px; }
.prompt-versions nav { display: inline-flex; gap: 2px; padding: 2px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.prompt-versions a { padding: 5px 12px; color: var(--muted); font-size: .86rem; text-decoration: none; border-radius: 3px; }
.prompt-versions a:hover { color: var(--text); }
.prompt-versions a[aria-current] { color: var(--text); background: var(--bg-3); }
.prompt-versions p { margin-top: 8px; color: var(--muted); font-size: .84rem; }

/* Longer words than in English and French, and fonts without a condensed width. */
html:not(:lang(en)):not(:lang(fr)) .hero h1 { font-size: clamp(2.3rem, 6.6vw, 6.4rem); line-height: 1.02; }
h1, h2, h3, .tile-title { overflow-wrap: break-word; hyphens: auto; }

/* Scripts that break with tight tracking, capitals or tight lines. */
:is(:lang(ar), :lang(fa), :lang(ur), :lang(he), :lang(hi), :lang(mr), :lang(bn), :lang(gu), :lang(ta), :lang(te), :lang(th), :lang(am), :lang(ja), :lang(ko), :lang(zh)) :is(h1, h2, h3, .hero h1, .kicker, .tile-title, .lead, .btn) { letter-spacing: 0; text-transform: none; }
:is(:lang(ar), :lang(fa), :lang(ur), :lang(he), :lang(hi), :lang(mr), :lang(bn), :lang(gu), :lang(ta), :lang(te), :lang(th), :lang(am)) :is(h1, h2, h3, .hero h1, .tile-title) { line-height: 1.3; }

/* Right to left. Code and original prompts keep their own direction. */
code, .code-block pre { direction: ltr; unicode-bidi: isolate; text-align: start; }
[dir="rtl"] .skip { left: auto; right: 8px; }
[dir="rtl"] .head-actions { margin-left: 0; margin-right: auto; }
[dir="rtl"] .hero::after { transform: scaleX(-1); }
[dir="rtl"] .hero-credit { right: auto; left: var(--gutter); }
[dir="rtl"] .filter-select select { padding: 0 12px 0 30px; background-position: left 11px center; }
[dir="rtl"] .field select { padding-right: 12px; padding-left: 30px; background-position: left 11px center; }
[dir="rtl"] .filter-count { margin-left: 0; margin-right: auto; }
[dir="rtl"] .tile-tags { left: auto; right: 8px; }
[dir="rtl"] .tile-copy { right: auto; left: 7px; }
[dir="rtl"] .crumbs a + a::before { margin-right: 0; margin-left: 6px; }
[dir="rtl"] .code-block .btn-copy { right: auto; left: 8px; }
@media (max-width: 720px) {
  [dir="rtl"] .filter-count { margin-right: 0; }
}
