/* 尺寸与字体取自 专项计划考生资格审核表-材料粘贴页.pdf */
:root {
  --bg: #d8dde6;
  --paper: #fff;
  --text: #1a2332;
  --muted: #6b7a8f;
  --border: #000;
  --primary: #1a5fb4;
  --primary-dark: #0d4a94;
  --font-ui: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-doc: "仿宋_GB2312", "FangSong_GB2312", "仿宋", FangSong, serif;
  --size-title: 20.05pt;
  --size-cap: 15.95pt;
  --size-foot: 10.45pt;
  --hukou-l: 12.585cm;
  --hukou-r: 13.25cm;
  --hukou-gap-x: 0.538cm;
  --hukou-gap-y: 0.599cm;
  --hukou-h-t: 7.218cm;
  --hukou-h-b: 7.377cm;
  --id-w: 9.016cm;
  --id-gap: 0.482cm;
  --id-h: 6.018cm;
  --other-w: 18.574cm;
  --other-h: 15.297cm;
  --other-gap-top: 0.547cm;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

.topbar {
  background: var(--primary);
  color: #fff;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.topbar h1 { margin: 0; font-size: 1rem; font-weight: 600; }
.topbar-actions { display: flex; gap: 0.5rem; }

.page-wrap {
  max-width: calc(29.7cm + 2rem);
  margin: 0 auto;
  padding: 1rem 0.75rem 2rem;
}

.page-hint {
  margin: 0 0 0.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}

.status {
  min-height: 1.2rem;
  margin: 0 0 0.75rem;
  text-align: center;
  font-size: 0.82rem;
}

.status.error { color: #c01c28; }
.status.success { color: #1c7c3e; }

.page-scaler {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  overflow-x: auto;
}

.portrait-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
}

.portrait-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 0.4cm;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--muted);
}

.portrait-page-label { font-weight: 600; color: var(--text); }

.portrait-toolbar {
  display: flex;
  justify-content: center;
  width: 100%;
}

.btn-sm {
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
}

.doc-page {
  background: var(--paper);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  font-family: var(--font-doc);
  flex-shrink: 0;
  color: #000;
}

.doc-page.landscape {
  width: 29.7cm;
  height: 21.001cm;
  padding: 2.179cm 1.764cm 2.251cm 1.563cm;
}

.doc-title {
  margin: 0 0 0.663cm;
  text-align: center;
  font-family: var(--font-doc);
  font-size: var(--size-title);
  font-weight: normal;
  line-height: 1.15;
}

.doc-page.portrait {
  width: 21.001cm;
  height: 29.7cm;
  padding: 3.709cm 1.143cm 2.43cm 1.313cm;
}

/* 独立框 + 白缝：框与框之间无连线 */
.frames-grid {
  display: grid;
  background: var(--paper);
}

.hukou-grid {
  grid-template-columns: var(--hukou-l) var(--hukou-r);
  column-gap: var(--hukou-gap-x);
  row-gap: var(--hukou-gap-y);
}

.id-grid {
  grid-template-columns: var(--id-w) var(--id-w);
  column-gap: var(--id-gap);
}

.frame-box {
  position: relative;
  border: 1px solid var(--border);
  background: #fff;
  overflow: hidden;
}

.frame-box.drag-over {
  border-color: var(--primary);
  border-width: 2px;
  background: rgba(26, 95, 180, 0.06);
  box-shadow: inset 0 0 0 2px rgba(26, 95, 180, 0.25);
}

.frame-box.drag-over .slot-remind {
  color: var(--primary);
}

.hukou-grid .frame-box:nth-child(-n+2) { height: var(--hukou-h-t); }
.hukou-grid .frame-box:nth-child(n+3) { height: var(--hukou-h-b); }

.id-grid .frame-box { height: var(--id-h); }

.frame-other {
  width: var(--other-w);
  height: var(--other-h);
  margin-top: var(--other-gap-top);
}

.doc-foot {
  margin: 0.563cm 0 0 1.485cm;
  width: 12.717cm;
  font-family: var(--font-doc);
  font-size: var(--size-foot);
  line-height: 1.35;
  white-space: nowrap;
}

.slot-remind {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--font-doc);
  font-size: var(--size-cap);
  line-height: 1.35;
  color: #000;
  pointer-events: none;
}

.slot-remind span { display: block; }

.slot-inner {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  cursor: pointer;
  overflow: hidden;
  background: transparent;
  margin: 0;
  padding: 0;
}

.slot-inner:hover { background: rgba(26, 95, 180, 0.04); }

.frame-box.filled .slot-inner {
  background: #fff;
}

.slot-inner img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: fill;
  object-position: center;
}

.frame-box.filled .slot-inner img {
  display: block;
}

.frame-box.filled .slot-remind { display: none; }

.recrop-btn {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 3;
  border: 1px solid #ccc;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 4px;
  padding: 3px 8px;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  cursor: pointer;
  color: var(--primary-dark);
}

.btn {
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; border: 1px solid #ccc; color: var(--text); }
.btn.light.ghost {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}
.btn.light.primary { background: #fff; color: var(--primary-dark); }

.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.crop-modal[hidden] { display: none; }

.crop-dialog {
  background: #fff;
  border-radius: 10px;
  width: min(720px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.25);
}

.crop-header { padding: 0.75rem 1rem 0.5rem; border-bottom: 1px solid #ddd; }
.crop-header h3 { margin: 0; font-size: 0.95rem; }
.crop-header p { margin: 0.3rem 0 0; font-size: 0.78rem; color: var(--muted); }

.crop-stage {
  flex: 1;
  min-height: 320px;
  max-height: 60vh;
  background: #222;
  overflow: hidden;
}

.crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #ddd;
}

@media (max-width: 1100px) {
  .page-scaler { align-items: flex-start; }
}

.guidance-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 50;
  width: 17.5rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  font-family: var(--font-ui);
}

.guidance-panel[hidden] { display: none; }

.guidance-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  background: var(--primary);
  color: #fff;
}

.guidance-head-text { flex: 1; min-width: 0; }

.guidance-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
}

.guidance-promo {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffe082;
  line-height: 1.3;
  animation: guidance-blink 1.1s ease-in-out infinite;
}

.guidance-promo-alt {
  margin-top: 0.35rem;
  animation-delay: 0.55s;
}

@keyframes guidance-blink {
  0%, 100% {
    opacity: 1;
    text-shadow: 0 0 8px rgba(255, 224, 130, 0.9);
  }
  50% {
    opacity: 0.25;
    text-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .guidance-promo {
    animation: none;
    opacity: 1;
  }
}

.guidance-close {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.guidance-close:hover { background: rgba(255, 255, 255, 0.32); }

.guidance-qr {
  display: block;
  width: 100%;
  height: auto;
}

.guidance-note {
  margin: 0;
  padding: 0.55rem 0.75rem 0.7rem;
  font-size: 0.82rem;
  color: var(--text);
  text-align: center;
  line-height: 1.35;
  font-weight: 500;
}

.guidance-reopen {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 49;
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(26, 95, 180, 0.35);
}

.guidance-reopen:hover { background: var(--primary-dark); }

.guidance-reopen[hidden] { display: none; }

@media (max-width: 900px) {
  .guidance-panel {
    position: static;
    width: min(17.5rem, 92vw);
    margin: 0 auto 1.5rem;
  }

  .guidance-reopen {
    right: 0.75rem;
    bottom: 0.75rem;
  }
}
