/* Qvoca 단어 시험지 생성기 — 화면 + 인쇄 스타일
   브랜드 토큰: app/src/main/java/com/named/autovocaexam/ui/theme/Color.kt (Ultramarine) */

:root {
  --primary: #606EEF;        /* Ultramarine450 */
  --primary-deep: #4857E0;   /* Ultramarine500 */
  --primary-soft: #E5E8FF;   /* Ultramarine050 */
  --primary-faint: #F5F5FD;  /* Ultramarine000 */
  --canvas: #FAFAFB;
  --surface: #FFFFFF;
  --ink: #171821;            /* Gray800 */
  --ink-soft: #5A5B64;       /* Gray650 */
  --border: rgba(23, 24, 33, 0.06);
  --border-strong: rgba(23, 24, 33, 0.12);
  --warn: #B45309;
  --warn-bg: #FEF3C7;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}

.print-only { display: none; }

/* ---------- 헤더 ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 20px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
}

.brand img { border-radius: 6px; }

.lang-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 13px;
}

.lang-nav a { color: var(--ink-soft); text-decoration: none; }
.lang-nav a:hover { color: var(--primary-deep); text-decoration: underline; }
.lang-nav .lang-current { color: var(--primary-deep); font-weight: 700; }

/* ---------- 본문 ---------- */

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

h1 { font-size: 30px; line-height: 1.3; margin: 24px 0 4px; }
.tagline { color: var(--ink-soft); margin: 0 0 28px; font-size: 16px; }

section { margin: 28px 0; }
h2 { font-size: 19px; margin: 0 0 12px; }

.help { color: var(--ink-soft); font-size: 13px; margin: 8px 0; }

#word-input {
  width: 100%;
  padding: 14px;
  font: inherit;
  font-size: 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  resize: vertical;
}

#word-input:focus, #sheet-title:focus, #question-count:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  border-color: transparent;
}

/* ---------- 파싱 결과 ---------- */

.badges { display: flex; gap: 8px; margin-bottom: 8px; }

.badge {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-size: 13px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
}

.badge:empty { display: none; }
.badge-warn { background: var(--warn-bg); color: var(--warn); }

#word-table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

#word-table { width: 100%; border-collapse: collapse; font-size: 14px; }

#word-table th, #word-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

#word-table thead th { background: var(--primary-faint); font-size: 13px; }
#word-table tbody tr:last-child td { border-bottom: none; }
.col-num { width: 40px; color: var(--ink-soft); }
.col-del { width: 40px; }

#word-table input {
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  padding: 2px 0;
}

#word-table input:focus { outline: 1px solid var(--primary); border-radius: 4px; }
#word-table .row-warn input { color: var(--warn); }

.del-btn {
  border: none;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
}

.del-btn:hover { color: var(--warn); }

.warn-panel {
  margin-top: 12px;
  background: var(--warn-bg);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--warn);
  font-size: 14px;
}

.warn-panel .help { color: var(--warn); }
.warn-panel ul { margin: 6px 0 0; padding-left: 20px; }
.warn-panel li { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ---------- 옵션 ---------- */

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.option-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0;
  display: block;
}

.option-label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 8px; }

fieldset.option-block legend { padding: 0; }
fieldset.option-block label { display: block; font-size: 14px; margin: 4px 0; cursor: pointer; }

#sheet-title, #question-count {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
}

.option-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}

.option-check input { width: 18px; height: 18px; accent-color: var(--primary); }

input[type="radio"] { accent-color: var(--primary); }

/* ---------- 버튼 ---------- */

.btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary-deep), var(--primary));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 14px 32px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn-primary:hover { filter: brightness(1.06); }

.btn-secondary {
  display: inline-block;
  background: var(--primary-faint);
  color: var(--primary-deep);
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 8px 20px;
  cursor: pointer;
  margin-top: 4px;
}

.btn-secondary:hover { background: var(--primary-soft); }

.actions { margin: 32px 0; text-align: center; }
.actions .btn-primary { width: 100%; max-width: 420px; padding: 16px 32px; }

/* ---------- 사용법 / CTA ---------- */

#howto ol { padding-left: 22px; margin: 0; }
#howto li { margin: 6px 0; }

.cta-card {
  background: var(--primary-faint);
  border: 1px solid var(--primary-soft);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
}

.cta-icon { border-radius: 12px; }
.cta-card h2 { margin: 12px 0 8px; }
.cta-card p { max-width: 520px; margin: 0 auto 12px; color: var(--ink-soft); font-size: 15px; }

.cta-features {
  list-style: none;
  padding: 0;
  margin: 0 auto 20px;
  max-width: 420px;
  text-align: left;
  font-size: 14px;
}

.cta-features li { margin: 6px 0; }

/* ---------- 푸터 ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

.site-footer a { color: var(--ink-soft); }
.site-footer p { margin: 8px 0 0; }

/* ---------- 모바일 ---------- */

@media (max-width: 480px) {
  h1 { font-size: 24px; }
  .site-header { justify-content: center; }
}

/* ---------- 인쇄 (A4 시험지) ---------- */

@page { size: A4 portrait; margin: 14mm 12mm; }

@media print {
  .screen-only { display: none !important; }
  .print-only { display: block !important; }
  html, body { background: #fff; color: #000; }
}

.sheet { font-size: 12pt; color: #000; }

.sheet + .sheet {
  break-before: page;
  page-break-before: always;
}

.sheet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid #000;
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.sheet-title { font-size: 16pt; font-weight: 700; margin: 0; }

.sheet-fields { display: flex; gap: 18px; font-size: 10.5pt; white-space: nowrap; }

.sheet-fields .field-line {
  display: inline-block;
  min-width: 26mm;
  border-bottom: 1px solid #000;
}

ol.quiz, ol.answers { margin: 0; padding-left: 0; list-style: none; counter-reset: q; }

.quiz-row, .answers li {
  break-inside: avoid;
  page-break-inside: avoid;
}

.quiz-row {
  display: flex;
  align-items: baseline;
  gap: 6mm;
  padding: 3.2mm 0;
}

.quiz-row::before {
  counter-increment: q;
  content: counter(q) ".";
  min-width: 8mm;
  font-weight: 700;
}

.quiz-row .prompt {
  flex: 0 1 auto;
  max-width: 55%;
  overflow-wrap: break-word;
}

.quiz-row .blank {
  flex: 1 1 auto;
  display: inline-block;
  min-width: 50mm;
  border-bottom: 1px solid #000;
  height: 1.2em;
}

ol.answers { column-count: 2; column-gap: 10mm; }

.answers li {
  padding: 1.6mm 0;
  overflow-wrap: break-word;
}

.answers li::before {
  counter-increment: q;
  content: counter(q) ". ";
  font-weight: 700;
}

.sheet-foot {
  margin-top: 10mm;
  padding-top: 3mm;
  border-top: 1px solid #999;
  font-size: 9pt;
  color: #555;
  text-align: center;
}
