* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 var(--display); -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--text); text-decoration: none; } a:hover { text-decoration: underline; text-underline-offset: 4px; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }
::selection { background: #ff3b3b; color: #fff; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.searchbar {
  display: flex; align-items: center; gap: 10px; flex: 1; max-width: 720px; margin: 0 auto; padding: 0 14px; height: 44px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px; transition: box-shadow .15s, border-color .15s;
}
.searchbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.searchbar .ic { color: var(--muted); }
.searchbar input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; height: 100%; }
.searchbar input::-webkit-search-cancel-button { display: none; }
.searchbar .clear { border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 0 4px; }
.searchbar.big { height: 60px; max-width: 680px; padding: 0 8px 0 20px; box-shadow: var(--shadow); font-size: 17px; }
body.home #top-search { visibility: hidden; }
button.primary {
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: 4px; padding: 0 22px; height: 44px; font-weight: 600;
}
button.primary:hover { filter: brightness(1.08); }
button.primary:disabled { opacity: .55; cursor: default; }
button.ghost, a.ghost {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; display: inline-flex; align-items: center; gap: 8px;
  color: var(--text); font-weight: 500; white-space: nowrap;
}
button.ghost:hover, a.ghost:hover { background: var(--surface-2); text-decoration: none; }
button.danger { color: var(--danger); }
.nav { display: flex; gap: 6px; }
.nav-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 8px 12px; border-radius: 10px; font-weight: 500; }
.nav-btn:hover, .nav-btn.active { background: var(--surface-2); }
.nav-btn.icon-only { padding: 8px; }
.count { background: var(--accent); color: var(--accent-text); border-radius: 4px; font-size: 11px; padding: 1px 7px; }

/* Hero */
.hero { position: relative; max-width: 900px; margin: 0 auto; padding: 11vh 20px 60px; text-align: left; }
.hero h1 { font-size: clamp(40px, 9vw, 96px); line-height: .9; letter-spacing: -.05em; font-weight: 700; margin: 0 0 16px; }
.hero h1 em { font-style: normal; }
.hero .sub { margin-left: 0 !important; color: var(--text); font-size: 20px; line-height: 1.3; max-width: 560px; margin: 0 auto 32px; }
.hero .searchbar { margin: 0; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-start; margin-top: 22px; font-family: var(--mono); }
.chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 6px 14px; font-size: 13.5px; color: var(--text);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.sources-strip { margin-top: 56px; display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: flex-start; color: var(--muted); font: 13px var(--mono); border-top: 1px solid var(--text); padding-top: 14px; }
.sources-strip span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.dot.off { background: var(--border); } .dot.err { background: var(--danger); }

/* Filters */
.filterbar {
  position: sticky; top: 65px; z-index: 20; display: flex; gap: 8px; padding: 10px 20px; overflow-x: auto; scrollbar-width: none;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.pill-wrap { position: relative; flex: none; }
.pill {
  display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 4px; background: var(--surface);
  border: 1px solid var(--border); font-size: 13.5px; white-space: nowrap;
}
.pill:hover { border-color: var(--muted); }
.pill.set { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.pill .caret { width: 12px; height: 12px; opacity: .6; }
.menu {
  position: fixed; z-index: 60; min-width: 220px; max-width: 320px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; max-height: 70vh; overflow: auto;
}
.menu .opt { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; }
.menu .opt:hover { background: var(--surface-2); }
.menu .opt[aria-checked="true"] { color: var(--accent); font-weight: 600; }
.menu .opt small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.menu .opt[disabled] { opacity: .5; cursor: default; }
.menu .check { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.menu .menu-actions { display: flex; gap: 8px; padding: 4px 10px; font-size: 13px; }
.menu .menu-actions button { background: none; border: 0; color: var(--accent); padding: 2px 0; }
.reset { background: none; border: 0; color: var(--muted); padding: 0 8px; flex: none; }
.reset:hover { color: var(--text); }

/* Status & grid */
.statusbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 20px 4px; color: var(--muted); font-size: 13px; }
.statusbar .src { display: inline-flex; align-items: center; gap: 6px; }
.statusbar .src.err { color: var(--danger); }
.grid { display: flex; flex-wrap: wrap; gap: var(--gap); padding: 10px 20px 20px; align-content: flex-start; }
.card {
  position: relative; flex: none; overflow: hidden; border-radius: 8px; background: var(--surface-2); cursor: zoom-in; isolation: isolate;
  animation: fade .3s both;
}
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.card:hover img { transform: scale(1.03); }
.card .shade {
  position: absolute; inset: 0; opacity: 0; transition: opacity .18s; pointer-events: none;
  background: linear-gradient(to bottom, rgb(0 0 0 / .45), transparent 35%, transparent 55%, rgb(0 0 0 / .7));
}
.card:hover .shade, .card:focus-within .shade { opacity: 1; }
.card .meta { position: absolute; left: 10px; right: 10px; bottom: 8px; color: #fff; opacity: 0; transition: opacity .18s; pointer-events: none; font-size: 12.5px; text-shadow: 0 1px 3px rgb(0 0 0 / .6); }
.card .meta b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta span { opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.card:hover .meta, .card:focus-within .meta { opacity: 1; }
.badge {
  position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; color: #fff;
  background: rgb(0 0 0 / .5); backdrop-filter: blur(6px); opacity: 0; transition: opacity .18s;
}
.card:hover .badge { opacity: 1; }
.card-actions { position: absolute; right: 8px; top: 8px; display: flex; gap: 6px; }
.round {
  width: 32px; height: 32px; border-radius: 4px; border: 0; display: grid; place-items: center; color: #fff;
  background: rgb(0 0 0 / .5); backdrop-filter: blur(6px); opacity: 0; transition: opacity .18s, background .15s, transform .1s;
}
.round:hover { background: rgb(0 0 0 / .75); } .round:active { transform: scale(.92); }
.card:hover .round, .card:focus-within .round, .round.on { opacity: 1; }
.round.on { background: var(--accent); color: var(--accent-text); }
.round.on .ic { fill: currentColor; }
@media (hover: none) { .round, .badge, .card .meta, .card .shade { opacity: 1; } .card .shade { opacity: .6; } }
.loader { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 24px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 18px; }
.skeleton { background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface) 50%, var(--surface-2) 70%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Overlays */
.overlay { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; animation: fade .15s both; }
.viewer-body { display: grid; grid-template-columns: 1fr 380px; flex: 1; min-height: 0; }
.stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 20px 64px; background: color-mix(in srgb, var(--surface-2) 70%, var(--bg)); }
.stage > img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: var(--shadow); }
.stage .spinner { position: absolute; }
.nav-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; box-shadow: var(--shadow); }
.nav-arrow:hover { background: var(--surface-2); } .nav-arrow.prev { left: 12px; } .nav-arrow.next { right: 12px; }
.nav-arrow:disabled { opacity: .35; cursor: default; }
.close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; }
.close:hover { background: var(--surface-2); }
.side { overflow: auto; padding: 22px 22px 28px; border-left: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 18px; }
.side h2 { margin: 0; font-size: 20px; line-height: 1.25; letter-spacing: -.01em; padding-right: 36px; overflow-wrap: anywhere; }
.side .by { color: var(--muted); font-size: 14px; margin-top: 4px; }
.side .desc { color: var(--muted); font-size: 14px; margin: 0; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.actions { display: grid; gap: 8px; }
.actions .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions button.primary, .actions .primary { height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.actions .ghost { justify-content: center; }
.box { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--bg); }
.box h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.lic-name { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.perms { display: grid; gap: 6px; font-size: 13.5px; }
.perm { display: flex; gap: 8px; align-items: center; } .perm i { font-style: normal; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--ok); }
.perm.no i { background: var(--danger); } .perm.warn i { background: #d99a1d; }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13.5px; }
dl.facts dt { color: var(--muted); } dl.facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; } .tags .chip { font-size: 12.5px; padding: 3px 10px; }
.attr { font-size: 13px; color: var(--muted); margin: 0 0 10px; user-select: all; }

/* Studio */
.studio-head { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.studio-head h3 { margin: 0; font-size: 15px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-body { display: grid; grid-template-columns: 1fr 340px; flex: 1; min-height: 0; }
.canvas { position: relative; overflow: hidden; display: grid; place-items: center; min-height: 0; min-width: 0; padding: 20px; background:
  conic-gradient(#0000 25%, color-mix(in srgb, var(--muted) 8%, transparent) 0 50%, #0000 0 75%, color-mix(in srgb, var(--muted) 8%, transparent) 0) 0 0 / 24px 24px, var(--surface-2); }
.fit { position: relative; user-select: none; touch-action: none; }
.fit > img { width: 100%; height: 100%; display: block; pointer-events: none; }
.crop-shade { position: absolute; inset: 0; pointer-events: none; }
.crop-box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgb(0 0 0 / .55); cursor: move; outline: 1px solid rgb(0 0 0 / .4); }
.crop-box::before, .crop-box::after { content: ""; position: absolute; inset: 0; pointer-events: none; background:
  linear-gradient(#fff6 0 0) 33.33% 0 / 1px 100% no-repeat, linear-gradient(#fff6 0 0) 66.66% 0 / 1px 100% no-repeat,
  linear-gradient(#fff6 0 0) 0 33.33% / 100% 1px no-repeat, linear-gradient(#fff6 0 0) 0 66.66% / 100% 1px no-repeat; }
.hd { position: absolute; width: 16px; height: 16px; background: #fff; border-radius: 4px; box-shadow: 0 0 0 1px rgb(0 0 0 / .5); }
.hd[data-h="nw"] { left: -9px; top: -9px; cursor: nwse-resize; } .hd[data-h="ne"] { right: -9px; top: -9px; cursor: nesw-resize; }
.hd[data-h="sw"] { left: -9px; bottom: -9px; cursor: nesw-resize; } .hd[data-h="se"] { right: -9px; bottom: -9px; cursor: nwse-resize; }
.hd[data-h="n"] { left: calc(50% - 8px); top: -9px; cursor: ns-resize; } .hd[data-h="s"] { left: calc(50% - 8px); bottom: -9px; cursor: ns-resize; }
.hd[data-h="w"] { top: calc(50% - 8px); left: -9px; cursor: ew-resize; } .hd[data-h="e"] { top: calc(50% - 8px); right: -9px; cursor: ew-resize; }
.crop-label { position: absolute; left: 0; top: -28px; background: rgb(0 0 0 / .75); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.tabs { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 3px; z-index: 3; box-shadow: var(--shadow); }
.tabs button { border: 0; background: none; padding: 5px 16px; border-radius: 4px; font-size: 13.5px; font-weight: 500; }
.tabs button.on { background: var(--accent); color: var(--accent-text); }
.panel { overflow: auto; padding: 18px; border-left: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 14px; }
.field { display: grid; gap: 6px; font-size: 13.5px; }
.field > label, .field > .lbl { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--border); background: var(--bg); border-radius: 8px; padding: 5px 10px; font-size: 13px; }
.seg button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.inputs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.panel input[type="number"], .panel select { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.panel input[type="range"] { width: 100%; accent-color: var(--accent); }
.lock { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); display: grid; place-items: center; }
.lock.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.result { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--bg); display: grid; gap: 4px; font-size: 13.5px; }
.result .big { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.result .save { color: var(--ok); font-weight: 600; } .result .save.up { color: var(--danger); }
.hint { color: var(--muted); font-size: 12.5px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.switch { display: flex; align-items: center; gap: 8px; font-size: 13.5px; } .switch input { accent-color: var(--accent); width: 16px; height: 16px; }

/* Collections */
.collections { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 65px); }
.coll-list { border-right: 1px solid var(--border); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.coll-item { display: flex; justify-content: space-between; gap: 10px; background: none; border: 0; text-align: left; padding: 9px 12px; border-radius: 10px; }
.coll-item:hover { background: var(--surface-2); } .coll-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.coll-item small { color: var(--muted); }
.coll-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 4px; flex-wrap: wrap; }
.coll-head h2 { margin: 0; flex: 1; font-size: 22px; letter-spacing: -.02em; min-width: 140px; }
.coll-main { min-width: 0; }

/* Popover + toasts */
.popover { position: fixed; z-index: 80; width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; color: var(--text); }
.popover h5 { margin: 4px 8px 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.popover label { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.popover label:hover { background: var(--surface-2); } .popover input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.popover form { display: flex; gap: 6px; padding: 6px 4px 2px; border-top: 1px solid var(--border); margin-top: 6px; }
.popover form input { flex: 1; min-width: 0; height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; background: var(--bg); }
.popover form button { height: 34px; padding: 0 12px; border-radius: 8px; border: 0; background: var(--accent); color: var(--accent-text); font-weight: 600; }
#toasts { position: fixed; z-index: 100; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); animation: fade .2s both; }

@media (max-width: 900px) {
  .viewer-body, .studio-body { grid-template-columns: 1fr; grid-template-rows: minmax(240px, 45vh) 1fr; overflow: auto; }
  .stage { padding: 12px 16px; } .side, .panel { border-left: 0; border-top: 1px solid var(--border); overflow: visible; }
  .collections { grid-template-columns: 1fr; } .coll-list { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .coll-item { flex: none; } .nav-btn span { display: none; }
  .topbar { padding: 8px 12px; gap: 8px; } .brand span { display: none; } .filterbar { top: 61px; padding: 8px 12px; }
  .grid { padding: 8px 12px; } .statusbar { padding: 10px 12px 2px; }
  .nav-arrow { width: 36px; height: 36px; } .nav-arrow.prev { left: 4px; } .nav-arrow.next { right: 4px; }
  .studio-body { grid-template-rows: minmax(260px, 50vh) 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Gather: violet accent on the shared minimal dark tokens (neonatica.css) */
:root { --accent: #a78bfa; --accent-soft: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
::selection { background: var(--accent); color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.topbar { background: var(--bg); backdrop-filter: none; }
.brand img { display: none; }
.brand::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.brand .neon { color: inherit; }
.searchbar, .searchbar.big { border-radius: var(--radius-sm); box-shadow: none; }
.searchbar.big { height: 56px; }
button.primary { border-radius: var(--radius-sm); color: var(--accent-text); }
button.ghost, a.ghost { border-radius: var(--radius-sm); }
.nav-btn, .tabs button, .seg button, .coll-item, .menu .opt, .field input, .panel select { border-radius: var(--radius-sm); }
.count { border-radius: 99px; }
.chip { border-radius: 99px; background: none; border-color: var(--line); color: var(--muted); font-size: 12px; padding: 3px 12px; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.pill { border-radius: 99px; }
.hero { max-width: 68rem; padding: 12vh 24px 60px; }
.hero h1 { font-size: clamp(2.4rem, 7vw, 4.5rem); line-height: 1.02; letter-spacing: -.035em; font-weight: 600; max-width: 46rem; }
.hero h1 em { color: var(--accent); }
.hero .sub { color: var(--muted); font-size: 1.15rem; line-height: 1.55; max-width: 36rem; }
.hero .sub span { color: var(--muted) !important; }
.sources-strip { border-top: 1px solid var(--line); }
.card, .box, .result, .menu, .popover { box-shadow: none; }
.menu, .popover, .toast, .stage > img, .nav-arrow, .tabs { box-shadow: 0 8px 24px #0008; }

/* Polish pass: layout fixes, quieter surfaces, mono labels */
.viewer-body { grid-template-columns: minmax(0, 1fr) 380px; }
.studio-body { grid-template-columns: minmax(0, 1fr) 340px; }
.side > *, .panel > *, .actions > *, .actions .row > * { min-width: 0; }
.actions .ghost, .actions .primary { overflow: hidden; text-overflow: ellipsis; }
.actions .ghost { white-space: nowrap; }
.actions button.primary, .actions .primary { border-radius: var(--radius-sm); height: 44px; }
button.primary { height: 40px; }
.searchbar.big button.primary { height: 40px; }
button.ghost, a.ghost { padding: 7px 12px; font-size: 14px; }
.topbar { padding: 0 20px; height: 56px; }
.filterbar { top: 56px; }
.collections { min-height: calc(100vh - 56px); }
.nav-btn { color: var(--muted); border-radius: var(--radius-sm); }
.nav-btn:hover, .nav-btn.active { color: var(--text); background: var(--surface); }
.searchbar { height: 38px; background: var(--surface); }
.searchbar:focus-within { box-shadow: none; }
.hero { padding-top: 14vh; }
.hero .searchbar.big { max-width: 640px; padding: 0 8px 0 16px; }
.hero .sub { margin-bottom: 28px; }
.suggest { margin-top: 18px; }
.sources-strip { margin-top: 64px; font-size: 12px; }
.statusbar { font: 12px var(--mono); padding: 12px 20px 2px; }
.pill { height: 30px; font-size: 13px; background: none; color: var(--muted); }
.pill:hover { color: var(--text); }
.pill.set { background: var(--accent-soft); color: var(--accent); }
.filterbar { padding: 10px 20px; }
.card { border-radius: var(--radius-sm); background: var(--surface); }
.card img { transition: opacity .2s; }
.card:hover img { transform: none; opacity: .72; }
.card .shade { background: none; }
.card .meta { text-shadow: none; }
.card .meta b, .card .meta span { background: none; }
.card:hover, .card:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
.badge, .round { background: rgb(11 12 15 / .8); backdrop-filter: none; border: 1px solid var(--border); font-family: var(--mono); font-weight: 500; }
.round:hover { background: var(--bg); border-color: var(--muted); }
.round.on { border-color: var(--accent); }
.skeleton { background: var(--surface-2); animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .45; } }
.empty { padding: 96px 20px; }
.empty h3 { font-weight: 600; }
.stage { background: var(--bg); }
.stage > img { box-shadow: none; border-radius: var(--radius-sm); }
.nav-arrow, .close { box-shadow: none; background: var(--bg); }
.side { background: var(--bg); border-left-color: var(--line); gap: 16px; }
.side h2 { font-size: 18px; font-weight: 600; }
.box { background: var(--surface); border-color: var(--line); border-radius: var(--radius-sm); }
.box h4, .field > label, .field > .lbl, .popover h5 { font: 500 11px var(--mono); letter-spacing: .08em; color: var(--muted); }
.perm i { width: 16px; height: 16px; font-size: 10px; color: var(--bg); }
.perm.warn i { background: var(--warn); }
.tags .chip { font-size: 11.5px; padding: 2px 10px; }
.studio-head { padding: 8px 16px; height: 56px; border-bottom-color: var(--line); }
.studio-head h3 { font-weight: 500; font-size: 14px; color: var(--muted); }
.canvas { background: var(--surface); }
.panel { background: var(--bg); border-left-color: var(--line); padding: 20px 18px; gap: 18px; }
.seg button, .panel input[type="number"], .panel select, .lock { background: var(--surface); border-radius: var(--radius-sm); }
.seg button:hover { border-color: var(--muted); }
.result { background: var(--surface); border-color: var(--line); border-radius: var(--radius-sm); }
.result .big { font-size: 18px; }
.tabs { background: var(--bg); box-shadow: none; }
.coll-list { border-right-color: var(--line); padding: 16px 12px; }
.coll-item { color: var(--muted); }
.coll-item:hover { color: var(--text); background: var(--surface); }
.coll-item.on { color: var(--accent); background: var(--accent-soft); font-weight: 500; }
.coll-item small { font-family: var(--mono); font-size: 12px; }
.coll-head { padding: 20px 20px 8px; }
.coll-head h2 { font-size: 20px; font-weight: 600; }
.popover form input, .popover form button { border-radius: var(--radius-sm); }
.toast { border-radius: var(--radius-sm); }
@media (max-width: 900px) {
  .topbar { padding: 0 12px; height: 56px; } .filterbar { top: 56px; padding: 8px 12px; }
  .viewer-body, .studio-body { grid-template-columns: minmax(0, 1fr); }
  .stage > img { max-height: 42vh; }
  .hero { padding-top: 9vh; }
  .coll-head h2 { flex-basis: 100%; }
}
@media (max-width: 900px) { body:not(.home) .brand span { display: none; } .brand span { display: inline; } }
@media (max-width: 520px) {
  .hero .searchbar.big { padding-left: 12px; }
}

/* Polish pass 2: grid rhythm, viewer actions, studio and collections on mobile */
.grid { gap: 6px; }
.actions .row:has(a.ghost) { grid-template-columns: auto minmax(0, 1fr); }
.actions .lbl-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nav-arrow, .close { background: rgb(11 12 15 / .85); }
.nav-arrow:hover, .close:hover { background: var(--bg); border-color: var(--muted); }
.round.on { background: rgb(11 12 15 / .85); color: var(--accent); border-color: var(--accent); }
.coll-item { align-items: baseline; }
.field > label, .field > .lbl { text-transform: uppercase; }
.hero { padding-top: 16vh; }
@media (max-width: 900px) {
  .coll-list { align-items: center; padding: 10px 12px; }
  .coll-item { height: 36px; align-items: center; gap: 8px; }
  .canvas { padding-top: 56px; }
  .tabs { top: 10px; }
  .stage { padding: 56px 16px 12px; }
  .close { top: 8px; right: 8px; }
}
@media (max-width: 900px) {
  .collections { grid-template-rows: auto 1fr; }
  .canvas { padding-bottom: 40px; }
}
@media (max-width: 900px) { .stage > img { max-height: calc(45vh - 68px); } .stage { min-height: 0; } }
@media (max-width: 900px) { .viewer-body { grid-template-rows: 45vh auto; } .stage > img { max-height: 100%; min-height: 0; } }
