@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&family=Noto+Serif+SC:wght@600;700&display=swap");

:root {
  --navy: #102c3b;
  --navy-soft: #173f50;
  --gold: #b9965b;
  --gold-light: #d8c398;
  --cream: #f8f5ef;
  --paper: rgba(255, 255, 255, 0.94);
  --ink: #17252d;
  --muted: #68757c;
  --line: #dfe4e2;
  --danger: #b5473d;
  --shadow: 0 28px 80px rgba(25, 45, 53, 0.11);
  color-scheme: light;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(16, 44, 59, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 44, 59, 0.025) 1px, transparent 1px),
    var(--cream);
  background-size: 36px 36px;
}

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

button {
  color: inherit;
}

.honeypot {
  position: fixed !important;
  top: -9999px !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(4px);
  pointer-events: none;
}

.ambient-one {
  top: -180px;
  right: -110px;
  background: radial-gradient(circle, rgba(185, 150, 91, 0.18), transparent 68%);
}

.ambient-two {
  top: 460px;
  left: -250px;
  background: radial-gradient(circle, rgba(45, 120, 135, 0.11), transparent 70%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 40px));
  height: 84px;
  margin: 0 auto;
  border-bottom: 1px solid rgba(16, 44, 59, 0.12);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--navy);
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 1px solid rgba(185, 150, 91, 0.5);
  border-radius: 12px;
  box-shadow: 0 7px 18px rgba(16, 44, 59, 0.16);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: "Noto Serif SC", serif;
  font-size: 15px;
  letter-spacing: 0.08em;
}

.brand small {
  margin-top: 2px;
  color: #849096;
  font-size: 8px;
  letter-spacing: 0.24em;
}

.secure-label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.secure-dot {
  width: 7px;
  height: 7px;
  background: #3d8c76;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(61, 140, 118, 0.12);
}

main {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  padding: 82px 0 60px;
  text-align: center;
}

.eyebrow {
  margin-bottom: 18px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.27em;
}

.hero h1 {
  margin: 0;
  color: var(--navy);
  font-family: "Noto Serif SC", serif;
  font-size: clamp(38px, 6vw, 58px);
  line-height: 1.28;
  letter-spacing: 0.03em;
}

.hero h1 em {
  position: relative;
  color: var(--gold);
  font-style: normal;
}

.hero h1 em::after {
  position: absolute;
  right: 0;
  bottom: -11px;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  content: "";
}

.hero > p {
  max-width: 650px;
  margin: 30px auto 25px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.9;
}

.hero-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7c878b;
  font-size: 12px;
}

.hero-meta i {
  width: 3px;
  height: 3px;
  margin: 0 14px;
  background: var(--gold);
  border-radius: 50%;
}

.form-shell {
  overflow: hidden;
  background: var(--paper);
  border: 1px solid rgba(16, 44, 59, 0.08);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.form-section {
  padding: 56px 64px;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 38px;
}

.section-heading > span {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 14px;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
}

.section-heading h2 {
  margin: 0 0 7px;
  color: var(--navy);
  font-family: "Noto Serif SC", serif;
  font-size: 24px;
  letter-spacing: 0.04em;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.field-stack {
  display: grid;
  gap: 28px;
}

.field {
  position: relative;
  display: grid;
  gap: 10px;
}

.field > span,
.signature-top > span {
  color: #34444b;
  font-size: 14px;
  font-weight: 600;
}

.field b,
.check-row b,
.signature-top b {
  color: var(--gold);
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  color: var(--ink);
  background: #fbfcfb;
  border: 1px solid #d7dedc;
  border-radius: 10px;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

input,
select {
  height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 112px;
  padding: 14px;
  line-height: 1.75;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #bbc7c4;
}

input:focus,
select:focus,
textarea:focus {
  background: #fff;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(185, 150, 91, 0.12);
}

input::placeholder,
textarea::placeholder {
  color: #a0aaa9;
}

.counter {
  position: absolute;
  right: 12px;
  bottom: 9px;
  color: #9aa3a3;
  font-size: 10px;
  pointer-events: none;
}

.notice {
  margin-bottom: 28px;
  padding: 20px 22px;
  background: #f8f5ee;
  border: 1px solid #eadfc9;
  border-left: 3px solid var(--gold);
  border-radius: 10px;
}

.notice strong {
  color: var(--navy);
  font-size: 14px;
}

.notice p {
  margin: 8px 0 0;
  color: #667277;
  font-size: 12px;
  line-height: 1.85;
}

.check-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 18px 0;
  cursor: pointer;
}

.check-row input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--navy);
}

.check-row span {
  color: #536168;
  font-size: 13px;
  line-height: 1.8;
}

.signature-field {
  margin-top: 34px;
}

.signature-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.signature-top button {
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.signature-top button:hover {
  color: var(--navy);
}

.signature-wrap {
  position: relative;
  overflow: hidden;
  height: 210px;
  background:
    linear-gradient(90deg, rgba(16, 44, 59, 0.018) 1px, transparent 1px),
    linear-gradient(rgba(16, 44, 59, 0.018) 1px, transparent 1px),
    #fcfdfc;
  background-size: 24px 24px;
  border: 1px dashed #aebbb8;
  border-radius: 12px;
}

#signaturePad {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.signature-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 72%;
  color: #b0b8b6;
  text-align: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.signature-hint span {
  display: block;
  margin-bottom: 30px;
  font-family: "Noto Serif SC", serif;
  font-size: 16px;
}

.signature-hint i {
  display: block;
  height: 1px;
  background: linear-gradient(90deg, transparent, #c9cfcd 15%, #c9cfcd 85%, transparent);
}

.signature-field > small {
  display: block;
  margin-top: 9px;
  color: #8a9596;
  font-size: 11px;
}

.field-error {
  min-height: 18px;
  margin: 7px 0 0;
  color: var(--danger);
  font-size: 12px;
}

.submit-area {
  padding: 44px 64px 52px;
  text-align: center;
  background: linear-gradient(180deg, #fff, #fafbf9);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 300px;
  min-height: 54px;
  padding: 14px 28px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--navy);
  border: 0;
  border-radius: 9px;
  box-shadow: 0 12px 26px rgba(16, 44, 59, 0.2);
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button:hover {
  background: var(--navy-soft);
  box-shadow: 0 15px 30px rgba(16, 44, 59, 0.25);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.primary-button svg {
  width: 19px;
  margin-left: 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.submit-area > p {
  max-width: 560px;
  margin: 18px auto 0;
  color: #8a9596;
  font-size: 11px;
  line-height: 1.7;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(920px, calc(100% - 40px));
  margin: 34px auto 0;
  padding: 24px 4px 46px;
  color: #899395;
  font-size: 11px;
}

footer p {
  margin: 0;
}

footer > div {
  display: flex;
  gap: 16px;
  align-items: center;
}

footer a {
  color: #899395;
  text-decoration: none;
}

footer a:hover {
  color: var(--navy);
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: start center;
  overflow-y: auto;
  padding: 30px 16px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 28, 38, 0.7);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(620px, 100%);
  padding: 38px;
  text-align: center;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #768287;
  font-size: 26px;
  line-height: 1;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.modal-close:hover {
  background: #f1f3f2;
}

.success-seal {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 15px;
  color: #fff;
  background: #3f8b75;
  border-radius: 50%;
  box-shadow: 0 0 0 7px rgba(63, 139, 117, 0.11);
}

.success-seal svg {
  width: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.modal-kicker {
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.modal-card > h2 {
  margin: 8px 0 9px;
  color: var(--navy);
  font-family: "Noto Serif SC", serif;
  font-size: 27px;
}

.modal-card > p {
  margin: 0 auto 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.receipt {
  padding: 25px;
  text-align: left;
  background:
    linear-gradient(rgba(16, 44, 59, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 44, 59, 0.018) 1px, transparent 1px),
    #fbfaf7;
  background-size: 20px 20px;
  border: 1px solid #ded8cc;
  border-radius: 12px;
}

.receipt-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid #dcd8cf;
}

.receipt-head small,
.receipt-head strong {
  display: block;
}

.receipt-head small {
  margin-bottom: 3px;
  color: var(--gold);
  font-size: 10px;
}

.receipt-head strong {
  color: var(--navy);
  font-family: "Noto Serif SC", serif;
  font-size: 22px;
}

.receipt-status {
  padding: 5px 10px;
  color: #3d7d6d;
  font-size: 11px;
  font-weight: 600;
  background: #e8f1ed;
  border-radius: 20px;
}

.receipt dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}

.receipt dl div {
  min-width: 0;
}

.receipt dt,
.receipt-signature small,
.receipt-code small {
  margin-bottom: 5px;
  color: #889192;
  font-size: 9px;
}

.receipt dd {
  overflow: hidden;
  margin: 0;
  color: #2d3d44;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt-signature {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-height: 90px;
  padding: 14px 0;
  border-top: 1px solid #e2ded5;
  border-bottom: 1px solid #e2ded5;
}

#receiptSignature {
  display: block;
  width: 150px;
  height: 55px;
  margin-top: 3px;
  object-fit: contain;
  object-position: left center;
}

.receipt-brand {
  display: flex;
  gap: 9px;
  align-items: center;
  text-align: right;
}

.receipt-brand > img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 1px solid rgba(185, 150, 91, 0.5);
  border-radius: 9px;
}

.receipt-brand span,
.receipt-brand small {
  display: block;
}

.receipt-brand span {
  color: var(--navy);
  font-family: "Noto Serif SC", serif;
  font-size: 12px;
  font-weight: 700;
}

.receipt-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}

.receipt-code small,
.receipt-code strong {
  display: block;
}

.receipt-code strong {
  color: var(--navy);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.receipt-code button {
  padding: 6px 10px;
  color: var(--navy);
  font-size: 10px;
  background: transparent;
  border: 1px solid #bdc6c5;
  border-radius: 6px;
  cursor: pointer;
}

.hash-line {
  overflow: hidden;
  margin: 10px 0 0 !important;
  color: #9a9f9d !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 8px !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

.primary-button.compact {
  min-width: 0;
  min-height: 46px;
  padding: 10px 14px;
  font-size: 12px;
}

.secondary-button {
  min-height: 46px;
  padding: 10px 14px;
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  border: 1px solid #cbd3d1;
  border-radius: 9px;
  cursor: pointer;
}

.secondary-button:hover {
  background: #f6f8f7;
}

.storage-note {
  display: block;
  margin-top: 15px;
  color: #899395;
  font-size: 10px;
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  max-width: min(360px, calc(100% - 40px));
  padding: 12px 17px;
  color: #fff;
  font-size: 12px;
  background: rgba(16, 44, 59, 0.94);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 680px) {
  .topbar {
    width: calc(100% - 28px);
    height: 72px;
  }

  .secure-label {
    font-size: 10px;
  }

  main {
    width: calc(100% - 20px);
  }

  .hero {
    padding: 56px 14px 42px;
  }

  .hero h1 {
    font-size: 38px;
  }

  .hero > p {
    margin-top: 25px;
    font-size: 13px;
  }

  .hero-meta {
    flex-wrap: wrap;
    row-gap: 8px;
    font-size: 10px;
  }

  .hero-meta i {
    margin: 0 8px;
  }

  .form-shell {
    border-radius: 18px;
  }

  .form-section {
    padding: 38px 20px;
  }

  .section-heading {
    gap: 13px;
    margin-bottom: 30px;
  }

  .section-heading > span {
    width: 34px;
    height: 34px;
    font-size: 12px;
  }

  .section-heading h2 {
    font-size: 21px;
  }

  .field-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .signature-wrap {
    height: 190px;
  }

  .submit-area {
    padding: 36px 20px 42px;
  }

  .primary-button {
    width: 100%;
    min-width: 0;
  }

  footer {
    width: calc(100% - 32px);
    padding-bottom: 34px;
  }

  footer > div > span {
    display: none;
  }

  .modal {
    padding: 12px 8px;
  }

  .modal-card {
    padding: 33px 16px 24px;
    border-radius: 18px;
  }

  .receipt {
    padding: 18px 15px;
  }

  #receiptSignature {
    width: 125px;
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4;
    margin: 14mm;
  }

  body * {
    visibility: hidden !important;
  }

  #successModal,
  #successModal .modal-card,
  #successModal .modal-card * {
    visibility: visible !important;
  }

  #successModal {
    position: static;
    display: block;
    padding: 0;
  }

  .modal-backdrop,
  .modal-close,
  .success-seal,
  .modal-kicker,
  .modal-card > h2,
  .modal-card > p,
  .modal-actions,
  .storage-note {
    display: none !important;
  }

  .modal-card {
    width: 100%;
    padding: 0;
    box-shadow: none;
  }

  .receipt {
    padding: 28px;
    border: 1px solid #aaa;
  }
}

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