* {
  box-sizing: border-box;
}

body {
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  background: #f4f6f8;
  color: #1f2937;
  margin: 0;
  padding: 24px;
}

.container {
  max-width: 720px;
  margin: 0 auto 32px;
}

h1 {
  font-size: 22px;
  margin-bottom: 20px;
}

.panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.panel h2 {
  font-size: 16px;
  margin-top: 0;
  margin-bottom: 10px;
}

.hint {
  font-size: 13px;
  color: #6b7280;
  margin: 6px 0;
}

textarea#paste-area {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  resize: vertical;
}

.data-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 4px;
}

.checkbox-label {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}

input[type="text"],
input[type="number"],
select {
  padding: 7px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
}

button {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

button.primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  font-size: 15px;
  padding: 10px 18px;
}

button.secondary {
  background: #f1f5f9;
}

.error-msg {
  color: #dc2626;
  font-size: 13px;
  min-height: 18px;
}

#output {
  max-width: 720px;
  margin: 0 auto;
}

/* ------------------------------------------------------------------
   출력물

   시험지는 app.js가 캔버스에 그려 이미지 한 장으로 만든다.
   화면에 보이는 이 이미지가 그대로 인쇄된다(재배치가 없다).
   ------------------------------------------------------------------ */

.sheet-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.sheet-tab {
  flex: 1;
  padding: 9px 10px;
  font-size: 14px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
}

.sheet-tab.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  font-weight: 600;
}

.print-bar {
  text-align: center;
  margin-bottom: 16px;
}

.print-bar .primary {
  margin: 0 4px;
}

.warn-hint {
  color: #b45309;
}

#page-holder {
  text-align: center;
}

.page-image {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  margin: 0 auto;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #fff;
}

/* 앱 안의 브라우저(당근·카카오톡 등) 안내 */
.inapp-notice {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.7;
}

.inapp-notice p,
.inapp-notice ul {
  margin: 8px 0;
}

.inapp-notice ul {
  padding-left: 20px;
}

.saved-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.saved-empty {
  font-size: 13px;
  color: #9ca3af;
  padding: 8px 0;
}

.saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #eef2f7;
  font-size: 13px;
}

.saved-item:last-child {
  border-bottom: none;
}

.saved-date {
  color: #6b7280;
  font-size: 12px;
}

.saved-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.saved-actions button {
  padding: 5px 10px;
  font-size: 12px;
}

/* ------------------------------------------------------------------
   인쇄

   예전에는 여기에 flex/grid/column-count/transform으로 짜인 복잡한
   레이아웃이 있었고, 브라우저마다 결과가 흔들려 애를 먹었다.
   지금은 인쇄 대상이 이미지 한 장뿐이라 이 정도로 충분하다.
   ------------------------------------------------------------------ */
@media print {
  @page {
    size: 210mm 297mm; /* A4 세로 */
    margin: 8mm;
  }

  html,
  body {
    background: #fff;
    margin: 0;
    padding: 0;
  }

  .no-print {
    display: none !important;
  }

  #output {
    max-width: none;
    margin: 0;
  }

  /* 인쇄영역(194x281mm)에 정확히 채운다. 이미지는 이 비율로 생성돼 있다. */
  .page-image {
    width: 194mm;
    height: 281mm;
    max-width: none;
    border: none;
    border-radius: 0;
    margin: 0;
    display: block;
    page-break-inside: avoid;
    break-inside: avoid;
  }
}
