:root {
  --bg: #0b0b0c;
  --panel: #141416;
  --line: #26262a;
  --text: #ececec;
  --muted: #8b8b92;
  --accent: #f2f2f2;
  --radius: 10px;
  --gap: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif; }
a { color: inherit; }
button, select, input { font: inherit; color: inherit; }
body.lock { overflow: hidden; }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; gap: 16px; align-items: center;
  padding: 12px 20px; background: rgba(11,11,12,.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); }
.logo { font-weight: 700; font-size: 20px; text-decoration: none; letter-spacing: -.5px; }
.logo span { color: #ff6a3d; }
.search { flex: 1; max-width: 560px; }
.search input { width: 100%; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); outline: none; }
.search input:focus { border-color: #555; }
.controls { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.controls select, .controls button, .toggle { background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; cursor: pointer; }
.toggle { display: flex; gap: 6px; align-items: center; user-select: none; }

/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; padding: 12px 20px 0; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.sub:empty { display: none; }
.chip { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; cursor: pointer; white-space: nowrap; color: var(--muted); }
.chip:hover { color: var(--text); border-color: #444; }
.chip.on { background: var(--accent); color: #111; border-color: var(--accent); }
.chip small { opacity: .6; margin-left: 4px; }
.chips.sub .chip { font-size: 12.5px; padding: 4px 10px; }
.activebar { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 20px 0; }
.activebar:empty { display: none; }
.activebar .chip { color: var(--text); border-color: #555; }

/* ---------- grid ---------- */
main { padding: 14px 20px 60px; }
.count { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.grid { display: flex; gap: var(--gap); align-items: flex-start; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.card { position: relative; display: block; border-radius: var(--radius); overflow: hidden;
  background: var(--panel); cursor: zoom-in; text-decoration: none; }
.card .ph { width: 100%; display: block; }
.card img, .card video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .35s; }
.card img.ok, .card video.ok { opacity: 1; }
.card .meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 12px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,.78)); opacity: 0; transition: opacity .2s;
  font-size: 12.5px; }
.card:hover .meta { opacity: 1; }
.card .meta b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta span { color: #bbb; }
.badge { position: absolute; top: 8px; left: 8px; padding: 2px 7px; border-radius: 6px; font-size: 11px;
  background: rgba(0,0,0,.6); backdrop-filter: blur(6px); }
.sentinel { height: 1px; }
.status { text-align: center; color: var(--muted); padding: 24px; font-size: 13px; }

/* ---------- overlay / detail ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; }
.overlay[hidden] { display: none; }
.ov-bar { display: flex; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.ov-spacer { flex: 1; }
.ov-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; font-size: 18px; line-height: 1; }
.ov-btn:hover { border-color: #555; }
.ov-scroll { flex: 1; overflow-y: auto; }
.detail { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 32px;
  padding: 24px 28px; max-width: 1600px; margin: 0 auto; }
@media (max-width: 960px) { .detail { grid-template-columns: 1fr; } }
.media { position: sticky; top: 0; align-self: start; border-radius: var(--radius); overflow: hidden;
  display: flex; justify-content: center; background: var(--panel); }
.media img, .media video { max-width: 100%; max-height: calc(100vh - 120px); display: block; object-fit: contain; }
.info h1 { font-size: 24px; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.3px; }
.info .crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.info .summary { color: #cfcfd4; font-size: 15px; margin: 0 0 18px; }
.info h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  margin: 22px 0 8px; font-weight: 600; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sw { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font-size: 11px; color: var(--muted); }
.sw i { width: 46px; height: 46px; border-radius: 8px; border: 1px solid rgba(255,255,255,.08); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags .chip { font-size: 12px; padding: 3px 10px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.stats { display: flex; gap: 14px; color: var(--muted); font-size: 13px; }
.body { font-size: 14px; color: #d6d6da; }
.body h4 { font-size: 15px; margin: 18px 0 6px; color: var(--text); }
.body p { margin: 0 0 10px; }
.body ul { margin: 0 0 10px; padding-left: 20px; }
.body code { background: var(--panel); padding: 1px 5px; border-radius: 4px; }
.ds-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ds-color { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; background: var(--panel);
  border-radius: 8px; padding: 8px; }
.ds-color i { flex: none; width: 28px; height: 28px; border-radius: 6px; border: 1px solid rgba(255,255,255,.1); }
.ds-color small { color: var(--muted); display: block; }
.ds-type { background: var(--panel); border-radius: 8px; padding: 10px; font-size: 12.5px; margin-bottom: 6px; }
.ds-type b { font-size: 15px; }
.links a { display: inline-block; margin-right: 12px; color: #9ecbff; text-decoration: none; }
.links a:hover { text-decoration: underline; }
.related { padding: 8px 28px 60px; max-width: 1600px; margin: 0 auto; }
.related h2 { font-size: 18px; margin: 24px 0 14px; }
.related h2 small { color: var(--muted); font-weight: 400; font-size: 13px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #fff; color: #111; padding: 8px 14px; border-radius: 8px; transition: transform .25s; z-index: 99; }
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- search ---------- */
.search { position: relative; }
.search input { padding-right: 40px; }
.help-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px;
  border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.help-btn:hover { color: var(--text); }
.suggest, .help { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 6px; z-index: 30;
  box-shadow: 0 12px 40px rgba(0,0,0,.5); max-height: 70vh; overflow-y: auto; }
.suggest[hidden], .help[hidden] { display: none; }
.suggest h6 { margin: 8px 10px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.sg { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.sg small { color: var(--muted); white-space: nowrap; }
.sg.on, .sg:hover { background: #222226; }
.help { padding: 14px 16px; font-size: 13px; }
.help table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.help td { padding: 4px 6px; vertical-align: top; color: var(--muted); }
.help td:first-child { white-space: nowrap; color: var(--text); }
.help code, .notice code { background: #222226; padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.help a, .notice a { color: #9ecbff; text-decoration: none; cursor: pointer; }
.api-link { text-decoration: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; }
.notice { color: var(--muted); font-size: 13px; margin: -4px 0 10px; }
.notice:empty { display: none; }
mark { background: rgba(255, 200, 60, .28); color: inherit; border-radius: 2px; padding: 0 1px; }
