/* 霞鹜拼音体：正规无衬线，a/g 为教材规范的 ɑ/ɡ */
@font-face {
  font-family: "LxgwPinyin";
  src: url("./fonts/LxgwPinyin-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.sz-wrap {
  width: 100%;
  padding: 4px 0 24px;
  box-sizing: border-box;
}

.sz-lead {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.65;
  color: #64748b;
}

.sz-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 20px;
  align-items: start;
}

.sz-settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 12px;
}

.sz-panel {
  background: #fff;
  border: 1px solid #e8ecf1;
  border-radius: 12px;
  overflow: hidden;
}

.sz-panel-h {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.sz-panel-h .sz-link-btn {
  margin-left: auto;
}

.sz-panel-fold > .sz-panel-h {
  list-style: none;
  cursor: pointer;
  user-select: none;
  border-bottom: none;
}

.sz-panel-fold > .sz-panel-h::-webkit-details-marker {
  display: none;
}

.sz-panel-fold[open] > .sz-panel-h {
  border-bottom: 1px solid #f1f5f9;
}

.sz-fold-hint {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: #94a3b8;
}

.sz-panel-fold[open] .sz-fold-hint {
  display: none;
}

.sz-fold-chevron {
  width: 8px;
  height: 8px;
  margin-left: 6px;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(45deg);
  flex-shrink: 0;
  transition: transform .15s;
}

.sz-panel-fold[open] .sz-fold-chevron {
  margin-left: auto;
  margin-top: 4px;
  transform: rotate(225deg);
}

.sz-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #eff6ff;
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.sz-panel-b {
  padding: 12px 14px 14px;
}

.sz-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: #94a3b8;
}

.sz-label-inline {
  margin: 0;
  white-space: nowrap;
}

.sz-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sz-title-row .sz-label {
  margin-bottom: 0;
}

.sz-title-count {
  font-size: 12px;
  color: #cbd5e1;
}

.sz-input,
.sz-textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  color: #0f172a;
  background: #f8fafc;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color .15s, background .15s;
}

.sz-input:focus,
.sz-textarea:focus {
  outline: none;
  background: #fff;
  border-color: #93c5fd;
}

.sz-textarea {
  resize: vertical;
  min-height: 78px;
  line-height: 1.6;
}

.sz-subgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.sz-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.sz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.4;
}

.sz-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.sz-btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 7px;
}

.sz-btn-primary {
  background: #2563eb;
  color: #fff;
}

.sz-btn-primary:hover:not(:disabled) { background: #1d4ed8; }

.sz-btn-ghost {
  background: #f1f5f9;
  color: #334155;
}

.sz-btn-ghost:hover:not(:disabled) { background: #e2e8f0; }

.sz-btn-muted {
  color: #94a3b8;
  background: transparent;
}

.sz-btn-muted:hover:not(:disabled) {
  color: #dc2626;
  background: #fef2f2;
}

.sz-btn-print {
  width: 100%;
  padding: 12px 16px;
  background: #2563eb;
  color: #fff;
  font-size: 15px;
  border-radius: 10px;
}

.sz-btn-print:hover:not(:disabled) { background: #1d4ed8; }

.sz-upload {
  position: relative;
  overflow: hidden;
}

.sz-link-btn {
  border: none;
  background: transparent;
  color: #2563eb;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.sz-link-btn:hover { background: #eff6ff; }

.sz-tip {
  margin: 8px 0 0;
  font-size: 12px;
  color: #dc2626;
  line-height: 1.5;
}

.sz-tip.is-ok { color: #059669; }

.sz-word-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0 8px;
  font-size: 12px;
  color: #64748b;
}

.sz-word-head b { color: #0f172a; }

.sz-muted { color: #94a3b8; }

.sz-word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 52px;
  max-height: 200px;
  overflow-y: auto;
  /* 给词语右上角删除钮留出空间，避免被 overflow 裁切 */
  padding: 8px 8px 4px 2px;
}

.sz-word-empty {
  width: 100%;
  padding: 18px 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px dashed #e2e8f0;
}

.sz-word-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

.sz-word-item:hover {
  border-color: #93c5fd;
  background: #fff;
}

.sz-word-py {
  display: flex;
  gap: 2px;
  font-size: 11px;
  color: #64748b;
  font-family: "LxgwPinyin", Arial, "Helvetica Neue", Helvetica, sans-serif;
  line-height: 1.2;
}

.sz-word-hz {
  font-size: 18px;
  font-weight: 500;
  color: #334155;
  letter-spacing: 0;
  font-family: KaiTi, STKaiti, "Kaiti SC", "楷体", serif;
}

.sz-word-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  padding: 0;
}

.sz-word-item:hover .sz-word-del { opacity: 1; }

.sz-color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.sz-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sz-color {
  width: 26px;
  height: 26px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
}

.sz-color.is-active {
  outline: 2px solid #cbd5e1;
  outline-offset: 2px;
}

.sz-sticky-print {
  padding-top: 2px;
}

.sz-print-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
  text-align: center;
}

.sz-preview-wrap {
  min-width: 0;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.sz-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}

.sz-preview-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.sz-preview-label {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.sz-page-info {
  font-size: 12px;
  color: #94a3b8;
}

.sz-preview-scroll {
  max-height: 820px;
  overflow: auto;
  padding: 20px 12px;
}

.sz-preview {
  --sz-scale: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.sz-page-shell {
  width: calc(794px * var(--sz-scale, 1));
  height: calc(1123px * var(--sz-scale, 1));
  flex-shrink: 0;
  overflow: hidden;
}

.sz-empty {
  padding: 48px 24px;
  color: #94a3b8;
  font-size: 14px;
  text-align: center;
  line-height: 1.8;
}

.sz-empty strong {
  display: block;
  color: #64748b;
  font-size: 15px;
  margin-bottom: 6px;
}

.sz-page {
  width: 794px;
  height: 1123px;
  box-sizing: border-box;
  padding: 40px 50px 56px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15,23,42,.08), 0 8px 24px rgba(15,23,42,.06);
  position: relative;
  page-break-after: always;
  transform: scale(var(--sz-scale, 1));
  transform-origin: top left;
}

.sz-page-title {
  text-align: center;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #111;
}

.sz-page-subs {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 16px;
}

.sz-page-subs.is-alone {
  margin-top: 0;
}

.sz-page-sub {
  display: flex;
  align-items: flex-end;
  font-size: 16px;
  color: #2b2d42;
}

.sz-page-sub .sz-sub-label {
  white-space: nowrap;
  font-family: KaiTi, STKaiti, "Kaiti SC", serif;
}

.sz-page-sub .sz-sub-line {
  width: 100px;
  height: 1px;
  background: #000;
  margin-bottom: 4px;
  margin-left: 2px;
}

.sz-page-main {
  margin-top: 28px;
}

/* 整行一体：上四线三格 + 下田字格（对齐常见注音字帖） */
.sz-main-row {
  border: 1px solid #000;
  box-sizing: border-box;
  margin-top: 20px;
  position: relative;
}

.sz-main-row:first-child {
  margin-top: 0;
}

.sz-row-py {
  display: flex;
  position: relative;
  align-items: stretch;
}

.sz-py-mid1,
.sz-py-mid2 {
  position: absolute;
  left: 0;
  width: 100%;
  border-top: 1px dashed #000;
  opacity: .5;
  pointer-events: none;
  z-index: 1;
}

.sz-py-mid1 { top: 8px; }
.sz-py-mid2 { top: 17px; }

.sz-py-cell {
  flex: 1;
  height: 26px;
  box-sizing: border-box;
  border-right: 1px solid #000;
}

.sz-py-cell:last-child {
  border-right: none;
}

.sz-row-hz {
  display: flex;
}

.sz-hz-cell {
  flex: 1;
  flex-shrink: 0;
  height: 58px;
  box-sizing: border-box;
  border-top: 1px solid #000;
  border-right: 1px solid #000;
  position: relative;
}

.sz-hz-cell:last-child {
  border-right: none;
}

.sz-hz-h,
.sz-hz-v {
  position: absolute;
  opacity: .5;
  pointer-events: none;
  box-sizing: border-box;
}

.sz-hz-h {
  left: 0;
  top: 50%;
  width: 100%;
  border-top: 1px dashed #000;
  transform: translateY(-50%);
}

.sz-hz-v {
  top: 0;
  left: 50%;
  height: 100%;
  border-right: 1px dashed #000;
  transform: translateX(-50%);
}

.sz-hz-text {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: KaiTi, STKaiti, "Kaiti SC", "楷体", serif;
  font-size: 36px;
  line-height: 1;
  color: #111;
}

.sz-page-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  padding: 0 50px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #9ca3af;
}

.sz-edit-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .35);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.sz-edit-modal[hidden] { display: none !important; }

.sz-edit-panel {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 20px 40px rgba(0,0,0,.18);
}

.sz-edit-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  color: #111827;
}

.sz-edit-rows {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.sz-edit-item {
  flex: 1;
  min-width: 72px;
  text-align: center;
}

.sz-edit-item .hz {
  display: block;
  font-size: 22px;
  margin-bottom: 6px;
  color: #334155;
}

.sz-edit-item input {
  width: 100%;
  text-align: center;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  font-family: "LxgwPinyin", Arial, "Helvetica Neue", Helvetica, sans-serif;
}

.sz-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.sz-intro {
  margin-top: 28px;
  padding: 18px 20px;
  background: #f8fafc;
  border: 1px solid #e8ecf1;
  border-radius: 10px;
}

.sz-intro h2 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}

.sz-intro h2:not(:first-child) {
  margin-top: 18px;
}

.sz-intro p,
.sz-intro li {
  margin: 0;
  font-size: 14px;
  line-height: 1.75;
  color: #475569;
}

.sz-intro ol,
.sz-intro ul {
  margin: 0;
  padding: 0 0 0 1.25em;
}

.sz-intro li + li {
  margin-top: 4px;
}

.sz-intro p + ol,
.sz-intro p + ul {
  margin-top: 8px;
}

.sz-intro p + p {
  margin-top: 10px;
}

.sz-intro ol + p {
  margin-top: 10px;
}

.sz-faq {
  margin: 0;
}

.sz-faq dt {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.sz-faq dt:first-child {
  margin-top: 0;
}

.sz-faq dd {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.75;
  color: #475569;
}

@media (max-width: 1024px) {
  .sz-layout {
    grid-template-columns: 1fr;
  }

  .sz-settings {
    position: static;
  }

  .sz-preview-scroll {
    max-height: none;
    overflow-x: hidden;
    padding: 12px 8px;
  }

  .sz-preview {
    gap: 12px;
  }
}

@media print {
  html, body {
    background: #fff !important;
    height: auto !important;
    overflow: visible !important;
  }
  body * { visibility: hidden !important; }
  .sz-preview-wrap,
  .sz-preview-wrap * { visibility: visible !important; }
  .sz-preview-wrap {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }
  .sz-preview-bar,
  .no-print,
  header, footer, aside, nav,
  .app-title { display: none !important; }
  .sz-preview-scroll {
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    background: none !important;
  }
  .sz-preview {
    gap: 0 !important;
    --sz-scale: 1 !important;
  }
  .sz-page-shell {
    width: 794px !important;
    height: 1123px !important;
    overflow: visible !important;
  }
  .sz-page {
    box-shadow: none !important;
    margin: 0 auto !important;
    transform: none !important;
    page-break-after: always;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .sz-page:last-child { page-break-after: auto; }
}

@page {
  size: A4 portrait;
  margin: 0;
}
