:root {
  color-scheme: light;
  --ink: #17211d;
  --ink-soft: #3e4b43;
  --museum-green: #123a32;
  --museum-green-2: #0a2926;
  --paper: #f8f1e3;
  --paper-soft: #fffaf0;
  --paper-muted: #eadfc9;
  --gold: #c89b4a;
  --gold-soft: #ead09b;
  --cinnabar: #b8422d;
  --jade: #1d7566;
  --shadow: rgba(18, 28, 24, .22);
  --hairline: rgba(39, 54, 47, .14);
  --font-display: "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --font-ui: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Source Han Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: clamp(18px, 2.6vw, 42px);
  color: var(--ink);
  font-family: var(--font-ui);
  background:
    linear-gradient(115deg, rgba(200, 155, 74, .15), transparent 36%),
    radial-gradient(circle at 80% 18%, rgba(234, 208, 155, .2), transparent 34%),
    linear-gradient(135deg, var(--museum-green-2), var(--museum-green) 58%, #1f4635);
}

/* Desktop content workspace */
body {
  padding: 24px;
  background: #e9ece8;
}

body::before,
body::after {
  opacity: .035;
}

.admin-shell {
  max-width: 1560px;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
  border-color: rgba(18, 58, 50, .16);
  box-shadow: 0 18px 54px rgba(18, 28, 24, .14);
}

.admin-header {
  grid-template-columns: auto 1fr auto;
  justify-items: start;
  align-items: center;
  gap: 20px;
  margin: 0;
  padding: 18px 24px;
  text-align: left;
  border-radius: 0;
}

.brand-mark {
  width: 150px;
  height: 48px;
  grid-column: 1;
  grid-row: 1 / span 2;
}

.admin-header h1 {
  grid-column: 2;
  font-size: 28px;
  line-height: 1.2;
}

.admin-header p {
  grid-column: 2;
  max-width: none;
  font-size: 14px;
}

.back-link {
  grid-column: 3;
  grid-row: 1 / span 2;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 6px;
}

.admin-content {
  padding: 20px 24px 0;
}

.notice {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-left-width: 4px;
  border-radius: 6px;
  font-size: 14px;
}

.editor {
  gap: 16px;
}

.password {
  display: none;
}

.hall-manager,
.device-location-panel,
.editor-block,
.content-card {
  border-radius: 6px;
}

.hall-manager {
  grid-template-columns: minmax(300px, 520px) 1fr;
  padding: 16px;
}

.device-location-panel {
  grid-template-columns: minmax(300px, 1fr) minmax(240px, 360px) auto;
  padding: 16px;
}

.device-location-panel strong {
  font-size: 22px;
}

.editor-tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 4px;
  padding: 8px;
  background: rgba(248, 241, 227, .97);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(18, 28, 24, .08);
  backdrop-filter: blur(10px);
}

.editor-tabs button {
  min-width: 0;
  min-height: 42px;
  padding: 9px 18px;
  color: var(--ink-soft);
  background: transparent;
  border-radius: 4px;
  box-shadow: none;
  font-size: 15px;
}

.editor-tabs button.is-active {
  color: #fff;
  background: var(--museum-green);
}

.editor-block {
  padding: 20px;
  border-left-width: 4px;
}

.block-head h2 {
  font-size: 26px;
}

.content-card-head h3 {
  font-size: 20px;
}

label {
  gap: 6px;
  font-size: 14px;
}

input,
textarea,
select {
  min-height: 42px;
  padding: 9px 11px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 500;
}

.grid {
  gap: 14px;
}

.local-image-field {
  grid-template-columns: 112px minmax(220px, 1fr) auto;
  align-items: center;
  padding: 10px;
  border-radius: 5px;
}

.upload-preview {
  grid-row: 1 / span 3;
  width: 112px;
  height: 76px;
  object-fit: cover;
  background: #e5e1d8;
  border: 1px solid var(--hairline);
  border-radius: 4px;
}

.local-image-field input[type="file"] {
  min-height: 40px;
}

.local-image-field span {
  font-size: 12px;
}

.local-image-field button {
  grid-column: 3;
  grid-row: 1 / span 2;
}

button {
  min-width: 112px;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 5px;
  font-size: 14px;
}

.actions {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin: 0 -24px;
  padding: 14px 24px;
  background: rgba(255, 250, 240, .97);
  border-top: 1px solid var(--hairline);
  box-shadow: 0 -10px 28px rgba(18, 28, 24, .09);
  backdrop-filter: blur(10px);
}

#status {
  position: sticky;
  bottom: 70px;
  z-index: 19;
  margin: 0;
  padding: 10px 14px;
  color: var(--museum-green);
  background: #fffaf0;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  font-size: 14px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: .16;
  background-image:
    linear-gradient(rgba(248, 241, 227, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(248, 241, 227, .08) 1px, transparent 1px);
  background-size: 42px 42px;
}

body::after {
  content: "";
  position: fixed;
  inset: -120px;
  z-index: -1;
  pointer-events: none;
  opacity: .14;
  background-image: url("assets/peony-chanzhi-gold-transparent.png");
  background-size: 620px 620px;
  mix-blend-mode: screen;
}

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

.admin-shell {
  max-width: 1340px;
  margin: 0 auto;
  padding: clamp(24px, 3vw, 46px);
  background:
    linear-gradient(180deg, rgba(255, 250, 240, .98), rgba(248, 241, 227, .95)),
    var(--paper);
  border: 1px solid rgba(234, 208, 155, .48);
  border-radius: 28px;
  box-shadow: 0 34px 90px var(--shadow);
}

.admin-header {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-bottom: 26px;
  padding: 28px;
  overflow: hidden;
  text-align: center;
  color: var(--paper-soft);
  background:
    linear-gradient(135deg, rgba(200,155,74,.2), transparent),
    var(--museum-green);
  border-radius: 24px;
}

.brand-mark {
  width: 250px;
  height: 74px;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .24));
}

.back-link {
  justify-self: start;
  min-height: 52px;
  padding: 14px 18px;
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(180deg, #f5d891, var(--gold));
  border-radius: 999px;
  font-weight: 900;
}

h1 {
  margin: 0;
  color: var(--paper-soft);
  font-family: var(--font-display);
  font-size: clamp(48px, 5vw, 82px);
  font-weight: 900;
  line-height: 1;
}

.admin-header p,
.login-panel p,
#status,
#login-status {
  color: var(--ink-soft);
  font-size: 18px;
  font-weight: 650;
  line-height: 1.65;
}

.admin-header p {
  max-width: 820px;
  margin: 0;
  color: rgba(255, 250, 240, .82);
  font-size: 20px;
}

.notice {
  display: grid;
  gap: 8px;
  margin: 18px 0 26px;
  padding: 18px 20px;
  color: var(--ink);
  background: rgba(200, 155, 74, .14);
  border: 1px solid rgba(200, 155, 74, .36);
  border-left: 7px solid var(--gold);
  border-radius: 20px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.55;
}

.notice code {
  padding: 2px 7px;
  background: rgba(255,255,255,.72);
  border-radius: 8px;
  font-weight: 900;
}

.login-panel {
  max-width: 620px;
  margin: 36px auto 12px;
  padding: 34px;
  background: rgba(255, 250, 240, .82);
  border: 1px solid var(--hairline);
  border-radius: 24px;
  box-shadow: 0 22px 44px rgba(18,28,24,.12);
}

.login-panel h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 50px;
  line-height: 1.08;
}

.login-form,
.editor {
  display: grid;
  gap: 20px;
}

.login-form {
  margin-top: 24px;
}

.admin-content[hidden] {
  display: none;
}

label {
  display: grid;
  gap: 9px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 850;
}

.password {
  max-width: 430px;
}

input,
textarea,
select {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fffdf7;
  border: 1px solid rgba(18, 58, 50, .2);
  border-radius: 14px;
  box-shadow: inset 0 1px 8px rgba(18,58,50,.05);
  font-size: 17px;
  line-height: 1.58;
  font-weight: 650;
}

textarea {
  resize: vertical;
}

input[type="file"] {
  padding: 10px;
}

input:focus,
textarea:focus,
select:focus {
  outline: 4px solid rgba(200, 155, 74, .34);
  border-color: rgba(200, 155, 74, .9);
}

.local-video-field span,
.local-image-field span {
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.5;
}

.local-image-field {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 14px;
  background: rgba(29, 117, 102, .08);
  border: 1px solid rgba(29, 117, 102, .18);
  border-radius: 14px;
}

.local-image-field button {
  justify-self: start;
  min-width: 0;
  min-height: 44px;
  padding: 0 14px;
}

.hall-manager,
.device-location-panel {
  display: grid;
  gap: 18px;
  align-items: end;
  padding: 20px;
  background: rgba(255, 250, 240, .72);
  border: 1px solid var(--hairline);
  border-left: 7px solid var(--gold);
  border-radius: 20px;
}

.hall-manager {
  grid-template-columns: minmax(260px, 1fr) auto;
}

.device-location-panel {
  grid-template-columns: minmax(320px, 1fr) minmax(240px, 340px) auto;
  border-left-color: var(--jade);
}

.hall-actions,
.device-location-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.device-location-panel strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1.08;
}

.device-location-panel p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.6;
}

#device-location-status {
  grid-column: 1 / -1;
  min-height: 24px;
  color: var(--cinnabar);
  font-size: 16px;
  font-weight: 850;
}

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

.editor-sections,
.content-groups {
  display: grid;
  gap: 22px;
}

.editor-block,
.content-card {
  display: grid;
  gap: 18px;
  padding: 24px;
  background: rgba(255, 250, 240, .72);
  border: 1px solid var(--hairline);
  border-left: 7px solid var(--jade);
  border-radius: 22px;
}

.editor-block:nth-of-type(2) {
  border-left-color: var(--cinnabar);
}

.editor-block:nth-of-type(3) {
  border-left-color: var(--gold);
}

.editor-block:nth-of-type(4) {
  border-left-color: var(--museum-green);
}

.content-card {
  padding: 20px;
  border-left-width: 0;
}

.block-head,
.content-card-head {
  display: grid;
  gap: 7px;
}

.block-head h2,
.content-card-head h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 850;
  line-height: 1.1;
}

.block-head h2 {
  font-size: 38px;
}

.content-card-head h3 {
  font-size: 28px;
}

.block-head p,
.content-card-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.58;
}

.compact-grid {
  gap: 14px;
}

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

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
}

button {
  min-width: 138px;
  min-height: 54px;
  border: 0;
  border-radius: 999px;
  color: var(--paper-soft);
  background: var(--museum-green);
  box-shadow: 0 12px 28px rgba(18,28,24,.14);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

button[type="button"] {
  color: var(--ink);
  background: linear-gradient(180deg, #f5d891, var(--gold));
}

#delete-hall {
  color: #fff;
  background: var(--cinnabar);
}

button:focus-visible,
.back-link:focus-visible {
  outline: 4px solid rgba(200, 155, 74, .42);
  outline-offset: 4px;
}

#status,
#login-status {
  min-height: 28px;
  margin: 0;
}

#login-status {
  color: var(--cinnabar);
}

#status {
  position: fixed;
  right: 28px;
  bottom: 82px;
  z-index: 100;
  max-width: min(560px, calc(100vw - 56px));
  min-height: 0;
  padding: 12px 16px;
  color: #fff;
  background: var(--museum-green);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 6px;
  box-shadow: 0 16px 36px rgba(18, 28, 24, .24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .18s ease, transform .18s ease;
}

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

button:disabled {
  cursor: wait;
  opacity: .62;
}

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

@media (max-width: 900px) {
  .admin-shell {
    padding: 18px;
  }

  .grid,
  .hall-manager,
  .device-location-panel {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }

  .back-link {
    justify-self: center;
  }
}
