:root {
  --bg: #eef1ed;
  --surface: #ffffff;
  --ink: #111;
  --muted: #66706f;
  --line: #111;
  --ui-line: #d7ddd7;
  --accent: #ff481f;
  --accent-dark: #d93411;
  --forest: #176b58;
  --forest-soft: #e8f2ed;
  --shadow: 0 18px 60px rgba(25, 31, 28, 0.16);
  font-family: Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html.devtools-guard-pending body,
html.devtools-guard-blocked body {
  visibility: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

img,
svg {
  display: block;
}

.consent-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px max(14px, env(safe-area-inset-left)) 10px max(14px, env(safe-area-inset-right));
  border-bottom: 1px solid rgba(215, 221, 215, 0.95);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.brand img {
  width: 170px;
  height: auto;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar button,
.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--forest);
  font-weight: 900;
}

.toolbar button svg,
.icon-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.toolbar strong {
  min-width: 52px;
  text-align: center;
  color: var(--forest);
  font-size: 13px;
}

.document-stage {
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
  overflow: auto;
  cursor: grab;
  padding: 28px 20px 96px;
  display: grid;
  justify-content: center;
  align-items: start;
  overscroll-behavior: contain;
  touch-action: none;
  user-select: none;
}

.document-stage.is-panning {
  cursor: grabbing;
}

.page-frame {
  position: relative;
  width: 794px;
  height: 1123px;
}

.a4-page {
  position: absolute;
  left: 0;
  top: 0;
  width: 794px;
  height: 1123px;
  padding: 110px 58px;
  background: #fff;
  box-shadow: var(--shadow);
  transform-origin: top left;
  font-family: "Batang", "Gungsuh", "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.5;
}

.a4-page h1 {
  margin: 0 0 34px;
  text-align: center;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
}

.lead {
  margin: 0 0 32px;
  word-break: keep-all;
}

.consent-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 44px;
  table-layout: fixed;
}

.consent-table th,
.consent-table td {
  border: 1.5px solid var(--line);
  padding: 16px 10px;
  vertical-align: middle;
}

.consent-table th {
  width: 40%;
  text-align: center;
  font-weight: 700;
}

.consent-table td {
  width: 60%;
}

.doc-bullet-line {
  display: grid;
  grid-template-columns: 6px 1fr;
  gap: 8px;
  align-items: start;
}

.doc-bullet {
  width: 4px;
  height: 4px;
  margin-top: 0.72em;
  border-radius: 999px;
  background: var(--line);
}

.question-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 24px;
}

.question-row p {
  margin: 0;
}

.box-mark {
  width: 14px;
  height: 14px;
  border: 1.4px solid var(--line);
}

.agree-table {
  width: 585px;
  height: 44px;
  margin: 0 auto 82px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1.5px solid var(--line);
}

.agree-table label {
  display: grid;
  grid-template-columns: 1fr 54px;
  align-items: center;
  border-right: 1.5px solid var(--line);
  cursor: pointer;
}

.agree-table label:last-child {
  border-right: 0;
}

.agree-table span {
  text-align: center;
}

.agree-table input {
  width: 14px;
  height: 14px;
  justify-self: center;
  accent-color: var(--ink);
}

.date-line {
  display: flex;
  justify-content: center;
  gap: 34px;
  margin: 0 0 60px;
}

.date-line b {
  font-weight: 400;
}

.sign-line {
  display: grid;
  grid-template-columns: auto 1fr 190px;
  gap: 10px;
  align-items: center;
  width: 420px;
  margin-left: auto;
  margin-right: 46px;
}

.sign-line strong {
  min-height: 24px;
  border-bottom: 1px solid transparent;
  font-family: "Batang", "Gungsuh", serif;
  font-weight: 400;
}

.signature-stamp {
  position: relative;
  display: inline-grid;
  min-width: 180px;
  min-height: 58px;
  place-items: center;
}

.signature-stamp span {
  position: relative;
  z-index: 1;
}

#signaturePreview {
  position: absolute;
  z-index: 2;
  width: 172px;
  height: 58px;
  object-fit: contain;
  opacity: 0;
  pointer-events: none;
}

#signaturePreview.has-signature {
  opacity: 1;
}

.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(215, 221, 215, 0.95);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 -16px 38px rgba(25, 31, 28, 0.12);
  backdrop-filter: blur(16px);
}

.save-progress {
  width: min(360px, 100%);
  display: grid;
  gap: 7px;
  align-self: center;
}

.save-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-family: Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", Arial, sans-serif;
  font-size: 12px;
  font-weight: 850;
}

.save-progress-meta span {
  color: var(--forest);
}

.save-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8e2;
}

.save-progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--forest);
  transition: width 0.22s ease;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(255, 72, 31, 0.2);
}

.primary-button:disabled {
  background: #d8ded9;
  color: #7b8580;
  box-shadow: none;
}

.secondary-button {
  background: var(--forest);
  color: #fff;
}

.ghost-button {
  border: 1px solid var(--ui-line);
  background: var(--surface);
  color: var(--ink);
}

.document-log-copy {
  min-height: 38px;
  padding: 0 14px;
  border-color: rgba(23, 107, 88, 0.22);
  color: var(--forest);
  font-size: 13px;
}

.is-hidden {
  display: none !important;
}

.signature-dialog {
  width: min(760px, calc(100% - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.signature-dialog::backdrop {
  background: rgba(14, 20, 18, 0.56);
}

.signature-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--ui-line);
}

.signature-head span {
  color: var(--forest);
  font-size: 13px;
  font-weight: 900;
}

.signature-head h2 {
  margin: 4px 0 0;
  font-size: 22px;
}

.name-field {
  display: grid;
  gap: 8px;
  padding: 16px 18px 0;
}

.name-field span {
  font-size: 14px;
  font-weight: 900;
}

.name-field input {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  outline: none;
}

.signature-pad-wrap {
  position: relative;
  margin: 16px 18px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  background: #fbfcfa;
  overflow: hidden;
}

#signatureCanvas {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 230px;
  touch-action: none;
}

#signatureGuide {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center;
  z-index: 1;
  width: max-content;
  color: rgba(89, 101, 95, 0.5);
  pointer-events: none;
  user-select: none;
  font-family: Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", Arial, sans-serif;
  font-size: 140px;
  font-weight: 600;
  line-height: 0.86;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
}

.signature-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 18px 18px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 88px;
  z-index: 20;
  max-width: min(420px, calc(100% - 36px));
  padding: 14px 16px;
  border-radius: 8px;
  background: #222529;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 760px) {
  .consent-header {
    min-height: 60px;
  }

  .brand img {
    width: 128px;
  }

  .toolbar {
    gap: 4px;
  }

  .toolbar button {
    min-width: 34px;
    height: 34px;
  }

  .toolbar strong {
    min-width: 44px;
    font-size: 12px;
  }

  .document-stage {
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    padding: 18px 12px 96px;
    justify-content: start;
  }

  .a4-page {
    box-shadow: 0 12px 32px rgba(25, 31, 28, 0.14);
  }

  .action-bar {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .action-bar button {
    flex: 1;
  }

  .action-bar .document-log-copy {
    flex: 0 0 100%;
  }

  .save-progress {
    flex: 0 0 100%;
  }

  .signature-dialog {
    width: calc(100% - 18px);
  }

  #signatureCanvas {
    height: 260px;
  }

  .signature-actions {
    flex-direction: column-reverse;
  }

  .signature-actions button {
    width: 100%;
  }
}

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

@media print {
  html,
  body {
    width: 210mm;
    height: 297mm;
    margin: 0;
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .consent-header,
  .action-bar,
  .signature-dialog,
  .toast {
    display: none !important;
  }

  .document-stage {
    display: block !important;
    width: 210mm !important;
    height: 297mm !important;
    overflow: visible !important;
    padding: 0 !important;
    background: #fff !important;
    cursor: default !important;
  }

  .page-frame {
    width: 210mm !important;
    height: 297mm !important;
    margin: 0 !important;
  }

  .a4-page {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 210mm !important;
    height: 297mm !important;
    padding: 29mm 15mm !important;
    box-shadow: none !important;
    transform: none !important;
  }
}
