:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.9);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(29, 29, 31, 0.12);
  --blue: #0071e3;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.11);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000;
    --panel: rgba(28, 28, 30, 0.74);
    --panel-strong: rgba(44, 44, 46, 0.9);
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --line: rgba(255, 255, 255, 0.14);
    --blue: #2997ff;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
  }

  .brand img {
    filter: invert(1);
  }
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% -8%, rgba(0, 113, 227, 0.18), transparent 34rem),
    radial-gradient(circle at 92% 12%, rgba(175, 82, 222, 0.12), transparent 26rem),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
}

.brand img {
  width: min(42vw, 280px);
  display: block;
}

.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.nav a,
.nav button,
.primary,
.secondary {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  background: var(--panel-strong);
  color: var(--text);
}

.primary {
  border-color: transparent;
  background: var(--blue);
  color: #fff;
}

.danger {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 59, 48, 0.28);
  border-radius: 999px;
  padding: 0 16px;
  background: color-mix(in srgb, #ff3b30 12%, var(--panel-strong));
  color: color-mix(in srgb, #ff3b30 78%, var(--text));
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(24px, 4vw, 56px) 0;
}

.hero {
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 36px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(30px) saturate(170%);
  -webkit-backdrop-filter: blur(30px) saturate(170%);
  padding: clamp(34px, 8vw, 80px);
}

.hero h1 {
  margin: 0;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.55;
}

.hero.hero-media {
  padding: 0;
  overflow: hidden;
  min-height: 420px;
}

.hero.hero-media img,
.hero.hero-media video {
  display: block;
  width: 100%;
  min-height: 420px;
  max-height: 620px;
  object-fit: cover;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.glass,
.album-card {
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(170%);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
}

.toolbar {
  margin: 20px 0;
  padding: 18px;
  display: grid;
  grid-template-columns: 160px minmax(220px, 1fr) 180px 180px auto;
  gap: 12px;
  align-items: end;
}

.login-card,
.author-panel {
  margin: 20px 0;
  padding: 20px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 26px 0 14px;
}

.section-head h2,
.form-grid h3,
.viewer-info h2 {
  margin: 0;
}

.muted,
.message,
.footer {
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 12px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.photo-manager {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.compact-head {
  margin-bottom: 12px;
}

.manager-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1fr) minmax(260px, 1.6fr);
  gap: 12px;
  align-items: end;
}

.manager-actions {
  align-self: end;
}

.photo-library {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.photo-row {
  display: grid;
  grid-template-columns: auto 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
}

.photo-row img {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--panel-strong);
}

.photo-row h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.photo-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.photo-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.photo-row-actions button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 9px 12px;
  background: color-mix(in srgb, var(--panel-strong) 82%, transparent);
  color: var(--text);
  outline: none;
}

select[multiple] {
  min-height: 120px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: color-mix(in srgb, var(--blue) 62%, var(--line));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 14%, transparent);
}

.split-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.inline-action,
.button-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-action input {
  flex: 1 1 180px;
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

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

.album-card {
  overflow: hidden;
}

.album-cover {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel-strong) 72%, var(--blue) 8%);
}

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

.album-cover span {
  color: var(--muted);
  font-weight: 800;
}

.album-body {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.album-body h3 {
  margin: 0;
  font-size: 22px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--muted);
  font-size: 13px;
}

.photo-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.photo-strip button {
  border: 0;
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--panel-strong);
}

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

.viewer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
}

.viewer[hidden] {
  display: none;
}

.viewer-panel {
  position: relative;
  width: min(1100px, 100%);
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 30px;
  background: var(--panel-strong);
}

.viewer-media {
  min-height: min(72vh, 720px);
  display: grid;
  place-items: center;
  background: #000;
}

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

.viewer-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.photo-detail-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 42px 20px;
}

.detail-photo-card {
  margin: 28px 0 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 36px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.detail-photo-card img {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.04);
}

.detail-photo-card figcaption {
  padding: 22px 8px 6px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-strong);
  color: var(--text);
  font-size: 24px;
}

.close-viewer {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
}

.compact {
  flex-wrap: nowrap;
}

.footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 32px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
  font-size: 13px;
}

.police-beian {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.police-beian img {
  width: 18px;
  height: 20px;
}

@media (max-width: 900px) {
  .toolbar,
  .admin-grid,
  .manager-grid {
    grid-template-columns: 1fr;
  }

  .section-head,
  .viewer-info {
    align-items: flex-start;
    flex-direction: column;
  }

  .compact {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .topbar {
    justify-content: center;
  }

  .brand img {
    width: min(82vw, 320px);
  }

  .nav {
    width: 100%;
    justify-content: center;
  }

  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .hero {
    min-height: 260px;
    border-radius: 28px;
  }

  .hero h1 {
    font-size: clamp(42px, 13vw, 58px);
  }

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

  .split-fields {
    grid-template-columns: 1fr;
  }

  .photo-row {
    grid-template-columns: auto 58px minmax(0, 1fr);
  }

  .photo-row img {
    width: 58px;
    height: 58px;
  }

  .photo-row-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .photo-row-actions button {
    flex: 1 1 auto;
  }
}
