:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #fffdfa;
  --surface-2: #f0eee7;
  --ink: #1d1b18;
  --muted: #706c63;
  --line: #ded8ca;
  --accent: #c6422f;
  --accent-2: #1c6d73;
  --gold: #b7882f;
  --ok: #2f8d5b;
  --warn: #c27d22;
  --shadow: 0 18px 45px rgba(49, 42, 31, 0.14);
}

body.dark {
  color-scheme: dark;
  --bg: #171512;
  --surface: #22201b;
  --surface-2: #2f2b25;
  --ink: #f8f3e8;
  --muted: #bcb3a4;
  --line: #403a31;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(198, 66, 47, 0.06), transparent 24%),
    radial-gradient(circle at 82% 10%, rgba(28, 109, 115, 0.12), transparent 28%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 250, 0.78);
  backdrop-filter: blur(18px);
}

body.dark .sidebar {
  background: rgba(34, 32, 27, 0.78);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 900;
  font-size: 24px;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.eyebrow,
.sidebar-panel small {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 8px;
  margin: 36px 0;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
}

.nav-link.active,
.nav-link:hover {
  background: var(--ink);
  color: var(--surface);
}

.nav-link b {
  min-width: 28px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  text-align: center;
}

.sidebar-panel {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.sidebar-panel strong {
  font-size: 42px;
  line-height: 1;
}

.main {
  min-width: 0;
  padding: 24px clamp(18px, 4vw, 48px) 48px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 22px;
  background: linear-gradient(var(--bg) 72%, transparent);
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(520px, 100%);
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.hidden {
  display: none !important;
}

.admin-only {
  display: none !important;
}

body.is-admin .admin-only {
  display: flex !important;
}

body.is-admin section.admin-only {
  display: none !important;
}

body.is-admin section.admin-only.active {
  display: block !important;
}

.icon-button,
.primary-action,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.icon-button {
  width: 42px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.primary-action {
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.primary-action.full {
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
  min-height: 210px;
  padding: 42px 0 28px;
}

.section-head.compact {
  min-height: auto;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 12px;
  font-size: clamp(42px, 7vw, 92px);
  line-height: 0.96;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.05;
}

.section-head p:not(.eyebrow) {
  max-width: 680px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.stats-strip,
.admin-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 10px;
}

.stats-strip span,
.admin-metrics article {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.stats-strip b,
.admin-metrics b {
  color: var(--ink);
  font-size: 24px;
}

.toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.mobile-filter-toggle {
  display: none;
}

.segments {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.segment {
  min-width: 72px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.segment.active {
  background: var(--ink);
  color: var(--surface);
}

select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  content-visibility: auto;
  contain-intrinsic-size: 800px;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin: 0 0 18px;
  content-visibility: auto;
  contain-intrinsic-size: 260px;
}

.folder-card {
  display: grid;
  grid-template-columns: 46px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 10px;
  align-items: center;
  min-height: 66px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.folder-card.active,
.folder-card:hover {
  border-color: var(--accent);
}

.folder-card img,
.folder-cover {
  grid-row: 1 / span 2;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--ink);
  color: var(--surface);
}

.folder-cover {
  display: grid;
  place-items: center;
  font-weight: 900;
}

.folder-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.folder-card small {
  color: var(--muted);
}

.heat-board {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  content-visibility: auto;
  contain-intrinsic-size: 180px;
}

.advanced-search {
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.heat-head strong {
  display: block;
  font-size: 18px;
}

.heat-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.heat-item {
  display: grid;
  grid-template-columns: auto minmax(96px, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 210px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
}

.heat-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heat-item em {
  color: var(--accent);
  font-style: normal;
  font-weight: 800;
}

.review-board,
.honor-wall,
.identity-card {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
}

.review-board,
.honor-wall {
  padding: 16px;
}

.review-head,
.honor-head,
.identity-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.review-head strong,
.honor-head h3,
.identity-head b {
  margin-bottom: 0;
  font-size: 22px;
}

.review-head span,
.identity-head span {
  color: var(--muted);
  font-size: 13px;
}

.review-grid,
.honor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.review-grid article,
.honor-grid article {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.review-grid span,
.honor-grid span,
.review-grid small,
.honor-grid small {
  color: var(--muted);
}

.review-grid b,
.honor-grid b {
  font-size: 18px;
  line-height: 1.25;
}

.folder-detail {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.folder-detail h2 {
  margin-bottom: 6px;
  font-size: 28px;
}

.folder-detail p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
}

.folder-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.timeline {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.timeline-head,
.collapse-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.timeline-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

.timeline-head h3 {
  margin-bottom: 0;
  font-size: 20px;
}

.timeline-head span,
.timeline-head b,
.collapse-toggle b {
  color: var(--muted);
  font-size: 13px;
}

.timeline-body {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  content-visibility: auto;
  contain-intrinsic-size: 72px;
}

.timeline-item img {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
}

.timeline-item strong,
.timeline-item span {
  display: block;
}

.timeline-item span {
  color: var(--muted);
  font-size: 13px;
}

.like-button {
  width: 100%;
  margin-top: 12px;
}

.detail-button {
  width: 100%;
  margin-top: 12px;
}

.audit-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.comment-panel {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.comment-panel h3 {
  margin-bottom: 0;
}

.comment-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.comment-item p {
  margin: 6px 0;
}

.comment-item small {
  color: var(--muted);
}

#commentForm,
.detail-comment-form {
  display: grid;
  gap: 10px;
}

.inline-check {
  display: inline-flex;
  grid-auto-flow: column;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.inline-check input {
  width: auto;
  min-height: auto;
}

.upload-mode {
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 28%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-2) 8%, var(--surface));
  color: var(--ink);
  font-weight: 800;
}

.upload-form.is-original-only #imageUrlInput,
.upload-form.is-original-only #editedFileInput {
  pointer-events: none;
}

.upload-form.is-original-only label:has(#imageUrlInput),
.upload-form.is-original-only label:has(#editedFileInput) {
  opacity: 0.48;
}

body.is-admin .audit-actions.admin-only {
  display: flex !important;
}

body:not(.is-admin) .audit-actions.admin-only {
  display: none !important;
}

.avatar-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  content-visibility: auto;
  contain-intrinsic-size: 420px;
}

.avatar-media {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  aspect-ratio: 1;
  background: var(--surface-2);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

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

.status {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(29, 27, 24, 0.82);
  color: #fff;
  font-size: 12px;
}

.compare-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  max-width: calc(100% - 24px);
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.9);
  color: #1d1b18;
  font-size: 12px;
  font-weight: 700;
}

.avatar-info {
  padding: 14px;
}

.avatar-info h3 {
  margin-bottom: 6px;
  font-size: 17px;
}

.avatar-info p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

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

.tags span {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.compare-layout,
.upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}

.compare-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  min-height: 380px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
  box-shadow: var(--shadow);
  touch-action: none;
}

.compare-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.86) contrast(0.94);
}

.compare-overlay {
  position: absolute;
  inset: 0;
  clip-path: inset(0 48% 0 0);
  will-change: clip-path;
}

.compare-overlay .compare-image {
  filter: saturate(1.18) contrast(1.08);
}

.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 52%;
  z-index: 2;
  width: 0;
  pointer-events: none;
}

.compare-divider::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.compare-divider span {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 42px;
  height: 42px;
  transform: translate(-50%, -50%);
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(29, 27, 24, 0.72);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.compare-divider span::before {
  content: "";
  width: 16px;
  height: 12px;
  border-left: 2px solid #fff;
  border-right: 2px solid #fff;
  color: #fff;
  font-size: 18px;
  line-height: 1;
}

#compareRange {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
}

.compare-label {
  position: absolute;
  z-index: 2;
  bottom: 16px;
  padding: 7px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.64);
  color: #fff;
  font-size: 13px;
}

.compare-label.left {
  left: 16px;
}

.compare-label.right {
  right: 16px;
}

.detail-panel,
.upload-form,
.preview-card,
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-panel {
  padding: 18px;
}

.detail-panel img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-2);
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}

.meta-grid span {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.meta-grid b {
  color: var(--ink);
  font-size: 16px;
}

.upload-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  outline: 0;
}

input {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
}

.dropzone {
  place-items: center;
  min-height: 150px;
  padding: 20px;
  border: 1px dashed var(--accent-2);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-2) 8%, var(--surface));
  text-align: center;
  cursor: pointer;
}

.dropzone input {
  display: none;
}

.dropzone span {
  color: var(--ink);
  font-weight: 800;
}

.preview-card {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.preview-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.login-card {
  width: min(520px, 100%);
  margin: 80px auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.7;
}

.preview-frame {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
}

.preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.admin-metrics {
  margin-bottom: 18px;
}

.upload-progress {
  position: relative;
  overflow: hidden;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.upload-progress span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.18s ease;
}

.upload-progress b {
  position: relative;
  z-index: 1;
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--ink);
}

.detail-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}

.detail-figure {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-strong);
}

.detail-figure img {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  background: var(--surface-2);
}

.detail-actions {
  display: grid;
  gap: 10px;
}

.detail-actions > * {
  width: 100%;
}

.admin-section {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 97%, transparent), color-mix(in srgb, var(--surface-2) 66%, transparent));
  box-shadow: var(--shadow);
}

.avatar-admin-section {
  margin-top: 0;
}

.admin-section + .admin-section {
  margin-top: 30px;
}

.admin-section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.collapse-toggle {
  margin: 0 0 16px;
}

.collapse-toggle:hover {
  color: var(--ink);
}

.admin-section.is-collapsed {
  padding-bottom: 4px;
}

.admin-section.is-collapsed .admin-section-head {
  margin-bottom: 0;
  border-bottom: 0;
}

.admin-section-head h3 {
  margin-bottom: 0;
  font-size: 24px;
}

.admin-section-head span {
  color: var(--muted);
  text-align: right;
}

.admin-log-list {
  display: grid;
  gap: 10px;
  padding: 0;
}

.admin-log-list article {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.forum-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

.forum-tabs {
  display: inline-flex;
  gap: 6px;
  margin: 0 0 18px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.forum-compose,
.forum-list-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.forum-compose {
  max-width: 760px;
  overflow: hidden;
}

.forum-compose-head,
.forum-feed-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-2) 10%, var(--surface)), color-mix(in srgb, var(--gold) 12%, var(--surface)));
}

.forum-compose-head h3,
.forum-feed-head h3 {
  margin-bottom: 0;
  font-size: 24px;
}

.forum-compose-head span,
.forum-feed-head span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.forum-form {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.forum-list,
.forum-admin-list {
  display: grid;
  gap: 16px;
  padding: 18px;
  content-visibility: auto;
  contain-intrinsic-size: 600px;
}

.forum-post,
.forum-admin-post {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 82%, transparent));
  box-shadow: 0 10px 28px rgba(42, 35, 24, 0.08);
  content-visibility: auto;
  contain-intrinsic-size: 220px;
}

.forum-post strong,
.forum-admin-post strong {
  display: block;
  font-size: 20px;
  line-height: 1.35;
}

.forum-post small,
.forum-admin-post small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.forum-post p,
.forum-admin-post p {
  margin-bottom: 0;
  color: var(--ink);
  line-height: 1.7;
  white-space: pre-wrap;
}

.forum-post .ghost-button {
  justify-self: start;
}

.forum-related,
.forum-related-static {
  justify-self: start;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 35%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-2) 10%, var(--surface));
  color: var(--ink);
  font-weight: 800;
}

.forum-related {
  cursor: pointer;
}

.identity-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-2) 10%, var(--surface)), color-mix(in srgb, var(--gold) 14%, var(--surface)));
}

.identity-body {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.identity-body img {
  width: 76px;
  height: 76px;
  border-radius: 8px;
  object-fit: cover;
}

.identity-body strong,
.identity-body small {
  display: block;
}

.identity-body small,
.identity-code {
  color: var(--muted);
  font-size: 12px;
}

.identity-code {
  overflow: hidden;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-card {
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
}

.ticket-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
}

.ticket-head span,
.ticket-head b,
.ticket-info small {
  color: var(--muted);
  font-size: 13px;
}

.ticket-body {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.ticket-qr img {
  display: block;
  width: 132px;
  height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ticket-info {
  display: grid;
  gap: 4px;
}

.ticket-info strong {
  font-size: 18px;
}

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

.forum-tags span {
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-2) 10%, var(--surface));
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.forum-topic-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px 0;
}

.forum-topic-bar button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
}

.forum-topic-bar button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.admin-log-list span,
.admin-log-list small {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 10px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 260px;
}

.ghost-button,
.danger-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
}

.danger-button {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow);
  transition: 0.22s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.edit-dialog,
.collage-dialog,
.disclaimer-dialog {
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.collage-dialog {
  width: min(980px, calc(100vw - 24px));
}

.edit-dialog::backdrop,
.collage-dialog::backdrop,
.disclaimer-dialog::backdrop {
  background: rgba(0, 0, 0, 0.42);
}

.edit-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.edit-head,
.edit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.edit-head h3 {
  margin-bottom: 0;
}

.edit-actions {
  justify-content: flex-end;
}

.collage-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.disclaimer-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.disclaimer-content {
  display: grid;
  gap: 10px;
  color: var(--muted);
  line-height: 1.75;
}

.disclaimer-content p {
  margin-bottom: 0;
}

.collage-body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  min-height: min(680px, calc(100vh - 120px));
}

.collage-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 72%, transparent));
}

.collage-summary {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), color-mix(in srgb, var(--accent-2) 12%, var(--surface)));
}

.collage-summary span {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
}

.collage-summary strong {
  font-size: 20px;
  line-height: 1.35;
}

.collage-preview {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), transparent),
    color-mix(in srgb, var(--surface-2) 72%, var(--surface));
}

.collage-canvas-frame {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 420px;
  place-items: center;
  overflow: auto;
  border-radius: 8px;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--line) 42%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--line) 42%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--line) 42%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--line) 42%, transparent) 75%),
    var(--surface);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

#collageCanvas {
  width: 100%;
  max-width: 100%;
  max-height: calc(100vh - 178px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  object-fit: contain;
}

#collageStatus {
  margin: auto 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.collage-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.collage-actions > * {
  width: 100%;
}

@media (max-width: 920px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    display: flex;
    overflow-x: auto;
    margin: 18px 0 0;
    padding-bottom: 4px;
  }

  .nav-link {
    flex: 0 0 auto;
  }

  .sidebar-panel {
    display: none;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    padding-top: 16px;
    position: static;
  }

  .top-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .top-actions > * {
    flex: 1 1 auto;
  }

  .section-head,
  .toolbar,
  .compare-layout,
  .upload-layout,
  .detail-page-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .stats-strip,
  .admin-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .compare-stage {
    min-height: 300px;
  }

}

@media (max-width: 560px) {
  body {
    background: var(--bg);
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    font-size: 22px;
  }

  .main {
    padding: 12px 12px 32px;
  }

  .search-wrap {
    height: 42px;
  }

  .primary-action,
  .ghost-button,
  .icon-button {
    min-height: 42px;
  }

  .section-head {
    min-height: 0;
    padding: 24px 0 18px;
    gap: 14px;
  }

  h1 {
    font-size: 40px;
    line-height: 1;
  }

  h2 {
    font-size: 32px;
  }

  .section-head p:not(.eyebrow) {
    font-size: 15px;
    line-height: 1.65;
  }

  .stats-strip,
  .admin-metrics {
    grid-template-columns: 1fr;
  }

  .toolbar {
    gap: 10px;
  }

  .segments {
    width: 100%;
  }

  .segment {
    min-width: 68px;
  }

  select {
    width: 100%;
  }

  .folder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .heat-board {
    grid-template-columns: 1fr;
  }

  .review-grid,
  .honor-grid {
    grid-template-columns: 1fr;
  }

  .folder-detail {
    display: grid;
    gap: 14px;
  }

  .folder-detail-actions {
    justify-content: stretch;
  }

  .folder-detail-actions > * {
    flex: 1 1 100%;
  }

  .folder-card {
    grid-template-columns: 38px minmax(0, 1fr);
    min-height: 58px;
    padding: 8px;
  }

  .folder-card img,
  .folder-cover {
    width: 38px;
    height: 38px;
  }

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

  .compare-stage {
    min-height: 0;
    aspect-ratio: 1;
  }

  .compare-label {
    bottom: 10px;
    font-size: 12px;
  }

  .compare-divider span {
    width: 36px;
    height: 36px;
  }

  .detail-panel,
  .upload-form,
  .preview-card,
  .login-card {
    padding: 14px;
  }

  .preview-pair {
    grid-template-columns: 1fr;
  }

  .login-card {
    margin: 24px auto;
  }

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

  table {
    min-width: 680px;
  }

  th,
  td {
    padding: 10px;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }
}

/* API documentation */
.api-docs-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.api-docs-side {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 14px;
}

.api-docs-main,
.api-docs-groups {
  display: grid;
  gap: 18px;
}

.api-docs-card,
.api-group-card,
.api-endpoint {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 68%, transparent));
  box-shadow: var(--shadow);
}

.api-docs-card,
.api-group-card {
  padding: 18px;
}

.api-docs-card h3,
.api-group-head h3 {
  margin-bottom: 8px;
  font-size: 24px;
}

.api-docs-card p:not(.eyebrow),
.api-group-head span,
.api-endpoint p {
  color: var(--muted);
  line-height: 1.7;
}

.api-docs-dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.api-docs-dl div {
  display: grid;
  gap: 4px;
  padding-bottom: 9px;
  border-bottom: 1px dashed var(--line);
}

.api-docs-dl dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.api-docs-dl dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.api-docs-toc {
  display: grid;
  gap: 8px;
}

.api-docs-toc-link {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
}

.api-docs-toc-link:hover {
  border-color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 9%, var(--surface));
}

.api-docs-toc-link small {
  color: var(--muted);
  white-space: nowrap;
}

.api-group-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.api-endpoint-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.api-endpoint {
  display: grid;
  gap: 12px;
  padding: 16px;
  box-shadow: none;
}

.api-endpoint-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.api-endpoint-head code,
.api-docs-card code {
  padding: 4px 7px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--ink) 8%, var(--surface-2));
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  overflow-wrap: anywhere;
}

.api-endpoint-head b {
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 15%, var(--surface));
  color: var(--ink);
  font-size: 12px;
}

.api-method {
  min-width: 64px;
  padding: 5px 8px;
  border-radius: 7px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.method-get {
  background: var(--accent-2);
}

.method-post {
  background: var(--ok);
}

.method-patch {
  background: var(--warn);
}

.method-put {
  background: var(--gold);
}

.method-delete {
  background: var(--accent);
}

.method-header,
.method-400,
.method-401,
.method-404,
.method-413,
.method-500 {
  background: var(--muted);
}

.api-code-grid,
.api-example-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.api-code-grid strong,
.api-example-grid strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.api-code-grid pre,
.api-example-grid pre {
  overflow: auto;
  min-height: 74px;
  margin: 0;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--ink) 7%, var(--surface-2));
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 920px) {
  .api-docs-layout,
  .api-code-grid,
  .api-example-grid {
    grid-template-columns: 1fr;
  }

  .api-docs-side {
    position: static;
  }
}

@media (max-width: 560px) {
  .api-endpoint-head,
  .api-group-head {
    display: grid;
    align-items: start;
  }

  .api-endpoint-head {
    grid-template-columns: 1fr;
  }

  .api-method {
    width: max-content;
  }
}

/* Visual polish layer */
:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #f3efe6;
  --ink: #20201d;
  --muted: #706b60;
  --line: #ded5c5;
  --accent: #c73f31;
  --accent-2: #167177;
  --gold: #b78326;
  --soft-red: rgba(199, 63, 49, 0.1);
  --soft-teal: rgba(22, 113, 119, 0.11);
  --soft-gold: rgba(183, 131, 38, 0.14);
  --shadow: 0 18px 44px rgba(42, 35, 24, 0.12);
  --shadow-strong: 0 26px 70px rgba(42, 35, 24, 0.18);
}

body.dark {
  --bg: #151411;
  --surface: #24211b;
  --surface-2: #302b24;
  --ink: #fbf6ea;
  --muted: #c5bbaa;
  --line: #494134;
  --soft-red: rgba(230, 88, 72, 0.14);
  --soft-teal: rgba(77, 169, 176, 0.13);
  --soft-gold: rgba(214, 161, 67, 0.15);
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
  --shadow-strong: 0 28px 78px rgba(0, 0, 0, 0.42);
}

body {
  background:
    linear-gradient(120deg, var(--soft-red), transparent 30%),
    linear-gradient(240deg, var(--soft-teal), transparent 34%),
    linear-gradient(180deg, transparent 0, rgba(255, 255, 255, 0.24) 42%, transparent 100%),
    var(--bg);
}

button,
a,
input,
select,
textarea {
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent-2) 35%, transparent);
  outline-offset: 2px;
}

.sidebar {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--surface-2) 80%, transparent)),
    var(--surface);
  box-shadow: 12px 0 40px rgba(43, 35, 23, 0.06);
}

body.dark .sidebar {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 90%, transparent), color-mix(in srgb, var(--surface-2) 84%, transparent)),
    var(--surface);
}

.brand-mark {
  box-shadow: inset 0 -10px 22px rgba(255, 255, 255, 0.12), 0 12px 24px rgba(0, 0, 0, 0.16);
}

.brand strong {
  font-size: 19px;
  letter-spacing: 0;
}

.nav-link {
  border: 1px solid transparent;
  font-weight: 700;
}

.nav-link:hover {
  transform: translateX(2px);
}

.nav-link.active {
  box-shadow: 0 12px 28px rgba(29, 27, 24, 0.16);
}

.sidebar-panel,
.stats-strip span,
.admin-metrics article,
.advanced-search,
.heat-board,
.folder-card,
.folder-detail,
.timeline,
.avatar-card,
.detail-panel,
.upload-form,
.preview-card,
.table-wrap,
.login-card,
.edit-dialog,
.collage-dialog {
  border-color: color-mix(in srgb, var(--line) 82%, transparent);
}

.main {
  max-width: 1540px;
}

.topbar {
  margin: -24px calc(clamp(18px, 4vw, 48px) * -1) 0;
  padding: 18px clamp(18px, 4vw, 48px) 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.search-wrap,
input,
textarea,
select {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.search-wrap:focus-within,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-2) 13%, transparent);
}

.section-head {
  position: relative;
  overflow: hidden;
  margin: 18px 0 20px;
  padding: 44px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 8px;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--surface-2) 82%, transparent)),
    var(--surface);
  box-shadow: var(--shadow);
}

.section-head::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -120px;
  width: 330px;
  height: 330px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--soft-gold), transparent 64%);
  pointer-events: none;
}

.section-head.compact {
  min-height: auto;
  padding: 30px 34px;
}

.section-head > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  color: var(--accent-2);
  font-weight: 900;
}

.stats-strip span,
.admin-metrics article {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 76%, transparent));
}

.stats-strip b,
.admin-metrics b {
  color: var(--accent);
}

.toolbar,
.advanced-search,
.heat-board,
.folder-grid,
.gallery-grid {
  position: relative;
  z-index: 1;
}

.toolbar {
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.segments {
  background: var(--surface-2);
  box-shadow: inset 0 1px 4px rgba(42, 35, 24, 0.06);
}

.segment.active,
.nav-link.active,
.nav-link:hover {
  background: linear-gradient(135deg, var(--ink), color-mix(in srgb, var(--ink) 76%, var(--accent-2)));
}

.primary-action {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 82%, #711f18));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 24%, transparent);
}

.primary-action:hover,
.ghost-button:hover,
.danger-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.ghost-button:hover,
.icon-button:hover {
  border-color: color-mix(in srgb, var(--accent-2) 45%, var(--line));
  background: color-mix(in srgb, var(--accent-2) 10%, var(--surface));
}

.advanced-grid label,
.upload-form label,
.edit-form label {
  font-weight: 700;
}

.heat-board {
  grid-template-columns: 170px minmax(0, 1fr);
  background:
    linear-gradient(90deg, var(--soft-gold), transparent 36%),
    var(--surface);
}

.heat-item {
  border-color: transparent;
  background: color-mix(in srgb, var(--surface) 78%, var(--surface-2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 60%, transparent);
}

.heat-item:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, var(--line)), 0 10px 24px rgba(42, 35, 24, 0.1);
}

.folder-card {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 72%, transparent));
}

.folder-card.active,
.folder-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(42, 35, 24, 0.12);
}

.folder-card.active {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), color-mix(in srgb, var(--accent-2) 10%, var(--surface)));
}

.avatar-card {
  position: relative;
  box-shadow: 0 12px 28px rgba(42, 35, 24, 0.1);
}

.avatar-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-strong);
}

.avatar-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.avatar-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.32));
  opacity: 0;
  transition: opacity 0.18s ease;
}

.avatar-card:hover .avatar-media::after {
  opacity: 1;
}

.avatar-media img {
  transition: transform 0.28s ease, filter 0.28s ease;
}

.avatar-card:hover .avatar-media img {
  transform: scale(1.035);
  filter: saturate(1.06) contrast(1.02);
}

.status {
  z-index: 1;
  background: color-mix(in srgb, var(--ink) 82%, transparent);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.compare-hint {
  z-index: 1;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.avatar-info h3 {
  line-height: 1.25;
}

.tags span {
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.original-only-card .compare-hint {
  background: color-mix(in srgb, var(--accent-2) 88%, #ffffff);
  color: #fff;
}

.original-only-card .avatar-media {
  cursor: default;
}

.compare-stage,
.detail-panel,
.upload-form,
.preview-card,
.login-card {
  box-shadow: var(--shadow-strong);
}

.compare-stage {
  border-color: color-mix(in srgb, var(--accent-2) 34%, var(--line));
}

.detail-panel,
.preview-card {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 64%, transparent));
}

.dropzone {
  border-width: 2px;
}

.dropzone:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.preview-frame,
.detail-panel img {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent);
}

.admin-metrics article {
  min-height: 92px;
}

.table-wrap {
  background:
    linear-gradient(90deg, var(--surface), transparent 24px) left / 40px 100% no-repeat,
    linear-gradient(270deg, var(--surface), transparent 24px) right / 40px 100% no-repeat,
    var(--surface);
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

tbody tr:hover {
  background: color-mix(in srgb, var(--accent-2) 7%, transparent);
}

.edit-dialog,
.collage-dialog,
.disclaimer-dialog {
  overflow: hidden;
}

.edit-form,
.collage-panel,
.disclaimer-panel {
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.edit-head {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -18px -18px 0;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px);
}

.collage-panel .edit-head {
  margin: -18px -18px 0;
}

#collageCanvas {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent), 0 12px 34px rgba(42, 35, 24, 0.12);
}

.collage-dialog,
.disclaimer-dialog {
  width: min(1120px, calc(100vw - 24px));
}

.disclaimer-dialog {
  width: min(560px, calc(100vw - 24px));
}

.collage-dialog::backdrop {
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 253, 248, 0.16), transparent 28%),
    rgba(0, 0, 0, 0.52);
}

.collage-canvas-frame canvas {
  animation: softScaleIn 0.24s ease both;
}

@media (max-width: 920px) {
  .sidebar {
    position: relative;
    z-index: 10;
    padding: 14px 16px 10px;
    box-shadow: 0 12px 32px rgba(42, 35, 24, 0.08);
    backdrop-filter: none;
  }

  .brand {
    justify-content: center;
  }

  .nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 20;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 6px;
    margin: 0;
    padding: 8px;
    overflow: visible;
    border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    box-shadow: var(--shadow-strong);
    backdrop-filter: blur(18px);
  }

  .nav-link {
    min-height: 48px;
    justify-content: center;
    gap: 5px;
    padding: 0 8px;
    font-size: 13px;
    text-align: center;
  }

  .nav-link b {
    min-width: 22px;
    padding: 2px 6px;
  }

  .nav-link:hover {
    transform: none;
  }

  .main {
    padding-bottom: 100px;
  }

  .topbar {
    position: sticky;
    top: 0;
    margin: 0 -16px;
    padding: 12px 16px;
  }

  .section-head {
    margin-top: 12px;
    padding: 28px;
  }

  .toolbar {
    align-items: stretch;
  }

  .heat-board {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }
}

@media (max-width: 560px) {
  body {
    background:
      linear-gradient(180deg, var(--soft-teal), transparent 260px),
      var(--bg);
  }

  .sidebar {
    padding: 12px 12px 8px;
  }

  .brand {
    justify-content: flex-start;
  }

  .brand strong {
    font-size: 17px;
  }

  .brand small {
    font-size: 11px;
  }

  .topbar {
    gap: 10px;
    margin: 0 -12px;
    padding: 10px 12px 12px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 42px 1fr 1fr;
    gap: 8px;
  }

  .top-actions .primary-action {
    grid-column: span 2;
  }

  .top-actions > * {
    min-width: 0;
  }

  .section-head {
    margin: 10px 0 14px;
    padding: 22px 18px;
  }

  .section-head::after {
    right: -130px;
    bottom: -150px;
  }

  h1 {
    font-size: 38px;
  }

  h2 {
    font-size: 30px;
  }

  .toolbar {
    padding: 10px;
  }

  .toolbar > select,
  .toolbar > button {
    width: 100%;
  }

  .advanced-search {
    padding: 12px;
  }

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

  .advanced-grid label,
  .advanced-grid button {
    min-width: 0;
  }

  .advanced-grid label:nth-child(1),
  .advanced-grid label:nth-child(2),
  .advanced-grid button {
    grid-column: 1 / -1;
  }

  .heat-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(190px, 78vw);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .heat-item {
    scroll-snap-align: start;
  }

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

  .gallery-grid {
    gap: 14px;
  }

  .avatar-card:hover {
    transform: none;
  }

  .avatar-info {
    padding: 13px;
  }

  .compare-layout,
  .upload-layout {
    gap: 14px;
  }

  .compare-stage {
    border-radius: 8px;
  }

  .comment-panel {
    margin: 14px 0;
  }

  .audit-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .admin-metrics article {
    min-height: 78px;
  }

  .table-wrap {
    margin: 0 -12px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  table {
    min-width: 760px;
  }

  .row-actions {
    min-width: 300px;
  }

  .edit-dialog,
  .collage-dialog,
  .disclaimer-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .collage-body {
    grid-template-columns: 1fr;
    gap: 12px;
    min-height: 0;
  }

  .collage-sidebar {
    padding: 12px;
  }

  .collage-summary {
    padding: 12px;
  }

  .collage-summary strong {
    font-size: 18px;
  }

  .collage-preview {
    padding: 10px;
  }

  .collage-canvas-frame {
    min-height: 320px;
    max-height: 48vh;
  }

  .collage-actions {
    position: sticky;
    bottom: -14px;
    z-index: 3;
    margin: 0 -12px -12px;
    padding: 12px;
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(14px);
  }

  .edit-form,
  .collage-panel,
  .disclaimer-panel {
    padding: 14px;
  }

  .edit-head,
  .collage-panel .edit-head,
  .disclaimer-panel .edit-head {
    margin: -14px -14px 0;
    padding: 14px;
  }

  .edit-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .edit-actions > * {
    width: 100%;
  }

  #collageCanvas {
    max-height: 44vh;
  }
}

/* Motion layer */
@keyframes softRise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes softScaleIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes glowSweep {
  from {
    transform: translateX(-120%) skewX(-18deg);
  }
  to {
    transform: translateX(220%) skewX(-18deg);
  }
}

@keyframes pulseRing {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.34), 0 8px 22px rgba(0, 0, 0, 0.28);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0), 0 8px 22px rgba(0, 0, 0, 0.28);
  }
}

@keyframes badgePop {
  0% {
    transform: scale(0.82);
  }
  55% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes bottomDockIn {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view.active .section-head {
  animation: softRise 0.46s ease both;
}

.view.active .toolbar,
.view.active .advanced-search,
.view.active .heat-board,
.view.active .folder-detail,
.view.active .timeline,
.view.active .compare-stage,
.view.active .detail-panel,
.view.active .upload-form,
.view.active .preview-card,
.view.active .login-card,
.view.active .admin-metrics,
.view.active .table-wrap {
  animation: softRise 0.42s ease both;
}

.view.active .toolbar {
  animation-delay: 0.04s;
}

.view.active .advanced-search,
.view.active .compare-stage,
.view.active .upload-form,
.view.active .login-card {
  animation-delay: 0.08s;
}

.view.active .heat-board,
.view.active .detail-panel,
.view.active .preview-card,
.view.active .table-wrap {
  animation-delay: 0.12s;
}

.gallery-grid .avatar-card,
.folder-grid .folder-card,
.heat-list .heat-item {
  animation: softScaleIn 0.36s ease both;
}

.gallery-grid .avatar-card:nth-child(2n),
.folder-grid .folder-card:nth-child(2n),
.heat-list .heat-item:nth-child(2n) {
  animation-delay: 0.04s;
}

.gallery-grid .avatar-card:nth-child(3n),
.folder-grid .folder-card:nth-child(3n),
.heat-list .heat-item:nth-child(3n) {
  animation-delay: 0.08s;
}

.gallery-grid .avatar-card:nth-child(4n),
.folder-grid .folder-card:nth-child(4n),
.heat-list .heat-item:nth-child(4n) {
  animation-delay: 0.12s;
}

.primary-action,
.danger-button,
.ghost-button,
.icon-button,
.segment,
.nav-link,
.heat-item,
.folder-card,
.avatar-card {
  will-change: transform;
}

.primary-action {
  position: relative;
  overflow: hidden;
}

.primary-action::after {
  content: "";
  position: absolute;
  top: -35%;
  bottom: -35%;
  left: 0;
  width: 42px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: translateX(-120%) skewX(-18deg);
  pointer-events: none;
}

.primary-action:hover::after {
  animation: glowSweep 0.72s ease;
}

button:active,
.primary-action:active,
.ghost-button:active,
.danger-button:active,
.icon-button:active,
.nav-link:active,
.folder-card:active,
.heat-item:active {
  transform: translateY(1px) scale(0.98);
}

.nav-link.active b,
.status {
  animation: badgePop 0.34s ease both;
}

.compare-divider span {
  animation: pulseRing 2.2s ease-in-out infinite;
}

.dropzone:hover span,
.upload-mode:hover {
  color: var(--accent);
}

dialog[open] {
  animation: softScaleIn 0.2s ease both;
}

.toast.show {
  animation: softRise 0.22s ease both;
}

@media (max-width: 920px) {
  .nav {
    animation: bottomDockIn 0.34s ease both;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Mobile comfort pass */
@media (max-width: 560px) {
  .main {
    padding: 10px 14px 118px;
  }

  .sidebar {
    padding: 10px 14px 8px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

  .brand strong {
    font-size: 16px;
  }

  .brand small {
    font-size: 10px;
  }

  .topbar {
    position: static;
    gap: 8px;
    margin: 0 -14px;
    padding: 10px 14px 12px;
    border-bottom: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .search-wrap {
    height: 46px;
    border-radius: 8px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 8px;
  }

  .top-actions .primary-action {
    grid-column: 1 / -1;
    min-height: 46px;
    font-size: 16px;
  }

  #loginButton,
  #logoutButton {
    min-width: 0;
  }

  .section-head {
    margin: 8px 0 16px;
    padding: 22px 18px 18px;
  }

  .section-head.compact {
    padding: 22px 18px;
  }

  .section-head p:not(.eyebrow) {
    font-size: 14px;
    line-height: 1.72;
  }

  h1 {
    font-size: 34px;
    line-height: 1.08;
  }

  h2 {
    font-size: 28px;
    line-height: 1.12;
  }

  .stats-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .stats-strip span {
    min-height: 78px;
    padding: 12px 8px;
    text-align: center;
    align-content: center;
    font-size: 12px;
  }

  .stats-strip b {
    font-size: 24px;
  }

  .toolbar {
    gap: 10px;
    padding: 10px;
    margin-bottom: 12px;
  }

  .segments {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    overflow: visible;
  }

  .segment {
    min-width: 0;
    height: 38px;
    padding: 0 6px;
    font-size: 13px;
  }

  .toolbar > select,
  .toolbar > button {
    min-height: 42px;
  }

  .mobile-filter-toggle {
    display: inline-flex;
  }

  .advanced-search {
    display: none;
    padding: 10px;
    margin-bottom: 12px;
  }

  .advanced-search.mobile-open {
    display: block;
    animation: softRise 0.22s ease both;
  }

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

  .advanced-grid label:nth-child(n),
  .advanced-grid button {
    grid-column: auto;
  }

  .advanced-grid label {
    font-size: 12px;
  }

  .advanced-grid input,
  .advanced-grid select {
    min-height: 40px;
  }

  .heat-board {
    padding: 10px;
    margin-bottom: 12px;
  }

  .heat-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
  }

  .heat-head .eyebrow {
    margin-bottom: 0;
  }

  .folder-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }

  .folder-card {
    min-height: 54px;
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .folder-card img,
  .folder-cover {
    width: 40px;
    height: 40px;
  }

  .gallery-grid {
    gap: 16px;
  }

  .avatar-card {
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(42, 35, 24, 0.1);
  }

  .avatar-media {
    aspect-ratio: 4 / 3;
  }

  .avatar-info {
    padding: 14px;
  }

  .avatar-info h3 {
    font-size: 16px;
  }

  .avatar-info p {
    margin-bottom: 10px;
    line-height: 1.5;
  }

  .like-button {
    margin-top: 10px;
  }

  .nav {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 7px;
    gap: 5px;
  }

  .nav-link {
    min-height: 50px;
    padding: 0 4px;
    font-size: 12px;
  }

  .nav-link b {
    min-width: 20px;
    padding: 1px 5px;
    font-size: 11px;
  }

  .compare-layout,
  .upload-layout {
    gap: 16px;
  }

  .detail-panel,
  .upload-form,
  .preview-card,
  .login-card {
    padding: 16px;
  }

  .detail-page-layout,
  .forum-layout {
    gap: 16px;
  }

  .detail-figure img {
    max-height: 54vh;
  }

  .forum-layout {
    grid-template-columns: 1fr;
  }

  .forum-compose {
    max-width: none;
  }

  .forum-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .forum-compose-head,
  .forum-feed-head,
  .admin-section-head,
  .timeline-head {
    display: grid;
    gap: 6px;
    align-items: start;
  }

  .forum-compose-head span,
  .forum-feed-head span,
  .admin-section-head span,
  .timeline-head span {
    text-align: left;
  }

  .forum-list,
  .forum-admin-list {
    padding: 12px;
  }

  .forum-post,
  .forum-admin-post {
    padding: 12px;
  }

  .identity-body {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .identity-body img {
    width: 64px;
    height: 64px;
  }

  .ticket-body {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .ticket-qr img {
    width: 96px;
    height: 96px;
  }

  .admin-section {
    padding: 14px;
    margin-top: 18px;
  }

  .admin-section + .admin-section {
    margin-top: 22px;
  }

  .nav-link {
    font-size: 11px;
  }

  .dropzone {
    min-height: 124px;
  }

  .admin-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .admin-metrics article {
    min-height: 74px;
    padding: 10px 8px;
    text-align: center;
  }

  .admin-metrics b {
    font-size: 22px;
  }
}

/* Admin/forum polish pass */
.forum-compose,
.forum-list-panel,
.admin-section {
  overflow: hidden;
}

.forum-form .inline-check {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
}

.forum-form textarea {
  min-height: 150px;
  resize: vertical;
}

.forum-admin-section {
  border-color: color-mix(in srgb, var(--accent-2) 28%, var(--line));
}

.log-admin-section {
  border-color: color-mix(in srgb, var(--gold) 32%, var(--line));
}

.forum-admin-list .empty,
.forum-list .empty {
  padding: 6px 0;
  color: var(--muted);
}

@media (max-width: 920px) {
  .admin-section {
    border-radius: 8px;
  }
}

@media (max-width: 560px) {
  .nav {
    position: static;
    display: flex;
    gap: 8px;
    margin: 14px 0 0;
    padding: 0 0 4px;
    overflow-x: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .nav-link {
    flex: 0 0 auto;
    min-width: 86px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
  }

  .nav-link b {
    position: static;
  }

  .main {
    padding-bottom: 42px;
  }

  .forum-layout {
    gap: 14px;
  }

  .forum-compose,
  .forum-list-panel {
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(42, 35, 24, 0.08);
  }

  .forum-compose-head,
  .forum-feed-head {
    padding: 16px;
  }

  .forum-compose-head h3,
  .forum-feed-head h3 {
    font-size: 23px;
  }

  .forum-form {
    gap: 12px;
    padding: 14px;
  }

  .forum-form textarea {
    min-height: 132px;
  }

  .forum-form .dropzone {
    min-height: 112px;
  }

  .forum-list,
  .forum-admin-list {
    gap: 12px;
    padding: 14px;
  }

  .forum-post,
  .forum-admin-post {
    gap: 10px;
    padding: 14px;
  }

  .forum-post strong,
  .forum-admin-post strong {
    font-size: 18px;
  }

  .admin-section-head h3 {
    font-size: 22px;
  }

  .admin-section-head {
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  .admin-log-list article {
    padding: 12px;
  }

  .avatar-admin-section .table-wrap {
    overflow: visible;
  }

  .avatar-admin-section table,
  .avatar-admin-section thead,
  .avatar-admin-section tbody,
  .avatar-admin-section tr,
  .avatar-admin-section th,
  .avatar-admin-section td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .avatar-admin-section table {
    border-collapse: separate;
    border-spacing: 0 12px;
  }

  .avatar-admin-section thead {
    display: none;
  }

  .avatar-admin-section tr {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: 0 8px 22px rgba(42, 35, 24, 0.07);
  }

  .avatar-admin-section td {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 9px 0;
    border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    word-break: break-word;
  }

  .avatar-admin-section td:first-child {
    grid-template-columns: 1fr;
    padding-top: 0;
  }

  .avatar-admin-section td:nth-child(8) {
    grid-template-columns: 1fr;
  }

  .avatar-admin-section td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .avatar-admin-section td::before {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .avatar-admin-section td:nth-child(2)::before {
    content: "头像";
  }

  .avatar-admin-section td:nth-child(3)::before {
    content: "人物文件夹";
  }

  .avatar-admin-section td:nth-child(4)::before {
    content: "作者";
  }

  .avatar-admin-section td:nth-child(5)::before {
    content: "标签";
  }

  .avatar-admin-section td:nth-child(6)::before {
    content: "热度";
  }

  .avatar-admin-section td:nth-child(7)::before {
    content: "状态";
  }

  .avatar-admin-section td:nth-child(8)::before {
    content: "操作";
  }

  .avatar-admin-section td img {
    width: 56px;
    height: 56px;
  }

  .avatar-admin-section .row-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    min-width: 0 !important;
    width: 100%;
  }

  .avatar-admin-section .row-actions button {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 0 8px;
  }
}

/* Apifox-like API documentation polish */
#apiDocs {
  --api-green: #13a86b;
  --api-blue: #3478f6;
  --api-orange: #e98b2a;
  --api-red: #d94b42;
  --api-purple: #7b61ff;
}

#apiDocs .section-head {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(30, 28, 24, 0.07);
}

.api-docs-layout {
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.api-docs-side {
  top: 78px;
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding-right: 4px;
}

.api-docs-card,
.api-group-card,
.api-endpoint {
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(30, 28, 24, 0.06);
}

.api-docs-card,
.api-group-card {
  padding: 0;
}

.api-docs-card > .eyebrow {
  padding: 14px 16px 0;
}

.api-docs-meta {
  padding: 14px 16px 16px;
}

.api-docs-meta-head {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--ok) 22%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--ok) 8%, var(--surface));
}

.api-docs-meta-head strong,
.api-docs-meta-head small {
  display: block;
}

.api-docs-meta-head small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.api-online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--ok) 18%, transparent);
}

.api-docs-dl {
  gap: 0;
}

.api-docs-dl div {
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.api-docs-dl div:last-child {
  border-bottom: 0;
}

.api-docs-dl dd {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.api-docs-dl code,
.api-endpoint-head code,
.api-docs-card code {
  border-radius: 5px;
  background: color-mix(in srgb, var(--api-blue) 7%, var(--surface-2));
  color: var(--ink);
}

.api-docs-toc {
  gap: 0;
  padding: 8px;
}

.api-docs-toc-group + .api-docs-toc-group {
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.api-docs-toc-link {
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-weight: 850;
}

.api-docs-toc-link small {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 7%, var(--surface-2));
  text-align: center;
}

.api-docs-toc-endpoints {
  display: grid;
  gap: 2px;
  padding: 0 0 8px 10px;
}

.api-docs-toc-endpoints a {
  display: grid;
  grid-template-columns: 45px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
}

.api-docs-toc-endpoints a:hover {
  background: color-mix(in srgb, var(--api-blue) 8%, var(--surface));
  color: var(--ink);
}

.api-docs-toc-endpoints code {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-mini-method {
  padding: 2px 4px;
  border-radius: 4px;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
}

.api-docs-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: end;
  padding: 22px;
}

.api-docs-hero h3 {
  margin: 4px 0 10px;
  font-size: clamp(24px, 3vw, 38px);
  letter-spacing: 0;
}

.api-docs-hero p {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.7;
}

.api-docs-search {
  display: grid;
  gap: 7px;
}

.api-docs-search label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.api-docs-search input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
}

.api-docs-search input:focus {
  border-color: var(--api-blue);
  outline: 3px solid color-mix(in srgb, var(--api-blue) 18%, transparent);
}

.api-docs-primer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.api-docs-primer article {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  background: var(--surface);
}

.api-docs-primer span {
  color: var(--api-blue);
  font-size: 24px;
  font-weight: 950;
}

.api-docs-primer small {
  color: var(--muted);
}

.private-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.private-upload-form {
  position: sticky;
  top: 88px;
}

.private-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
  padding: 0 4px;
}

.private-toolbar h3 {
  margin: 0;
  font-size: 22px;
}

.private-toolbar input {
  width: min(100%, 320px);
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.private-grid .private-card .status.private-status {
  background: color-mix(in srgb, var(--accent) 78%, black);
}

.private-grid .private-card {
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
}

.private-grid .private-card .avatar-media::after {
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.36));
}

.private-grid .private-card .avatar-info {
  background: color-mix(in srgb, var(--surface) 96%, var(--surface-2));
}

.private-grid .private-card .ghost-button {
  width: 100%;
}

.private-head {
  border-color: color-mix(in srgb, var(--accent) 18%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface));
}

body:not(.is-admin) .private-layout,
body:not(.is-admin) .private-head {
  display: none;
}

.api-group-head {
  align-items: center;
  padding: 18px 20px;
  background: color-mix(in srgb, var(--surface-2) 55%, var(--surface));
}

.api-group-head h3 {
  margin: 0;
  font-size: 21px;
}

.api-group-head span {
  max-width: 520px;
  text-align: right;
}

.api-endpoint-list {
  gap: 0;
  margin-top: 0;
}

.api-endpoint {
  gap: 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  scroll-margin-top: 90px;
}

.api-endpoint.hidden,
.api-group-card.hidden {
  display: none;
}

.api-endpoint-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 10px;
}

.api-endpoint-route,
.api-endpoint-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.api-endpoint-route code {
  padding: 7px 9px;
  font-size: 14px;
}

.api-endpoint-tools {
  flex-wrap: wrap;
  justify-content: end;
}

.api-endpoint > p {
  margin: 0;
  padding: 0 18px 14px;
}

.api-param-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 0 18px 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.api-param-strip span {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--surface-2) 55%, var(--surface));
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.api-param-strip strong {
  color: var(--ink);
  font-size: 11px;
  text-transform: uppercase;
}

.api-method {
  min-width: 72px;
  border-radius: 5px;
}

.method-get {
  background: var(--api-blue);
}

.method-post {
  background: var(--api-green);
}

.method-patch,
.method-put {
  background: var(--api-orange);
}

.method-delete,
.method-400,
.method-401,
.method-404,
.method-413,
.method-500 {
  background: var(--api-red);
}

.method-header {
  background: var(--api-purple);
}

.api-copy-mini {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.api-copy-mini:hover {
  border-color: var(--api-blue);
  color: var(--api-blue);
}

.api-code-grid {
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.api-code-grid > div {
  padding: 14px;
  background: var(--surface);
}

.api-code-grid .api-curl-block {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
}

.api-code-grid strong,
.api-example-grid strong {
  color: var(--ink);
}

.api-code-grid pre,
.api-example-grid pre {
  min-height: 86px;
  border-color: color-mix(in srgb, var(--line) 84%, transparent);
  background: color-mix(in srgb, #101828 7%, var(--surface-2));
  font-size: 12px;
  line-height: 1.65;
}

body.dark .api-code-grid pre,
body.dark .api-example-grid pre {
  background: #151a20;
}

.api-example-grid {
  padding: 18px;
}

#apiDocsExamples > .eyebrow,
#apiDocsExamples > h3 {
  padding-left: 18px;
  padding-right: 18px;
}

#apiDocsExamples > .eyebrow {
  padding-top: 18px;
}

@media (max-width: 980px) {
  .api-docs-layout,
  .api-docs-hero,
  .api-code-grid,
  .api-example-grid {
    grid-template-columns: 1fr;
  }

  .api-docs-side {
    position: static;
    max-height: none;
    padding-right: 0;
  }

  .api-docs-toc-endpoints {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-left: 0;
  }

  .api-docs-primer,
  .api-param-strip,
  .private-layout {
    grid-template-columns: 1fr;
  }

  .private-upload-form {
    position: static;
  }

  .private-toolbar {
    display: grid;
    align-items: start;
  }

  .private-toolbar input {
    width: 100%;
  }
}

@media (max-width: 560px) {
  #apiDocs .section-head,
  .api-docs-hero,
  .api-group-head,
  .api-endpoint-head {
    padding: 14px;
  }

  .api-docs-stats {
    width: 100%;
  }

  .api-docs-toc-endpoints {
    grid-template-columns: 1fr;
  }

  .api-endpoint-head,
  .api-endpoint-route,
  .api-endpoint-tools {
    display: grid;
    justify-content: stretch;
  }

  .api-endpoint-tools {
    grid-template-columns: 1fr auto;
  }

  .api-endpoint-route code {
    width: 100%;
  }
}
