/* Public library: hero, filter bar, work cards, detail dialog, publish wizard. */

.plaza-main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 16px clamp(16px, 2.4vw, 30px) 52px;
}

/* ---------- top bar ---------- */

.plaza-topbar {
  gap: 12px;
}

/* Top-bar discovery nav: 作品库 / 关注 / 收藏 / 我的. Kept visually lighter
   than the search controls so the page still reads as a library, not a menu. */
/* The four-item nav and the account cluster leave less room for search; a
   smaller flex basis keeps the signed-in header on one line at 1440px. */
.plaza-topbar .ui-search {
  flex: 1 1 200px;
  min-width: 160px;
}

.plaza-nav {
  flex-shrink: 0;
}

.plaza-nav a {
  padding: 7px 12px;
  font-size: 12.5px;
}

.topbar-selects {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-selects .ui-select {
  width: auto;
  min-width: 108px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.topbar-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.topbar-filter svg {
  width: 15px;
  height: 15px;
}

/* The filter trigger belongs to the category bar, aligned with its right
   edge. On narrow screens the bar scrolls sideways but the trigger stays put. */
.category-bar {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 10px;
}

.category-bar .filters {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
}

.category-filter {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: auto;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  white-space: nowrap;
}

.category-filter svg {
  width: 15px;
  height: 15px;
}

.filter-count {
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 99px;
  background: rgb(var(--accent-rgb) / 0.9);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 9px;
}

.topbar-publish-ico {
  font-size: 16px;
  line-height: 1;
  font-weight: 500;
}

/* ---------- welcome hero ---------- */

/* P0: the hero is a 96px band so the gallery starts above the 240px line even
   on a 720px-tall viewport. The title and the one-line pitch share a row, the
   animation is a compact panel on the right, and nothing else competes. */
.home-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 96px;
  overflow: hidden;
  padding: 0 0 0 20px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--hero-bg);
  box-shadow:
    inset 0 1px 0 rgb(var(--tint-rgb) / 0.07),
    0 40px 80px -60px var(--shadow-strong);
}

.home-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgb(var(--grid-rgb) / 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgb(var(--grid-rgb) / 0.055) 1px, transparent 1px);
  background-size: 38px 38px;
  -webkit-mask-image: linear-gradient(90deg, #000, transparent 72%);
  mask-image: linear-gradient(90deg, #000, transparent 72%);
}

.home-hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 16px;
  row-gap: 4px;
  min-width: 0;
}

.home-hero h2 {
  margin: 0;
  font-size: clamp(17px, 1.5vw, 21px);
  font-weight: 720;
  letter-spacing: -0.035em;
  line-height: 1.18;
  white-space: nowrap;
}

.home-hero h2 em {
  font-style: normal;
  background: var(--hero-headline-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.home-hero p {
  display: -webkit-box;
  flex: 1 1 260px;
  max-width: 520px;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.home-hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

/* The animation keeps a compact panel on the right edge of the band. */
.home-hero-art {
  position: relative;
  z-index: 1;
  flex: 0 0 176px;
  width: 176px;
  height: 100%;
  overflow: hidden;
  border-left: 1px solid var(--line-strong);
  border-radius: 0 15px 15px 0;
  background:
    radial-gradient(220px 160px at 50% 0%, rgb(var(--accent-rgb) / 0.18), transparent 70%),
    #05080f;
}

.home-hero-art .laser-stage {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
}

/* At 1280px and below the top bar wraps to two rows; keeping the marketing hero
   would push the first work card past the 240px line, so the page starts with
   the library itself. The hero stays on wide desktop screens. */
@media (max-width: 1280px) {
  .home-hero {
    display: none;
  }
}

/* ---------- page heading (signed-in view) ---------- */

.plaza-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 4px 0 16px;
}

.plaza-head h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 720;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.plaza-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- filter bar ---------- */

/* One line, always: categories scroll sideways while the filter trigger stays
   pinned to the right edge of the bar. Tags moved into the filter drawer, so the
   strip no longer wraps to a second row. */
.filters {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 10px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(var(--tint-rgb) / 0.025);
  backdrop-filter: blur(14px);
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

/* Fade the right edge only while there is more to scroll; the last category
   must stay fully readable at the end of the strip. */
.filters.can-scroll:not(.at-end) {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 16px), transparent 100%);
  mask-image: linear-gradient(90deg, #000 calc(100% - 16px), transparent 100%);
}

.filters::-webkit-scrollbar {
  display: none;
}

.filters > * {
  flex: 0 0 auto;
}

.chip {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgb(var(--tint-rgb) / 0.03);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  user-select: none;
  transition:
    color 0.16s var(--ease),
    background 0.16s var(--ease),
    border-color 0.16s var(--ease);
}

.chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgb(var(--tint-rgb) / 0.06);
}

.chip.on {
  border-color: rgb(var(--accent-rgb) / 0.5);
  background: var(--chip-on-bg);
  color: var(--chip-on-text);
  box-shadow: 0 8px 20px -14px var(--accent);
}

/* ---------- active filters ---------- */

.active-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: -8px 0 16px;
}

.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 5px 4px 10px;
  border: 1px solid rgb(var(--accent-rgb) / 0.34);
  border-radius: 99px;
  background: var(--chip-on-bg);
  color: var(--chip-on-text);
  font-size: 11.5px;
}

.active-chip b {
  font-weight: 600;
}

.active-chip button {
  width: 17px;
  height: 17px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(var(--tint-rgb) / 0.12);
  color: inherit;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.active-chip button:hover {
  background: rgb(var(--tint-rgb) / 0.22);
}

.active-clear {
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.active-clear:hover {
  color: var(--text);
}

/* ---------- advanced filter dialog ---------- */

.filter-dlg {
  width: min(760px, calc(100% - 32px));
}

.filter-shell {
  display: flex;
  flex-direction: column;
  max-height: min(84vh, 780px);
}

.filter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--line);
}

.filter-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.filter-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.filter-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 28px;
  padding: 20px 24px;
  overflow-y: auto;
}

.filter-group h3 {
  margin: 0 0 9px;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 620;
  letter-spacing: 0.01em;
}

.filter-group-wide {
  grid-column: 1 / -1;
}

.filter-group h3 small {
  margin-left: 6px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 400;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-empty {
  color: var(--faint);
  font-size: 12px;
}

.filter-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--line);
}

.filter-result {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.filter-foot-actions {
  display: flex;
  gap: 8px;
}

/* ---------- gallery ---------- */

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card-bg);
  box-shadow: inset 0 1px 0 rgb(var(--tint-rgb) / 0.05);
  cursor: pointer;
  transition:
    transform 0.22s var(--ease),
    border-color 0.22s var(--ease),
    box-shadow 0.22s var(--ease);
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgb(var(--accent-rgb) / 0.34);
  box-shadow:
    0 30px 60px -32px var(--shadow-strong),
    0 0 0 1px rgb(var(--accent-rgb) / 0.12);
}

.thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background:
    radial-gradient(360px 180px at 50% 0%, rgb(var(--accent-rgb) / 0.12), transparent 72%),
    var(--media-bg-strong);
  color: var(--faint);
  font-size: 11.5px;
}

.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-bottom: 1px solid var(--line);
  pointer-events: none;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.5s var(--ease);
}

.card:hover .thumb img {
  transform: scale(1.035);
}

.thumb-empty {
  display: grid;
  place-items: center;
  gap: 6px;
  color: var(--faint);
  font-size: 11px;
}

.thumb-empty b {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--faint);
  font: 700 16px/1 var(--mono);
}

.card-badges {
  position: absolute;
  top: 10px;
  right: 10px;
  left: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.card-cat,
.card-filecount {
  padding: 3px 9px;
  border: 1px solid rgb(var(--tint-rgb) / 0.16);
  border-radius: 99px;
  background: var(--badge-bg);
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.card-cat {
  border-color: var(--accent-line);
  color: var(--accent-text-strong);
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  padding: 13px 15px 14px;
}

/* Who made it: avatar + name right under the cover, linking to the author page. */
.card-author {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  max-width: 100%;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}

/* The whole card opens the detail dialog; the author link sits above it. */
.card-open {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.card-open:focus-visible {
  outline: 2px solid rgb(var(--accent-rgb) / 0.75);
  outline-offset: -3px;
}

.card:focus-within {
  border-color: rgb(var(--accent-rgb) / 0.34);
}

.card-author .ui-avatar {
  width: 22px;
  height: 22px;
  font-size: 9.5px;
  box-shadow: none;
}

.card-author-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

a.card-author:hover {
  color: var(--accent-text);
}

a.card-author:hover .card-author-name {
  text-decoration: underline;
}

.card-author.is-official {
  color: var(--faint);
}

.card-author-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  color: var(--faint);
  font: 700 9px/1 var(--mono);
}

/* The role sits next to the name and stays visible even on a zero-like card. */
.card-role {
  flex: 0 0 auto;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgb(var(--tint-rgb) / 0.045);
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.5;
}

.card-role.is-admin {
  border-color: var(--accent-line);
  background: rgb(var(--accent-rgb) / 0.12);
  color: var(--accent-text-strong);
}

.card-role.is-reviewer {
  border-color: rgb(var(--ok-rgb) / 0.34);
  background: rgb(var(--ok-rgb) / 0.1);
  color: var(--ok-text);
}

/* Non-numeric identity signals: official / sample / first work / new this week.
   They do not depend on likes or downloads, so a brand-new card still explains
   itself. */
.card-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: -1px;
}

.signal {
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgb(var(--tint-rgb) / 0.045);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.55;
  letter-spacing: 0.01em;
}

.signal-official {
  border-color: var(--accent-line);
  background: rgb(var(--accent-rgb) / 0.12);
  color: var(--accent-text-strong);
}

.signal-sample {
  color: var(--muted);
}

.signal-first {
  border-color: rgb(var(--ok-rgb) / 0.34);
  background: rgb(var(--ok-rgb) / 0.1);
  color: var(--ok-text);
}

.signal-new {
  border-color: rgb(var(--warn-rgb) / 0.34);
  background: rgb(var(--warn-rgb) / 0.1);
  color: var(--warn-text);
}

.card-title {
  color: var(--text);
  font-size: 14.5px;
  font-weight: 620;
  line-height: 1.4;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-summary {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.tag {
  padding: 1px 8px;
  border: 1px solid rgb(var(--accent-rgb) / 0.2);
  border-radius: 99px;
  background: rgb(var(--accent-rgb) / 0.08);
  color: var(--accent-text);
  font-size: 10.5px;
}

/* Cutting parameters on a browse card: the "fits my machine" line. */
.card-cut {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.card-cut span {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgb(var(--tint-rgb) / 0.045);
  color: var(--text-soft);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.meta {
  display: flex;
  gap: 11px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: auto;
  padding-top: 4px;
  color: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.meta .meta-views::before {
  content: "◎";
  margin-right: 3px;
}

.meta .meta-dl::before {
  content: "↓";
  margin-right: 3px;
}

.meta .meta-like::before {
  content: "♥";
  margin-right: 3px;
}

.meta .meta-boost::before {
  content: "⚡";
  margin-right: 3px;
}

.meta .meta-comment::before {
  content: "◌";
  margin-right: 3px;
}

.meta .meta-date {
  margin-left: auto;
}

.meta .meta-quiet {
  color: var(--faint);
  font-style: italic;
}

.empty,
.loading {
  padding: 64px 0;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.more {
  margin-top: 24px;
  text-align: center;
}

/* ---------- getting-started blocks (sparse library) ---------- */

/* Below 8 works the gallery leaves a wide free column; the three blocks fill it
   instead of blank pixels. They sit beside the cards only when the row really
   fits: one or two cards from 1101px, three cards from 1320px. Otherwise the
   panel follows the gallery as a full-width row. */
.library {
  display: grid;
  gap: 18px;
}

/* One card + panel: 300 + 18 + 340 = 658px of content is the floor. */
@media (min-width: 1101px) {
  .library.is-sparse[data-cards='1'],
  .library.is-sparse[data-cards='2'] {
    display: flex;
    align-items: stretch;
    gap: 18px;
  }

  .library.is-sparse[data-cards='1'] .grid,
  .library.is-sparse[data-cards='2'] .grid {
    display: flex;
    flex: 0 0 auto;
    gap: 14px;
  }

  .library.is-sparse[data-cards='1'] .grid .card,
  .library.is-sparse[data-cards='2'] .grid .card {
    width: 300px;
  }

  .library.is-sparse[data-cards='1'] .starter,
  .library.is-sparse[data-cards='2'] .starter {
    flex: 1 1 0;
    min-width: 340px;
  }
}

/* Three cards + panel: 3x290 + gaps + 340 = 1252px of content, i.e. 1320px viewport. */
@media (min-width: 1320px) {
  .library.is-sparse[data-cards='3'] {
    display: flex;
    align-items: stretch;
    gap: 18px;
  }

  .library.is-sparse[data-cards='3'] .grid {
    display: flex;
    flex: 0 0 auto;
    gap: 14px;
  }

  .library.is-sparse[data-cards='3'] .grid .card {
    width: 290px;
  }

  .library.is-sparse[data-cards='3'] .starter {
    flex: 1 1 0;
    min-width: 340px;
  }
}

/* A single work leaves a wide panel: three blocks share it. A narrow side panel
   reads better with stacked full-width blocks; a wide one (below 1101px, or the
   stacked three-card case) falls back to the auto-fit grid. */
@media (min-width: 1101px) {
  .library.is-sparse[data-cards='1'] .starter-blocks {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .library.is-sparse[data-cards='2'] .starter-blocks {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1320px) {
  .library.is-sparse[data-cards='3'] .starter-blocks {
    grid-template-columns: 1fr;
  }
}

.starter {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(420px 200px at 0% 0%, rgb(var(--accent-rgb) / 0.1), transparent 70%),
    rgb(var(--tint-rgb) / 0.02);
  box-shadow: inset 0 1px 0 rgb(var(--tint-rgb) / 0.05);
}

.starter-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.starter-head b {
  font-size: 13.5px;
  letter-spacing: -0.01em;
}

.starter-head span {
  color: var(--muted);
  font-size: 11.5px;
}

.starter-blocks {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.starter-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(var(--tint-rgb) / 0.03);
}

.starter-kicker {
  color: var(--accent-text);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.starter-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.starter-card .ui-btn {
  align-self: flex-start;
  margin-top: auto;
}

.starter-steps {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: starter-step;
}

.starter-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 11.5px;
  line-height: 1.4;
  counter-increment: starter-step;
}

.starter-steps li::before {
  content: counter(starter-step);
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1px solid rgb(var(--accent-rgb) / 0.34);
  border-radius: 50%;
  background: rgb(var(--accent-rgb) / 0.1);
  color: var(--accent-text);
  font-size: 9.5px;
  font-weight: 700;
}

/* Generic plaza buttons rendered by JS keep a modern look. */
.plaza-main button.ghost,
#detail button.ghost,
#publish button.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgb(var(--tint-rgb) / 0.04);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
}

.plaza-main button.ghost:hover,
#detail button.ghost:hover,
#publish button.ghost:hover {
  background: rgb(var(--tint-rgb) / 0.08);
  border-color: rgb(var(--tint-rgb) / 0.24);
  color: var(--text);
}

button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- detail dialog ---------- */

.detail-dlg {
  width: min(1080px, calc(100% - 24px));
  max-height: 92vh;
  border-radius: 24px;
  overflow: hidden;
}

.detail-shell {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow-y: auto;
}

.detail-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 26px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--sticky-bg);
  backdrop-filter: blur(20px);
}

.detail-head-main {
  min-width: 0;
}

.detail-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.detail-sub {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 7px;
  color: var(--faint);
  font-size: 11.5px;
}

.detail-sub .status-badge {
  padding: 2px 9px;
  border: 1px solid rgb(var(--warn-rgb) / 0.34);
  border-radius: 99px;
  background: rgb(var(--warn-rgb) / 0.1);
  color: var(--warn-text);
  font-size: 10.5px;
  font-weight: 600;
}

.detail-close {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(var(--tint-rgb) / 0.04);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.detail-close:hover {
  background: rgb(var(--tint-rgb) / 0.09);
  color: var(--text);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
}

.detail-media {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 22px 24px;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(500px 300px at 50% 0%, rgb(var(--accent-rgb) / 0.08), transparent 70%),
    rgb(var(--tint-rgb) / 0.012);
}

.dlg-cover {
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--media-bg);
  padding: 12px;
}

.dlg-cover img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

.gallery {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.gallery::-webkit-scrollbar {
  display: none;
}

.gallery img {
  flex: 0 0 auto;
  width: 84px;
  height: 58px;
  padding: 3px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--media-bg);
  object-fit: contain;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), transform 0.16s var(--ease);
}

.gallery img:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.gallery img.on {
  border-color: rgb(var(--accent-rgb) / 0.75);
  box-shadow: 0 0 0 2px rgb(var(--accent-rgb) / 0.16);
}

.detail-info {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 22px 24px;
}

.detail-info .card-summary {
  -webkit-line-clamp: 4;
  font-size: 13px;
  color: var(--text-soft);
}

.view-desc {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.kv {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 7px 14px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(var(--tint-rgb) / 0.02);
  color: var(--muted);
  font-size: 12px;
}

.kv > span {
  color: var(--faint);
}

.kv b {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-weight: 500;
}

.kv a {
  color: var(--link-soft);
}

.files {
  display: grid;
  gap: 9px;
}

.files h3 {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.asset {
  display: grid;
  gap: 8px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgb(var(--tint-rgb) / 0.025);
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}

.asset:hover {
  border-color: var(--line-strong);
  background: rgb(var(--tint-rgb) / 0.04);
}

.asset-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

.asset-head b {
  font-size: 13px;
  font-weight: 620;
}

.asset-sub {
  color: var(--faint);
  font-size: 10.5px;
  overflow-wrap: anywhere;
}

.asset-badge {
  padding: 1px 8px;
  border: 1px solid rgb(var(--ok-rgb) / 0.3);
  border-radius: 99px;
  background: rgb(var(--ok-rgb) / 0.1);
  color: var(--ok-text);
  font-size: 10px;
  font-weight: 600;
}

.asset.is-doc {
  border-style: dashed;
}

.asset-badge.is-doc {
  border-color: rgb(var(--warn-rgb) / 0.34);
  background: rgb(var(--warn-rgb) / 0.1);
  color: var(--warn-text);
}

.profile-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--faint);
  font-size: 10.5px;
}

.profile-meta span {
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgb(var(--tint-rgb) / 0.03);
}

.asset-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.asset-actions .ui-select {
  width: auto;
  min-width: 96px;
}

.origin-badge {
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgb(var(--tint-rgb) / 0.04);
  color: var(--muted);
  font-size: 10.5px;
}

.detail-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px 26px;
  border-top: 1px solid var(--line);
  background: var(--sticky-bg);
  backdrop-filter: blur(20px);
}

.detail-actions .ui-btn,
.detail-actions button {
  height: 34px;
}

.detail-actions .is-on {
  border-color: rgb(var(--danger-rgb) / 0.5);
  background: rgb(var(--danger-rgb) / 0.12);
  color: var(--danger-text);
}

.detail-actions .is-on.fav {
  border-color: rgb(var(--warn-rgb) / 0.5);
  background: rgb(var(--warn-rgb) / 0.1);
  color: var(--warn-text);
}

.detail-actions .ui-muted,
.detail-actions .who {
  color: var(--muted);
  font-size: 12px;
}

.msg {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.msg.err {
  color: var(--danger-text);
}

.msg.ok {
  color: var(--ok-text);
}

.comments {
  display: grid;
  gap: 11px;
  padding: 20px 26px 24px;
  border-top: 1px solid var(--line);
  background: rgb(var(--tint-rgb) / 0.012);
}

.comments h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.comments h3 span {
  margin-left: 4px;
  color: var(--faint);
  font-weight: 400;
}

#dComments {
  display: grid;
  gap: 8px;
}

.comment {
  display: grid;
  gap: 3px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(var(--tint-rgb) / 0.025);
}

.comment .who {
  color: var(--link-soft);
  font-size: 11.5px;
  font-weight: 600;
}

.comment .body {
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment .foot {
  display: flex;
  gap: 12px;
  color: var(--faint);
  font-size: 10.5px;
}

.comment .foot button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--danger-text);
  font-size: 10.5px;
  cursor: pointer;
}

.comment-form {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.comment-form .ui-input {
  flex: 1;
  height: 38px;
  min-height: 38px;
  border-radius: 99px;
}

/* v1.17: following feed tabs and comment images. */
.feed-tabs {
  padding: 8px 12px;
  margin-bottom: 10px;
}

.chip small {
  opacity: 0.7;
  font-size: 10px;
}

.comment-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.comment-images a {
  display: block;
  width: 92px;
  height: 68px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--media-bg);
}

.comment-images img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comment-image-pick {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgb(var(--tint-rgb) / 0.03);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.comment-image-pick:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

#dFavCollection {
  max-width: 170px;
  height: 34px;
}

/* ---------- publish wizard ---------- */

#publish {
  width: min(860px, calc(100% - 24px));
}

.publish-body {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px 24px;
}

.publish-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.publish-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.wizard-steps {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.wizard-steps span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgb(var(--tint-rgb) / 0.03);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.wizard-steps span.on {
  border-color: rgb(var(--accent-rgb) / 0.5);
  background: var(--chip-on-bg);
  color: var(--chip-on-text);
}

.publish-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(var(--tint-rgb) / 0.02);
}

.field-label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 550;
}

.file-row {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 13px;
  background: rgb(var(--accent-rgb) / 0.04);
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.file-row:focus-within {
  border-color: rgb(var(--accent-rgb) / 0.7);
  background: rgb(var(--accent-rgb) / 0.06);
  box-shadow: 0 0 0 4px rgb(var(--accent-rgb) / 0.1);
}

input[type="file"] {
  width: 100%;
  color: var(--muted);
  font-size: 12px;
}

input[type="file"]:focus-visible {
  outline: none;
}

.extra-file summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}

.extra-file summary::-webkit-details-marker {
  display: none;
}

.extra-file summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 10px;
  transition: transform 0.16s var(--ease);
}

.extra-file[open] summary::before {
  transform: rotate(90deg);
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgb(var(--tint-rgb) / 0.06);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  background: rgb(var(--tint-rgb) / 0.1);
}

.extra-list {
  display: grid;
  gap: 9px;
}

.extra-file {
  display: grid;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(var(--tint-rgb) / 0.025);
}

.extra-file .row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.extra-file input[type="file"] {
  flex: 1 1 220px;
}

.extra-file input[type="text"],
.extra-file input[type="number"],
.extra-file select {
  flex: 1 1 150px;
}

.grid2 {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Category select plus its one-line explanation, kept inside one grid cell. */
.cat-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.cat-field .msg {
  min-height: 0;
}

.progress {
  height: 6px;
  border-radius: 99px;
  background: rgb(var(--tint-rgb) / 0.08);
  overflow: hidden;
}

.progress > i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: var(--gradient);
  transition: width 0.2s linear;
}

.publish-foot {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 4px;
}

/* ---------- small dialogs ---------- */

#reportDlg,
#assetDlg {
  width: min(520px, calc(100% - 24px));
}

.dlg-body {
  display: grid;
  gap: 13px;
  padding: 22px;
}

.dlg-head h2,
.dlg-body h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.dlg-body .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.dlg-body textarea {
  min-height: 96px;
}

/* ---------- signed-in operations shelf (v1.25) ---------- */

.home-shelf {
  margin: 0 0 14px;
  padding: 11px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(120deg, rgb(var(--tint-rgb) / 0.035), transparent 65%),
    var(--card-bg);
}

.home-shelf[hidden] {
  display: none;
}

.home-shelf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.home-shelf-tabs {
  display: flex;
  gap: 6px;
}

.home-shelf-tab {
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.home-shelf-tab.on {
  border-color: rgb(var(--accent-rgb) / 0.5);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.home-shelf-tab:hover {
  color: var(--text);
}

.home-shelf-more {
  flex: none;
  color: var(--link-muted);
  font-size: 12px;
  text-decoration: none;
}

.home-shelf-more:hover {
  color: var(--accent-text);
}

.home-shelf-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.ops-card {
  display: flex;
  gap: 9px;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(var(--tint-rgb) / 0.025);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.ops-card:hover {
  border-color: rgb(var(--accent-rgb) / 0.55);
  transform: translateY(-1px);
}

.ops-thumb {
  position: relative;
  flex: none;
  width: 84px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 7px;
  background: var(--glass);
}

.ops-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ops-thumb.is-empty {
  display: grid;
  place-items: center;
  color: var(--faint);
  font: 600 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.ops-rank {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(3, 7, 14, 0.68);
  color: #e8eef8;
  font: 700 10px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.ops-body {
  display: grid;
  align-content: center;
  gap: 3px;
  min-width: 0;
}

.ops-title {
  overflow: hidden;
  font-size: 12.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-author {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  color: var(--faint);
  font-size: 10.5px;
}

.ops-empty {
  grid-column: 1 / -1;
  padding: 14px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 900px) {
  .home-shelf-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .home-shelf {
    margin-bottom: 10px;
    padding: 9px 10px 10px;
  }

  .home-shelf-track {
    grid-auto-flow: column;
    grid-auto-columns: minmax(230px, 82%);
    grid-template-columns: none;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: thin;
  }
}

/* ---------- footer ---------- */

.plaza-footer {
  padding: 26px 20px 34px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 11.5px;
  text-align: center;
  background: rgb(var(--tint-rgb) / 0.012);
}

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .plaza-main {
    padding-top: 12px;
  }

  .detail-dlg {
    width: min(1080px, calc(100% - 20px));
  }
}

@media (max-width: 980px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-media {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .dlg-cover {
    min-height: 0;
    height: min(44vh, 420px);
  }
}

/* Tablet / small laptop: brand and account on the first line, discovery
   controls on the second, instead of letting flex-wrap scatter them. */
@media (max-width: 1500px) {
  .plaza-topbar #searchBtn {
    display: none;
  }
}

@media (min-width: 701px) and (max-width: 1280px) {
  .plaza-topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "brand nav actions"
      "search search selects";
    gap: 10px 14px;
    padding: 10px clamp(14px, 2.4vw, 22px);
  }

  .plaza-topbar .ui-brand {
    grid-area: brand;
    min-width: 0;
  }

  /* Four extra items must not push the account controls off the first row. */
  .plaza-topbar .plaza-nav {
    grid-area: nav;
    justify-self: start;
    padding: 3px;
  }

  .plaza-topbar .plaza-nav a {
    padding: 6px 9px;
    font-size: 12px;
  }

  .plaza-topbar .topbar-actions {
    grid-area: actions;
    justify-self: end;
  }

  .plaza-topbar .ui-search {
    grid-area: search;
    max-width: none;
    min-width: 0;
  }

  .plaza-topbar .topbar-selects {
    grid-area: selects;
    justify-content: flex-end;
  }

  .plaza-topbar #searchBtn {
    display: none;
  }
}

@media (max-width: 700px) {
  .plaza-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand actions"
      "nav nav"
      "search search"
      "selects selects";
    gap: 4px 10px;
    padding: 4px 12px;
  }

  /* One full-width row of four equal tabs: the primary mobile navigation. */
  .plaza-topbar .plaza-nav {
    grid-area: nav;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    justify-self: stretch;
    gap: 2px;
    padding: 3px;
  }

  .plaza-topbar .plaza-nav a {
    padding: 6px 2px;
    text-align: center;
    font-size: 12px;
  }

  /* The header stacks four rows on a phone; trimming every row keeps the first
     work card well inside the first screen. */
  .plaza-topbar .ui-search .ui-input {
    height: 36px;
    min-height: 36px;
  }

  .plaza-topbar .ui-select-sm {
    min-height: 32px;
  }

  .plaza-topbar .ui-brand {
    grid-area: brand;
    min-width: 0;
  }

  /* Signed-in phones carry publish, language, theme, inbox and the avatar menu
     in the same row; the wordmark would be clipped to "Hype…". Keep the logo;
     the four-tab nav and the page context already name the library. */
  body.has-user .plaza-topbar .ui-brand-name {
    display: none;
  }

  .plaza-topbar .topbar-actions {
    grid-area: actions;
    justify-self: end;
  }

  .plaza-topbar .ui-search {
    grid-area: search;
    max-width: none;
    min-width: 0;
  }

  .plaza-topbar .topbar-selects {
    grid-area: selects;
    margin-left: 0;
  }

  .topbar-selects .ui-select {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .topbar-filter {
    flex: 0 0 auto;
  }

  /* Keep the filter trigger outside the horizontally scrolling chip strip. */
  .category-bar {
    gap: 6px;
    margin: 0 -12px 6px;
  }

  .category-filter {
    min-height: 36px;
    padding: 0 12px;
    margin-right: 10px;
    border-radius: 10px;
  }

  .category-filter span {
    display: none;
  }

  .category-filter svg {
    width: 16px;
    height: 16px;
  }

  .topbar-filter span {
    display: none;
  }

  .filter-body {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }

  .filter-head {
    padding: 18px 16px 12px;
  }

  .filter-foot {
    padding: 12px 16px 16px;
  }

  .plaza-topbar #searchBtn {
    display: none;
  }

  .topbar-publish {
    width: 36px;
    padding: 0;
    border-radius: 10px;
  }

  .topbar-publish-text {
    display: none;
  }

  .topbar-publish-ico {
    font-size: 19px;
    margin-top: -1px;
  }

  /* Guests already have the hero CTA; keep the phone header uncluttered. */
  body:not(.has-user) .topbar-publish {
    display: none;
  }

  .plaza-main {
    padding: 4px 12px 44px;
  }

  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0;
    padding: 4px 12px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  /* Inside the category bar the strip keeps the bar's own spacing. */
  .category-bar .filters {
    margin: 0;
    padding: 4px 10px 4px 12px;
  }

  .filters::-webkit-scrollbar {
    display: none;
  }

  .filters > * {
    flex: 0 0 auto;
  }

  /* The top bar already says "作品库" and the active nav tab marks the page, so
     the head is dropped entirely: the category strip is the first content and
     the first card stays above 240px even when signed in. */
  .plaza-head {
    display: none;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .starter {
    padding: 14px;
    border-radius: 16px;
  }

  .starter-blocks {
    grid-template-columns: 1fr;
  }

  .starter-card .ui-btn {
    align-self: stretch;
  }

  .detail-dlg {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .detail-shell {
    max-height: none;
    height: 100%;
  }

  .detail-head {
    padding: 14px 16px 12px;
  }

  .detail-head h2 {
    font-size: 18px;
  }

  .kv {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .detail-grid {
    display: block;
  }

  .detail-media {
    padding: 12px 16px;
  }

  .dlg-cover {
    height: min(42vh, 360px);
    padding: 8px;
  }

  .detail-info {
    padding: 16px;
  }

  .detail-actions {
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  }

  .comments {
    padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
  }

  #publish {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .publish-body {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    padding: 16px 14px 0;
    gap: 12px;
  }

  .publish-head h2 {
    font-size: 17px;
  }

  .publish-section {
    padding: 13px;
  }

  .grid2 {
    grid-template-columns: 1fr;
  }

  .publish-foot {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin: auto -14px 0;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--sticky-bg);
    backdrop-filter: blur(15px);
  }

  #reportDlg,
  #assetDlg {
    width: calc(100% - 16px);
  }

  .dlg-body {
    padding: 18px 16px;
  }
}

/* ---------- detail 2D toolpath ---------- */

.detail-preview-switch {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.detail-preview-switch button {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: 0.16s var(--ease);
}

.detail-preview-switch button:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.detail-preview-switch button.on {
  border-color: transparent;
  background: var(--chip-on-bg);
  color: var(--chip-on-text);
  box-shadow: 0 0 0 1px rgb(var(--accent-rgb) / 0.28) inset;
}

.detail-toolpath {
  position: relative;
  flex: 1 1 auto;
  min-height: 300px;
  height: clamp(300px, 44vh, 460px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(600px 340px at 18% 8%, rgba(91, 140, 255, 0.11), transparent 62%),
    radial-gradient(480px 300px at 88% 92%, rgba(34, 211, 238, 0.08), transparent 62%),
    #070b14;
  box-shadow: var(--shadow-sm);
}

.detail-toolpath::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(148, 163, 184, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.028) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
}

.detail-toolpath canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

.detail-toolpath canvas.is-panning {
  cursor: grabbing;
}

.detail-toolpath-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 26px;
  color: rgba(203, 220, 244, 0.66);
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}

.detail-toolpath-hud {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: rgba(203, 220, 244, 0.72);
  font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  pointer-events: none;
}

.detail-toolpath-hud span:first-child {
  padding: 4px 9px;
  border: 1px solid rgba(148, 190, 255, 0.16);
  border-radius: 999px;
  background: rgba(8, 14, 25, 0.62);
  color: #dbeafe;
}

.detail-toolpath-hud span:last-child {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(8, 14, 25, 0.55);
}

.detail-toolpath-plates {
  position: absolute;
  z-index: 2;
  left: 14px;
  bottom: 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.detail-toolpath-plates button {
  padding: 5px 10px;
  border: 1px solid rgba(148, 190, 255, 0.2);
  border-radius: 999px;
  background: rgba(8, 14, 25, 0.68);
  color: rgba(203, 220, 244, 0.8);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}

.detail-toolpath-plates button.on {
  border-color: transparent;
  background: var(--chip-on-bg);
  color: var(--chip-on-text);
}

.detail-image-pane {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.detail-image-empty {
  display: grid;
  flex: 1 1 auto;
  place-items: center;
  min-height: 220px;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.detail-image-empty[hidden] {
  display: none;
}

@media (max-width: 980px) {
  .detail-toolpath {
    min-height: 260px;
    height: min(44vh, 420px);
  }
}
