:root {
  color-scheme: light;
  --forest-950: #0b241d;
  --forest-900: #12382d;
  --forest-700: #27614f;
  --forest-100: #dfece6;
  --paper: #f5f0e6;
  --paper-deep: #e9e0d1;
  --cream: #fffdf8;
  --ink: #18231f;
  --muted: #6e7772;
  --copper: #c56b46;
  --copper-soft: #f5e2d8;
  --line: rgba(18, 56, 45, 0.16);
  --shadow: 0 28px 70px rgba(20, 43, 35, 0.16);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 84% 2%, rgba(197, 107, 70, 0.12), transparent 24rem),
    linear-gradient(180deg, var(--paper) 0%, #efe8dc 100%);
  font-family: "Avenir Next", "PingFang TC", "Noto Sans TC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.page-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.page-shell::before {
  position: absolute;
  top: 118px;
  right: -92px;
  width: 290px;
  height: 340px;
  border: 1px solid rgba(18, 56, 45, 0.08);
  background:
    repeating-linear-gradient(90deg, transparent 0 43px, rgba(18, 56, 45, 0.06) 44px),
    repeating-linear-gradient(0deg, transparent 0 41px, rgba(18, 56, 45, 0.06) 42px);
  content: "";
  transform: rotate(-8deg);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  width: min(100% - 32px, 520px);
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 0 16px;
}

.brand-mark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  width: 34px;
  height: 36px;
  padding: 6px 5px;
  border-radius: 4px 4px 1px 1px;
  background: var(--forest-900);
}

.brand-mark span {
  flex: 1;
  height: 16px;
  border: 1px solid rgba(255, 253, 248, 0.75);
  border-bottom: 0;
}

.brand-mark span:nth-child(2) { height: 23px; }

.brand-name {
  margin: 0;
  color: var(--forest-900);
  font-family: "Iowan Old Style", "Palatino Linotype", "Noto Serif TC", serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.brand-place {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.preview-badge {
  margin-left: auto;
  padding: 6px 9px;
  border: 1px solid rgba(197, 107, 70, 0.35);
  border-radius: 999px;
  color: #8c4327;
  background: rgba(255, 253, 248, 0.72);
  font-size: 11px;
  font-weight: 700;
}

main {
  position: relative;
  width: min(100% - 32px, 520px);
  margin: 0 auto;
  padding: 32px 0 max(40px, env(safe-area-inset-bottom));
}

.intro { padding: 0 5px 30px; }

.eyebrow, .section-index {
  margin: 0 0 10px;
  color: var(--forest-700);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.eyebrow::before {
  display: inline-block;
  width: 22px;
  height: 1px;
  margin: 0 9px 4px 0;
  background: currentColor;
  content: "";
}

h1, h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Noto Serif TC", serif;
  font-weight: 600;
}

h1 {
  margin: 0;
  color: var(--forest-950);
  font-size: clamp(39px, 12vw, 58px);
  line-height: 1.06;
  letter-spacing: -0.04em;
}

h1 em { color: var(--copper); font-style: normal; }

.intro-copy {
  max-width: 410px;
  margin: 20px 0 0;
  color: #58635e;
  font-size: 15px;
  line-height: 1.75;
}

.verification-card {
  position: relative;
  padding: 24px 21px 25px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 24px 24px 8px 24px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.verification-card::after {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 25px;
  height: 25px;
  background: linear-gradient(135deg, var(--paper-deep) 50%, transparent 51%);
  content: "";
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 27px;
  padding: 4px;
  border-radius: 11px;
  background: #ebe9e1;
}

.mode-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: #7a827e;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.mode-button.active {
  color: var(--forest-900);
  background: var(--cream);
  box-shadow: 0 3px 12px rgba(18, 56, 45, 0.09);
}

.progress {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  margin-bottom: 31px;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #98a09c;
}

.progress-item span {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid #c7ceca;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.progress-item p { margin: 0; font-size: 12px; font-weight: 700; }
.progress-item.active { color: var(--forest-900); }
.progress-item.active span { border-color: var(--forest-900); background: var(--forest-900); color: white; }
.progress-item.done span { border-color: var(--forest-700); color: transparent; background: var(--forest-700); }
.progress-item.done span::after { color: white; content: "✓"; }
.progress-line { height: 1px; margin: 0 10px; background: #d7dcd9; }

.view { animation: enter 320ms cubic-bezier(.2,.8,.2,1) both; }
.view[hidden] { display: none; }

.section-heading h2 {
  margin: 0;
  color: var(--forest-950);
  font-size: 28px;
  letter-spacing: -0.025em;
}

.section-heading > p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

form { margin-top: 25px; }

label:not(.drop-zone) {
  display: block;
  margin: 18px 0 8px;
  color: #31483f;
  font-size: 13px;
  font-weight: 800;
}

input[type="text"] {
  width: 100%;
  min-height: 53px;
  padding: 13px 14px;
  border: 1px solid #c8cfcb;
  border-radius: 10px;
  outline: none;
  background: #fffefa;
  color: var(--ink);
  font-size: 16px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input[type="text"]:focus {
  border-color: var(--forest-700);
  box-shadow: 0 0 0 4px rgba(39, 97, 79, 0.11);
  transform: translateY(-1px);
}

input::placeholder { color: #a4aaa7; }

.optional-label {
  margin-left: 4px;
  color: #8b938f;
  font-size: 10px;
  font-weight: 600;
}

.field-help {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
}

#new-resident-fields {
  margin-top: 24px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
}

.demo-hint {
  margin: 15px 0 0;
  padding: 11px 12px;
  border-left: 3px solid var(--copper);
  color: #725444;
  background: #fbf3ed;
  font-size: 12px;
  line-height: 1.6;
}

code {
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(197, 107, 70, 0.12);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.primary-button, .secondary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.primary-button {
  justify-content: space-between;
  margin-top: 24px;
  padding: 0 17px 0 20px;
  color: white;
  background: var(--forest-900);
  box-shadow: 0 10px 22px rgba(18, 56, 45, 0.18);
}

.primary-button svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.primary-button:hover { background: var(--forest-950); transform: translateY(-1px); }
.primary-button:active { transform: translateY(1px); }
.primary-button:disabled { cursor: wait; opacity: 0.48; transform: none; }

.form-status {
  min-height: 20px;
  margin: 11px 0 0;
  color: #a04729;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.back-button {
  margin: 0 0 23px;
  padding: 0;
  border: 0;
  color: var(--forest-700);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.section-index.warm { color: var(--copper); }

.identity-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 21px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--line);
}

.identity-summary div { padding: 12px; background: #faf7f0; }
.identity-summary span { display: block; color: var(--muted); font-size: 10px; }
.identity-summary strong { display: block; margin-top: 3px; overflow-wrap: anywhere; font-size: 13px; }

.drop-zone {
  position: relative;
  display: grid;
  min-height: 178px;
  padding: 24px 18px;
  place-items: center;
  align-content: center;
  overflow: hidden;
  border: 1px dashed #95aa9f;
  border-radius: 13px;
  background: #f5f8f5;
  cursor: pointer;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone:hover { border-color: var(--forest-700); background: #eef5f1; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.upload-icon {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 11px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--forest-700);
  font-size: 23px;
  font-weight: 300;
}

.drop-zone strong { color: var(--forest-900); font-size: 14px; }
.drop-zone small { margin-top: 5px; color: var(--muted); font-size: 11px; }

.drop-zone.has-file { padding: 10px; }
.drop-zone.has-file .upload-icon { display: none; }
.drop-zone.has-file strong, .drop-zone.has-file small { position: relative; z-index: 2; padding: 3px 7px; border-radius: 5px; color: white; background: rgba(11, 36, 29, 0.78); }
.drop-zone.has-file img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.privacy-note {
  display: flex;
  gap: 10px;
  margin-top: 13px;
  padding: 12px;
  border-radius: 9px;
  background: var(--copper-soft);
  color: #754932;
}

.privacy-note svg { flex: 0 0 auto; width: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.privacy-note p { margin: 0; font-size: 11px; line-height: 1.55; }

.result-view { padding: 16px 0 4px; text-align: center; }

.success-seal, .pending-seal {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  place-items: center;
  border-radius: 50%;
}

.success-seal { color: white; background: var(--forest-700); box-shadow: 0 0 0 9px var(--forest-100); font-size: 31px; }
.pending-seal { display: flex; justify-content: center; gap: 5px; background: var(--copper-soft); }
.pending-seal span { width: 7px; height: 7px; border-radius: 50%; background: var(--copper); animation: pulse 1.2s infinite; }
.pending-seal span:nth-child(2) { animation-delay: 120ms; }
.pending-seal span:nth-child(3) { animation-delay: 240ms; }

.result-view h2 { margin: 0; color: var(--forest-950); font-size: 29px; }

.code-ticket {
  position: relative;
  width: 100%;
  margin-top: 23px;
  padding: 21px 12px 16px;
  overflow: hidden;
  border: 1px solid rgba(18, 56, 45, 0.2);
  border-radius: 11px;
  color: var(--forest-950);
  background: #eff5f1;
  cursor: pointer;
}

.code-ticket::before, .code-ticket::after {
  position: absolute;
  top: 50%;
  width: 19px;
  height: 19px;
  border: 1px solid rgba(18, 56, 45, 0.2);
  border-radius: 50%;
  background: var(--cream);
  content: "";
  transform: translateY(-50%);
}

.code-ticket::before { left: -11px; }
.code-ticket::after { right: -11px; }
.code-value { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(31px, 9vw, 40px); font-weight: 900; letter-spacing: 0.09em; }
.copy-label { display: block; margin-top: 7px; color: var(--forest-700); font-size: 11px; font-weight: 700; }

.result-copy { margin: 20px auto 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

.line-community-button {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  border-radius: 12px;
  color: #082d18;
  background: #06c755;
  box-shadow: 0 12px 24px rgba(6, 199, 85, 0.2);
  text-align: left;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.line-community-button[hidden] { display: none; }
.line-community-button:hover { transform: translateY(-1px); box-shadow: 0 15px 28px rgba(6, 199, 85, 0.25); }
.line-community-button:active { transform: translateY(1px); }
.line-community-button strong, .line-community-button small { display: block; }
.line-community-button strong { color: #062b16; font-size: 14px; }
.line-community-button small { margin-top: 2px; color: rgba(6, 43, 22, 0.72); font-size: 10px; }

.line-symbol {
  display: grid;
  width: 42px;
  height: 34px;
  place-items: center;
  border-radius: 17px;
  color: #06a947;
  background: white;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.line-arrow { color: #07351b; font-size: 29px; line-height: 1; }

.secondary-button {
  margin-top: 23px;
  border: 1px solid var(--line);
  color: var(--forest-900);
  background: transparent;
}

.secondary-button:hover { background: #f4f1e9; }
.receipt-label { margin: 23px 0 4px; color: var(--muted); font-size: 11px; }
.receipt { margin: 0; color: var(--copper); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 22px; font-weight: 900; letter-spacing: 0.05em; }

.footer-note { margin: 28px 0 0; color: #7b817e; font-size: 10px; letter-spacing: 0.08em; text-align: center; }

@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 70%, 100% { opacity: .28; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }

@media (min-width: 700px) {
  .brand, main { width: min(100% - 48px, 600px); }
  main { padding-top: 50px; }
  .verification-card { padding: 32px 34px; }
}

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