/**
 * puzzle-shell.css — puzzlelo 퍼즐 생성기 공통 Shell 스타일 v2.0
 * ─────────────────────────────────────────────────────────────────
 * 버전: 2.0  (2025-05)
 *
 * 레이아웃 규칙 (스크롤 없는 100vh 고정 구조):
 *  ┌─────────────────────────────────────────────┐  ← css/style.css #app-header (56px)
 *  ├─────────────────────────────────────────────┤  ← #topbar (46px) : 현재 문제 조작 버튼만
 *  ├──────────┬──────────────────────────────────┤
 *  │  #side   │  #main                           │  ← flex:1, overflow:hidden
 *  │  220px   │  퍼즐 캔버스 영역                  │
 *  │  (설정)  │  (첫 화면 = 빈 상태 or 퍼즐)      │
 *  └──────────┴──────────────────────────────────┘
 *
 * 탑바 항목: 새문제생성, 같은Seed, 정답확인, 힌트, 초기화, 에디터연결
 * 사이드바 항목: 크기/유형, 난이도, SEED, 페이지수, [인쇄설정], [문제생성]
 * ※ 인쇄설정은 사이드바에만 위치 (탑바 없음)
 * ※ 사이드바 스크롤: overflow-y:auto (콘텐츠 많을 때만 스크롤)
 */

/* ════════════════════════════════════════
   CSS 변수 (공통 디자인 토큰)
   ※ 브랜드 색상 --ps-* 는 css/theme.css 의 섹션 6에서
     css/style.css 값(--primary 등)으로 자동 브리지됩니다.
     여기의 하드코딩 값은 theme.css 미로드 시 폴백용.
════════════════════════════════════════ */
:root {
  /* 브랜드 컬러 (폴백; theme.css 섹션 6에서 style.css 변수로 override) */
  --ps-blue:      #4f46e5;
  --ps-blue-l:    #eef2ff;
  --ps-blue-m:    #c7d2fe;
  --ps-purple:    #7c3aed;
  --ps-green:     #10b981;
  --ps-green-l:   #d1fae5;
  --ps-red:       #ef4444;
  --ps-red-l:     #fef2f2;
  --ps-amber:     #f59e0b;
  --ps-amber-l:   #fffbeb;

  /* 중립 */
  --ps-gray:      #6b7280;
  --ps-gray-l:    #f3f4f6;
  --ps-gray-b:    #e5e7eb;
  --ps-muted:     #94a3b8;
  --ps-text:      #1e293b;
  --ps-text-sub:  #475569;

  /* 레이아웃 */
  --ps-header-h:  56px;   /* css/style.css 공통 헤더 높이 */
  --ps-topbar-h:  54px;   /* 게임 컨트롤 바 */
  --ps-side-w:    260px;  /* 사이드바 너비 */

  /* 공간 */
  --ps-radius:    8px;
  --ps-radius-lg: 12px;
}

/* ════════════════════════════════════════
   body — 100vh 고정 (스크롤 없음)
════════════════════════════════════════ */
body {
  font-family: 'Noto Sans KR', system-ui, sans-serif;
  background: #f0f4ff;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;           /* ← 전체 스크롤 방지 */
  padding-top: var(--ps-header-h);
  box-sizing: border-box;
}

/* ════════════════════════════════════════
   #topbar — 게임 조작 버튼만 (46px)
   현재 문제에 대한 실시간 조작:
   새문제 / 같은Seed / 정답확인 / 힌트 / 초기화 / 에디터
════════════════════════════════════════ */
#topbar {
  background: #fff;
  border-bottom: 2px solid var(--ps-gray-b);
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  height: var(--ps-topbar-h);
  overflow-x: auto;           /* 좁은 화면에서 가로 스크롤 */
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  box-sizing: border-box;
}
#topbar::-webkit-scrollbar { display: none; }

/* 퍼즐 이름 */
#topbar strong {
  color: var(--ps-blue);
  font-size: 17px;
  font-weight: 900;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 구분선 */
.sep {
  width: 1px;
  height: 24px;
  background: var(--ps-gray-b);
  flex-shrink: 0;
}

/* 라벨 */
.tlbl {
  font-size: 12px;
  font-weight: 800;
  color: var(--ps-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── 툴바 버튼 ── */
.tbtn {
  padding: 0 14px;
  height: 40px;
  border-radius: 6px;
  border: 2px solid var(--ps-gray-b);
  background: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  color: #555;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: .15s;
  font-family: inherit;
}
.tbtn:hover  { background: var(--ps-blue-l); border-color: var(--ps-blue); color: var(--ps-blue); }
.tbtn.on     { background: var(--ps-blue); color: #fff; border-color: var(--ps-blue); }
.tbtn.green  { border-color: var(--ps-green); color: var(--ps-green); }
.tbtn.green:hover, .tbtn.green.on { background: var(--ps-green); color: #fff; border-color: var(--ps-green); }
.tbtn.amber  { border-color: var(--ps-amber); color: #92400e; }
.tbtn.amber:hover { background: var(--ps-amber-l); }
.tbtn.red    { border-color: var(--ps-red); color: var(--ps-red); }
.tbtn.red:hover { background: var(--ps-red-l); }
.tbtn.purple { border-color: var(--ps-purple); color: var(--ps-purple); }
.tbtn.purple:hover { background: #f5f3ff; }

/* ── 탑바 액션 버튼 통일 (역할별 고정 색상) ─────────────────
   .tbtn-new   : 새 문제 생성   (초록  — #10b981)
   .tbtn-regen : SEED 재생성   (파란  — #4f46e5 outline)
   .tbtn-check : 정답 확인     (하늘  — #0ea5e9)
   .tbtn-hint  : 힌트          (노란  — #f59e0b)
   .tbtn-reset : 초기화        (회색  — 기본 tbtn과 동일, 약간 진함)
─────────────────────────────────────────────────────────── */
/* 새 문제 생성 — 채워진 초록 */
.tbtn-new {
  background: var(--ps-green);
  border-color: var(--ps-green);
  color: #fff !important;
  font-weight: 800;
}
.tbtn-new:hover { background: #059669; border-color: #059669; color: #fff; }

/* SEED 재생성 — 파란 outline */
.tbtn-regen {
  border-color: var(--ps-blue);
  color: var(--ps-blue) !important;
  background: #fff;
}
.tbtn-regen:hover { background: var(--ps-blue-l); }

/* 정답 확인 — 하늘색 outline */
.tbtn-check {
  border-color: #0ea5e9;
  color: #0369a1 !important;
  background: #fff;
}
.tbtn-check:hover { background: #f0f9ff; border-color: #0369a1; }

/* 힌트 — 노란 outline */
.tbtn-hint {
  border-color: var(--ps-amber);
  color: #92400e !important;
  background: #fff;
}
.tbtn-hint:hover { background: var(--ps-amber-l); }

/* 초기화 — 빨강 outline */
.tbtn-reset {
  border-color: #fca5a5 !important;
  color: #dc2626 !important;
  background: #fff1f2;
}
.tbtn-reset:hover { background: #fee2e2; border-color: #f87171 !important; }

/* ════════════════════════════════════════
   #wrap — 사이드바 + 메인 래퍼
════════════════════════════════════════ */
#wrap {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ════════════════════════════════════════
   #side — 사이드바 (220px 고정)
   설정 항목: 크기/유형, 난이도, SEED, 페이지수, 인쇄, 생성버튼
   ※ flex 컨테이너 — 항목들이 자연스럽게 쌓임
   ※ 내용이 많을 때만 overflow-y:auto 로 스크롤
════════════════════════════════════════ */
#side {
  width: var(--ps-side-w);
  min-width: var(--ps-side-w);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--ps-gray-b);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--ps-gray-b) transparent;
  box-sizing: border-box;
}
#side::-webkit-scrollbar { width: 4px; }
#side::-webkit-scrollbar-track { background: transparent; }
#side::-webkit-scrollbar-thumb { background: var(--ps-gray-b); border-radius: 4px; }

/* ─ 섹션 제목 ─ */
.stit {
  font-size: 12px;
  font-weight: 800;
  color: var(--ps-muted);
  border-bottom: 1px solid var(--ps-gray-b);
  padding-bottom: 4px;
  margin-bottom: 5px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* ─ 난이도 버튼 행 ─ */
.drow { display: flex; gap: 3px; }
.dbtn {
  flex: 1;
  padding: 8px 3px;
  border-radius: 6px;
  border: 2px solid var(--ps-gray-b);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  background: #fff;
  color: #888;
  transition: .15s;
  font-family: inherit;
}
.dbtn:hover { border-color: var(--ps-blue); color: var(--ps-blue); }
.dbtn.on    { background: var(--ps-blue); color: #fff; border-color: var(--ps-blue); }

/* ══════════════════════════════════════════════════════
   저울 퍼즐 — 유형+난이도 통합 트리 UI
══════════════════════════════════════════════════════ */

/* 유형 그룹 컨테이너 */
.wp-type-group {
  border: 1.5px solid #e5e7eb;
  border-radius: 9px;
  overflow: hidden;
  margin-bottom: 5px;
}

/* 유형 헤더 (클릭 시 펼침) */
.wp-type-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  cursor: pointer;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  transition: background .12s, color .12s;
  user-select: none;
}
.wp-type-header:hover { background: #f3f4f6; }
.wp-type-header.on {
  background: #eef2ff;
  color: #4f46e5;
  border-bottom: 1.5px solid #c7d2fe;
}
.wp-th-icon  { font-size: 14px; flex-shrink: 0; }
.wp-th-label { flex: 1; }
.wp-th-arrow { font-size: 10px; color: #94a3b8; flex-shrink: 0; }

/* 난이도 패널 (열림/닫힘) */
.wp-diff-panel {
  background: #fafbff;
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.wp-diff-section { display: flex; flex-direction: column; gap: 4px; }
.wp-diff-section-label {
  font-size: 9px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.wp-diff-row { display: flex; flex-wrap: wrap; gap: 3px; }

/* 난이도 버튼 (문장 퍼즐) */
.wp-dbtn {
  flex: 1 1 52px;
  padding: 5px 2px;
  border-radius: 6px;
  border: 1.5px solid #e5e7eb;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  background: #fff;
  color: #6b7280;
  transition: .12s;
  font-family: inherit;
  white-space: nowrap;
}
.wp-dbtn:hover { border-color: #4f46e5; color: #4f46e5; background: #eef2ff; }
.wp-dbtn.on    { background: #4f46e5; color: #fff; border-color: #4f46e5; }

/* 그림 전용 난이도 버튼 (완전초급·초급) */
.wp-dbtn-visual {
  border-color: #f59e0b;
  color: #92400e;
  background: #fffbeb;
  font-size: 10px;
}
.wp-dbtn-visual:hover { border-color: #d97706; color: #78350f; background: #fef3c7; }
.wp-dbtn-visual.on    { background: #f59e0b; color: #fff; border-color: #f59e0b; }

/* 그림 전용 난이도 버튼 (완전초급·초급) — 구버전 호환 */
.dbtn-visual {
  border-color: #f59e0b;
  color: #92400e;
  background: #fffbeb;
  font-size: 10px;
}
.dbtn-visual:hover { border-color: #d97706; color: #78350f; background: #fef3c7; }
.dbtn-visual.on    { background: #f59e0b; color: #fff; border-color: #f59e0b; }

/* 상자 답안 버튼 */
.ans-btn-box {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 14px !important; min-width: 72px;
}
.ans-box-icon { font-size: 22px; }
.ans-box-label { font-size: 11px; font-weight: 700; }

/* 상자 퍼즐 — 저울 그림 카드 그리드 */
.box-cond-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin: 10px 0;
}
.box-cond-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #f9fafb;
  border: 2px solid #e0e7ff;
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 240px;
}
.box-cond-text {
  font-size: 12.5px;
  color: #374151;
  line-height: 1.6;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.box-cond-label {
  font-size: 12px;
  color: #6366f1;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
}
.question-box-visual .q-intro {
  font-size: 13.5px;
  line-height: 1.75;
  color: #374151;
  background: #fef3c7;
  border-radius: 8px;
  padding: 10px 14px;
  border-left: 4px solid #f59e0b;
  margin-bottom: 8px;
}

/* ─ SEED 입력 ─ */
.seed-row { display: flex; gap: 4px; align-items: center; }
#side-seed, .ps-seed-input {
  flex: 1;
  height: 28px;
  border: 2px solid var(--ps-gray-b);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  padding: 0 4px;
  outline: none;
  font-family: monospace;
  color: var(--ps-text);
}
#side-seed:focus, .ps-seed-input:focus { border-color: var(--ps-blue); }
.seed-lbl {
  font-size: 10px;
  color: var(--ps-muted);
  font-weight: 700;
  font-family: monospace;
}

/* ─ 통계 박스 ─ */
.stat-row { display: flex; gap: 4px; }
.stat-box {
  flex: 1;
  text-align: center;
  background: #f9fafb;
  border-radius: 7px;
  padding: 6px 3px;
  border: 1.5px solid var(--ps-gray-b);
}
.stat-n { font-size: 17px; font-weight: 900; color: var(--ps-blue); }
.stat-l { font-size: 9px; color: var(--ps-muted); font-weight: 600; }

/* ─ 유형 목록 ─ */
#type-list, .ps-type-list { display: flex; flex-direction: column; gap: 3px; }
.ti, .ps-type-item {
  padding: 7px 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  background: #f9fafb;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: .15s;
  font-family: inherit;
}
.ti:hover, .ps-type-item:hover  { background: var(--ps-blue-l); color: var(--ps-blue); }
.ti.on, .ps-type-item.on { background: var(--ps-blue-l); color: var(--ps-blue); border-color: var(--ps-blue-m); }

/* ════════════════════════════════════════
   사이드바 하단 고정 블록
   (페이지수 + 인쇄설정버튼 + 생성버튼)
   ※ margin-top:auto 로 항상 하단에 붙음
════════════════════════════════════════ */
.ps-sidebar-bottom {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--ps-gray-b);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── 페이지 수 컨트롤 ── */
.ps-pages-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ps-pages-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ps-text-sub);
  white-space: nowrap;
  min-width: 44px;
}
.ps-qty-ctrl {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
}
.ps-qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1.5px solid var(--ps-gray-b);
  background: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ps-text-sub);
  transition: .12s;
  line-height: 1;
  font-family: inherit;
  flex-shrink: 0;
}
.ps-qty-btn:hover { border-color: var(--ps-blue); color: var(--ps-blue); background: var(--ps-blue-l); }

.ps-qty-num {
  flex: 1;
  min-width: 0;
  height: 26px;
  text-align: center;
  border: 1.5px solid var(--ps-gray-b);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ps-text);
  font-family: monospace;
  outline: none;
}
.ps-qty-num:focus { border-color: var(--ps-blue); }
.ps-qty-unit {
  font-size: 11px;
  color: var(--ps-muted);
  white-space: nowrap;
}
.ps-pages-hint {
  font-size: 10px;
  color: var(--ps-muted);
  line-height: 1.4;
}

/* ── 인쇄 설정 버튼 ── */
.ps-print-btn {
  width: 100%;
  padding: 9px;
  border-radius: var(--ps-radius);
  border: 2px solid var(--ps-gray-b);
  background: #fff;
  color: var(--ps-text-sub);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: .15s;
}
.ps-print-btn:hover {
  border-color: var(--ps-green);
  color: var(--ps-green);
  background: var(--ps-green-l);
}

/* ── 문제 생성 버튼 ── */
.ps-gen-btn {
  width: 100%;
  padding: 11px;
  border-radius: var(--ps-radius);
  border: none;
  background: linear-gradient(135deg, var(--ps-blue), var(--ps-purple));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: .2px;
  transition: opacity .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ps-gen-btn:hover { opacity: .88; }

/* 기존 #gen-btn 호환 */
#gen-btn {
  width: 100%;
  padding: 11px;
  border-radius: var(--ps-radius);
  border: none;
  background: linear-gradient(135deg, var(--ps-blue), var(--ps-purple));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s;
}
#gen-btn:hover { opacity: .88; }

/* ════════════════════════════════════════
   #main — 퍼즐 메인 영역
════════════════════════════════════════ */
#main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}

/* ════════════════════════════════════════
   퍼즐 카드
════════════════════════════════════════ */
.puzzle-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(79, 70, 229, .09);
  border: 2px solid var(--ps-blue-m);
  padding: 20px 24px;
}
.puzzle-title {
  font-size: 15px;
  font-weight: 900;
  color: #1e1b4b;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.puzzle-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 10px;
  background: var(--ps-blue);
  color: #fff;
}
.puzzle-badge.beginner { background: #22c55e; }
.puzzle-badge.easy     { background: var(--ps-green); }
.puzzle-badge.medium   { background: var(--ps-amber); color: #000; }
.puzzle-badge.hard     { background: var(--ps-red); }
.puzzle-badge.expert   { background: #7c3aed; }

/* ════════════════════════════════════════
   빈 상태 (첫 화면) — 항상 이 상태로 시작
════════════════════════════════════════ */
.ps-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 20px;
  color: var(--ps-muted);
  text-align: center;
  flex: 1;
  min-height: 300px;
}
.ps-empty-icon {
  font-size: 56px;
  opacity: .45;
  line-height: 1;
}
.ps-empty-state h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--ps-text-sub);
}
.ps-empty-state p {
  font-size: 13px;
  line-height: 1.7;
  max-width: 320px;
}
/* 빈 상태 내 "생성 시작" 버튼 */
.ps-empty-cta {
  padding: 12px 28px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--ps-blue), var(--ps-purple));
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ps-empty-cta:hover { opacity: .88; }

/* 로딩 */
.ps-loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--ps-muted);
  font-size: 14px;
  flex: 1;
}
.ps-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--ps-gray-b);
  border-top-color: var(--ps-blue);
  border-radius: 50%;
  animation: ps-spin .7s linear infinite;
}
@keyframes ps-spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════
   QR 섹션 (화면용)
════════════════════════════════════════ */
.ps-qr-section {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid var(--ps-gray-b);
  border-radius: var(--ps-radius);
  padding: 10px 12px;
  margin-top: 12px;
}
/* 64×64px 화면 QR */
.ps-qr-box {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--ps-gray-b);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ps-qr-box img, .ps-qr-box canvas { width: 60px !important; height: 60px !important; }
.ps-qr-info { font-size: 11px; color: var(--ps-text-sub); line-height: 1.6; }
.ps-qr-info b { font-size: 12px; color: var(--ps-text); }

/* ════════════════════════════════════════
   인쇄 모달 (공통 쉘)
════════════════════════════════════════ */
.ps-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 99999;
  align-items: center;
  justify-content: center;
}
.ps-modal-overlay.open { display: flex; }

.ps-modal-box {
  background: #fff;
  border-radius: 18px;
  padding: 26px 28px 22px;
  max-width: 520px;
  width: 93%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.ps-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  color: #9ca3af;
  cursor: pointer;
  line-height: 1;
  padding: 2px;
}
.ps-modal-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--ps-text);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ps-modal-sub {
  font-size: 12px;
  color: var(--ps-muted);
  margin-bottom: 20px;
}
.ps-modal-group { margin-bottom: 18px; }
.ps-modal-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ps-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 8px;
}

/* 레이아웃 선택 (1/2/4) */
.ps-layout-btns { display: flex; gap: 8px; }
.ps-layout-btn {
  flex: 1;
  padding: 10px 6px;
  border: 2px solid var(--ps-gray-b);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: .15s;
  font-size: 12px;
  font-weight: 700;
  color: var(--ps-text-sub);
  font-family: inherit;
}
.ps-layout-btn:hover { border-color: var(--ps-blue); color: var(--ps-blue); }
.ps-layout-btn.active { border-color: var(--ps-blue); background: var(--ps-blue-l); color: var(--ps-blue); }
.ps-modal-group.auto-layout-fixed-group { display: none !important; }
.ps-layout-btns.auto-layout-locked .ps-layout-btn {
  cursor: default;
  pointer-events: none;
}
.ps-layout-btns.auto-layout-locked .ps-layout-btn:not(.active) { opacity: .42; }

.ps-layout-preview { display: grid; gap: 2px; width: 36px; height: 28px; }
.ps-lp-1 { grid-template-columns: 1fr; }
.ps-lp-2 { grid-template-columns: 1fr 1fr; }
.ps-lp-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.ps-lp-6 { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); }
.ps-layout-preview div { background: currentColor; border-radius: 2px; opacity: .35; }
.ps-layout-btn.active .ps-layout-preview div { opacity: .7; }

/* 자동 추천 */
.ps-auto-recommend {
  margin-top: 8px;
  padding: 7px 10px;
  background: #fffbeb;
  border-radius: 8px;
  border: 1px solid #fde68a;
  font-size: 11px;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.5;
}

/* 인쇄 분량 요약 박스 (읽기 전용, 사이드바 연동) */
.ps-modal-summary-box {
  margin-top: 8px;
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px 8px;
}
.ps-modal-summary-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ps-modal-summary-chip {
  display: inline-block;
  min-width: 28px;
  text-align: center;
  font-size: 17px;
  font-weight: 900;
  color: var(--ps-blue);
  font-family: monospace;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  padding: 1px 8px;
  line-height: 1.6;
}
.ps-modal-summary-chip.ps-modal-summary-total {
  color: #10b981;
  border-color: #6ee7b7;
  background: #f0fdf4;
  font-size: 19px;
}
.ps-modal-summary-sep {
  font-size: 12px;
  color: var(--ps-text-sub);
  font-weight: 600;
}
.ps-modal-summary-hint {
  margin-top: 7px;
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: -0.2px;
}

/* A4 paper preview inside the print settings modal */
.ps-a4-preview-group { margin-top: -2px; }
.ps-a4-preview-shell {
  display: grid;
  grid-template-columns: 138px 1fr;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1.5px solid #dbeafe;
  border-radius: 12px;
  background: linear-gradient(135deg, #eff6ff, #ffffff);
}
.ps-a4-paper {
  aspect-ratio: 210 / 297;
  width: 122px;
  margin: 0 auto;
  padding: 9px 8px 7px;
  background: #fff;
  border: 1.5px solid #94a3b8;
  border-radius: 4px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .14);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ps-a4-page-title {
  height: 10px;
  border-bottom: 1px solid #dbeafe;
  color: #2563eb;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
}
.ps-a4-slot-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 4px;
}
.ps-a4-paper[data-layout="1"] .ps-a4-slot-grid {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}
.ps-a4-paper[data-layout="2"] .ps-a4-slot-grid {
  grid-template-columns: 1fr;
  grid-template-rows: repeat(2, 1fr);
}
.ps-a4-paper[data-layout="4"] .ps-a4-slot-grid {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}
.ps-a4-paper[data-layout="6"] .ps-a4-slot-grid {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, 1fr);
}
.ps-a4-slot {
  min-height: 0;
  border: 1px solid #bfdbfe;
  border-radius: 3px;
  background: #f8fbff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
  font-size: 9px;
  font-weight: 900;
}
.ps-a4-slot span {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #dbeafe;
}
.ps-a4-page-foot {
  height: 9px;
  color: #64748b;
  font-size: 6.5px;
  font-weight: 800;
  text-align: center;
  border-top: 1px solid #e2e8f0;
  padding-top: 2px;
  overflow: hidden;
}
.ps-a4-preview-copy {
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.55;
  letter-spacing: -0.2px;
}

/* 출력 내용 라디오 */
.ps-radio-group { display: flex; flex-direction: column; gap: 6px; }
.ps-radio-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--ps-gray-b);
  border-radius: 10px;
  cursor: pointer;
  transition: .15s;
}
.ps-radio-label:hover { border-color: var(--ps-blue); background: #fafbff; }
.ps-radio-label.selected { border-color: var(--ps-blue); background: var(--ps-blue-l); }
.ps-radio-label input[type=radio] { margin-top: 2px; accent-color: var(--ps-blue); flex-shrink: 0; }
.ps-rl-title { font-size: 13px; font-weight: 700; color: var(--ps-text); }
.ps-rl-sub   { font-size: 11px; color: var(--ps-muted); margin-top: 1px; }

/* 힌트 체크 */
.ps-hint-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ps-text-sub);
}
.ps-hint-row input[type=checkbox] { accent-color: var(--ps-blue); }

/* 모달 푸터 */
.ps-modal-footer { display: flex; gap: 8px; margin-top: 6px; }
.ps-btn-print {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--ps-blue), #6366f1);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  transition: filter .15s;
}
.ps-btn-print:hover { filter: brightness(1.08); }
.ps-btn-cancel {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--ps-gray-b);
  background: #fff;
  color: var(--ps-text-sub);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.ps-btn-cancel:hover { background: var(--ps-gray-l); color: var(--ps-text); }

/* ════════════════════════════════════════
   반응형 (모바일 640px 이하)
════════════════════════════════════════ */
@media (max-width: 640px) {
  #side { display: none; }
  #main { padding: 12px 14px; }
  :root { --ps-topbar-h: 44px; }
  .ps-a4-preview-shell {
    grid-template-columns: 1fr;
  }
  .ps-a4-paper {
    width: 116px;
  }
}
