:root {
  color-scheme: light;
  --paper: #f2f5f2;
  --surface: #fcfdfb;
  --ink: #26322f;
  --muted: #5e6c67;
  --line: #cbd6d1;
  --indigo: #33546a;
  --indigo-pale: #e7eeeb;
  --vermilion: #b72f3f;
  --vermilion-pale: #f3e8e5;
  --pine: #527467;
  --raspberry: #b72f3f;
  --serif: "Zen Old Mincho", "Noto Serif TC", "Songti TC", "PMingLiU", Georgia, serif;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "DM Sans", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: #e8eeeb;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.8;
  line-break: strict;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, canvas:focus-visible { outline: 3px solid var(--indigo); outline-offset: 3px; }
[hidden] { display: none !important; }

.page-grain {
  display: none;
}
main { width: 100%; }

.lock-screen {
  position: relative;
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 38px 24px 28px;
  background: var(--paper);
  text-align: center;
}
.lock-art { position: relative; display: grid; width: 158px; height: 158px; place-items: center; margin: 22px 0 28px; }
.lock-knot { display: block; width: 150px; height: 150px; overflow: visible; }
.orbit-note { position: absolute; bottom: -13px; color: var(--pine); font-size: 9px; font-weight: 700; white-space: nowrap; }
.section-label { margin: 0; color: var(--pine); font-size: 10px; font-weight: 700; }
.lock-screen h1 { margin: 15px 0 12px; font-family: var(--serif); font-size: 54px; font-weight: 500; line-height: 1.18; }
.lock-screen h1 em, h1 em, h2 em { color: inherit; font-style: normal; font-weight: inherit; }
.lock-copy { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.unlock-form { width: min(100%, 330px); margin-top: 27px; text-align: left; }
.unlock-form label { display: block; margin-bottom: 8px; font-size: 11px; font-weight: 700; }
.password-row { display: flex; gap: 8px; }
.password-row input { min-width: 0; height: 50px; flex: 1; padding: 0 14px; border: 1px solid #a9b9b1; border-radius: 1px; background: var(--surface); color: #243b37; font-size: 15px; }
.password-row input::placeholder { color: #65766f; }
.unlock-button { display: grid; width: 50px; height: 50px; place-items: center; border: 0; border-radius: 1px; background: var(--raspberry); color: white; cursor: pointer; font-size: 22px; transition: background .2s ease, transform .2s ease; }
.unlock-button:hover { background: var(--vermilion); transform: translateY(-2px); }
.field-hint, .form-error { min-height: 15px; margin: 8px 0 0; color: var(--muted); font-size: 10px; }
.form-error { color: var(--vermilion); }
.lock-foot { position: absolute; bottom: 23px; margin: 0; color: var(--muted); font-size: 10px; }
.lock-foot span { padding-left: 4px; color: var(--vermilion); }

.agreement { width: min(calc(100% - 48px), 1160px); margin: 0 auto; background: var(--surface); animation: page-arrive .7s cubic-bezier(.2,.7,.2,1) both; }
.clear-button { border: 0; background: none; cursor: pointer; }
.hero { position: relative; isolation: isolate; display: grid; min-height: 420px; grid-template-columns: minmax(0, 1fr) 280px; gap: 52px; align-items: center; padding: 74px 7% 82px; background-color: #f5f5ef; background-image: repeating-linear-gradient(0deg, rgba(82,116,103,.01) 0 1px, transparent 1px 8px); }
.hero::after { position: absolute; z-index: -1; top: 19%; right: calc(7% + 306px); bottom: 19%; width: 1px; background: #d4c8ad; content: ""; }
.hero-copy { display: flex; width: max-content; max-width: 100%; align-items: center; gap: clamp(16px, 2vw, 28px); }
.hero h1 { margin: 0; color: var(--ink); font-family: var(--serif); font-size: 82px; font-weight: 500; line-height: 1.12; }
.hero h1 em { color: inherit; }
.hero-copy h1 { min-width: 0; flex: 0 1 auto; }
.hero-side { display: grid; justify-items: center; align-content: center; gap: 19px; padding-left: 20px; }
.hero-seal { position: relative; display: grid; width: 148px; height: 148px; flex: 0 0 148px; place-items: center; border: 1px solid var(--vermilion); border-radius: 50%; transform: rotate(-7deg); }
.hero-seal::before { position: absolute; inset: 7px; border: 1px solid rgba(183,47,63,.3); border-radius: 50%; content: ""; }
.hero-knot { display: block; width: 112px; height: 112px; }
.hero-deck { max-width: 385px; margin: 25px 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.party-line { display: grid; grid-template-columns: 1fr; justify-items: start; gap: 8px; }
.party-line > div { display: flex; align-items: center; gap: 9px; }
.party-initial { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--pine); border-radius: 50%; color: var(--pine); font-family: var(--serif); font-size: 14px; }
.party-j { border-color: var(--vermilion); color: var(--vermilion); }
.party-line strong, .party-line small { display: block; }
.party-line strong { font-size: 12px; }
.party-line small { margin-top: 2px; color: var(--muted); font-family: var(--serif); font-size: 11px; }
.party-join { padding-left: 12px; color: var(--vermilion); font-family: var(--serif); font-size: 13px; }
.section-rule { border-bottom: 0; }
.preamble { position: relative; display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 38px; align-items: start; padding: 48px 5.5% 52px; }
.section-label { font-size: 10px; }
.section-label span { display: block; margin-top: 5px; color: #87948d; font-size: 9px; }
.preamble-text { max-width: 60ch; margin: -2px 0 0; font-family: var(--serif); font-size: 19px; line-height: 1.95; }
.terms { padding: 52px 5.5% 42px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 29px; }
.section-heading h2, .friendship h2, .right-panel h2, .benefits h2, .signing h2 { margin: 12px 0 0; font-family: var(--serif); font-size: 46px; font-weight: 500; line-height: 1.24; }
.section-heading h2 em { color: inherit; }
.term-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 42px; }
.term-row { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start; padding: 21px 0 23px; }
.term-no { display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid var(--vermilion); border-radius: 50%; color: var(--vermilion); font-family: var(--serif); font-size: 12px; }
.term-row h3 { margin: 0 0 8px; font-family: var(--serif); font-size: 18px; font-weight: 600; line-height: 1.5; }
.term-row p { max-width: 52ch; margin: 0; color: #505b5a; font-size: 13px; line-height: 1.9; }
.friendship { position: relative; display: grid; grid-template-columns: .8fr 1.2fr; gap: 45px; padding: 54px 5.5% 58px; overflow: hidden; }
.friendship h2 { margin-top: 19px; font-size: 52px; }
.friendship h2 em, .benefits h2 em, .signing h2 em { color: inherit; }
.friendship-list { padding: 1px 60px 0 0; }
.friendship-list p { margin: 0; padding: 12px 0 12px 15px; border-bottom: 1px solid var(--line); border-left: 2px solid var(--vermilion); color: #505b5a; font-size: 13px; line-height: 1.85; }
.friendship-list p:first-child { border-top: 0; }
.friendship-list span { display: inline-block; width: 34px; color: var(--vermilion); font-family: var(--serif); font-size: 12px; }
.friendship-list b { color: var(--ink); font-family: var(--serif); font-size: 14px; }
.rights { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.right-panel { min-width: 0; padding: 32px clamp(23px, 4vw, 49px) 42px; border-top: 2px solid var(--pine); }
.blue-panel, .coral-panel { background: transparent; }
.coral-panel { border-top-color: var(--vermilion); border-left: 1px solid var(--line); }
.right-top { display: flex; align-items: center; justify-content: space-between; }
.right-letter { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid currentColor; border-radius: 50%; color: var(--indigo); font-family: var(--serif); font-size: 18px; }
.coral-panel .right-letter { color: var(--vermilion); }
.right-panel .section-label { color: var(--pine); }
.coral-panel .section-label { color: var(--vermilion); }
.right-panel h2 { margin-top: 28px; font-size: 44px; }
.blue-panel h2 em { color: var(--indigo); }
.coral-panel h2 em { color: var(--vermilion); }
.right-panel > p { margin: 17px 0 0; color: #374747; font-size: 12px; line-height: 1.85; }
.right-aside { margin-top: 25px; padding-top: 0; }
.right-aside > span { color: var(--indigo); font-size: 9px; font-weight: 700; }
.right-aside p { margin: 7px 0 0; color: #374747; font-family: var(--serif); font-size: 15px; line-height: 1.7; }
.coral-panel .fine-print { margin-top: 11px; color: #694840; font-size: 9px; line-height: 1.7; }
.benefits { position: relative; display: grid; grid-template-columns: 1fr 1.1fr; gap: 35px; align-items: center; padding: 54px 5.5% 57px; overflow: hidden; }
.benefits h2 { margin-top: 15px; }
.benefit-big { position: relative; padding: 4px 0 4px 51px; }
.benefit-number { position: absolute; top: -13px; left: 0; color: var(--pine); font-family: var(--serif); font-size: 39px; }
.benefit-list { margin: 0; padding-left: 20px; }
.benefit-list li { padding: 2px 0 6px 4px; border-bottom: 1px solid var(--line); font-family: var(--serif); font-size: 20px; }
.benefit-list li::marker { color: var(--pine); font-family: var(--sans); font-size: 13px; }
.benefit-big small { display: block; max-width: 355px; margin-top: 13px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.signing { padding: 53px 5.5% 36px; }
.signing-heading { display: flex; align-items: end; justify-content: space-between; }
.signing h2 { margin-top: 15px; }
.signing-date { margin: 0 0 3px; color: var(--muted); font-size: 9px; line-height: 1.7; text-align: right; }
.signing-date strong { color: var(--ink); font-family: var(--serif); font-size: 13px; font-weight: 500; }
.signature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.signature-block { min-width: 0; }
.receipt-copy { max-width: 720px; margin: 23px 0 12px; color: #374747; font-family: var(--serif); font-size: 15px; line-height: 1.8; }
.receipt-signature { max-width: 520px; margin-top: 18px; }
.signature-head { display: flex; align-items: center; justify-content: space-between; }
.signature-head label { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.clear-button { min-width: 44px; min-height: 44px; padding: 8px; color: var(--indigo); font-size: 11px; }
.signature-canvas { display: block; width: 100%; height: 115px; margin-top: 5px; border: 1px solid var(--line); border-bottom: 2px solid var(--indigo); background: var(--surface); touch-action: none; cursor: crosshair; }
.signature-help { display: flex; justify-content: space-between; margin: 6px 0 0; color: var(--muted); font-size: 9px; }
.signature-help span { color: var(--vermilion); }
.image-export-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--line); }
.export-image-button { min-height: 44px; padding: 10px 16px; border: 1px solid var(--pine); border-radius: 1px; background: var(--pine); color: #fff; cursor: pointer; font-size: 12px; font-weight: 600; }
.export-image-button:hover:not(:disabled) { border-color: var(--indigo); background: var(--indigo); }
.export-image-button:disabled { border-color: #d0d9d4; background: #d0d9d4; color: #5e6c67; cursor: not-allowed; }
.export-status { margin: 0; color: var(--muted); font-size: 10px; }
body[data-exporting="true"] .clear-button, body[data-exporting="true"] .image-export-controls { display: none !important; }

.lock-screen h1, .hero h1, .section-heading h2, .friendship h2, .right-panel h2, .benefits h2, .ending h2, .signing h2 { font-family: var(--serif); font-weight: 500; }
.term-row h3 { font-family: var(--sans); }
.hero h1 em, .section-heading h2 em, .friendship h2 em, .right-panel h2 em, .benefits h2 em, .ending h2 em, .signing h2 em { font-weight: inherit; }
.hero h1 em { font-style: normal; }

@keyframes page-arrive { from { opacity: 0; transform: translateY(11px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 700px) {
  .agreement { width: min(calc(100% - 36px), 540px); }
  .lock-screen h1 { font-size: 40px; }
  .hero { min-height: auto; grid-template-columns: minmax(0, 1fr); gap: 25px; padding: 55px 2px 47px; }
  .hero::after { display: none; }
  .hero h1 { font-size: 46px; line-height: 1.12; }
  .hero-copy { gap: 12px; }
  .hero-side { grid-template-columns: 1fr; justify-items: start; gap: 15px; padding: 0; }
  .hero-seal { width: 96px; height: 96px; flex-basis: 96px; }
  .hero-seal::before { inset: 6px; }
  .hero-knot { width: 72px; height: 72px; }
  .hero-deck { max-width: 315px; font-size: 12px; }
  .party-line { grid-template-columns: auto auto auto; align-items: center; gap: 12px; padding: 0; }
  .party-initial { width: 34px; height: 34px; font-size: 12px; }
  .party-join { padding-left: 0; }
  .preamble { grid-template-columns: 1fr; gap: 14px; padding: 34px 2px 36px; }
  .section-label span { display: inline; margin: 0 0 0 6px; }
  .preamble-text { font-size: 18px; }
  .terms { padding: 39px 2px 31px; }
  .term-list { grid-template-columns: minmax(0, 1fr); column-gap: 0; }
  .section-heading { align-items: start; flex-direction: column; gap: 13px; margin-bottom: 19px; }
  .section-heading h2 { margin-top: 0; font-size: 35px; }
  .term-row { grid-template-columns: 30px minmax(0, 1fr); gap: 8px; padding: 17px 0 17px 12px; }
  .term-row::before { top: 17px; }
  .term-row h3 { font-size: 17px; }
  .term-row p { font-size: 12px; }
  .friendship { grid-template-columns: 1fr; gap: 22px; padding: 38px 2px 47px; }
  .friendship h2 { margin-top: 13px; font-size: 42px; }
  .friendship-list { padding-right: 9px; }
  .rights { grid-template-columns: 1fr; margin: 0 -18px; }
  .right-panel { padding: 31px 27px 30px; }
  .coral-panel { border-left: 0; }
  .right-panel h2 { font-size: 40px; }
  .benefits { grid-template-columns: 1fr; gap: 25px; padding: 39px 2px 42px; }
  .benefits h2 { margin-top: 13px; font-size: 36px; }
  .benefit-big { padding-left: 45px; }
  .joint-rights, .consideration, .other-terms { margin: 0 -18px; }
  .signing { padding: 39px 2px 30px; }
  .signing-heading { align-items: start; flex-direction: column; gap: 13px; }
  .signing-date { text-align: left; }
  .signing h2 { font-size: 34px; }
  .signature-grid { grid-template-columns: 1fr; gap: 22px; }
  .signature-canvas { height: 105px; }
  .image-export-controls { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 380px) {
  .lock-screen h1 { font-size: 38px; }
  .agreement { width: calc(100% - 28px); }
  .rights, .joint-rights, .consideration, .other-terms { margin-right: -14px; margin-left: -14px; }
  .hero h1 { font-size: 36px; }
  .hero-copy { gap: 12px; }
  .hero-seal { width: 82px; height: 82px; flex-basis: 82px; }
  .hero-knot { width: 62px; height: 62px; }
  .party-line { gap: 8px; }
  .party-line > div { gap: 6px; }
  .party-initial { width: 32px; height: 32px; font-size: 11px; }
}

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

@media print {
  @page { margin: 15mm 14mm; }
  body { background: white; color: #111; font-size: 10pt; }
  .page-grain, .lock-screen, .clear-button, .image-export-controls { display: none !important; }
  .agreement { width: 100%; margin: 0; animation: none; }
  .hero { min-height: 250px; padding-top: 25px; padding-bottom: 30px; }
  .hero h1 { font-size: 60pt; }
  .hero-seal { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .section-rule { break-inside: avoid; }
  .terms, .friendship, .benefits, .signing { padding-top: 27px; padding-bottom: 27px; }
  .right-panel { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .signature-canvas { background: white; }
  .signature-confirmation { color: #444; }
}