:root {
  --red: #c9433a;
  --red-deep: #982d27;
  --red-soft: #f9e9e5;
  --gold: #d9a653;
  --gold-soft: #f8edda;
  --ink: #352925;
  --muted: #76655d;
  --paper: #fff9f1;
  --surface: #fffdf9;
  --line: #eadbce;
  --success: #397b60;
  --shadow: 0 14px 40px rgba(117, 61, 43, 0.12);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.65;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.museum-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 10px max(18px, env(safe-area-inset-left));
  color: #fffaf2;
  background: linear-gradient(135deg, var(--red-deep), var(--red));
  border-bottom: 4px solid var(--gold);
}

.museum-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.museum-seal {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 2px solid #edc880;
  border-radius: 12px;
  color: #ffe9bd;
  background: #8f261f;
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 27px;
  font-weight: 700;
}
.museum-brand strong { display: block; font-family: "KaiTi", "STKaiti", serif; font-size: 21px; letter-spacing: 2px; }
.museum-brand small { display: block; color: #ffe0b2; font-size: 12px; }

.header-link, .ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  color: inherit;
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.page-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 64px; }
.intro { max-width: 760px; margin-bottom: 28px; }
.intro h1, .exhibit-copy h1 { margin: 0 0 10px; font-family: "KaiTi", "STKaiti", serif; color: var(--red-deep); line-height: 1.25; }
.intro h1 { font-size: clamp(32px, 6vw, 54px); }
.intro p, .exhibit-copy p { margin: 0; color: var(--muted); }

.exhibit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.exhibit-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(117, 61, 43, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.view-count-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  color: #fff;
  background: rgba(54, 41, 37, 0.76);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}
.exhibit-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.exhibit-card a { display: block; color: inherit; text-decoration: none; }
.exhibit-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--gold-soft); }
.card-copy { padding: 16px; }
.card-copy h2 { margin: 0 0 6px; font-size: 20px; line-height: 1.35; }
.card-copy p { margin: 0; color: var(--muted); font-size: 14px; }
.audio-state { display: inline-flex; margin-top: 13px; color: var(--success); font-size: 13px; font-weight: 700; }
.audio-state.empty { color: var(--red); }

.state-panel {
  padding: 34px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
  text-align: center;
}

.detail-shell { width: min(980px, calc(100% - 28px)); margin: 0 auto; padding: 26px 0 60px; }
.detail-card { overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.detail-image-wrap { position: relative; background: var(--gold-soft); }
.detail-view-count { top: 14px; right: 14px; }
.detail-image { display: block; width: 100%; max-height: 62vh; object-fit: contain; }
.exhibit-copy { padding: clamp(20px, 4vw, 38px); }
.exhibit-copy h1 { font-size: clamp(30px, 6vw, 46px); }
.description { white-space: pre-wrap; }

.audio-panel { margin-top: 24px; padding: 20px; border-radius: 16px; background: var(--red-soft); }
.audio-panel h2 { margin: 0 0 8px; font-size: 20px; }
.audio-panel p { margin: 0 0 14px; }
.audio-panel audio { width: 100%; margin-top: 8px; }

.primary-button, .secondary-button, .danger-button {
  min-height: 48px;
  padding: 11px 20px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
}
.primary-button { color: #fff; background: var(--red); }
.secondary-button { display: inline-flex; align-items: center; justify-content: center; color: var(--red-deep); background: var(--gold-soft); border-color: var(--line); text-decoration: none; }
.danger-button { color: #fff; background: #8d302b; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button:active { transform: translateY(1px); }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }

.record-box { display: none; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.record-box.show { display: block; }
.record-status { min-height: 26px; margin: 10px 0; color: var(--muted); }

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(44, 31, 27, 0.58);
}
.modal-mask.show { display: grid; }
.modal-card { position: relative; width: min(430px, 100%); padding: 26px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.modal-card h2 { margin: 0 0 8px; color: var(--red-deep); }
.modal-card p { margin: 0 0 16px; color: var(--muted); }
.modal-close { position: absolute; top: 10px; right: 10px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: transparent; font-size: 24px; cursor: pointer; }

.field { display: grid; gap: 7px; margin: 14px 0; }
.field label { font-weight: 700; }
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 3px solid rgba(201, 67, 58, 0.16); border-color: var(--red); }
.form-message { min-height: 24px; color: var(--red); }

.admin-shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 26px 0 64px; }
.admin-panel { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 18px rgba(117, 61, 43, 0.08); }
.admin-panel + .admin-panel { margin-top: 20px; }
.admin-panel h1, .admin-panel h2 { margin-top: 0; color: var(--red-deep); }
.admin-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.admin-form-grid .wide { grid-column: 1 / -1; }
.admin-list { display: grid; gap: 12px; }
.admin-item { display: grid; grid-template-columns: 112px 1fr auto; gap: 16px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 15px; }
.admin-item img { width: 112px; height: 84px; border-radius: 10px; object-fit: cover; background: var(--gold-soft); }
.admin-item h3 { margin: 0 0 5px; }
.admin-meta { color: var(--muted); font-size: 13px; }
.admin-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.admin-actions button { min-height: 40px; padding: 7px 12px; }
.status-badge { display: inline-flex; padding: 3px 9px; border-radius: 999px; color: var(--success); background: #e7f3ed; font-size: 12px; font-weight: 700; }
.status-badge.draft { color: var(--red-deep); background: var(--red-soft); }
.recording-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.recording-item:last-child { border-bottom: 0; }
.recording-item audio { width: 100%; margin: 10px 0; }
.qr-image { display: block; width: min(320px, 100%); margin: 14px auto; }
.qr-target { overflow-wrap: anywhere; color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 22px, 1120px); padding-top: 24px; }
  .exhibit-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card-copy { padding: 13px; }
  .card-copy h2 { font-size: 17px; }
  .admin-form-grid { grid-template-columns: 1fr; }
  .admin-form-grid .wide { grid-column: auto; }
  .admin-item { grid-template-columns: 78px 1fr; }
  .admin-item img { width: 78px; height: 72px; }
  .admin-actions { grid-column: 1 / -1; justify-content: stretch; }
  .admin-actions button { flex: 1; }
}

@media (max-width: 460px) {
  .museum-header { min-height: 60px; padding: 8px 10px; }
  .museum-brand strong { font-size: 17px; letter-spacing: 1px; }
  .museum-brand small { display: none; }
  .museum-seal { width: 40px; height: 40px; flex-basis: 40px; }
  .header-link { padding: 7px 11px; font-size: 13px; }
  .exhibit-grid { grid-template-columns: 1fr; }
  .detail-shell { width: min(100% - 18px, 980px); padding-top: 14px; }
  .exhibit-copy { padding: 18px; }
  .audio-panel { padding: 16px; }
  .button-row > button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
