.sheet {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 560px);
  gap: clamp(24px, 5vw, 72px);
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(32px, 7vh, 88px) 24px 64px;
  align-items: start;
}
.masthead { position: sticky; top: 40px; padding-top: 12px; }
.masthead .vert {
  writing-mode: vertical-rl;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 900;
  letter-spacing: 0.32em;
  line-height: 1.15;
  border-right: 3px double var(--ink);
  padding-right: 18px;
  height: 11em;
  max-height: 60vh;
  animation: rise 0.6s ease-out both;
}
.masthead .sub { margin-top: 18px; font-size: 0.86rem; color: var(--ink-2); max-width: 12em; }
.seal-mark {
  display: inline-grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin-top: 26px;
  border: 3px solid var(--seal);
  border-radius: 4px;
  color: var(--seal);
  font-family: var(--serif);
  font-weight: 900;
  font-size: 1.25rem;
  line-height: 1.1;
  text-align: center;
  transform: rotate(-9deg);
  opacity: 0.85;
  animation: stamp 0.5s 0.35s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

.panel {
  position: relative;
  background: var(--card);
  border: 1.5px solid var(--ink);
  padding: clamp(24px, 4vw, 40px);
  margin-top: 64px;
  box-shadow: 10px 10px 0 var(--paper-2), 10px 10px 0 1.5px var(--line);
  animation: rise 0.6s 0.12s ease-out both;
}
.panel::before {
  content: attr(data-tag);
  position: absolute;
  top: -1.5px;
  right: 24px;
  transform: translateY(-100%);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  padding: 4px 10px;
}
.panel h2 { font-size: 1.5rem; margin-bottom: 6px; }
.panel .lead { margin: 0 0 24px; color: var(--ink-2); }
.form-row { margin-bottom: 18px; }
.last6 { font-family: var(--mono); letter-spacing: 0.35em; font-size: 1.25rem !important; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.actions .btn { min-width: 9em; }
#msg { margin-bottom: 16px; }

.who { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px dashed var(--line); padding-bottom: 14px; }
.who .name { font-family: var(--serif); font-size: 2rem; font-weight: 900; letter-spacing: 0.1em; }
.ticket-card { border: 1.5px solid var(--line); padding: 16px 18px; margin-bottom: 14px; background: #fffdf8; }
.ticket-card dl { display: grid; grid-template-columns: 5.5em 1fr; gap: 4px 12px; margin: 0 0 14px; }
.ticket-card dt { color: var(--ink-2); font-size: 0.9rem; }
.ticket-card dd { margin: 0; font-weight: 600; }
.ticket-card .no { font-family: var(--mono); font-size: 1.15rem; letter-spacing: 0.06em; }
.ticket-card .pending { color: var(--ochre); font-weight: 600; }
.viewer { margin-top: 18px; border: 1.5px solid var(--ink); background: #fff; }
.viewer header { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.viewer iframe { display: block; width: 100%; height: min(78vh, 900px); border: 0; }
.foot { margin-top: 28px; font-size: 0.82rem; color: var(--ink-2); }

.notice { border: 1.5px solid var(--line); background: #fffdf8; padding: 16px 18px; margin-bottom: 18px; font-size: 0.95rem; line-height: 1.75; }
.notice h3 { margin: 0 0 8px; font-size: 1.1rem; }
.notice p { margin: 6px 0; }
.notice ul { margin: 4px 0 8px; padding-left: 1.4em; }
.notice .notice-sub { margin-bottom: 0; font-weight: 600; color: var(--seal); }
.notice .notice-key {
  margin: 10px 0 4px;
  padding: 10px 12px;
  border-left: 4px solid var(--seal);
  background: #fdf3ee;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.7;
}
.notice .notice-key strong { color: var(--seal); }
.notice .sample { display: block; margin: 10px 0 4px; border: 1.5px solid var(--ink); background: #fff; }
.notice .sample img { display: block; width: 100%; height: auto; }
.form-block { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.form-block h4 { margin: 0 0 8px; font-size: 1rem; }
.upload-btn { cursor: pointer; }
.signed-state { margin: 8px 0 0; font-size: 0.88rem; color: var(--ink-2); }
.signed-state.done { color: #1f6b3a; font-weight: 600; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes stamp { from { opacity: 0; transform: rotate(-9deg) scale(1.8); } }

@media (max-width: 720px) {
  .sheet { grid-template-columns: 1fr; padding-top: 28px; gap: 8px; }
  .masthead { position: static; display: flex; align-items: center; gap: 16px; }
  .masthead .vert { writing-mode: horizontal-tb; height: auto; border-right: 0; border-bottom: 3px double var(--ink); padding: 0 0 6px; font-size: 2rem; letter-spacing: 0.2em; }
  .masthead .sub { display: none; }
  .seal-mark { width: 58px; height: 58px; font-size: 1rem; margin: 0 0 0 auto; }
  .panel { margin-top: 32px; box-shadow: 6px 6px 0 var(--paper-2); }
}

/* ---------- 在线填写报名表 ---------- */
body.ff-lock { overflow: hidden; }
.ff-root {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column;
  height: 100%;
  background: var(--paper-2, #f2ece0);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.ff-head { position: relative; z-index: 96; display: flex; align-items: flex-start; gap: 12px;
  justify-content: space-between; padding: 14px 24px 10px;
  border-bottom: 1px solid var(--line); background: var(--paper, #fffdf8); }
/* 标题和说明各自占一列：原先和说明、按钮挤一行，手机上标题被压成一字一行 */
.ff-who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ff-who strong { font-family: var(--serif); font-size: 1.1rem; letter-spacing: 0.04em; white-space: nowrap; }
.ff-head p { margin: 0; font-size: 0.86rem; line-height: 1.5; max-width: 62ch; }
.ff-head .ff-close { flex: none; }

/* 加载态：以前要等 pdf.js + 取地址 + 下载 + 解析全部完成才挂出编辑器，中间几秒没反应 */
.ff-load { position: fixed; inset: 0; z-index: 95; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center;
  background: rgba(242, 236, 224, 0.96); }
.ff-load p { margin: 0; }
.ff-loadtext { font-weight: 600; font-size: 0.98rem; }
.ff-loadsub { font-size: 0.82rem; max-width: 22em; }
.ff-spin { width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(184, 67, 47, 0.22); border-top-color: var(--seal);
  animation: spin 0.8s linear infinite; }
.ff-load.err .ff-spin { display: none; }
.ff-bar { width: min(240px, 70vw); height: 6px; border-radius: 3px; background: rgba(31, 42, 36, 0.12); overflow: hidden; }
.ff-bar i { display: block; height: 100%; width: 0; background: var(--seal); transition: width 0.25s ease-out; }
.ff-retry { margin-top: 4px; }

.ff-stage { flex: 1; display: grid; place-items: start center; padding: 20px 24px 24px; }
/* 还没备好时先占位（拿得到宽度），但不可见也不可点 */
.ff-prep { visibility: hidden; }
.ff-sheet { position: relative; box-shadow: 4px 4px 0 rgba(0,0,0,.08); background: #fff;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ff-sheet canvas { position: absolute; inset: 0; display: block; }
.ff-ink { pointer-events: none; }
.ff-boxes { position: absolute; inset: 0; }
.ff-box { position: absolute; box-sizing: border-box; border: 1.5px dashed rgba(200,60,50,.55);
  background: rgba(255,225,215,.16); pointer-events: auto; }
.ff-box.filled { border-style: solid; border-color: rgba(31,107,58,.5); background: rgba(225,245,230,.10); }
.ff-box.active { border-color: #c0392b; border-width: 2px; background: rgba(255,220,210,.22);
  box-shadow: 0 0 0 3px rgba(192,57,43,.12); }
.ff-tag { position: absolute; left: -1px; bottom: 100%; margin-bottom: 2px;
  font-size: 11px; line-height: 1.5; padding: 1px 6px; white-space: nowrap;
  background: #a5301f; color: #fff; border-radius: 2px 2px 0 0;
  display: none; pointer-events: none; }
/* 只给当前框挂标签，别遮住要照着抄的原文 */
.ff-box.active .ff-tag { display: block; }
.ff-grip { position: absolute; width: 18px; height: 18px; border: 2px solid #fff;
  background: #c0392b; border-radius: 50%; padding: 0; cursor: grab; }
.ff-grip.move { left: -9px; top: -9px; } .ff-grip.size { right: -9px; bottom: -9px; cursor: nwse-resize; }
.ff-grip:active { cursor: grabbing; }
.ff-toolbar { position: sticky; bottom: 0; display: flex; gap: 16px; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  padding: 12px 24px; border-top: 1.5px solid var(--ink); background: var(--paper, #fffdf8); }
.ff-tb-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ff-tb-info .ff-name { font-size: 0.95rem; }
.ff-tb-info .ff-hint { font-size: 0.84rem; color: var(--ochre, #a1681b); font-weight: 600; }
.ff-tb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ff-msg { margin: 0 24px; }
.ff-modal { position: fixed; inset: 0; z-index: 100; background: rgba(24,20,16,.72);
  display: grid; place-items: center; padding: 14px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
.ff-modal-panel { background: var(--card, #fffdf8); border: 1.5px solid var(--ink);
  padding: 14px 16px; max-width: 100%; max-height: 100%; overflow: auto;
  display: flex; flex-direction: column; gap: 10px; }
.ff-modal-panel header { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.ff-modal-panel header .muted { font-size: 0.82rem; }
.ff-mstage { position: relative; background: #fff; touch-action: none; align-self: center;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ff-mstage canvas { display: block; background: repeating-linear-gradient(
  to bottom, #fff 0 31px, #d8d0c0 31px 32px); }
.ff-mstage .ff-rules { position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.ff-modal-panel footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ff-modal-panel .row-actions { display: flex; gap: 8px; }

/* 整屏写字板（手机）：竖拿时面板被 JS 转 90°，人把手机横过来写 */
.ff-modal.ff-full { padding: 0; display: block; background: var(--card, #fffdf8);
  touch-action: none; overscroll-behavior: contain; }
.ff-full .ff-modal-panel { position: fixed; top: 0; left: 0; transform-origin: top left;
  max-width: none; max-height: none; overflow: hidden; border: 0;
  padding: 8px max(14px, env(safe-area-inset-left, 0px)) 8px max(14px, env(safe-area-inset-right, 0px));
  gap: 6px; }
.ff-full header { flex: none; flex-wrap: nowrap; align-items: baseline; gap: 10px; min-width: 0; }
.ff-full header strong { flex: none; font-size: 1.05rem; }
.ff-full header .ff-mhint { flex: 1 1 auto; min-width: 0; font-size: 0.82rem; color: var(--ochre, #a1681b);
  font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ff-full .ff-step { flex: none; font-family: var(--mono); font-size: 0.8rem; color: var(--ink-2); }
.ff-full .ff-mwrap { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; }
.ff-full .ff-mstage { box-shadow: 0 0 0 1.5px var(--ink); }
.ff-full .ff-mstage canvas { background: #fff; }
/* 中线：书写参考，写的字不容易偏上偏下 */
.ff-full .ff-mstage .ff-rules { box-shadow: none;
  background: linear-gradient(to bottom, transparent calc(50% - 0.5px), rgba(160,122,60,.35) calc(50% - 0.5px), rgba(160,122,60,.35) calc(50% + 0.5px), transparent calc(50% + 0.5px)); }
.ff-full footer { flex: none; flex-wrap: nowrap; }
.ff-full footer .btn { padding: 9px 16px; font-size: 0.95rem; }

@media (max-width: 760px) {
  .ff-head { padding: 10px 14px; gap: 10px; }
  .ff-head strong { font-size: 1rem; }
  .ff-head p { font-size: 0.8rem; }
  .ff-stage { padding: 10px; }
  .ff-msg { margin: 0 14px; }
  /* 手机上工具条常驻底部，别让它被浏览器底栏和圆角挡住 */
  .ff-toolbar { padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    gap: 8px; flex-wrap: nowrap; align-items: stretch; }
  .ff-tb-info { flex: 1 1 auto; min-width: 0; justify-content: center; }
  .ff-tb-info .ff-name { font-size: 0.9rem; }
  .ff-tb-info .ff-hint { font-size: 0.78rem; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ff-tb-actions { flex: none; display: grid; grid-template-columns: repeat(3, auto); gap: 6px; }
  /* 提交单独一行占满，指头按得着 */
  .ff-tb-actions .btn { padding: 8px 10px; font-size: 0.85rem; white-space: nowrap; }
  .ff-tb-actions .btn.seal { grid-column: 1 / -1; }
  .ff-grip { width: 24px; height: 24px; }
  .ff-grip.move { left: -12px; top: -12px; }
  .ff-grip.size { right: -12px; bottom: -12px; }
}
@media (max-height: 460px) {
  .ff-head p { display: none; }
  .ff-toolbar { padding-top: 6px; padding-bottom: 6px; }
}
