/* ==========================================================================
   字韵工坊 HanziCraft Studio v1.0 — Dual-Mode Calligraphy & Guofeng Card CSS
   Zero external CDN / Exact 210mm x 297mm @media print A4 SVG vector engine
   ========================================================================== */

:root {
  --bg-app: #f4f2ec;
  --bg-panel: #ffffff;
  --bg-subtle: #f8f6f1;
  --border: #e6e1d6;
  --border-strong: #d3cbbd;

  --text-main: #1c1917;
  --text-sec: #57534e;
  --text-muted: #8a8178;

  --vermilion: #c0392b;
  --vermilion-soft: #fdf2f0;
  --jade: #27665b;
  --jade-soft: #ebf5f2;
  --ink: #1c1917;

  --topbar-h: 60px;
  --panel-w: 420px;
  --sheet-zoom: 0.8;

  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-kai: "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", "Songti SC", serif;
  --font-song: "Songti SC", "STSong", "Noto Serif SC", "SimSun", Georgia, serif;
  --font-mono: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-main);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* ==================== TOP HEADER ==================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-left,
.topbar-center,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #c0392b 0%, #991b1b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(192, 57, 43, 0.28);
  flex-shrink: 0;
}

.brand-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.brand-en {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--vermilion-soft);
  color: var(--vermilion);
}

.brand-slogan {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Dual Mode Switcher */
.mode-switcher {
  display: inline-flex;
  padding: 4px;
  border-radius: 11px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  gap: 4px;
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--text-sec);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.mode-btn.active {
  background: #ffffff;
  color: var(--vermilion);
  box-shadow: 0 2px 6px rgba(28, 25, 23, 0.08);
}

/* Header Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-sm {
  height: 32px;
  padding: 0 11px;
  font-size: 12px;
}

.btn-dark {
  background: var(--ink);
  color: #ffffff;
}

.btn-vermilion {
  background: linear-gradient(135deg, #c0392b 0%, #991b1b 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(192, 57, 43, 0.24);
}

.btn-ghost {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-license {
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(192, 57, 43, 0.24);
  background: linear-gradient(135deg, #c0392b 0%, #991b1b 100%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.btn-license.is-pro {
  background: linear-gradient(135deg, #1c1917 0%, #292524 100%);
  color: #fde68a;
  border-color: rgba(245, 196, 81, 0.5);
}

/* ==================== WORKSPACE LAYOUT ==================== */

.workspace {
  display: grid;
  grid-template-columns: var(--panel-w) minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

/* LEFT EDITOR PANEL */
.editor-panel {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.panel-body {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  flex-direction: column;
  gap: 12px;
}

.panel-body.active {
  display: flex;
}

.section-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-header h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main);
}

.badge-soft {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg-subtle);
  color: var(--text-sec);
  white-space: nowrap;
}

.badge-accent {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--vermilion-soft);
  color: var(--vermilion);
  white-space: nowrap;
}

/* Preset Pills */
.preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-btn {
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-sec);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
  transition: all 0.14s ease;
}

.preset-btn:hover {
  border-color: var(--vermilion);
  color: var(--vermilion);
  background: #ffffff;
}

.preset-btn.active {
  background: var(--vermilion);
  border-color: var(--vermilion);
  color: #ffffff;
}

/* Form Inputs */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sec);
}

.field-hint {
  font-size: 10.5px;
  color: var(--text-muted);
}

.field input[type="text"],
.field textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--vermilion);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

.field input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-sec);
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 6px;
  border-radius: 7px;
}

.seg-btn.active {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Grid & Theme Pickers */
.grid-picker,
.theme-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pick-card {
  position: relative;
  text-align: left;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: all 0.14s ease;
}

.pick-card:hover {
  border-color: var(--border-strong);
}

.pick-card.active {
  border-color: var(--vermilion);
  background: var(--vermilion-soft);
}

.pick-card.locked {
  border-style: dashed;
  background: #fbfaf8;
}

.pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
}

.pick-name {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-main);
}

.pick-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

.swatch-strip {
  height: 18px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  padding: 0 6px;
  gap: 6px;
}

.swatch-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.tag-free {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--jade-soft);
  color: var(--jade);
}

.tag-pro {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 5px;
  background: #fef3c7;
  color: #92400e;
}

.tag-pro.unlocked {
  background: var(--ink);
  color: #fde68a;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--jade);
  background: var(--jade-soft);
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.slider-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slider-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sec);
}

.slider-val {
  font-family: var(--font-mono);
  color: var(--vermilion);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--vermilion);
}

.pro-mini-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 5px;
  background: #fef3c7;
  color: #92400e;
}

.pro-mini-tag.unlocked {
  background: var(--jade-soft);
  color: var(--jade);
}

.panel-legal-footer {
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.link-btn {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-sec);
  white-space: nowrap;
}

.link-btn:hover {
  color: var(--vermilion);
}

.link-btn-accent {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--vermilion);
  text-decoration: underline;
  white-space: nowrap;
}

/* ==================== RIGHT PREVIEW STAGE ==================== */

.preview-stage {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background-color: #ece9e1;
  background-image: radial-gradient(rgba(120, 108, 92, 0.18) 1px, transparent 1px);
  background-size: 20px 20px;
}

.preview-toolbar {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.toolbar-left-meta,
.toolbar-right-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stage-pill {
  font-size: 12.5px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.stage-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.zoom-label,
.zoom-val {
  font-size: 12px;
  color: var(--text-sec);
  font-family: var(--font-mono);
}

.toolbar-right-controls input[type="range"] {
  width: 100px;
}

.file-mode-banner {
  margin: 12px 20px 0;
  padding: 9px 14px;
  border-radius: 10px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.file-tag {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  background: #f59e0b;
  color: #ffffff;
}

.preview-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

/* ==================== A4 VECTOR SHEET STYLING ==================== */

.sheets-viewport {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  transform: scale(var(--sheet-zoom));
  transform-origin: top center;
}

.a4-sheet {
  width: 210mm;
  height: 297mm;
  padding: 13mm 14mm 11mm;
  background: var(--h-paper-bg, #ffffff);
  border: 1px solid var(--h-paper-border, #e5e5e5);
  border-radius: 4px;
  box-shadow: 0 18px 46px rgba(28, 25, 23, 0.14);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--h-ink, #1c1917);
  flex-shrink: 0;
}

.a4-sheet.font-kai {
  font-family: var(--font-kai);
}

.a4-sheet.font-song {
  font-family: var(--font-song);
}

.a4-header {
  border-bottom: 1.5px solid var(--h-header-border, #e5c6c3);
  padding-bottom: 3.5mm;
  margin-bottom: 4.5mm;
  display: flex;
  flex-direction: column;
  gap: 1.5mm;
}

.a4-header-title {
  font-family: var(--font-sans);
  font-size: 13pt;
  font-weight: 700;
  color: var(--h-ink, #1c1917);
  letter-spacing: 0.02em;
}

.a4-header-meta {
  font-family: var(--font-sans);
  font-size: 8.5pt;
  color: var(--h-muted, #78716c);
  display: flex;
  justify-content: space-between;
}

.a4-grid-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3.4mm;
  justify-content: flex-start;
}

.hanzi-row {
  display: grid;
  grid-template-columns: repeat(var(--h-cols, 8), 1fr);
  gap: 0;
}

.hanzi-cell {
  display: flex;
  flex-direction: column;
}

.cell-pinyin-band {
  position: relative;
  height: 7.4mm;
  border-left: 0.35mm solid var(--h-grid-color, #d9483b);
  border-right: 0.35mm solid var(--h-grid-color, #d9483b);
  margin-left: -0.35mm;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hanzi-cell:first-child .cell-pinyin-band {
  margin-left: 0;
}

.pinyin-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.p-line-outer {
  stroke: var(--h-pinyin-line, #df6b61);
  stroke-width: 1.4;
}

.p-line-inner {
  stroke: var(--h-pinyin-line, #df6b61);
  stroke-width: 1;
  opacity: 0.65;
}

.cell-pinyin-text {
  position: relative;
  z-index: 2;
  font-family: var(--font-sans);
  font-size: 8.5pt;
  font-weight: 600;
  color: var(--h-accent, #b91c1c);
  line-height: 1;
}

.cell-box {
  position: relative;
  aspect-ratio: 1 / 1;
  margin-left: -0.35mm;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hanzi-cell:first-child .cell-box {
  margin-left: 0;
}

.grid-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.g-outer {
  stroke: var(--h-grid-color, #d9483b);
  stroke-width: 2.2;
}

.g-sub {
  stroke: var(--h-grid-sub, rgba(217, 72, 59, 0.42));
  stroke-width: 1.2;
}

.g-inner {
  stroke: var(--h-grid-color, #d9483b);
  stroke-width: 1.2;
  opacity: 0.58;
}

.cell-glyph {
  position: relative;
  z-index: 2;
  font-size: calc(142mm / var(--h-cols, 8) * 0.78);
  line-height: 1;
  user-select: none;
}

.cell-glyph.is-model {
  color: var(--h-ink, #1c1917);
  opacity: 0.96;
}

.cell-glyph.is-trace {
  color: var(--h-trace, #57534e);
  opacity: var(--h-trace-opacity, 0.24);
}

.a4-footer {
  margin-top: 3mm;
  padding-top: 2.5mm;
  border-top: 0.8px solid var(--h-header-border, #e5c6c3);
  font-family: var(--font-sans);
  font-size: 8pt;
  color: var(--h-muted, #78716c);
  display: flex;
  justify-content: space-between;
}

.multipage-upsell-banner {
  max-width: 680px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  background: #ffffff;
  border: 1.5px solid var(--vermilion);
  box-shadow: 0 10px 26px rgba(192, 57, 43, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.multipage-upsell-banner p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-sec);
}

/* ==================== MODE B: 3:4 CARD PREVIEW ==================== */

.card-canvas-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.card-canvas-shell {
  width: min(440px, 86vw);
  border-radius: 16px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(28, 25, 23, 0.16);
}

.card-canvas-shell canvas {
  display: block;
  width: 100%;
  height: auto;
}

.card-stage-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ==================== MODALS & TOAST ==================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(28, 25, 23, 0.58);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 20px;
  padding: 26px 28px;
  box-shadow: 0 26px 64px rgba(15, 23, 42, 0.25);
}

.modal-upgrade { max-width: 960px; }
.modal-compact { max-width: 460px; }
.modal-legal { max-width: 660px; }

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 20px;
  line-height: 1;
}

.upgrade-head {
  text-align: center;
  margin-bottom: 18px;
}

.upgrade-eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 99px;
  background: var(--vermilion-soft);
  color: var(--vermilion);
  margin-bottom: 7px;
}

.upgrade-head h2,
.legal-head h2,
.licensed-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.upgrade-context-tip {
  margin: 8px auto 0;
  max-width: 580px;
  font-size: 12.5px;
  font-weight: 600;
  color: #92400e;
  background: #fef3c7;
  padding: 6px 12px;
  border-radius: 8px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.price-card {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.price-featured {
  border-color: var(--vermilion);
  background: linear-gradient(180deg, #fff7f6 0%, #ffffff 35%);
}

.price-bundle {
  border-color: #99d5c9;
  background: linear-gradient(180deg, #f0faf7 0%, #ffffff 35%);
}

.price-all {
  border-color: #292524;
  background: linear-gradient(180deg, #f5f5f4 0%, #ffffff 35%);
}

.price-ribbon {
  position: absolute;
  top: -10px;
  right: 10px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--vermilion);
  color: #ffffff;
}

.ribbon-jade { background: var(--jade); }
.ribbon-dark { background: var(--ink); color: #fde68a; }

.price-tier {
  font-size: 13.5px;
  font-weight: 800;
}

.price-amount {
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex-wrap: wrap;
}

.price-amount .yuan { font-size: 15px; font-weight: 700; }
.price-amount .num { font-size: 27px; font-weight: 900; line-height: 1; }
.price-amount .unit { font-size: 11px; color: var(--text-muted); }

.price-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--vermilion-soft);
  color: var(--vermilion);
  margin-left: 4px;
}

.tag-jade { background: var(--jade-soft); color: var(--jade); }
.tag-dark { background: #e7e5e4; color: var(--ink); }

.price-features {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-sec);
}

.price-features li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.42;
}

.price-features .muted-feat { color: #a8a29e; }
.chk, .chk-pro, .chk-jade, .chk-dark, .cross { flex-shrink: 0; font-weight: 800; }
.chk { color: #10b981; }
.chk-pro { color: var(--vermilion); }
.chk-jade { color: var(--jade); }
.chk-dark { color: var(--ink); }
.cross { color: #d6d3d1; }

.checkout-split {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.checkout-step-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 800;
  margin-bottom: 10px;
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.platform-box,
.activate-box {
  padding: 14px;
  border-radius: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.platform-links-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-platform {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.btn-platform em { font-style: normal; }
.btn-plat-red { background: var(--vermilion); color: #ffffff; }
.btn-plat-jade { background: var(--jade); color: #ffffff; }
.btn-plat-outline { background: #ffffff; color: var(--text-main); border: 1px solid var(--border-strong); }
.btn-platform.unconfigured { opacity: 0.74; }

.consumer-notice {
  padding: 8px 10px;
  border-radius: 9px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 11.5px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.file-mode-alert {
  padding: 8px 10px;
  border-radius: 8px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
  font-size: 11.5px;
}

.activate-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sec);
}

.license-input {
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  background: #ffffff;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.btn-activate {
  height: 42px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #c0392b 0%, #991b1b 100%);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 800;
}

.btn-activate:disabled { opacity: 0.6; cursor: wait; }

.activate-feedback {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.activate-feedback.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.activate-feedback.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }

.device-quota-line {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-sec);
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 7px 10px;
  border-radius: 8px;
}

.device-quota-line strong,
.device-ok { color: var(--jade); }

.licensed-head {
  text-align: center;
  margin-bottom: 14px;
}

.licensed-emblem {
  width: 48px;
  height: 48px;
  margin: 0 auto 8px;
  border-radius: 12px;
  background: var(--vermilion);
  color: #fffdf8;
  font-family: var(--font-song);
  font-size: 24px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.licensed-head p { margin: 5px 0 0; font-size: 12.5px; color: var(--text-sec); }

.licensed-details {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-sec);
}

.legal-sections {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 18px;
}

.legal-block {
  padding: 11px 13px;
  border-radius: 11px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.legal-block h3 { margin: 0 0 5px; font-size: 13.5px; font-weight: 800; }
.legal-block p { margin: 0; font-size: 12.5px; color: var(--text-sec); line-height: 1.65; }

.modal-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast-container {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.24);
}

.toast.success { background: var(--jade); }
.toast.error { background: #991b1b; }

/* ==================== RESPONSIVE ==================== */

@media (max-width: 1120px) {
  .brand-slogan { display: none; }
  :root { --panel-w: 375px; }
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .topbar { height: auto; padding: 10px 14px; flex-wrap: wrap; }
  .workspace { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .editor-panel { height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .checkout-split { grid-template-columns: 1fr; }
}

/* ==================== EXACT A4 VECTOR PRINT ENGINE ==================== */

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

@media print {
  html, body {
    background: #ffffff !important;
    height: auto !important;
    overflow: visible !important;
  }
  .topbar,
  .editor-panel,
  .preview-toolbar,
  .file-mode-banner,
  .multipage-upsell-banner,
  .card-preview-pane,
  .modal-backdrop,
  .toast-container {
    display: none !important;
  }
  .workspace,
  .preview-stage,
  .preview-scroll,
  .sheets-viewport {
    display: block !important;
    position: static !important;
    height: auto !important;
    width: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    background: none !important;
    transform: none !important;
  }
  .a4-sheet {
    width: 210mm !important;
    height: 297mm !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    page-break-after: always;
    break-after: page;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .a4-sheet:last-child {
    page-break-after: auto;
    break-after: auto;
  }
}
