:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --surface: #ffffff;
  --surface-soft: #efebe0;
  --text: #26231d;
  --muted: #6d675c;
  --line: #ddd7ca;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(42, 36, 25, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), transparent 42%),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.page-shell,
.admin-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 18px 36px;
}

.hero {
  display: grid;
  justify-items: center;
  padding: 18px 0 22px;
  text-align: center;
}

.brand-logo {
  display: block;
  width: min(78vw, 500px);
  height: auto;
  margin: 0 auto 22px;
  filter: invert(1);
}

.eyebrow,
.modal-kicker {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.18;
}

h1 {
  font-size: clamp(2rem, 8vw, 3.4rem);
}

h2 {
  font-size: 1.28rem;
}

.subtitle {
  max-width: 34rem;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

.action-panel,
.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(228, 227, 225, 0.78);
  box-shadow: var(--shadow);
}

.action-panel {
  padding: 10px;
}

.item-list,
.editor-list {
  display: grid;
  gap: 10px;
}

.entry-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  width: 100%;
  min-height: 84px;
  padding: 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.entry-button.has-entry-media {
  grid-template-columns: 48px 1fr auto;
}

.entry-button:hover,
.entry-button:focus-visible {
  border-color: rgba(15, 118, 110, 0.32);
  box-shadow: 0 12px 28px rgba(24, 73, 66, 0.12);
  outline: none;
  transform: translateY(-1px);
}

.entry-title {
  display: block;
  margin-bottom: 6px;
  font-size: 1.08rem;
  font-weight: 760;
}

.entry-media {
  display: grid;
  width: 48px;
  height: 48px;
  align-self: center;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  overflow: hidden;
}

.entry-media[hidden] {
  display: none;
}

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

.entry-title-only {
  margin-bottom: 0;
}

.entry-description,
.loading,
.empty,
.status-message,
.section-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.entry-badge {
  align-self: center;
  white-space: nowrap;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent-strong);
  padding: 6px 10px;
  font-size: 0.84rem;
  font-weight: 700;
}

.loading,
.empty {
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 14, 0.48);
}

.modal-card {
  position: relative;
  width: min(100%, 380px);
  padding: 24px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.qr-frame {
  display: grid;
  width: 100%;
  margin: 16px 0 14px;
  padding: 12px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-frame img {
  display: block;
  width: min(100%, 280px);
  aspect-ratio: 1;
  object-fit: contain;
}

.modal-instruction {
  margin: 12px 0 0;
  color: #f46666;
  font-weight: 760;
  line-height: 1.55;
  text-align: center;
}

.modal-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
}

.admin-shell {
  width: min(100%, 980px);
}

.admin-header,
.section-heading,
.toolbar,
.editor-topline,
.row-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.admin-header,
.section-heading {
  justify-content: space-between;
}

.admin-header {
  padding: 10px 0 22px;
}

.secondary-link {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.admin-panel {
  margin-bottom: 16px;
  padding: 18px;
}

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

.toolbar {
  flex-wrap: wrap;
  margin-top: 14px;
}

.compact-toolbar {
  margin-top: 0;
}

.region-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.region-option {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 760;
}

.region-option.active {
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: 0 6px 18px rgba(42, 36, 25, 0.1);
}

.button,
.icon-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 740;
}

.button {
  min-height: 42px;
  padding: 0 16px;
}

.button.primary {
  background: var(--accent);
  color: white;
}

.button.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.admin-panel.is-loading {
  position: relative;
}

.admin-panel.is-loading::after {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
  content: "";
  pointer-events: none;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 1rem;
}

.icon-button.danger {
  color: var(--danger);
}

.field {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 700;
}

.field[hidden] {
  display: none;
}

.field span {
  font-size: 0.9rem;
}

.image-preview {
  display: grid;
  min-height: 92px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.image-preview[hidden] {
  display: none;
}

.image-preview img {
  display: block;
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
}

.thumbnail-preview img {
  max-height: 64px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.14);
}

input.field-error,
select.field-error {
  border-color: var(--danger);
  background: #fff7f7;
}

input.field-error:focus,
select.field-error:focus {
  border-color: var(--danger);
  outline-color: rgba(180, 35, 24, 0.18);
}

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

.editor-topline {
  justify-content: space-between;
  margin-bottom: 14px;
}

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

.status-message {
  min-height: 1.6em;
  padding: 0 2px;
}

@media (max-width: 640px) {
  .page-shell,
  .admin-shell {
    padding-right: 14px;
    padding-left: 14px;
  }

  .entry-button,
  .admin-header,
  .section-heading {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .entry-button.has-entry-media {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
  }

  .entry-button.has-entry-media .entry-badge {
    grid-column: 2;
  }

  .entry-media {
    width: 36px;
    height: 36px;
    border-radius: 7px;
  }

  .entry-button,
  .admin-header,
  .section-heading,
  .form-grid {
    display: grid;
  }

  .entry-badge {
    justify-self: start;
  }

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

  .image-preview {
    justify-content: center;
  }

  .image-preview img {
    max-width: 50vw;
  }
}
