/* ============================================================
   登船票票面：横向 8:5，左侧票面 + 右侧票根
   容器查询单位 cqw 让票面在任意宽度下等比缩放
   ============================================================ */
.ticket {
  --paper: #fff0d6;
  --ticket-teal: #123e3c;
  --ticket-gold: #e6bb78;
  --seam: 68%;
  position: relative;
  container-type: inline-size;
  display: grid;
  grid-template-columns: minmax(0, 68fr) minmax(0, 32fr);
  width: 100%;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  border-radius: 12px;
  color: var(--ticket-gold);
  background: var(--ticket-teal);
  box-shadow: 0 10px 26px #071e1e55;
}
.ticket::before {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0.9cqw;
  border: 1px solid var(--ticket-gold);
  border-radius: 0.7cqw;
  pointer-events: none;
}
/* 左栏：hero + 票面两行 */
.ticket-body { display: grid; grid-template-rows: 46fr 54fr; min-width: 0; overflow: hidden; }

.ticket-hero { position: relative; display: grid; align-items: start; min-height: 0; overflow: hidden; }
.ticket-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(102deg, #0c272af2, #102b3068 48%, transparent 82%);
}
.ticket-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 46%; }
.ticket-title { position: relative; z-index: 1; padding: 4.2cqw 7% 0; }
.ticket-carrier { margin: 0 0 0.7cqw; color: #f0d6a2; font: 600 max(9px, 1.15cqw)/1.4 var(--sans); letter-spacing: .24em; }
.ticket-title h3 {
  color: #fff0c8;
  font: 800 7.2cqw/1.06 "Songti SC", SimSun, serif;
  letter-spacing: .035em;
  margin: 0;
  text-shadow: 0 3px 10px #102623;
}
.ticket-title p { color: #fff0c8; margin: 0.9cqw 0 0; font: 700 3.3cqw/1.2 "Songti SC", SimSun, serif; overflow-wrap: anywhere; }
.ticket-title p span { display: block; margin-top: 0.5cqw; color: #f3d9a0; font: 700 max(8px, 1.45cqw)/1.3 Georgia, serif; letter-spacing: .16em; }

.ticket-paper {
  display: grid;
  align-content: space-between;
  gap: 0.7cqw;
  min-height: 0;
  padding: 2.4% 7% 3%;
  color: #214c45;
  font-family: "Songti SC", SimSun, serif;
  background: linear-gradient(120deg, #fff4dc, #f7e2ba);
  overflow: hidden;
}
.ticket-paper.type-kai { color: #943e2b; font-family: KaiTi, STKaiti, "Kaiti SC", "Songti SC", serif; }
.ticket-paper.type-modern { color: #233546; font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }

.ticket-route { display: flex; align-items: flex-end; gap: 1.1cqw; color: #5d4630; }
.ticket-route .port { display: flex; align-items: center; gap: 0.6cqw; flex: 0 0 auto; }
.ticket-route .port i {
  width: 2.4cqw; height: 2.4cqw; display: grid; place-items: center; flex: 0 0 auto;
  border: 1px solid #b28d5d; border-radius: 0.45cqw;
  color: #8a6a45; font: 700 max(8px, 1.1cqw)/1 var(--sans); font-style: normal;
}
.ticket-route .port b {
  color: #2b4139; font: 700 2.3cqw/1.2 var(--serif); letter-spacing: .04em; white-space: nowrap;
}
.ticket-route .port.is-to { margin-left: auto; }
.ticket-route .link { flex: 1; min-width: 4cqw; display: flex; flex-direction: column; align-items: center; gap: 0.3cqw; padding-bottom: 0.4cqw; }
.ticket-route .link em { color: #7c5b39; font: 600 max(7.5px, 1.05cqw)/1.3 var(--sans); font-style: normal; letter-spacing: .04em; white-space: nowrap; }
.ticket-route .link::after { content: ""; width: 100%; border-top: 1px dashed #c09a67; }

.ticket-personal { display: grid; gap: 0.5cqw; padding: 0.2cqw 0 0; }
.ticket-personal p { margin: 0; overflow-wrap: anywhere; }
.ticket-personal p span { display: block; color: #765337; font: 700 max(8px, 1.1cqw)/1.4 var(--sans); letter-spacing: .1em; }
.ticket-visitor strong { font-size: 3.2cqw; line-height: 1.18; }
.ticket-message strong {
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 1.65cqw; line-height: 1.4;
}

.ticket-fields {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6cqw 1.8cqw;
  margin: 0; padding-top: 0.8cqw; border-top: 1px solid #e6cda2;
}
.ticket-fields > div { min-width: 0; }
.ticket-fields dt { color: #8a6a45; font: 600 max(8px, 1.05cqw)/1.4 var(--sans); letter-spacing: .06em; }
.ticket-fields dd {
  margin: 0.2cqw 0 0; color: #2a4038; font: 700 max(10px, 1.5cqw)/1.3 var(--sans);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.ticket-code { display: flex; align-items: center; justify-content: space-between; gap: 1.5cqw; padding-top: 0.7cqw; border-top: 1px solid #e6cda2; }
.ticket-barcode {
  flex: 1; max-width: 58%; height: 1.5cqw; opacity: .82;
  background-image: repeating-linear-gradient(90deg, #22433b 0 1.2px, transparent 1.2px 3.2px, #22433b 3.2px 4px, transparent 4px 6.4px, #22433b 6.4px 8.4px, transparent 8.4px 10.5px, #22433b 10.5px 11.2px, transparent 11.2px 14px);
}
.ticket-code em { color: #7c5b39; font: 600 max(7.5px, 1.05cqw)/1 var(--sans); font-style: normal; letter-spacing: .04em; white-space: nowrap; }

/* ---------- 右侧票根：运河印记 ---------- */
.ticket-stub {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.1cqw;
  min-width: 0;
  min-height: 0;
  padding: 3.4cqw 2.6cqw 2.8cqw;
  border-left: 1px dashed var(--ticket-gold);
  background: radial-gradient(ellipse at top right, #2a685c80, transparent 80%);
}
.stub-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 0.8cqw; white-space: nowrap; }
.stub-heading b { color: #fff0c8; font: 700 2.1cqw/1.1 "Songti SC", SimSun, serif; }
.stub-heading span { color: #e6bb78; font: 400 max(8px, 1.15cqw)/1 Georgia, serif; }
.stub-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.8cqw; }
.stub-seal {
  width: 4.4cqw; height: 4cqw; display: grid; place-items: center;
  border: 2px solid #c2583f; border-radius: 0.5cqw; color: #c2583f;
  font: 700 max(9px, 1.65cqw)/1 var(--serif); letter-spacing: .02em;
  transform: rotate(-7deg); opacity: .92;
}
.stub-serial { color: #e6bb78; font: 700 max(8px, 1.25cqw)/1.2 Georgia, serif; letter-spacing: .05em; }

.imprint-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--stamp-columns, 2), minmax(0, 1fr));
  gap: 0.9cqw 0.5cqw;
  align-content: center;
  min-height: 0;
  padding: 1.1cqw 0.9cqw;
  border: 1px solid #d2ac72;
  border-radius: 0.8cqw;
  background: linear-gradient(150deg, #fff3d6, #eac995);
}
.imprint-single { grid-template-columns: minmax(0, 1fr); }
.stamp-empty { grid-column: 1 / -1; margin: 2cqw; color: #765337; text-align: center; font-size: max(10px, 1.6cqw); }
.stamp {
  --seal-tilt: -4deg;
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0.6cqw;
  color: #873327;
  background: transparent;
  font: 700 max(8.5px, 1.15cqw)/1.2 "Songti SC", SimSun, serif;
}
.stamp:nth-child(even) { --seal-tilt: 3deg; }
button.stamp:hover { background: #fff4dc; }
.stamp-ink { display: grid; justify-items: center; gap: 0.3cqw; transform: rotate(var(--seal-tilt)); }
.stamp-ink img { display: block; width: 11cqw; max-width: 100%; aspect-ratio: 1; object-fit: contain; mix-blend-mode: multiply; }
.imprint-single .stamp-ink img { width: 15cqw; }
.stamp-ink span { text-align: center; overflow-wrap: anywhere; }
.ticket-badge { border-radius: 24px; }
.ticket-certificate { --ticket-teal: #683a30; }

/* ---------- 画布下的填写与生成 ---------- */
.ticket-workbench { margin: 12px 0 16px; }
.ticket-inputs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .85fr) minmax(0, 2fr); gap: 12px; }
.ticket-inputs > .field { margin: 0; }
.ticket-workbench .actions { margin-top: 9px; }
.step-note {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 12px;
  margin-top: 10px; padding: 7px 12px; border-radius: 7px;
  background: #f3f1e6; color: var(--subtle); font-size: 12.5px;
}
.step-note b { color: var(--bronze); font-size: 13px; letter-spacing: .04em; }
.step-optional { color: #8d846c; }
.seal-shelf-heading { margin: 0 0 8px; }
.seal-shelf-heading h3 { font-size: 20px; }
.seal-shelf-heading p { color: var(--subtle); font-size: 13px; }
.seal-pages { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.seal-pages [aria-pressed="true"] { background: #244b3e; color: #fff4dc; border-color: #244b3e; }
.seals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.seal-card { display: grid; min-width: 0; border: 1px solid #e0dacc; border-radius: 8px; background: #faf6e8; }
.seal-card.chosen { border-color: #b8765d; background: #f8ede4; }
.seal-pick { display: grid; justify-items: center; gap: 4px; position: relative; padding: 10px 6px 5px; border: 0; color: var(--heading); background: transparent; text-align: center; }
.seal-pick:hover { background: #e9e7dc; border-radius: 7px; }
.seal-pick img { display: block; width: clamp(66px, 8vw, 105px); aspect-ratio: 1; object-fit: contain; }
.seal-pick-copy strong, .seal-pick-copy small { display: block; }
.seal-pick-copy strong { font-size: 15px; }
.seal-pick-copy small { color: var(--subtle); font-size: 12px; }
.seal-pick-state { position: absolute; top: 5px; right: 9px; color: #8f422f; font-size: 17px; }
.seal-card .seal-story { justify-self: center; min-height: 30px; margin-bottom: 3px; }
.story-imprint { display: block; width: 118px; height: 118px; margin: 0 auto 14px; }

/* 窄屏：票面上下堆叠，字号改用 px 保证可读 */
@media (max-width: 720px) {
  .ticket { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; aspect-ratio: auto; }
  .ticket-body { grid-template-rows: 46vw auto; }
  .ticket-title { padding: 22px 7% 0; }
  .ticket-title h3 { font-size: clamp(30px, 10.5vw, 46px); }
  .ticket-title p { font-size: clamp(17px, 5.2vw, 24px); margin-top: 6px; }
  .ticket-title p span { font-size: 10px; margin-top: 3px; }
  .ticket-paper { padding: 10px 6% 13px; gap: 8px; }
  .ticket-route { gap: 8px; }
  .ticket-route .port b { font-size: 15px; }
  .ticket-route .port i { width: 17px; height: 17px; font-size: 9px; }
  .ticket-route .link em { display: none; }
  .ticket-personal p span { font-size: 9.5px; }
  .ticket-visitor strong { font-size: 24px; }
  .ticket-message strong { font-size: 12.5px; -webkit-line-clamp: 2; }
  .ticket-fields dt { font-size: 9.5px; }
  .ticket-fields dd { font-size: 12.5px; }
  .ticket-barcode { height: 16px; }
  .ticket-code em { font-size: 9.5px; }
  .ticket-stub { border-left: 0; border-top: 1px dashed var(--ticket-gold); padding: 12px 14px; gap: 8px; }
  .stub-heading b { font-size: 16px; }
  .stub-heading span { font-size: 11px; }
  .imprint-grid { min-height: 74px; padding: 8px; gap: 6px; }
  .stamp-ink img { width: min(100%, 58px); }
  .stamp-ink span { font-size: 10px; }
  .stub-seal { width: 34px; height: 31px; font-size: 12px; }
  .stub-serial { font-size: 10.5px; }
  .seals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ticket-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ticket-inputs > :last-child { grid-column: 1 / -1; }
}
.ticket-badge { border-radius: 24px; }
.ticket-certificate { --ticket-teal: #683a30; }

/* ---------- 画布下的填写与生成 ---------- */
.ticket-workbench { margin: 12px 0 16px; }
.ticket-inputs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .85fr) minmax(0, 2fr); gap: 12px; }
.ticket-inputs > .field { margin: 0; }
.ticket-workbench .actions { margin-top: 9px; }
.step-note {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 12px;
  margin-top: 10px; padding: 7px 12px; border-radius: 7px;
  background: #f3f1e6; color: var(--subtle); font-size: 12.5px;
}
.step-note b { color: var(--bronze); font-size: 13px; letter-spacing: .04em; }
.step-optional { color: #8d846c; }
.seal-shelf-heading { margin: 0 0 8px; }
.seal-shelf-heading h3 { font-size: 20px; }
.seal-shelf-heading p { color: var(--subtle); font-size: 13px; }
.seal-pages { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.seal-pages [aria-pressed="true"] { background: #244b3e; color: #fff4dc; border-color: #244b3e; }
.seals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.seal-card { display: grid; min-width: 0; border: 1px solid #e0dacc; border-radius: 8px; background: #faf6e8; }
.seal-card.chosen { border-color: #b8765d; background: #f8ede4; }
.seal-pick { display: grid; justify-items: center; gap: 4px; position: relative; padding: 10px 6px 5px; border: 0; color: var(--heading); background: transparent; text-align: center; }
.seal-pick:hover { background: #e9e7dc; border-radius: 7px; }
.seal-pick img { display: block; width: clamp(66px, 8vw, 105px); aspect-ratio: 1; object-fit: contain; }
.seal-pick-copy strong, .seal-pick-copy small { display: block; }
.seal-pick-copy strong { font-size: 15px; }
.seal-pick-copy small { color: var(--subtle); font-size: 12px; }
.seal-pick-state { position: absolute; top: 5px; right: 9px; color: #8f422f; font-size: 17px; }
.seal-card .seal-story { justify-self: center; min-height: 30px; margin-bottom: 3px; }
.story-imprint { display: block; width: 118px; height: 118px; margin: 0 auto 14px; }

/* 窄屏：票面按容器等比缩小，其余重排为单列 */
@media (max-width: 720px) {
  .ticket { width: 100%; }
  .ticket-route .link em { display: none; }
  .ticket-fields { gap: 1.4cqw 2cqw; }
  .seals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ticket-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ticket-inputs > :last-child { grid-column: 1 / -1; }
}
