:root {
  --green-900: #164936;
  --green-800: #1e5b43;
  --green-700: #246b4f;
  --green-100: #e9f1ec;
  --terracotta: #a75c3e;
  --ink: #19231e;
  --muted: #68736c;
  --line: #dfe5e1;
  --paper: #ffffff;
  --canvas: #f3f5f3;
  --danger: #bd3535;
  --shadow: 0 16px 45px rgba(28, 60, 44, 0.12);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input { font: inherit; letter-spacing: 0; }
button, label[for] { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.hero {
  position: relative;
  display: flex;
  min-height: min(58vh, 470px);
  align-items: flex-end;
  overflow: hidden;
  background: var(--green-900);
  color: #fff;
}

.hero__image, .hero__shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__image { object-fit: cover; object-position: center 52%; }
.hero__shade { background: linear-gradient(180deg, rgba(17, 48, 35, 0.1) 0%, rgba(13, 41, 29, 0.82) 100%); }
.hero__content { position: relative; z-index: 1; width: 100%; padding: 72px 24px 44px; }
.hero__community {
  display: inline-flex;
  align-items: center;
  margin-bottom: 15px;
  font-size: 13px;
  font-weight: 600;
}
.hero__community::before { width: 26px; height: 1px; margin-right: 10px; background: rgba(255,255,255,.8); content: ""; }
.hero h1 { margin: 0; font-family: "Songti SC", "STSong", serif; font-size: clamp(36px, 10vw, 48px); font-weight: 700; line-height: 1.2; letter-spacing: 0; }
.hero p { max-width: 340px; margin: 18px 0 0; color: rgba(255,255,255,.83); font-size: 14px; line-height: 1.75; }

.qr-section, .rules-section, .purpose-section { padding: 52px 24px; }
.qr-section { position: relative; padding-right: 14px; padding-left: 14px; background: var(--paper); text-align: center; }
.section-heading .eyebrow, .eyebrow { color: var(--green-700); font-size: 10px; font-weight: 800; letter-spacing: 0; }
.section-heading h2 { margin: 8px 0 0; font-family: "Songti SC", "STSong", serif; font-size: 27px; line-height: 1.35; letter-spacing: 0; }
.section-heading p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.section-heading--center { text-align: center; }

.qr-status { display: flex; justify-content: center; align-items: center; gap: 7px; margin: 24px 0 12px; color: var(--green-700); font-size: 12px; font-weight: 600; }
.status-dot, .live-badge i { width: 7px; height: 7px; border-radius: 50%; background: #38a36f; box-shadow: 0 0 0 4px rgba(56,163,111,.12); }
.qr-frame {
  display: grid;
  width: min(calc(100vw - 28px), 370px);
  min-height: min(calc(100vw - 28px), 370px);
  margin: 24px auto 16px;
  place-items: center;
  border: 1px solid #edf0ee;
  background: #fff;
  box-shadow: var(--shadow);
}
.qr-frame.has-image {
  min-height: 0;
}
.qr-status:not([hidden]) + .qr-frame { margin-top: 0; }
.qr-frame img { display: block; width: 100%; height: auto; object-fit: contain; }
.qr-loading, .qr-empty, .admin-empty { display: flex; align-items: center; justify-content: center; flex-direction: column; color: var(--muted); font-size: 12px; gap: 12px; }
.qr-empty strong { color: var(--ink); font-size: 15px; }
.spinner { width: 23px; height: 23px; border: 2px solid #dce7e0; border-top-color: var(--green-700); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.qr-empty__icon { position: relative; width: 48px; height: 48px; border: 2px dashed #aab9b0; }
.qr-empty__icon::before, .qr-empty__icon::after { position: absolute; width: 12px; height: 12px; border: 3px solid var(--green-700); content: ""; }
.qr-empty__icon::before { top: 6px; left: 6px; }
.qr-empty__icon::after { right: 6px; bottom: 6px; }
.scan-hint, .updated-time { margin: 0; color: var(--ink); font-size: 13px; }
.updated-time { margin-top: 7px; color: #879189; font-size: 11px; }
.quiet-button { margin-top: 16px; padding: 9px 18px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--green-700); font-size: 12px; }

.rules-section { background: #f2f5f2; }
.rules-list { padding: 0; margin: 26px 0 0; list-style: none; }
.rules-list li { display: grid; grid-template-columns: 42px 1fr; gap: 15px; padding: 23px 0; border-top: 1px solid #dbe2dd; }
.rules-list li:last-child { border-bottom: 1px solid #dbe2dd; }
.rules-section .eyebrow, .rule-number { color: var(--terracotta); }
.rule-number { font-family: Georgia, serif; font-size: 20px; line-height: 1.2; }
.rules-list strong { display: block; font-size: 15px; }
.rules-list p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.75; }

.purpose-section { background: var(--green-900); color: #fff; text-align: center; }
.purpose-section > p { margin: 0 0 28px; font-family: "Songti SC", "STSong", serif; font-size: 20px; }
.purpose-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.purpose-grid span { display: flex; align-items: center; flex-direction: column; gap: 9px; color: rgba(255,255,255,.75); font-size: 11px; }
.purpose-grid i { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; color: #fff; font-family: "Songti SC", serif; font-size: 15px; font-style: normal; }
.site-footer { display: flex; padding: 25px 20px calc(25px + env(safe-area-inset-bottom)); align-items: center; flex-direction: column; gap: 7px; background: #123c2d; color: rgba(255,255,255,.48); font-size: 10px; }

/* Admin */
.admin-page { min-height: 100vh; background: var(--canvas); }
.admin-header { display: grid; height: 68px; padding: 0 18px; align-items: center; grid-template-columns: 42px 1fr 42px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); }
.admin-header > div { display: flex; align-items: center; flex-direction: column; }
.admin-header strong { font-size: 14px; }
.admin-header span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.back-link { display: grid; width: 36px; height: 36px; place-items: center; color: var(--ink); font-size: 22px; text-decoration: none; }
.text-button { width: 48px; padding: 8px 0; border: 0; background: none; color: var(--green-700); font-size: 12px; }
.admin-main { width: min(100%, 680px); min-height: calc(100vh - 68px); padding: 38px 20px 60px; margin: 0 auto; }
.login-panel { width: min(100%, 390px); padding-top: 4vh; margin: 0 auto; }
.brand-mark { display: grid; width: 54px; height: 54px; margin: 0 auto 25px; place-items: center; border-radius: 50%; background: var(--green-800); color: #fff; font-family: "Songti SC", serif; font-size: 22px; }
.login-heading { margin-bottom: 32px; text-align: center; }
.login-heading h1, .manage-heading h1 { margin: 9px 0 0; font-family: "Songti SC", "STSong", serif; font-size: 29px; letter-spacing: 0; }
.login-heading p, .manage-heading p { margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
form label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 600; }
.password-field { display: grid; grid-template-columns: 1fr auto; border: 1px solid #cfd7d1; border-radius: 5px; background: #fff; transition: border-color .2s, box-shadow .2s; }
.password-field:focus-within { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(36,107,79,.1); }
.password-field input { min-width: 0; height: 50px; padding: 0 15px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 14px; }
.password-field button { padding: 0 15px; border: 0; background: none; color: var(--green-700); font-size: 12px; }
.primary-button, .secondary-button { min-height: 48px; padding: 0 18px; border-radius: 5px; font-weight: 700; }
.primary-button { border: 1px solid var(--green-700); background: var(--green-700); color: #fff; }
.primary-button:disabled { border-color: #93aa9e; background: #93aa9e; cursor: wait; }
.login-panel .primary-button { width: 100%; margin-top: 23px; }
.secondary-button { border: 1px solid #cfd7d1; background: #fff; color: var(--ink); }
.form-error { margin: 10px 0 0; color: var(--danger); font-size: 12px; line-height: 1.5; }
.admin-loading { display: flex; min-height: 60vh; align-items: center; justify-content: center; flex-direction: column; gap: 12px; color: var(--muted); font-size: 12px; }

.manage-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.manage-heading h1 { font-size: 27px; }
.live-badge { display: inline-flex; flex: 0 0 auto; padding: 7px 9px; align-items: center; gap: 7px; border: 1px solid #cfe0d5; border-radius: 4px; background: #edf5f0; color: var(--green-700); font-size: 10px; }
.live-badge i { display: block; width: 6px; height: 6px; box-shadow: none; }
.current-section, .upload-section { margin-top: 34px; }
.field-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.field-heading strong { font-size: 13px; }
.field-heading span { color: var(--muted); font-size: 10px; text-align: right; }
.admin-qr-preview { display: grid; min-height: 245px; padding: 14px; place-items: center; border: 1px solid var(--line); background: #fff; }
.admin-qr-preview img { display: block; width: min(82vw, 320px); height: auto; max-height: 520px; object-fit: contain; }
.admin-empty { min-height: 220px; }
.upload-zone { position: relative; display: flex; min-height: 174px; padding: 20px; align-items: center; justify-content: center; flex-direction: column; overflow: hidden; border: 1px dashed #9eafa5; background: #f9faf9; color: var(--muted); text-align: center; transition: border-color .2s, background .2s; cursor: pointer; }
.upload-zone:hover, .upload-zone.is-dragging { border-color: var(--green-700); background: #f2f7f4; }
.upload-zone strong { margin-top: 13px; color: var(--ink); font-size: 13px; }
.upload-zone > span:last-of-type { margin-top: 6px; font-size: 11px; }
.upload-zone img { width: min(82vw, 320px); height: auto; max-height: 520px; object-fit: contain; }
.upload-zone.has-file { min-height: 0; padding: 12px; background: #fff; }
.upload-zone.has-file .upload-icon, .upload-zone.has-file strong, .upload-zone.has-file > span { display: none; }
.upload-icon { position: relative; width: 34px; height: 34px; border: 1px solid #8ba093; border-radius: 50%; }
.upload-icon::before, .upload-icon::after { position: absolute; top: 50%; left: 50%; background: var(--green-700); content: ""; transform: translate(-50%, -50%); }
.upload-icon::before { width: 13px; height: 1px; }
.upload-icon::after { width: 1px; height: 13px; }
.upload-actions { display: grid; margin-top: 14px; grid-template-columns: 1fr 1.35fr; gap: 10px; }
.admin-note { padding: 17px 18px; margin-top: 28px; border-left: 3px solid var(--green-700); background: var(--green-100); }
.admin-note strong { font-size: 12px; }
.admin-note p { margin: 6px 0 0; color: #597064; font-size: 11px; line-height: 1.65; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: calc(30px + env(safe-area-inset-bottom)); max-width: calc(100% - 40px); padding: 11px 18px; border-radius: 4px; background: #16271f; box-shadow: 0 8px 28px rgba(0,0,0,.2); color: #fff; font-size: 12px; transform: translateX(-50%); }

@media (min-width: 720px) {
  .public-page { width: 430px; margin: 0 auto; box-shadow: 0 0 60px rgba(30,65,47,.12); }
  .hero { min-height: 500px; }
  .admin-main { padding-top: 55px; }
}

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