:root {
  --bg: #0b0d13; --panel: #131722; --panel2: #1a1f2d; --line: #262c3d;
  --fg: #e9edf6; --mut: #98a1b6; --acc: #ffb454; --acc-ink: #1d1404; --ok: #6ee7b7; --warn: #ffcf7a;
  --r: 12px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.6 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  word-break: keep-all; overflow-wrap: anywhere;
}
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 20px; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

/* 머리 */
.top { position: sticky; top: 0; z-index: 5; background: rgba(11, 13, 19, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: 14px 0 10px; }
.top .wrap { display: grid; grid-template-columns: 1fr auto; gap: 10px 20px; align-items: center; }
.brand { display: flex; gap: 12px; align-items: center; }
.logo { width: 34px; height: 34px; border-radius: 9px; flex: none; background: conic-gradient(from 210deg, #ffb454, #ff6f91, #7aa2ff, #5eead4, #ffb454); }
h1 { font-size: 20px; letter-spacing: -.01em; }
.brand p { color: var(--mut); font-size: 13px; }
.tools input { width: min(340px, 44vw); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; outline: none; }
.tools input:focus { border-color: var(--acc); }
.chips { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; color: var(--mut); white-space: nowrap; }
.chip:hover { color: var(--fg); }
.chip[aria-pressed="true"] { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); font-weight: 700; }
.chip small { opacity: .7; margin-left: 4px; }
.chips.small .chip { padding: 4px 10px; font-size: 12.5px; }

/* 목록 */
.count { color: var(--mut); font-size: 13px; margin: 16px 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, transform .15s; }
.card:hover { border-color: #3a4259; transform: translateY(-2px); }
.card.picked { border-color: var(--acc); }
.thumb { position: relative; aspect-ratio: 16 / 9; background: #000; cursor: pointer; border: 0; padding: 0; display: block; width: 100%; }
.thumb video { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb .n { position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, .65); border-radius: 6px; padding: 1px 7px; font-size: 12px; color: #fff; }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h2 { font-size: 16px; }
.card .sum { color: var(--mut); font-size: 13.5px; flex: 1; }
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.tag { color: var(--acc); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.empty { color: var(--mut); text-align: center; padding: 60px 0; }

.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.btn:hover { border-color: #46506b; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.on { border-color: var(--acc); color: var(--acc); }

.foot { color: var(--mut); font-size: 12.5px; padding: 36px 20px 110px; }

/* 고른 효과 모음 */
.tray { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: rgba(19, 23, 34, .96); border-top: 1px solid var(--acc); backdrop-filter: blur(10px); }
.tray-in { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.tray-btns { display: flex; gap: 8px; flex: none; }
#trayText { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 자세히 보기 */
.dlg { width: min(1180px, calc(100vw - 24px)); max-height: calc(100vh - 24px); background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 16px; padding: 22px; overflow: auto; }
.dlg.narrow { width: min(820px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(4, 6, 10, .78); }
.dlg .x { position: sticky; float: right; top: 0; margin: -8px -8px 0 8px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; font-size: 20px; line-height: 1; z-index: 2; }
.dlg-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; }
.stage { position: sticky; top: 0; align-self: start; }
.stage video { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; object-fit: contain; display: block; }
.stage .chips { margin-top: 10px; }
.info h2, .dlg > h2 { font-size: 22px; margin: 2px 0 6px; }
.lead { font-size: 15.5px; }
.use { color: var(--mut); font-size: 13.5px; margin: 6px 0 12px; }
.info h3 { font-size: 13px; color: var(--mut); margin: 16px 0 6px; font-weight: 700; }
.info ol, .info ul { margin: 0; padding-left: 20px; font-size: 14px; }
.info li { margin: 3px 0; }
.caution { margin-top: 14px; background: rgba(255, 207, 122, .08); border: 1px solid rgba(255, 207, 122, .3); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; }
.caution strong { color: var(--warn); margin-right: 4px; }

/* 프롬프트 */
.prompt { clear: both; margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.prompt h3 { font-size: 16px; margin-bottom: 10px; }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 10px; }
.opts label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--mut); }
.opts .wide2 { grid-column: span 2; }
.opts select, .opts input { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; color: var(--fg); outline: none; min-width: 0; }
.opts select:focus, .opts input:focus { border-color: var(--acc); }
.pbox { position: relative; }
.pbox pre { margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; white-space: pre-wrap; font: 13.5px/1.65 "D2Coding", "Cascadia Mono", Consolas, monospace; max-height: 420px; overflow: auto; }
.pbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; color: var(--mut); font-size: 12.5px; }

.blist { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.blist li { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.blist img { width: 64px; height: 36px; object-fit: cover; border-radius: 4px; background: #000; flex: none; }
.blist .nm { flex: 1; min-width: 0; }
.blist .nm small { color: var(--mut); display: block; }
.blist .btn { padding: 3px 9px; }

.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: var(--ok); color: #052; font-weight: 700; padding: 8px 18px; border-radius: 999px; z-index: 50; font-size: 14px; }

@media (max-width: 860px) {
  .top .wrap { grid-template-columns: 1fr; }
  .tools input { width: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .chips.small { flex-wrap: wrap; }
  .dlg { padding: 16px; }
  .dlg-body { grid-template-columns: 1fr; }
  .stage { position: static; }
  .opts .wide2 { grid-column: auto; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .card { transition: none; } html { scroll-behavior: auto; } }
