:root {
  color-scheme: dark;
  --bg: oklch(0.10 0 0);
  --surface: oklch(0.16 0.012 258);
  --surface-raised: oklch(0.20 0.018 258);
  --ink: oklch(0.96 0.01 258);
  --muted: oklch(0.72 0.025 258);
  --line: oklch(0.32 0.025 258);
  --primary: oklch(0.62 0.16 258);
  --primary-hover: oklch(0.68 0.16 258);
  --accent: oklch(0.78 0.16 145);
  --danger: oklch(0.66 0.18 28);
  --shadow: 0 8px 20px oklch(0.02 0 0 / 0.24);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; clip-path: inset(50%); }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; min-height: 64px; padding: 0 20px; background: oklch(0.10 0 0 / 0.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.brand { color: var(--ink); font-size: 1.18rem; font-weight: 780; letter-spacing: -0.045em; text-decoration: none; }
.brand span { color: var(--accent); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.language-picker select, .adult-toggle { min-height: 40px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.language-picker select { width: 58px; padding: 0 7px; }
.adult-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 0.82rem; }
.adult-toggle > span:first-child { color: var(--danger); font-weight: 800; }
.adult-toggle[aria-pressed="true"] { border-color: var(--danger); background: oklch(0.20 0.04 28); }

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 50px 0 80px; }
.intro { max-width: 720px; }
.intro-kicker { margin: 0 0 14px; color: var(--accent); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; }
h1 { max-width: 13ch; margin: 0; font-size: clamp(2.35rem, 7vw, 4.8rem); line-height: 0.98; letter-spacing: -0.04em; text-wrap: balance; }
.intro-copy { max-width: 55ch; margin: 22px 0 9px; color: var(--muted); font-size: 1.04rem; line-height: 1.55; text-wrap: pretty; }
.translation-link { color: var(--accent); font-weight: 700; text-underline-offset: 3px; }

.mode-tabs { display: flex; gap: 22px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.mode-tab { position: relative; min-height: 48px; padding: 0 4px; color: var(--muted); background: transparent; border: 0; font-weight: 720; }
.mode-tab::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; content: ""; background: transparent; }
.mode-tab.is-active { color: var(--ink); }
.mode-tab.is-active::after { background: var(--accent); }

.controls { display: flex; gap: 10px; align-items: stretch; }
.search-field { display: flex; flex: 1; gap: 9px; align-items: center; min-width: 0; padding: 0 13px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.search-field:focus-within { border-color: var(--primary); }
.search-field input { width: 100%; min-height: 48px; color: var(--ink); background: transparent; border: 0; outline: 0; }
.search-field input::placeholder { color: var(--muted); opacity: 1; }
.filter-field select { min-height: 48px; max-width: 160px; padding: 0 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.result-count { min-height: 22px; margin: 19px 0 13px; color: var(--muted); font-size: 0.9rem; }

.prompt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.prompt-card { display: flex; min-width: 0; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.prompt-card:hover { border-color: oklch(0.46 0.06 258); }
.card-media { position: relative; aspect-ratio: 9 / 16; display: grid; place-items: center; overflow: hidden; background: oklch(0.10 0.008 258); color: var(--muted); }
.card-media::before { width: 56px; height: 56px; border-radius: 50%; content: ""; background: var(--primary); opacity: 0.55; }
.card-media.is-video::before { border-radius: 10px; background: var(--accent); }
.card-media img, .card-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.card-media video { z-index: 1; background: #090a0c; }
.card-play { position: absolute; z-index: 2; width: 64px; height: 64px; display: grid; place-items: center; padding: 0 0 0 4px; color: oklch(0.98 0 0); background: oklch(0.18 0.03 258 / 0.92); border: 0; border-radius: 50%; box-shadow: 0 3px 8px oklch(0.02 0 0 / 0.42); font-size: 1.25rem; transition: opacity 180ms ease-out, transform 180ms ease-out; }
.card-play:hover { background: var(--primary); transform: scale(1.06); }
.card-media.is-playing .card-play { opacity: 0; pointer-events: none; transform: scale(0.92); }
.card-media small { position: absolute; z-index: 3; right: 12px; bottom: 10px; padding: 4px 7px; color: var(--ink); background: oklch(0.10 0 0 / 0.84); border-radius: 7px; font-weight: 700; }
.card-body { display: flex; flex: 1; flex-direction: column; padding: 15px; }
.card-topline { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.card-mode { color: var(--accent); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.06em; }
.card-category { color: var(--muted); font-size: 0.78rem; }
.card-title { margin: 10px 0; font-size: 1.06rem; letter-spacing: -0.015em; text-wrap: balance; }
.prompt-text { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.79rem; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 16px; }
.tag { padding: 4px 7px; color: var(--muted); background: oklch(0.12 0.01 258); border-radius: 7px; font-size: 0.72rem; }
.copy-button, .primary-button, .quiet-button { min-height: 45px; border-radius: 9px; font-weight: 760; }
.copy-button, .primary-button { color: oklch(0.98 0 0); background: var(--primary); border: 1px solid var(--primary); }
.copy-button { width: 100%; margin-top: auto; }
.copy-button:hover, .primary-button:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.quiet-button { padding: 0 14px; color: var(--ink); background: transparent; border: 1px solid var(--line); }
.primary-button { padding: 0 14px; }

.adult-card { justify-content: center; min-height: 370px; padding: 28px; text-align: center; }
.adult-card .adult-icon { display: grid; width: 52px; height: 52px; margin: 0 auto 16px; place-items: center; color: var(--danger); background: oklch(0.20 0.04 28); border-radius: 50%; font-weight: 850; }
.adult-card h2 { margin: 0; font-size: 1.25rem; }
.adult-card p { margin: 10px auto 22px; color: var(--muted); line-height: 1.45; }
.adult-card button { align-self: center; min-height: 44px; padding: 0 14px; color: var(--ink); background: transparent; border: 1px solid var(--danger); border-radius: 9px; font-weight: 750; }
.empty-state { padding: 56px 16px; color: var(--muted); text-align: center; }
.empty-state button { min-height: 42px; padding: 0 14px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 9px; }

dialog { width: min(420px, calc(100% - 32px)); padding: 0; color: var(--ink); background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 20px 44px oklch(0.02 0 0 / 0.5); }
dialog::backdrop { background: oklch(0.02 0 0 / 0.72); }
dialog form { padding: 24px; }
.dialog-mark { display: grid; width: 44px; height: 44px; margin: 0 0 18px; place-items: center; color: var(--danger); background: oklch(0.20 0.04 28); border-radius: 50%; font-weight: 850; }
dialog h2 { margin: 0; font-size: 1.35rem; }
dialog form > p:not(.dialog-mark) { color: var(--muted); line-height: 1.5; }
.dialog-actions { display: flex; gap: 8px; justify-content: end; margin-top: 24px; }
.toast { position: fixed; z-index: 20; right: 16px; bottom: 16px; max-width: calc(100vw - 32px); padding: 12px 15px; color: var(--ink); background: oklch(0.23 0.035 145); border-radius: 10px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity 180ms ease-out, transform 180ms ease-out; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

[dir="rtl"] .intro-kicker { letter-spacing: 0; }
[dir="rtl"] .search-field { flex-direction: row-reverse; }

@media (max-width: 640px) {
  .topbar { padding: 0 16px; }
  main { width: min(100% - 24px, 1180px); padding-top: 35px; }
  .intro-copy { font-size: 1rem; }
  .mode-tabs { margin-top: 34px; }
  .controls { flex-direction: column; }
  .filter-field select { width: 100%; max-width: none; }
  .prompt-grid { grid-template-columns: 1fr; gap: 12px; }
  .card-play { width: 60px; height: 60px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions > * { width: 100%; }
}

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