/*
  마니또 — 교사 화면
  방향: Structural Clarity (common/design/09_LIBRARY). 교사가 매일 쓰는 업무 도구라 장식보다 위계와 신뢰가 먼저 읽혀야 한다.
  색 의미: 파랑 = 진행·정보(만들기, 추가, 현재 단계) / 오렌지 = 비밀·되돌리기 어려운 일(코드 발급, 배정 확정, 단계 넘기기, 오류)
  물성: 글·표는 flat, 누를 수 있는 것만 soft(돌출 = 누를 수 있음, 눌림 = 누르는 중).
  폰트·이미지는 모두 로컬(외부 요청 없음). Pretendard가 설치된 PC면 그것을, 없으면 OS 기본 한글 글꼴을 쓴다.

  토큰 규칙 (임의 값을 쓰지 않는다)
  - 글자 크기: 12 14 16 18 20 24 28 32 36 40 48(최대)
  - 행간: 20 이하는 140%, 24 이상은 120%
  - 마진·패딩: 16 20 24. 섹션 사이는 24의 두 배(48)로 섹션 안 간격보다 확실히 크게.
    라벨↔입력칸, 글자↔아이콘처럼 한 덩어리 안의 붙은 간격만 4·8을 쓴다.
  - 버튼·입력칸·셀렉트 높이: 52 48 40 36 24 (같은 줄의 컨트롤은 같은 높이)
*/

:root {
  --canvas: #ffffff;
  --zone: #f7f8fa;          /* 한 화면에서 지금 할 일을 묶는 면 */
  --text: #191f28;
  --muted: #4e5968;
  --line: #e5e8eb;
  --line-strong: #d1d6db;
  --blue: #3182f6;          /* 면·굵은 18px 이상 */
  --blue-deep: #1b64da;     /* 흰 글자를 올리는 면, 작은 글자 */
  --orange: #f76707;
  --orange-deep: #c2410c;

  --font: "Pretendard Variable", "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  /* 코드(영문·숫자) 전용. 한글이 섞여도 굴림체로 떨어지지 않게 한글 sans를 monospace 앞에 둔다. */
  --mono: "Consolas", "Menlo", "DejaVu Sans Mono", "Pretendard Variable", "Pretendard", "Malgun Gothic", monospace;

  --fs-12: 12px; --fs-14: 14px; --fs-16: 16px; --fs-18: 18px; --fs-20: 20px;
  --fs-24: 24px; --fs-28: 28px; --fs-32: 32px; --fs-36: 36px; --fs-40: 40px; --fs-48: 48px;
  --lh-text: 1.4;           /* 12–20 */
  --lh-head: 1.2;           /* 24–48 */

  --m-16: 16px; --m-20: 20px; --m-24: 24px;
  --section: calc(var(--m-24) * 2);
  --tight: 8px;             /* 한 덩어리 안에서만 */
  --hair: 4px;

  --h-52: 52px; --h-48: 48px; --h-40: 40px; --h-36: 36px; --h-24: 24px;

  --radius: 12px;
  --radius-control: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-16);
  line-height: var(--lh-text);
  word-break: keep-all;
  overflow-wrap: break-word;
}

h1, h2, p { margin: 0; }
h1 { font-size: var(--fs-32); line-height: var(--lh-head); font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: var(--fs-24); line-height: var(--lh-head); font-weight: 700; letter-spacing: -0.01em; }
a { color: var(--blue-deep); text-underline-offset: 3px; }
code, .code-text { font-family: var(--mono); letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.hint { color: var(--muted); font-size: var(--fs-14); line-height: var(--lh-text); font-weight: 400; }
.empty { color: var(--muted); }

/* 한 섹션 안의 요소 사이는 16, 섹션 사이는 48 */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--m-24) var(--m-24) var(--section);
}
.page > * + * { margin-top: var(--m-24); }
.page > section + section,
.page > .notice + section { margin-top: var(--section); }
section > * + * { margin-top: var(--m-16); }

/* ── 상단 막대 ── */
.tp-bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--m-16);
  padding: var(--m-16) var(--m-24);
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
}
.tp-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tight); font-size: var(--fs-14); }
.tp-crumbs a, .tp-crumbs span { color: var(--muted); }
.tp-crumbs [aria-current] { color: var(--text); font-weight: 600; }
.tp-crumbs [aria-hidden] { color: var(--line-strong); }
.tp-brand { color: var(--text) !important; font-size: var(--fs-16); font-weight: 800; text-decoration: none; }

/* ── 버튼: 높이 52(lg) 48(기본) 40(md) 36(sm), 칩 24 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--tight);
  height: var(--h-48); padding: 0 var(--m-20);
  border: 1px solid transparent; border-radius: var(--radius-control);
  font: inherit; font-size: var(--fs-16); line-height: var(--lh-text); font-weight: 700;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 120ms ease-out, box-shadow 120ms ease-out;
}
.btn-lg { height: var(--h-52); padding: 0 var(--m-24); font-size: var(--fs-18); }
.btn-md { height: var(--h-40); padding: 0 var(--m-16); }
.btn-sm { height: var(--h-36); padding: 0 var(--m-16); font-size: var(--fs-14); border-radius: 8px; }

/* 채운 버튼: 흰 글자 대비를 위해 deep 색을 면으로 쓴다. 그림자는 같은 색조 하나만. */
.btn-primary { background: var(--blue-deep); color: #fff; box-shadow: 0 2px 6px rgb(27 100 218 / 0.25); }
.btn-primary:hover { background: #1550b5; }
.btn-secret { background: var(--orange-deep); color: #fff; box-shadow: 0 2px 6px rgb(194 65 12 / 0.25); }
.btn-secret:hover { background: #a3360a; }
.btn-primary:active, .btn-secret:active { box-shadow: inset 0 2px 4px rgb(0 0 0 / 0.2); }

/* soft: 바탕과 같은 면이 살짝 돌출되어 "누를 수 있음"을, 누르면 들어가 "누르는 중"을 보인다 */
.btn-soft {
  background: var(--canvas); color: var(--text); border-color: var(--line);
  box-shadow: 0 1px 2px rgb(25 31 40 / 0.06), 0 2px 6px rgb(25 31 40 / 0.06);
}
.btn-soft:hover { border-color: var(--line-strong); }
.btn-soft:active { background: var(--zone); box-shadow: inset 0 2px 4px rgb(25 31 40 / 0.1); }
.zone .btn-soft, .as-reveal .btn-soft { background: var(--canvas); }

.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--line-strong); }
.btn-danger { background: transparent; color: var(--orange-deep); }
.btn-danger:hover { border-color: var(--orange-deep); }

/* ── 입력칸·셀렉트: 버튼과 같은 높이 체계 ── */
label { display: grid; gap: var(--tight); font-size: var(--fs-14); line-height: var(--lh-text); font-weight: 600; }
input, select, textarea {
  width: 100%;
  font: inherit; font-size: var(--fs-16); line-height: var(--lh-text); font-weight: 400; color: var(--text);
  background: var(--canvas); border: 1px solid var(--line-strong); border-radius: var(--radius-control);
}
input, select { height: var(--h-48); padding: 0 var(--m-16); }
textarea { padding: var(--m-16); min-height: 200px; resize: vertical; }
input[type=file] { padding: 0 var(--m-16); line-height: calc(var(--h-48) - 2px); }
input.input-sm { height: var(--h-36); padding: 0 var(--m-16); font-size: var(--fs-14); border-radius: 8px; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--blue-deep); }

.stack { display: grid; gap: var(--m-20); }
.stack > .btn { justify-self: stretch; }
.row-form { display: flex; flex-wrap: wrap; align-items: end; gap: var(--m-16); }
.row-form .grow { flex: 1 1 280px; }
.row-form > label:not(.grow) { flex: 0 1 200px; }

/* 알림: 테두리 + 글자색 + 굵기로 구분(색만으로 구분하지 않음) */
.notice {
  padding: var(--m-16) var(--m-20); border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--zone);
  font-size: var(--fs-16);
}
.notice-error { border-color: var(--orange-deep); color: var(--orange-deep); background: #fff7f0; font-weight: 700; }
.notice-done { border-color: var(--blue-deep); color: var(--blue-deep); background: #f2f7ff; font-weight: 700; }

/* 상태 칩 24: 테두리 + 앞 점 두 가지로 구분 */
.state, .phase-tag {
  display: inline-flex; align-items: center; gap: var(--hair);
  height: var(--h-24); padding: 0 var(--tight); border-radius: 999px;
  border: 1px solid currentColor; background: var(--canvas);
  font-size: var(--fs-12); line-height: var(--lh-text); font-weight: 700; white-space: nowrap;
}
.state::before, .phase-tag::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.state-done { color: var(--blue-deep); }
.state-todo { color: var(--orange-deep); }
.phase-prep, .phase-profile, .phase-closed { color: var(--muted); }
.phase-active { color: var(--orange-deep); }
.phase-revealed { color: var(--blue-deep); }

/* ── 로그인·설정 ── */
.is-auth .page { min-height: 100vh; display: grid; place-items: center; }
.auth { width: min(440px, 100%); }
.auth > * + * { margin-top: var(--m-20); }
.auth-lead { color: var(--muted); font-size: var(--fs-16); }

/* ── 시즌 목록 ── */
.sl-list { list-style: none; padding: 0; border-top: 1px solid var(--text); }
.sl-item {
  display: grid; grid-template-columns: 1fr auto; gap: var(--hair) var(--m-16); align-items: center;
  padding: var(--m-20) var(--m-16); border-bottom: 1px solid var(--line);
  color: var(--text); text-decoration: none;
}
.sl-item:hover { background: var(--zone); }
.sl-name { font-size: var(--fs-20); font-weight: 700; }
.sl-meta { grid-column: 1; color: var(--muted); font-size: var(--fs-14); }
.sl-item .phase-tag { grid-column: 2; grid-row: 1 / span 2; }
.sl-new { padding: var(--m-24); background: var(--zone); border-radius: var(--radius); }

/* ── 시즌 대시보드 ── */
.sd-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: var(--m-24); }
.sd-head > * + * { margin-top: 0; }
.sd-head h1 { font-size: var(--fs-36); }
.sd-meta { color: var(--muted); font-size: var(--fs-16); margin-top: var(--tight); }
.sd-classcode { display: grid; justify-items: end; gap: var(--hair); }
.sd-classcode-label { font-size: var(--fs-14); color: var(--muted); font-weight: 600; }
.sd-classcode .code-text { font-size: var(--fs-40); line-height: var(--lh-head); font-weight: 700; color: var(--orange-deep); }

/* 단계 길: 지나온 점은 글자색으로 채우고, 현재 점은 파란 고리 + 굵은 라벨 */
.pt {
  list-style: none; padding: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.pt-step { position: relative; display: grid; justify-items: center; gap: var(--tight); text-align: center; }
.pt-step::before {
  content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--line);
}
.pt-step:first-child::before { display: none; }
.pt-step.is-done::before, .pt-step.is-current::before { background: var(--text); }
.pt-dot {
  position: relative; z-index: 1; /* 다음 단계의 연결선이 점 위로 지나가지 않게 */ width: 24px; height: 24px; border-radius: 50%;
  background: var(--canvas); border: 2px solid var(--line-strong);
}
.pt-step.is-done .pt-dot { background: var(--text); border-color: var(--text); }
.pt-step.is-current .pt-dot { border: 7px solid var(--blue); }
.pt-label { font-size: var(--fs-14); color: var(--muted); }
.pt-step.is-current .pt-label { color: var(--text); font-size: var(--fs-16); font-weight: 800; }

.sd-next { padding: var(--m-24); background: var(--zone); border-radius: var(--radius); }
.sd-next h2 { font-size: var(--fs-20); line-height: var(--lh-text); }
.sd-next p { max-width: 60ch; font-size: var(--fs-18); }
.sd-blocker { color: var(--orange-deep); font-weight: 700; }

/* 숫자 두 개는 카드가 아니라 선으로만 구획한다 */
.sd-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--text); }
.sd-grid > * + * { margin-top: 0; }
.sd-tile {
  display: grid; gap: var(--hair); align-content: start; padding: var(--m-20) var(--m-24) var(--m-24) 0;
  color: var(--text); text-decoration: none;
}
.sd-tile + .sd-tile { border-left: 1px solid var(--line); padding-left: var(--m-24); }
.sd-tile:hover .sd-tile-title { color: var(--blue-deep); text-decoration: underline; }
.sd-tile-title { font-size: var(--fs-16); font-weight: 700; color: var(--muted); }
.sd-tile-figure { font-size: var(--fs-48); line-height: var(--lh-head); font-weight: 800; font-variant-numeric: tabular-nums; }
.sd-tile-figure small { font-size: var(--fs-20); line-height: var(--lh-text); margin-left: var(--hair); white-space: nowrap; }
.sd-tile-word { font-size: var(--fs-28); min-height: calc(var(--fs-48) * 1.2); display: flex; align-items: center; }
.sd-tile-sub { color: var(--muted); font-size: var(--fs-14); }

.sd-access h2, .sl-new h2, .rs-add h2, .as-avoid h2 { font-size: var(--fs-20); line-height: var(--lh-text); }
.sd-access ul { list-style: none; padding: 0; font-size: var(--fs-24); line-height: var(--lh-head); }

/* ── 명단 ── */
.rs-add { padding: var(--m-24); background: var(--zone); border-radius: var(--radius); }
.rs-add-actions { display: flex; flex-wrap: wrap; gap: var(--m-16); justify-content: space-between; }
.rs-file { cursor: pointer; }
.rs-list-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--m-16); }
.rs-table { width: 100%; border-collapse: collapse; }
.rs-table th {
  text-align: left; font-size: var(--fs-14); font-weight: 600; color: var(--muted);
  padding: var(--tight) var(--m-16) var(--tight) 0; border-bottom: 1px solid var(--text);
}
.rs-table td { padding: var(--tight) var(--m-16) var(--tight) 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rs-table td:last-child, .rs-table th:last-child { padding-right: 0; }
.rs-num { font-size: var(--fs-18); font-weight: 800; width: 4em; font-variant-numeric: tabular-nums; }
.rs-rename { display: flex; gap: var(--tight); align-items: center; }
.rs-rename input { max-width: 220px; }
.rs-actions { display: flex; gap: var(--tight); justify-content: flex-end; flex-wrap: wrap; }

/* ── 더 할 일(책자·설정) ── */
.sl-head { display: flex; justify-content: space-between; align-items: center; gap: var(--m-16); }
.sl-head > * + * { margin-top: 0; }
.sl-head-actions { display: flex; flex-wrap: wrap; gap: var(--tight); }
.sl-check { display: flex !important; align-items: center; gap: var(--tight); height: var(--h-48); font-weight: 600; }
.sl-check input { width: 20px; height: 20px; }
.qs-row { display: flex; flex-wrap: wrap; gap: var(--m-16); }
.qs-row .grow { flex: 1 1 240px; }
.sd-info summary, .rc-profiles summary { cursor: pointer; font-weight: 700; }
.sd-info form { margin-top: var(--m-16); }
.rc-profiles summary h2 { display: inline; }
.rc-answer { display: inline-block; margin-right: var(--m-16); font-size: var(--fs-14); }
.sd-more { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--m-16); }
.sd-more > * + * { margin-top: 0; }
.sd-more > * { min-width: 0; }
.sd-stage-orders { display: flex; flex-wrap: wrap; gap: var(--tight); margin-top: var(--tight); }
.sd-more code { overflow-wrap: anywhere; }
.sd-setting { flex-wrap: wrap; }
.sd-more-link, .sd-setting {
  display: flex; justify-content: space-between; align-items: center; gap: var(--m-16);
  padding: var(--m-20) var(--m-24); border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--text); text-decoration: none;
}
.sd-more-link { flex-direction: column; align-items: flex-start; justify-content: center; gap: var(--hair); }
.sd-more-link:hover { border-color: var(--blue-deep); }
.sd-more-link:hover .sd-more-title { color: var(--blue-deep); }
.sd-setting > span { display: grid; gap: var(--hair); justify-items: start; }
.sd-theme-pick { display: flex !important; gap: var(--tight); align-items: center; }
.sd-theme-pick select { height: var(--h-36); width: auto; padding: 0 var(--m-16); font-size: var(--fs-14); border-radius: 8px; }
.sd-more-link.is-waiting .sd-more-title { color: var(--muted); }
.rc-zero { color: var(--orange-deep); font-weight: 800; }
.bu-list li.is-hidden { color: var(--muted); }
.sd-more-title { font-size: var(--fs-18); font-weight: 700; }
.zone { padding: var(--m-24); background: var(--zone); border-radius: var(--radius); }
.bk-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--m-16); }
.bk-options > * + * { margin-top: 0; }
.bk-option {
  display: grid; gap: var(--hair); padding: var(--m-24); border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--text); text-decoration: none;
}
.bk-option:hover { border-color: var(--blue-deep); }
.bk-option-title { font-size: var(--fs-20); font-weight: 800; color: var(--blue-deep); }
.bu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--m-24); }
.bu-grid > * + * { margin-top: 0; }
.bu-box > * + * { margin-top: var(--m-16); }
.bu-box h2, .bk-set h2 { font-size: var(--fs-20); line-height: var(--lh-text); }
.bu-list { list-style: none; padding: 0; border-top: 1px solid var(--text); }
.bu-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: var(--m-16); padding: var(--m-16) 0; border-bottom: 1px solid var(--line); }
.inline-form { display: inline-block; margin-left: var(--tight); }
.rc-photos { display: flex; gap: var(--tight); margin-top: var(--tight); }
.rc-photos img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line-strong); }

/* ── 기록 ── */
.rc-watch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--m-24); }
.rc-watch > * + * { margin-top: 0; }
.rc-watch-item { padding: var(--m-20) var(--m-24); background: var(--zone); border-radius: var(--radius); }
.rc-watch-item > * + * { margin-top: var(--tight); }
.rc-watch-item h2 { font-size: var(--fs-18); line-height: var(--lh-text); }
.rc-count { color: var(--orange-deep); }
.rc-table { width: 100%; border-collapse: collapse; }
.rc-table th { text-align: left; font-size: var(--fs-14); font-weight: 600; color: var(--muted); padding: var(--tight) var(--m-16) var(--tight) 0; border-bottom: 1px solid var(--text); }
.rc-table td { padding: var(--m-16) var(--m-16) var(--m-16) 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.rc-table td:last-child { padding-right: 0; }
.rc-date { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--fs-14); }
.rc-who { white-space: nowrap; font-weight: 600; }
.rc-text { max-width: 44ch; }
.rc-table tr.is-hidden td { color: var(--muted); }

/* ── 배정 ── */
.as-avoid-list { list-style: none; padding: 0; display: grid; gap: var(--tight); }
.as-avoid-list li { display: flex; flex-wrap: wrap; gap: var(--m-16); align-items: center; min-height: var(--h-36); }
.as-draw > h2 { font-size: var(--fs-24); }
.as-actions { display: flex; flex-wrap: wrap; gap: var(--m-16); }

/* 배정 보기는 오렌지(비밀) 점선 안에 접어 둔다 */
.as-reveal { border: 1px dashed var(--orange-deep); border-radius: var(--radius); }
.as-reveal summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--tight) var(--m-16);
  min-height: var(--h-52); padding: 0 var(--m-24); cursor: pointer; list-style: none;
  font-size: var(--fs-16); font-weight: 700; color: var(--orange-deep);
}
.as-reveal summary::-webkit-details-marker { display: none; }
/* 접힘·펼침을 글자로도 알린다 */
.as-reveal summary::after { content: "펼치기"; margin-left: auto; font-size: var(--fs-14); color: var(--muted); font-weight: 600; }
.as-reveal[open] summary::after { content: "접기"; }
.as-reveal[open] summary { border-bottom: 1px solid var(--line); }
.as-reveal-body {
  display: grid; grid-template-columns: minmax(0, 640px) minmax(0, 1fr); gap: var(--m-24);
  padding: var(--m-24); align-items: start;
}
.as-reveal-body > * + * { margin-top: 0; }
.as-pairs { margin: 0; padding-left: 2em; display: grid; font-size: var(--fs-14); line-height: var(--lh-text); }
.as-pairs li { display: flex; gap: var(--tight); }
.as-arrow { color: var(--orange-deep); font-weight: 800; }

/* 배정 고리 (SVG는 데스크톱에서 1:1로 그려져 아래 글자 크기가 실제 크기다) */
.rg { width: 100%; max-width: 640px; height: auto; }
.rg-arc { fill: none; stroke: var(--text); stroke-width: 1.5; }
.rg-headpath { fill: var(--orange-deep); }
.rg-node circle { fill: var(--canvas); stroke: var(--text); stroke-width: 1.5; }
.rg-num { font: 700 var(--fs-12) var(--font); fill: var(--text); }
.rg-name { font: 600 var(--fs-14) var(--font); fill: var(--text); }
.rg-center { font: 800 var(--fs-48) var(--font); fill: var(--orange-deep); }
.rg-center-sub { font: 600 var(--fs-16) var(--font); fill: var(--muted); }

/* ── 코드 카드 (화면) ── */
.cc-toolbar > * + * { margin-top: var(--m-16); }
.cc-toolbar p { font-size: var(--fs-18); }
.cc-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--m-16); }
.cc-sheet > * + * { margin-top: 0; }
.cc-card {
  display: grid; gap: var(--m-16); padding: var(--m-20) var(--m-24);
  background: var(--canvas); border: 1px dashed var(--muted); border-radius: var(--radius-control);
  break-inside: avoid;
}
.cc-who { font-size: var(--fs-18); }
.cc-num { font-weight: 800; }
.cc-name { font-weight: 600; }
/* 두 코드의 라벨과 값이 같은 줄에 오도록 dt는 1행, dd는 2행에 둔다 */
.cc-codes { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: var(--m-24); row-gap: var(--hair); margin: 0; align-items: end; }
.cc-codes > div { display: contents; }
.cc-codes dt { grid-row: 1; font-size: var(--fs-12); color: var(--muted); font-weight: 700; }
.cc-codes dd { grid-row: 2; margin: 0; font-size: var(--fs-20); line-height: var(--lh-text); font-weight: 700; }
.cc-codes .cc-personal { font-size: var(--fs-32); line-height: var(--lh-head); color: var(--orange-deep); letter-spacing: 0.06em; }
.cc-foot { display: grid; gap: var(--hair); font-size: var(--fs-12); color: var(--muted); border-top: 1px solid var(--line); padding-top: var(--tight); }

/* ── 반응형 ── */
@media (max-width: 1100px) {
  .as-reveal-body { grid-template-columns: 1fr; }
  .rg { justify-self: center; }
}

@media (max-width: 720px) {
  .page { padding: var(--m-20) var(--m-16) var(--section); }
  .tp-bar { padding: var(--m-16); }
  h1 { font-size: var(--fs-28); }
  .sd-head h1 { font-size: var(--fs-28); }
  h2, .as-draw > h2 { font-size: var(--fs-20); line-height: var(--lh-text); }
  .sd-classcode { justify-items: start; }
  .sd-classcode .code-text { font-size: var(--fs-32); }
  .sd-next, .rs-add, .sl-new { padding: var(--m-20); }
  .sd-next p { font-size: var(--fs-16); }
  .sd-grid { grid-template-columns: 1fr; }
  .rc-watch { grid-template-columns: 1fr; }
  .sd-more, .bk-options, .bu-grid { grid-template-columns: 1fr; }
  .rc-table thead { display: none; }
  .rc-table tr { display: grid; gap: var(--hair); padding: var(--m-16) 0; border-bottom: 1px solid var(--line); }
  .rc-table td { border: 0; padding: 0; }
  .sd-tile { padding-right: 0; }
  .sd-tile + .sd-tile { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; }
  .sd-access ul { font-size: var(--fs-20); line-height: var(--lh-text); }
  .pt-label, .pt-step.is-current .pt-label { font-size: var(--fs-12); }
  .as-reveal summary, .as-reveal-body { padding-left: var(--m-16); padding-right: var(--m-16); }
  /* 폰 폭에서는 고리 글자가 12px 아래로 줄어들어 읽을 수 없다. 같은 내용인 목록만 보인다. */
  .rg { display: none; }
  .stack > .btn, .row-form > .btn { width: 100%; }
  .row-form > label:not(.grow) { flex: 1 1 140px; }
  .rs-table thead { display: none; }
  .rs-table tr { display: grid; grid-template-columns: 3em 1fr; gap: var(--tight); padding: var(--m-16) 0; border-bottom: 1px solid var(--line); }
  .rs-table td { border: 0; padding: 0; }
  .rs-table td:nth-child(n+3) { grid-column: 2; }
  .rs-actions { justify-content: flex-start; }
  .rs-rename input { max-width: none; }
}

/* ── 인쇄: A4 한 장에 카드 8장(2열×4행), 점선을 따라 자른다 ── */
@page { size: A4; margin: 10mm; }
@media print {
  body { background: #fff; }
  .no-print, .tp-bar { display: none !important; }
  .page { max-width: none; padding: 0; }
  .page > * + * { margin-top: 0; }
  .cc-sheet { grid-template-columns: repeat(2, 1fr); gap: 0; }
  .cc-card {
    height: 66mm; border-radius: 0;
    border: 0; outline: 1px dashed #999; outline-offset: -0.5px;
    padding: var(--m-20) var(--m-24); align-content: space-between;
  }
  .cc-codes .cc-personal { color: #000; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
