:root {
  --bg: #0e0f12;
  --panel: #16181d;
  --panel-2: #1d2027;
  --line: #2a2e37;
  --text: #eceef2;
  --muted: #9097a3;
  --accent: #ff5a36;
  --accent-ink: #fff;
  --ok: #3ccf8e;
  --bad: #ff5d6c;
  --warn: #f5b942;
  --radius: 12px;
  --checker: repeating-conic-gradient(#20232a 0% 25%, #181a20 0% 50%) 50% / 16px 16px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f7; --panel: #ffffff; --panel-2: #f0f1f4; --line: #e1e3e8; --text: #15171c; --muted: #646b78;
    --checker: repeating-conic-gradient(#eceef2 0% 25%, #ffffff 0% 50%) 50% / 16px 16px;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 Inter, system-ui, sans-serif; }
a { color: inherit; }
code, pre, .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12.5px; }
pre { white-space: pre-wrap; word-break: break-word; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel-2);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: progress; }

header.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
header.top .logo { font-weight: 700; letter-spacing: -.02em; text-decoration: none; display: flex; align-items: center; gap: 8px; }
header.top .logo i { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: inline-block; }
header.top .spacer { flex: 1; }
main { max-width: 1320px; margin: 0 auto; padding: 24px; }
h1 { font-size: 26px; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 16px; margin: 24px 0 10px; }
h3 { font-size: 13px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.tight { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.grid.icons { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; display: flex; flex-direction: column; }
.card:hover { border-color: var(--muted); }
.card .cover { aspect-ratio: 16/10; background: var(--checker); display: grid; place-items: center; overflow: hidden; }
.card .cover img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 12px 14px; }
.card .title { font-weight: 600; }

.chip { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; border: 1px solid var(--line); }
.chip.exploring { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.chip.approved { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.chip.archived { color: var(--muted); }
.chip.rejected { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.chip.draft { color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--text); border-color: var(--accent); }

.tile { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tile.approved { border-color: var(--ok); }
.tile.rejected { opacity: .45; }
.tile .img { background: var(--checker); aspect-ratio: 1; display: grid; place-items: center; cursor: zoom-in; }
.tile .img img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.tile .meta { padding: 8px 10px; font-size: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tile .actions { display: flex; gap: 4px; padding: 0 10px 10px; flex-wrap: wrap; }
.tile .star { position: absolute; top: 8px; left: 8px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }

.batch { margin-bottom: 26px; }
.batch .prompt { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0 12px; }
.batch details summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-top: 6px; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 120px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.swatch i { display: block; height: 56px; }
.swatch div { padding: 6px 8px; font-size: 12px; }

.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over { border-color: var(--accent); color: var(--text); }

.two { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } main { padding: 16px; } header.top { padding: 10px 16px; } }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 60; display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 82vh; background: var(--checker); border-radius: 8px; }
.lightbox .cap { color: #ddd; max-width: 900px; margin-top: 12px; font-size: 12px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 70; }
#toast.show { opacity: 1; }
.login { max-width: 360px; margin: 12vh auto; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

.tile .img { position: relative; }
.tile .play { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.6); pointer-events: none; }
.lightbox video { max-width: 100%; max-height: 82vh; border-radius: 8px; background: #000; }
