@font-face {
  font-family: "ChosunGs";
  src: url("https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_20-04@1.0/ChosunGs.woff") format("woff");
  font-display: swap;
}

@font-face {
  font-family: "Yeseoche";
  src: url("../font/Yeseoche.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Haengseoche";
  src: url("../font/Haengseoche-v2.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Choseoche";
  src: url("../font/Choseoche.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Haeseoche";
  src: url("../font/Haeseoche.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.myeongjeong-shell,
.myeongjeong-shell * {
  box-sizing: border-box;
}

.myeongjeong-shell [hidden] {
  display: none !important;
}

.myeongjeong-shell {
  --mj-primary: var(--primary, #1f5bb6);
  --mj-primary-strong: var(--primary-strong, #174a95);
  max-width: 1100px;
  margin: 30px auto 40px;
}

.myeongjeong-layout {
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 20px;
}

.mj-panel,
.preview-wrap {
  border: 0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
}

.mj-form {
  padding: 18px;
}

.mj-grid,
.field-pair-inner {
  gap: 14px 16px;
}

.field {
  position: relative;
  gap: 6px;
}

.label {
  color: #283a59;
}

.input,
.textarea,
.select {
  min-height: 42px;
  border: 1px solid #dfe5ef;
  border-radius: 10px;
  padding: 10px 12px;
}

.textarea {
  min-height: 96px;
  line-height: 1.6;
}

.mj-color-field {
  margin: 0;
  padding: 0;
  border: 0;
}

.mj-color-options {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 42px;
}

.mj-color-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #374151;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.mj-color-option input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--mj-primary);
}

.mj-color-swatch {
  width: 16px;
  height: 16px;
  border: 1px solid #98a2b3;
  border-radius: 3px;
}

.mj-color-swatch-white {
  background: #fff;
}

.mj-color-swatch-black {
  background: #111;
}

.mj-color-swatch-yellow {
  background: #f4d27a;
}

.field-error {
  min-height: 18px;
  margin: 0;
  color: #b42318;
  font-size: 0.78rem;
}

.field.has-error .input,
.field.has-error .textarea,
.field.has-error .select {
  border-color: #d92d20;
}

.field-note,
.final-note,
.save-status {
  margin: 0;
  color: #667085;
  font-size: 0.82rem;
  line-height: 1.5;
}

.sponsor-note {
  margin: 0;
  color: #98a2b3;
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: right;
}

.final-field {
  grid-column: 1 / -1;
  margin-top: 2px;
}

.final-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-wrap {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 10px;
  background: var(--mj-primary);
  border: 0;
  color: #fff;
}

.preview-head-title {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
}

.mj-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 520px;
  padding: 20px;
  background: #fff;
  overflow: hidden;
}

.mj-card {
  width: auto;
  height: min(500px, 60vh);
  min-height: 0;
  max-width: 100%;
  aspect-ratio: 2 / 9;
  border: 0.75px solid #721112;
  border-radius: 0;
  background: #981b1e;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  padding: 24px 10px;
  overflow: hidden;
}

.mj-card::before {
  content: none;
}

.mj-result-text {
  position: static;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 0;
  color: var(--mj-text-color, #f4d27a);
  font-family: var(--mj-font-family, "ChosunGs", "Batang", "바탕", serif);
  font-size: var(--mj-preview-font-size, 28px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.mj-result-char {
  display: block;
  height: var(--mj-preview-char-step, 34px);
  line-height: var(--mj-preview-char-step, 34px);
}

.preview-actions {
  justify-content: center;
  margin: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.save-status {
  min-height: 20px;
  padding: 0 12px 10px;
  background: #f9fafb;
  text-align: center;
}

.save-status.is-error {
  color: #b42318;
}

.mj-mobile-nav {
  display: none;
}

.mj-preview-back {
  display: none;
}

.mj-print-root {
  display: none;
}

@media (max-width: 1000px) {
  .myeongjeong-layout {
    display: block;
  }

  .mj-panel {
    display: none;
  }

  .mj-panel.is-active {
    display: flex;
  }

  .mj-form.is-active {
    display: block;
  }

  .mj-mobile-nav {
    display: flex;
    justify-content: center;
    margin: 14px -18px -18px;
    padding: 14px 18px;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 14px 14px;
    background: #f9fafb;
  }

  .mj-mobile-nav .btn {
    width: 86px;
    min-width: 86px;
    height: 43px;
    padding: 0 12px;
  }

  .mj-preview-back {
    display: inline-flex;
  }

  .mj-actions.preview-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .mj-actions.preview-actions .btn {
    width: 100%;
    min-width: 0;
    height: 43px;
    padding: 0 6px;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .mj-actions.preview-actions #actionBtn {
    padding-inline: 6px;
  }
}

@media (max-width: 560px) {
  .mj-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-pair-inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .field-pair,
  .final-field,
  .catholic-field,
  .mj-font-field,
  .mj-color-field {
    grid-column: 1 / -1;
  }

  #roleField,
  #familyField {
    min-width: 0;
  }

  #roleField .input,
  #familyField .input {
    min-width: 0;
  }

  .mj-card {
    height: min(500px, 62vh);
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  html,
  body {
    width: 210mm;
    height: 297mm;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  body > * {
    display: none !important;
  }

  body > .mj-print-root {
    position: fixed;
    inset: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 210mm;
    height: 297mm;
    margin: 0;
    padding: 0;
    background: #fff;
  }

  .mj-print-card {
    position: fixed;
    top: 13.5mm;
    left: 75mm;
    width: 60mm;
    height: 270mm;
    border: 0.2px solid #721112;
    background: #981b1e !important;
    box-shadow: none;
    overflow: hidden;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .mj-print-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--mj-text-color, #f4d27a) !important;
    font-family: var(--mj-font-family, "ChosunGs", "Batang", "바탕", serif);
    font-size: var(--mj-print-font-size, 38pt);
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .mj-print-text .mj-result-char {
    height: var(--mj-print-char-step, 48pt);
    line-height: var(--mj-print-char-step, 48pt);
  }
}