/*
 * workbook.css — 어사문 학교자율시간 실물 워크북 공통 스타일
 * 어사문 총 제작기(total-paper.html)의 A4 페이지 프레임·카드·빈칸·인쇄 CSS 문법을 이식.
 */

:root {
    --wb-theme: #1B6B35;       /* 총 제작기 accent-green 계열 */
    --wb-theme-light: #E8F5E7;
    --wb-lemon: #F5C800;
    --wb-ink: #1f2937;
    --wb-gray: #6b7280;
    --wb-line: #e5e7eb;
    --wb-line-strong: #D1D5DB;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: #d6d4cf;
    font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--wb-ink);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* ====== 화면 전용 상단 툴바 ====== */
.wb-toolbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: linear-gradient(135deg, #142814, #1f3d1f);
    color: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.wb-toolbar a.wb-back {
    color: #FFE135;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.wb-toolbar button {
    background: #F5C800;
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.wb-toolbar .wb-title {
    font-size: 14px;
    font-weight: 800;
    color: #FFE135;
}

/* ====== A4 고정 페이지 프레임 (표지/도입부/맛보기/정리노트) ====== */
.wb-page {
    width: 210mm;
    height: 297mm;
    margin: 10mm auto;
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    padding: 18mm 16mm;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    page-break-after: always;
    break-after: page;
    position: relative;
    overflow: hidden;
}

.wb-page-footer {
    margin-top: auto;
    width: 100%;
    text-align: center;
    font-size: 9px;
    color: var(--wb-gray);
    font-weight: 600;
    border-top: 1px solid var(--wb-line);
    padding-top: 6px;
    flex-shrink: 0;
}

/* ====== 표지 ====== */
.wb-cover {
    background: linear-gradient(160deg, #142814, #1B6B35 130%);
    color: white;
    align-items: center;
    justify-content: space-between;
    padding: 25mm 18mm;
    text-align: center;
}

.wb-cover-illust {
    width: 78mm;
    height: 78mm;
    margin: 5mm auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wb-cover-card {
    border: 3px double rgba(255,255,255,0.8);
    border-radius: 12px;
    padding: 12mm 14mm;
    background: rgba(255,255,255,0.06);
}

.wb-cover-title {
    font-size: 30px;
    font-weight: 900;
    letter-spacing: 1px;
    margin: 0 0 6mm;
}

.wb-cover-sub {
    font-size: 15px;
    font-weight: 600;
    color: #FFE135;
}

.wb-cover-grade-tag {
    display: inline-block;
    margin-top: 10mm;
    margin-bottom: 6mm;
    background: #F5C800;
    color: #142814;
    font-weight: 800;
    font-size: 15px;
    padding: 6px 22px;
    border-radius: 9999px;
}

.wb-cover-blank {
    margin-top: 12mm;
    font-size: 12px;
    color: rgba(255,255,255,0.65);
}

/* ====== 도입부 ====== */
.wb-intro h1 {
    font-size: 20px;
    font-weight: 800;
    border-bottom: 3px solid var(--wb-theme);
    padding-bottom: 4mm;
    margin: 0 0 6mm;
}

.wb-intro h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--wb-theme);
    margin: 6mm 0 3mm;
}

.wb-intro p {
    font-size: 12.5px;
    line-height: 1.8;
    margin: 0 0 3mm;
}

.wb-intro-illust {
    border: 2px dashed var(--wb-line-strong);
    border-radius: 10px;
    padding: 6mm;
    font-size: 11px;
    color: var(--wb-gray);
    text-align: center;
    margin: 4mm 0;
}

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

.wb-goal-list li {
    font-size: 12.5px;
    padding: 2mm 0 2mm 6mm;
    position: relative;
    border-bottom: 1px dashed var(--wb-line);
}

.wb-goal-list li::before {
    content: "✔";
    position: absolute;
    left: 0;
    color: var(--wb-theme);
    font-weight: 900;
}

.wb-code-badge {
    display: inline-block;
    background: var(--wb-theme-light);
    color: var(--wb-theme);
    font-size: 10.5px;
    font-weight: 700;
    padding: 1.5px 8px;
    border-radius: 6px;
    margin: 0 2px;
}

/* ====== 어휘목록 (자연 흐름, 인쇄 시 페이지 자동 분할) ====== */
.wb-flow-section {
    max-width: 178mm;
    margin: 0 auto;
    padding: 12mm 0 20mm;
    background: white;
}

.wb-flow-header {
    text-align: center;
    padding: 10mm 0 6mm;
}

.wb-flow-header h1 {
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 3mm;
}

.wb-flow-header p {
    font-size: 11.5px;
    color: var(--wb-gray);
    line-height: 1.6;
}

.wb-subject-title {
    font-size: 14px;
    font-weight: 800;
    color: white;
    background: var(--wb-theme);
    padding: 2mm 4mm;
    border-radius: 6px;
    margin: 6mm 0 3mm;
    break-inside: avoid;
    page-break-inside: avoid;
}

.wb-vocab-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
    margin-bottom: 4mm;
}

.wb-vocab-table th {
    background: var(--wb-theme-light);
    color: var(--wb-theme);
    font-weight: 700;
    padding: 1.5mm 2mm;
    border: 1px solid var(--wb-line-strong);
    text-align: center;
}

.wb-vocab-table td {
    padding: 1.5mm 2mm;
    border: 1px solid var(--wb-line);
}

.wb-vocab-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
}

.wb-check-cell {
    width: 14mm;
    text-align: center;
    font-size: 13px;
    color: #bbb;
}

.wb-hanja-cell {
    width: 14mm;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
}

/* ====== 맛보기 (표제한자 학습지, 빈 템플릿) ====== */
.wb-taste-hanja-box {
    border: 3px dashed var(--wb-line-strong);
    border-radius: 12px;
    height: 42mm;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b0b0b0;
    font-size: 12px;
    margin-bottom: 6mm;
    flex-shrink: 0;
}

.wb-taste-field {
    display: flex;
    align-items: center;
    gap: 3mm;
    margin-bottom: 3mm;
    font-size: 11.5px;
    color: var(--wb-gray);
}

.wb-taste-field .fill-line {
    flex: 1;
    border-bottom: 1.5px dotted var(--wb-line-strong);
    height: 6mm;
}

.wb-taste-story-box {
    border: 2px dashed var(--wb-line-strong);
    border-radius: 8px;
    flex-grow: 1;
    padding: 4mm;
    color: #b0b0b0;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.wb-taste-card {
    border: 2px double var(--wb-line-strong);
    border-radius: 10px;
    padding: 4mm 5mm;
    margin-bottom: 3mm;
    position: relative;
}

.wb-taste-card::before, .wb-taste-card::after {
    content: "⊘";
    position: absolute;
    font-size: 10px;
    color: #ccc;
    top: 2mm;
}

.wb-taste-card::before { left: 3mm; }
.wb-taste-card::after { right: 3mm; }

.wb-taste-card-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--wb-theme);
    margin-bottom: 1.5mm;
}

.wb-taste-blank-line {
    border-bottom: 1.5px dotted var(--wb-line-strong);
    height: 5mm;
    margin-bottom: 1.5mm;
}

.wb-section-label {
    font-size: 11px;
    font-weight: 800;
    color: white;
    background: var(--wb-theme);
    display: inline-block;
    padding: 1.5mm 4mm;
    border-radius: 999px;
    margin-bottom: 3mm;
}


/* ====== 정리노트 (한 쪽 2슬롯 - 개편 양식) ====== */
.wb-notebook-page {
    padding: 12mm 14mm;
}

.wb-notebook-slot {
    flex: 1;
    border: 1.5px solid var(--wb-line-strong);
    border-radius: 10px;
    padding: 4mm 5mm;
    display: flex;
    flex-direction: column;
    margin-bottom: 4.5mm;
    box-sizing: border-box;
    overflow: hidden;
}

.wb-notebook-slot:last-child {
    margin-bottom: 0;
}

/* 상단 영역: 한자 훈음/음/한자 박스 + 교과서/수업 등장 어휘/뜻 1,2,3 */
.wb-nb-top-section {
    display: flex;
    gap: 5mm;
    align-items: flex-start;
}

.wb-nb-top-left {
    display: flex;
    gap: 2mm;
    align-items: flex-start;
    flex-shrink: 0;
}

.wb-nb-huneum-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wb-nb-huneum-box {
    width: 36mm;
    height: 24mm;
    border: 1.5px solid var(--wb-theme);
    border-radius: 8px;
    background: #FAFDFA;
}

.wb-nb-sublabel {
    font-size: 9.5px;
    font-weight: 700;
    color: #555;
    margin-top: 1.2mm;
}

.wb-nb-char-stack {
    display: flex;
    flex-direction: column;
    gap: 1.6mm;
}

.wb-nb-char-box {
    width: 11.2mm;
    height: 11.2mm;
    border: 1.5px solid var(--wb-theme);
    border-radius: 4px;
    background: #FAFDFA;
}

.wb-nb-top-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5mm;
}

.wb-nb-info-row {
    display: flex;
    align-items: center;
    gap: 1.5mm;
    font-size: 11px;
    color: #222;
}

.wb-nb-info-item {
    display: flex;
    align-items: center;
    gap: 1.5mm;
}

.wb-nb-bullet {
    font-weight: 800;
    color: var(--wb-theme);
    font-size: 11px;
}

.wb-nb-label {
    font-weight: 700;
    color: #333;
    white-space: nowrap;
}

.wb-nb-unit {
    font-weight: 600;
    color: #444;
}

.wb-nb-line {
    border-bottom: 1.3px dotted var(--wb-line-strong);
    height: 4mm;
}

/* 상단과 하단 사이 구분선 */
.wb-nb-divider {
    border-bottom: 1px dashed var(--wb-line);
    margin: 2.3mm 0;
}

/* 하단 6개 학습어휘 영역 (2열 3행 그리드) */
.wb-nb-bottom-section {
    display: flex;
    gap: 4mm;
    flex: 1;
}

.wb-nb-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.wb-nb-col-divider {
    width: 0px;
    border-right: 1px dashed var(--wb-line);
    margin: 0 1mm;
}

.wb-nb-vocab-item {
    display: flex;
    flex-direction: column;
    gap: 1mm;
}

.wb-nb-vocab-head {
    display: flex;
    align-items: center;
    gap: 2mm;
}

.wb-nb-num {
    font-size: 11px;
    font-weight: 800;
    color: var(--wb-theme);
}

.wb-nb-word-box {
    width: 30mm;
    height: 4.8mm;
    border: 1.3px solid var(--wb-theme);
    border-radius: 999px;
    background: #FAFDFA;
}

.wb-nb-vocab-sub {
    display: flex;
    align-items: center;
    gap: 1.5mm;
    font-size: 10.5px;
    padding-left: 2mm;
}

.wb-nb-sub-label {
    font-weight: 700;
    color: #444;
    white-space: nowrap;
}

ze: 10.5px;
    color: var(--wb-gray);
    border-bottom: 1px dashed var(--wb-line);
    padding-bottom: 2mm;
    margin-bottom: 3mm;
}

.wb-notebook-head .fill-line { width: 20mm; border-bottom: 1px dotted var(--wb-line-strong); display: inline-block; height: 4mm; }

.wb-notebook-row {
    display: flex;
    gap: 5mm;
    flex: 1;
}

.wb-notebook-col-left {
    width: 32mm;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2mm;
}

.wb-hanja-blank {
    border: 2px dashed var(--wb-line-strong);
    border-radius: 8px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 10px;
    min-height: 20mm;
}

.wb-huneum-blank {
    border-bottom: 1.5px dotted var(--wb-line-strong);
    height: 6mm;
    font-size: 10px;
    color: #ccc;
    text-align: center;
}

.wb-notebook-col-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2mm;
}

.wb-nb-field-label {
    font-size: 9.5px;
    font-weight: 700;
    color: var(--wb-theme);
}

.wb-nb-line {
    border-bottom: 1px dotted var(--wb-line-strong);
    height: 5mm;
}

/* ====== 인쇄 스타일 ====== */
@media print {
    @page { 
        size: A4 portrait; 
        margin: 15mm 15mm; 
    }
    .wb-toolbar { display: none !important; }
    body { background: white; margin: 0; padding: 0; }
    
    .wb-page {
        width: auto !important;
        height: 266mm !important; /* A4(297) - 30mm(margins) = 267mm. 안전여백 고려 266mm */
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        page-break-after: always;
        break-after: page;
        box-sizing: border-box;
    }
    
    .wb-cover {
        padding: 10mm 5mm !important;
    }
    
    .wb-flow-section { 
        width: auto !important;
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
}


/* ====== 학생 정보 입력란 (표지 하단) ====== */
.wb-cover-student-box {
    width: 100%;
    margin-top: auto;
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    padding: 8mm 10mm;
    display: flex;
    flex-direction: column;
    gap: 9mm;
    box-sizing: border-box;
}

.wb-cover-student-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4mm;
    font-size: 14px;
    font-weight: 700;
    color: #FFFFFF;
}

.wb-cover-field {
    display: flex;
    align-items: flex-end;
    gap: 2.5mm;
}

.wb-cover-line {
    display: inline-block;
    border-bottom: 2px solid rgba(255, 255, 255, 0.85);
    height: 9mm;
}

/* ====== 교과서 어휘 목록 페이지 상단 간이 헤더 ====== */
.wb-vocab-running-header {
    font-size: 13px;
    font-weight: 800;
    color: var(--wb-theme);
    border-bottom: 2px solid var(--wb-theme);
    padding-bottom: 2.5mm;
    margin-bottom: 4mm;
}
