:root {
  --paper: #f4efe5;
  --paper-deep: #eae1d2;
  --card: #fffdf8;
  --ink: #19231d;
  --ink-soft: #3f4c43;
  --muted: #7c877f;
  --line: rgba(25, 35, 29, 0.13);
  --line-strong: rgba(25, 35, 29, 0.24);
  --green: #1f6b4e;
  --green-dark: #103f2e;
  --green-soft: #dfece2;
  --green-pale: #edf3eb;
  --coral: #d66f4f;
  --coral-dark: #aa4e34;
  --coral-soft: #f8e4dc;
  --gold: #c59b55;
  --danger: #b34c39;
  --shadow-sm: 0 1px 2px rgba(22, 31, 25, 0.04), 0 6px 20px rgba(22, 31, 25, 0.05);
  --shadow-md: 0 20px 50px rgba(22, 31, 25, 0.1);
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", STSong, SimSun, serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(900px 500px at 96% -5%, rgba(211, 189, 150, 0.28), transparent 68%),
    radial-gradient(700px 480px at -8% 20%, rgba(115, 154, 128, 0.16), transparent 66%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: repeating-linear-gradient(
    102deg,
    rgba(55, 64, 55, 0.025) 0,
    rgba(55, 64, 55, 0.025) 1px,
    transparent 1px,
    transparent 5px
  );
  content: "";
  pointer-events: none;
}

::selection {
  background: var(--green);
  color: #fffdf8;
}

img {
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
}

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

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.noscript-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--coral-soft);
  color: var(--coral-dark);
  font-size: 12px;
  text-align: center;
}

/* ── gate 入口 ───────────────────────────────────────────── */
.gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(700px 480px at 50% 42%, rgba(31, 107, 78, 0.16), transparent 70%),
    radial-gradient(900px 600px at 50% 110%, rgba(214, 111, 79, 0.14), transparent 72%),
    var(--paper);
  transition: opacity 500ms ease, visibility 500ms ease;
}

.gate.is-done {
  visibility: hidden;
  opacity: 0;
}

.gate-glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 253, 248, 0.9), rgba(255, 253, 248, 0) 68%);
  filter: blur(2px);
  pointer-events: none;
}

.gate-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.gate-avatar-btn {
  position: relative;
  width: 168px;
  height: 168px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.gate-avatar-btn img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 24px 60px rgba(16, 63, 46, 0.35);
  transition: transform 500ms cubic-bezier(0.22, 0.8, 0.28, 1), opacity 500ms ease, box-shadow 500ms ease;
}

.gate-avatar-btn:hover img {
  transform: scale(1.05);
  box-shadow: 0 30px 70px rgba(16, 63, 46, 0.42);
}

.gate-ring {
  position: absolute;
  border: 1px dashed rgba(31, 107, 78, 0.35);
  border-radius: 50%;
  pointer-events: none;
}

.gate-ring-a {
  inset: -14px;
  animation: spin 18s linear infinite;
}

.gate-ring-b {
  inset: -30px;
  border-color: rgba(214, 111, 79, 0.28);
  animation: spin 26s linear infinite reverse;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.gate-title {
  margin: 30px 0 6px;
  font-family: var(--serif);
  font-size: clamp(2.6rem, 6vw, 4rem);
  font-weight: 600;
  letter-spacing: 0.14em;
}

.gate-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  letter-spacing: 0.06em;
}

.gate-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 34px;
  padding: 8px 18px;
  border: 1px solid rgba(31, 107, 78, 0.28);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.6);
  color: var(--green-dark);
  font-size: 11px;
  letter-spacing: 0.1em;
  animation: hint-pulse 2.4s ease-in-out infinite;
}

.gate-hint::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--coral);
  content: "";
}

@keyframes hint-pulse {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

.gate.is-entering .gate-avatar-btn img {
  transform: scale(2.6);
  opacity: 0;
  border-radius: 50%;
}

.gate.is-entering .gate-ring {
  animation: none;
  transform: scale(3.6);
  opacity: 0;
  transition: transform 700ms ease, opacity 700ms ease;
}

.gate.is-entering .gate-title,
.gate.is-entering .gate-sub,
.gate.is-entering .gate-hint {
  opacity: 0;
  transition: opacity 350ms ease;
}

/* ── shared buttons ──────────────────────────────────────── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.button svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.button-primary {
  background: var(--green);
  color: #fffef9;
  box-shadow: 0 8px 22px rgba(16, 63, 46, 0.17);
}

.button-primary:hover {
  background: var(--green-dark);
}

.button-quiet {
  border-color: var(--line-strong);
  background: rgba(255, 253, 248, 0.55);
  color: var(--ink);
}

.button-quiet:hover {
  border-color: var(--ink);
  background: var(--card);
}

.button-soft {
  border-color: var(--line);
  background: var(--card);
  color: var(--green-dark);
}

.button-ghost {
  border-color: transparent;
  background: var(--green);
  color: #fff;
  box-shadow: 0 8px 20px rgba(16, 63, 46, 0.16);
}

.button-ghost:hover {
  background: var(--green-dark);
}

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

.button-danger-quiet {
  border-color: rgba(179, 76, 57, 0.25);
  background: var(--coral-soft);
  color: var(--coral-dark);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.icon-button:hover {
  border-color: var(--line);
  background: var(--card);
  color: var(--ink);
}

.eyebrow,
.section-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  line-height: 1.4;
}

.eyebrow > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--coral);
}

.section-kicker {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.2em;
}

/* ── topbar ──────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 34px;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 14px max(40px, calc((100vw - 1240px) / 2 + 40px));
  backdrop-filter: blur(16px);
  background: rgba(244, 239, 229, 0.84);
  border-bottom: 1px solid rgba(25, 35, 29, 0.07);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px 16px 12px 16px;
  background: var(--green-dark);
  color: #f6f1e7;
  transform: rotate(-2deg);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-copy strong {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.brand-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.14em;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-item {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: background 160ms ease, color 160ms ease;
}

.nav-item:hover {
  color: var(--ink);
}

.nav-item.is-active {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.owner-badge {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 700;
}

.mini-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.4);
}

/* ── main / intro ────────────────────────────────────────── */
.main {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 30px 40px 40px;
}

.intro {
  padding: 18px 0 8px;
}

.intro h1 {
  margin: 14px 0 10px;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 4.4vw, 4rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.intro-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin: 5px 0 0;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.section-heading > p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
}

/* ── featured marquee ────────────────────────────────────── */
.featured-section {
  padding-top: 34px;
}

.featured-viewport {
  overflow: hidden;
  margin: 0 -40px;
  padding: 6px 40px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}

.featured-track {
  display: flex;
  width: max-content;
  animation: marquee 32s linear infinite;
}

.featured-track:hover {
  animation-play-state: paused;
}

@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.featured-frame {
  position: relative;
  flex: none;
  width: 232px;
  height: 320px;
  margin-right: 18px;
  overflow: hidden;
  border: 1px solid rgba(25, 35, 29, 0.08);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 240ms ease, box-shadow 240ms ease;
}

.featured-frame:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.featured-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-frame::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(12, 24, 17, 0.5), transparent 45%);
  content: "";
}

.featured-frame span {
  position: absolute;
  right: 13px;
  bottom: 12px;
  left: 13px;
  z-index: 1;
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── categories & frames ─────────────────────────────────── */
.categories-root {
  padding-top: 46px;
}

.category-section {
  margin-top: 14px;
}

.category-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
}

.category-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
}

.category-count {
  color: var(--muted);
  font-size: 11px;
}

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

.photo-frame {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border: 1px solid rgba(25, 35, 29, 0.08);
  border-radius: 16px;
  background: var(--paper-deep);
  cursor: zoom-in;
  box-shadow: var(--shadow-sm);
  transition: transform 240ms ease, box-shadow 240ms ease;
  animation: frame-in 420ms both;
}

.photo-frame:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

@keyframes frame-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms cubic-bezier(0.22, 0.8, 0.28, 1);
}

.photo-frame:hover img {
  transform: scale(1.035);
}

.photo-frame::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(12, 24, 17, 0.42), transparent 40%);
  opacity: 0;
  transition: opacity 220ms ease;
  content: "";
}

.photo-frame:hover::after {
  opacity: 1;
}

.photo-frame .frame-caption {
  position: absolute;
  right: 13px;
  bottom: 11px;
  left: 13px;
  z-index: 1;
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.photo-frame:hover .frame-caption {
  opacity: 1;
  transform: translateY(0);
}

.photo-frame .frame-caption.is-empty {
  color: rgba(255, 255, 255, 0.75);
  font-weight: 400;
}

/* ── empty state ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 58px 24px 48px;
  border: 1px dashed var(--line-strong);
  border-radius: 26px;
  text-align: center;
}

.empty-art {
  position: relative;
  width: 110px;
  height: 86px;
  margin-bottom: 23px;
}

.empty-art span {
  position: absolute;
  width: 66px;
  height: 76px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--card);
}

.empty-art span:nth-child(1) {
  top: 2px;
  left: 4px;
  transform: rotate(-9deg);
}

.empty-art span:nth-child(2) {
  top: 5px;
  right: 3px;
  background: var(--green-soft);
  transform: rotate(7deg);
}

.empty-art span:nth-child(3) {
  top: 0;
  left: 23px;
  background:
    radial-gradient(circle at 69% 29%, var(--coral) 0 5px, transparent 5.5px),
    linear-gradient(145deg, var(--card) 0 56%, #d9e4d8 56% 100%);
  transform: rotate(-1deg);
  box-shadow: var(--shadow-sm);
}

.empty-state h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
}

.empty-state p {
  max-width: 340px;
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 12px;
}

/* ── footer ──────────────────────────────────────────────── */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 30px 40px 38px;
  color: #98a099;
  font-size: 9px;
  letter-spacing: 0.05em;
}

/* ── dialogs ─────────────────────────────────────────────── */
dialog {
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(13, 24, 17, 0.55);
  backdrop-filter: blur(7px);
}

.modal {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.32);
}

.modal[open] {
  animation: dialog-in 240ms ease both;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
}

.command-shell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 30px;
}

.command-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
}

.command-icon svg {
  width: 22px;
  height: 22px;
}

.command-shell h2 {
  margin: 16px 0 6px;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
}

.command-shell p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.command-shell .field {
  width: 100%;
  margin-top: 20px;
}

.command-shell .field input {
  height: 50px;
  font-size: 15px;
}

.command-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  width: 100%;
  margin-top: 22px;
}

.command-error {
  min-height: 18px;
  margin: 10px 0 0 !important;
  color: var(--danger) !important;
}

/* ── fields & forms ──────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.field small {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 400;
}

.field input,
.field select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffefb;
  color: var(--ink);
  font-size: 13px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input::placeholder {
  color: #a9b0aa;
}

.field input:focus,
.field select:focus {
  border-color: var(--green);
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 107, 78, 0.09);
}

/* ── manager ─────────────────────────────────────────────── */
.manager-modal {
  width: min(680px, calc(100vw - 32px));
}

.manager-shell {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
  overflow: hidden;
  border-radius: 22px;
}

.manager-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px 0;
}

.manager-head h2 {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
}

.manager-tabs {
  display: flex;
  gap: 4px;
  margin: 18px 26px 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.manager-tab {
  padding: 8px 15px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.manager-tab.is-active {
  background: var(--green-soft);
  color: var(--green-dark);
}

.manager-body {
  padding: 18px 26px 10px;
  overflow-y: auto;
}

.m-panel {
  animation: panel-in 200ms ease both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

.dropzone {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 96px;
  padding: 18px 20px;
  border: 1.5px dashed rgba(31, 107, 78, 0.34);
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(223, 236, 226, 0.38), rgba(255, 253, 248, 0.4)),
    var(--card);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--green);
  background: var(--green-pale);
}

.dropzone-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 15px 20px 15px 20px;
  background: var(--green-soft);
  color: var(--green);
}

.dropzone-icon svg {
  width: 27px;
  height: 27px;
}

.dropzone-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dropzone-copy strong {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
}

.dropzone-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.selection {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.selection-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.selection-head > div {
  display: flex;
  flex-direction: column;
}

.selection-head strong {
  font-size: 12px;
}

.selection-head span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 9px;
  margin-top: 13px;
}

.selection-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--paper-deep);
}

.selection-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.selection-item button {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(17, 26, 20, 0.72);
  color: #fff;
  cursor: pointer;
}

.selection-item button svg {
  width: 13px;
  height: 13px;
}

.upload-meta-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 16px;
  margin-top: 16px;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  color: var(--ink-soft);
  font-size: 12px;
  cursor: pointer;
}

.check-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.upload-progress {
  margin-top: 16px;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
}

.progress-meta strong {
  color: var(--green);
  font-weight: 700;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--paper-deep);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #5ea77a);
  transition: width 140ms ease;
}

.manager-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.add-category {
  display: flex;
  gap: 9px;
}

.add-category input {
  flex: 1;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffefb;
  font-size: 13px;
}

.add-category input:focus {
  border-color: var(--green);
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 107, 78, 0.09);
}

.category-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffefb;
}

.cat-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-name-input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--green);
  border-radius: 7px;
  font-size: 13px;
}

.cat-count {
  color: var(--muted);
  font-size: 10px;
}

.cat-actions {
  display: flex;
  gap: 4px;
}

.cat-actions button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.cat-actions button:hover {
  background: var(--green-soft);
  color: var(--green-dark);
}

.cat-actions button.danger:hover {
  background: var(--coral-soft);
  color: var(--danger);
}

.cat-actions svg {
  width: 15px;
  height: 15px;
}

.panel-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.avatar-editor {
  display: flex;
  gap: 18px;
  align-items: center;
}

.avatar-editor img {
  flex: none;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.avatar-editor p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11px;
}

.avatar-editor .button + .button {
  margin-left: 8px;
}

.manager-foot {
  display: flex;
  justify-content: space-between;
  padding: 14px 26px 20px;
  border-top: 1px solid var(--line);
}

/* ── lightbox ────────────────────────────────────────────── */
.lightbox {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.lightbox::backdrop {
  background: rgba(8, 14, 10, 0.82);
  backdrop-filter: blur(6px);
}

.lightbox-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.55fr);
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #101711;
  color: #f6f1e7;
  transform-origin: center center;
  will-change: transform;
  transition: transform 480ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  background: rgba(20, 30, 23, 0.72);
  color: #fff;
}

.lightbox-close:hover {
  background: rgba(20, 30, 23, 0.9);
  color: #fff;
}

.lightbox-media {
  display: grid;
  place-items: center;
  min-height: 0;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.025) 75%),
    #101711;
  background-size: 24px 24px;
}

.lightbox-media img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100vh;
  object-fit: contain;
}

.lightbox-info {
  display: flex;
  flex-direction: column;
  padding: 46px 30px 30px;
  overflow-y: auto;
}

.lightbox-category {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(246, 241, 231, 0.12);
  color: #d9af6e;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.lightbox-info h2 {
  margin: 16px 0 4px;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.lightbox-meta {
  margin: 26px 0;
}

.lightbox-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(246, 241, 231, 0.12);
}

.lightbox-meta dt {
  color: rgba(246, 241, 231, 0.5);
  font-size: 10px;
}

.lightbox-meta dd {
  max-width: 72%;
  margin: 0;
  overflow: hidden;
  font-size: 11px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: auto;
  padding-top: 18px;
}

.lightbox-actions .button {
  flex: 1;
  min-width: 110px;
  font-size: 12px;
}

.lightbox-actions .button-quiet,
.lightbox-actions .button-danger-quiet {
  border-color: rgba(246, 241, 231, 0.24);
  background: rgba(246, 241, 231, 0.08);
  color: #f6f1e7;
}

.lightbox-actions .button-quiet:hover {
  background: rgba(246, 241, 231, 0.16);
}

.lightbox-actions .button-danger-quiet {
  border-color: rgba(240, 140, 114, 0.3);
  color: #f0a48e;
}

.lightbox-actions .button-danger-quiet:hover {
  background: rgba(240, 140, 114, 0.16);
}

/* ── toast ───────────────────────────────────────────────── */
.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(390px, calc(100vw - 32px));
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(19, 31, 23, 0.94);
  color: #f9f5e9;
  font-size: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.2);
  transform: translateY(8px);
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease;
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.toast::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7bc498;
  content: "";
  flex: none;
}

.toast.is-error::before {
  background: #f08c72;
}

/* ── responsive ──────────────────────────────────────────── */
@media (max-width: 1020px) {
  .topbar {
    gap: 20px;
    padding-right: 28px;
    padding-left: 28px;
  }

  .main {
    padding-right: 28px;
    padding-left: 28px;
  }

  .featured-viewport {
    margin-right: -28px;
    margin-left: -28px;
    padding-right: 28px;
    padding-left: 28px;
  }

  .lightbox-shell {
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  }
}

@media (max-width: 860px) {
  .desktop-nav {
    display: none;
  }

  .topbar {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .main {
    padding-top: 18px;
    padding-bottom: 40px;
  }

  .lightbox-shell {
    display: flex;
    flex-direction: column;
  }

  .lightbox-media {
    max-height: 52vh;
    flex: none;
  }

  .lightbox-media img {
    max-height: 52vh;
  }

  .lightbox-info {
    padding: 22px 20px 20px;
  }

  .lightbox-info h2 {
    font-size: 23px;
  }

  .lightbox-meta {
    margin: 14px 0;
  }

  .footer {
    display: none;
  }

  .toast-region {
    right: 16px;
    bottom: 16px;
    left: 16px;
    align-items: center;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 14px;
  }

  .gate-avatar-btn {
    width: 140px;
    height: 140px;
  }

  .gate-title {
    margin-top: 24px;
    font-size: 2.4rem;
  }

  .gate-sub {
    font-size: 12px;
  }

  .gate-hint {
    margin-top: 26px;
  }

  .topbar {
    padding: 11px 16px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

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

  .brand-copy small {
    display: none;
  }

  .mini-avatar {
    width: 31px;
    height: 31px;
  }

  .main {
    padding: 12px 16px 36px;
  }

  .intro h1 {
    font-size: 2.5rem;
  }

  .featured-section {
    padding-top: 24px;
  }

  .featured-viewport {
    margin-right: -16px;
    margin-left: -16px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .featured-frame {
    width: 190px;
    height: 262px;
  }

  .section-heading {
    display: block;
  }

  .section-heading > p {
    margin-top: 8px;
  }

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

  .photo-frame {
    border-radius: 13px;
  }

  .categories-root {
    padding-top: 34px;
  }

  .category-head h2 {
    font-size: 22px;
  }

  .command-shell {
    padding: 24px;
  }

  .manager-modal {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .manager-head {
    padding: 20px 20px 0;
  }

  .manager-tabs {
    margin: 14px 20px 0;
  }

  .manager-body {
    padding: 16px 20px 8px;
  }

  .manager-foot {
    padding: 12px 20px 16px;
  }

  .upload-meta-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .check-field {
    padding-bottom: 0;
  }

  .dropzone {
    padding: 16px;
  }

  .avatar-editor {
    flex-direction: column;
    align-items: flex-start;
  }

  .lightbox-close {
    top: 10px;
    right: 10px;
  }

  .lightbox-media {
    max-height: 46vh;
  }

  .lightbox-media img {
    max-height: 46vh;
  }
}

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