/**
 * puzzle-standard.css
 * puzzlelo 퍼즐 UI 표준 공통 CSS
 * 기준: baseball-puzzle.html (숫자야구)
 * 모든 독립 퍼즐 페이지에서 import하여 사용
 */

/* ══════════════════════════════════════════════
   0. CSS 토큰
══════════════════════════════════════════════ */
:root {
  --blue:    #4f46e5;
  --blue-l:  #eef2ff;
  --blue-m:  #c7d2fe;
  --red:     #ef4444;
  --red-l:   #fef2f2;
  --green:   #10b981;
  --green-l: #d1fae5;
  --amber:   #f59e0b;
  --amber-l: #fffbeb;
  --purple:  #7c3aed;
  --gray:    #6b7280;
  --gray-l:  #f3f4f6;
  --gray-b:  #e5e7eb;
  --text:    #1e293b;
  --sub:     #64748b;
  --out:     #94a3b8;
}

/* ══════════════════════════════════════════════
   1. 전체 레이아웃
══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Sans KR', 'Segoe UI', system-ui, sans-serif;
  background: #f0f4ff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 56px; /* app-header 높이 */
  color: var(--text);
}

/* ══════════════════════════════════════════════
   2. 탑바 (#topbar)
══════════════════════════════════════════════ */
#topbar {
  position: fixed;
  top: 56px;
  left: 0; right: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 2px solid var(--gray-b);
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
#topbar::-webkit-scrollbar { display: none; }
#topbar strong {
  color: var(--blue);
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
  flex-shrink: 0;
}
/* 탑바 사용 시 body 추가 padding */
body.has-topbar { padding-top: calc(56px + 46px); }

/* 구분선 */
.sep {
  width: 1px;
  height: 24px;
  background: var(--gray-b);
  flex-shrink: 0;
}
/* 라벨 */
.tlbl {
  font-size: 10px;
  font-weight: 800;
  color: var(--out);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════
   3. 탑바 버튼 (.tbtn)
══════════════════════════════════════════════ */
.tbtn {
  padding: 0 14px;
  height: 40px;
  border-radius: 6px;
  border: 2px solid var(--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: all .15s;
  font-family: inherit;
}
.tbtn:hover { background: var(--blue-l); border-color: var(--blue); color: var(--blue); }
.tbtn:disabled { opacity: .4; cursor: not-allowed; }
.tbtn.on { background: var(--blue); color: #fff; border-color: var(--blue); }

/* 버튼 variants */
.tbtn-new {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 2px 8px rgba(79,70,229,.35);
}
.tbtn-new:hover { opacity: .88; background: linear-gradient(135deg, var(--blue), var(--purple)); }

.tbtn-regen  { background: #fff7ed; border-color: #fb923c !important; color: #ea580c !important; }
.tbtn-regen:hover  { background: #ffedd5; border-color: #ea580c !important; }

.tbtn-hint   { background: #fefce8; border-color: #fbbf24 !important; color: #b45309 !important; }
.tbtn-hint:hover   { background: #fef9c3; }

.tbtn-check  { background: #f0fdf4; border-color: #34d399 !important; color: #065f46 !important; }
.tbtn-check:hover  { background: #dcfce7; }

.tbtn-reveal { background: #f0f9ff; border-color: #38bdf8 !important; color: #0369a1 !important; }
.tbtn-reveal:hover { background: #e0f2fe; }

.tbtn-save   { background: #faf5ff; border-color: #a78bfa !important; color: #6d28d9 !important; }
.tbtn-save:hover   { background: #ede9fe; }

.tbtn-reset  { background: #fff1f2; border-color: #fca5a5 !important; color: #dc2626 !important; }
.tbtn-reset:hover  { background: #fee2e2; }

.tbtn-print  { background: #f0fdf4; border-color: #6ee7b7 !important; color: #065f46 !important; }
.tbtn-print:hover  { background: #dcfce7; }

/* ══════════════════════════════════════════════
   4. 탭바 (#main-tabbar)
══════════════════════════════════════════════ */
#main-tabbar {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 2px solid var(--gray-b);
  background: #fff;
  padding: 0 16px;
  flex-shrink: 0;
}
.main-tab {
  padding: 10px 18px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--out);
  cursor: pointer;
  font-family: inherit;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
  white-space: nowrap;
}
.main-tab:hover { color: #374151; }
.main-tab.on { color: var(--blue); border-bottom-color: var(--blue); font-weight: 800; }
.tab-badge {
  background: var(--blue);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 99px;
  display: none;
}
.tab-badge.show { display: inline-block; }

/* 탭 뷰 */
.tab-view { display: none; flex: 1; overflow: hidden; min-height: 0; width: 100%; }
.tab-view.on { display: flex; }
#tab-puzzle.on { flex-direction: row; }
#tab-vault.on  { flex-direction: column; }

/* ══════════════════════════════════════════════
   5. 메인 래퍼 (#wrap)
══════════════════════════════════════════════ */
#wrap {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

/* ══════════════════════════════════════════════
   6. 사이드바 (#side)
══════════════════════════════════════════════ */
#side {
  width: 220px;
  min-width: 220px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--gray-b);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 0;
  scrollbar-width: thin;
}
#side::-webkit-scrollbar { width: 4px; }
#side::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

/* 섹션 제목 */
.stit {
  font-size: 12px;
  font-weight: 800;
  color: var(--out);
  border-bottom: 1px solid var(--gray-b);
  padding-bottom: 4px;
  margin-bottom: 6px;
  margin-top: 10px;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.stit:first-child { margin-top: 0; }

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

/* SEED 입력 */
.sv-seed-input {
  width: 100%;
  height: 34px;
  border: 2px solid var(--gray-b);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 0 8px;
  outline: none;
  margin-bottom: 5px;
  color: var(--text);
  font-family: inherit;
  transition: border-color .15s;
}
.sv-seed-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-l); }

/* SEED 재생성 버튼 */
.seed-action-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.sv-seed-regen-btn {
  width: 100%;
  padding: 8px 4px;
  border-radius: 7px;
  border: 2px solid #fb923c;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  background: #fff7ed;
  color: #ea580c;
  white-space: nowrap;
  font-family: inherit;
  transition: all .15s;
}
.sv-seed-regen-btn:hover { background: #ffedd5; border-color: #ea580c; }

/* 생성 버튼 (사이드바) */
.ps-gen-btn {
  width: 100%;
  padding: 10px 4px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(79,70,229,.3);
  transition: opacity .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 6px;
}
.ps-gen-btn:hover { opacity: .88; }

/* 사이드바 보조 버튼 (저장, 인쇄 등) */
.ps-side-btn {
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1.5px solid var(--gray-b);
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  color: var(--sub);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
  margin-bottom: 4px;
}
.ps-side-btn:hover { background: var(--blue-l); border-color: var(--blue); color: var(--blue); }
.ps-side-btn.save  { border-color: #ddd6fe; color: #6d28d9; background: #faf5ff; }
.ps-side-btn.save:hover  { background: #ede9fe; }
.ps-side-btn.print { border-color: #a7f3d0; color: #065f46; background: #f0fdf4; }
.ps-side-btn.print:hover { background: #dcfce7; }
.ps-side-btn.regen { border-color: #fed7aa; color: #ea580c; background: #fff7ed; }
.ps-side-btn.regen:hover { background: #ffedd5; }

/* 규칙 박스 */
.rule-box {
  font-size: 10px;
  color: var(--out);
  line-height: 1.9;
  background: #f8fafc;
  border-radius: 7px;
  padding: 8px 10px;
  margin-top: 10px;
}
.rule-box strong { font-weight: 800; }

/* ══════════════════════════════════════════════
   7. 메인 콘텐츠 (#main)
══════════════════════════════════════════════ */
#main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px;
}

/* ══════════════════════════════════════════════
   8. 인트로 화면
══════════════════════════════════════════════ */
.ps-intro-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  max-width: 480px;
  margin: 0 auto;
  gap: 0;
}
.ps-intro-icon {
  font-size: 72px;
  line-height: 1;
  margin-bottom: 20px;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,.12));
}
.ps-intro-title {
  font-size: 26px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 8px;
}
.ps-intro-desc {
  font-size: 13px;
  color: var(--sub);
  line-height: 1.8;
  margin-bottom: 16px;
  max-width: 380px;
}
.ps-intro-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 28px;
}
.ps-intro-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 36px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 20px rgba(79,70,229,.4);
  transition: transform .12s, opacity .12s;
}
.ps-intro-btn:hover { transform: scale(1.04); }
.ps-intro-btn i { font-size: 18px; }
.ps-intro-hint {
  font-size: 11px;
  color: var(--out);
  margin-top: 12px;
}

/* ══════════════════════════════════════════════
   9. 퍼즐 보드 섹션
══════════════════════════════════════════════ */
.puzzle-board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 100%;
}
.puzzle-board-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 560px;
}
.board-label {
  font-size: 12px;
  font-weight: 800;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin-bottom: 10px;
}
.board-label.problem { color: #1e40af; }
.board-label.answer  { color: #059669; }

/* ══════════════════════════════════════════════
   10. 태그 (교과 연계)
══════════════════════════════════════════════ */
.ctag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.ctag-blue   { background: #eff6ff; color: #1d4ed8; }
.ctag-purple { background: #f5f3ff; color: #7c3aed; }
.ctag-green  { background: #f0fdf4; color: #15803d; }
.ctag-amber  { background: #fffbeb; color: #92400e; }
.ctag-red    { background: #fef2f2; color: #991b1b; }

/* ══════════════════════════════════════════════
   11. 뱃지
══════════════════════════════════════════════ */
.ps-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}
.ps-badge-ok   { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.ps-badge-warn { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.ps-badge-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ══════════════════════════════════════════════
   12. 보관함 탭 (공통 구조)
══════════════════════════════════════════════ */
#tab-vault { background: #f0f4ff; align-items: stretch; }

#vault-toolbar-wrap {
  flex-shrink: 0;
  background: #fff;
  border-bottom: 2px solid var(--gray-b);
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
#vault-toolbar-inner {
  width: 100%;
  max-width: 760px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#vault-toolbar { display: flex; align-items: center; gap: 8px; }
.vt-search-wrap { position: relative; flex: 1; min-width: 200px; }
.vt-search-wrap i {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--out); font-size: 13px; pointer-events: none;
}
#vault-search {
  width: 100%; height: 38px; border-radius: 10px;
  border: 2px solid var(--gray-b); padding: 0 12px 0 34px;
  font-size: 13px; font-weight: 600; outline: none;
  font-family: inherit; color: var(--text); background: #fff;
  transition: border-color .15s;
}
#vault-search:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-l); }
#vault-search::placeholder { color: var(--out); }

.vt-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.vt-chip {
  padding: 5px 12px; border-radius: 99px;
  border: 1.5px solid var(--gray-b); background: #fff;
  font-size: 11px; font-weight: 700; color: var(--sub);
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.vt-chip:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }
.vt-chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }

#vault-inner {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; align-items: center; min-height: 0;
}
#vault-content { width: 100%; max-width: 900px; display: flex; flex-direction: column; flex: 1; }
#vault-result-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; font-size: 12px; color: var(--out); font-weight: 700; flex-shrink: 0;
}
#vault-result-row strong { color: #374151; }

#vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* 보관함 카드 */
.vc-card {
  background: #fff; border-radius: 16px;
  border: 2px solid var(--gray-b);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  transition: all .18s; position: relative;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.vc-card:hover {
  border-color: #a5b4fc;
  box-shadow: 0 6px 20px rgba(79,70,229,.12);
  transform: translateY(-2px);
}
.vc-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.vc-diff {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 800; padding: 3px 9px; border-radius: 99px;
}
.vc-diff.easy   { background: #dcfce7; color: #166534; }
.vc-diff.normal { background: #fef3c7; color: #92400e; }
.vc-diff.hard   { background: #ffe4e6; color: #9f1239; }
.vc-title { font-size: 13px; font-weight: 800; color: var(--text); line-height: 1.4; word-break: break-all; }
.vc-meta { font-size: 11px; color: var(--sub); line-height: 1.7; background: #f8fafc; border-radius: 8px; padding: 8px 10px; }
.vc-meta .vc-seed { font-family: monospace; font-weight: 800; color: #4338ca; background: var(--blue-l); border-radius: 4px; padding: 1px 5px; }
.vc-actions { display: flex; gap: 8px; }
.vc-load {
  flex: 1; padding: 9px 0; border-radius: 9px; border: none;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff; font-size: 12px; font-weight: 800;
  cursor: pointer; font-family: inherit; transition: opacity .15s;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.vc-load:hover { opacity: .88; }
.vc-del {
  width: 36px; height: 36px; border-radius: 9px;
  border: 1.5px solid #fca5a5; background: #fff1f2;
  color: #f87171; font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .15s;
}
.vc-del:hover { background: #ffe4e6; border-color: var(--red); color: var(--red); }

/* 빈 보관함 */
#vault-empty {
  display: none; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px;
  flex: 1; min-height: 280px; text-align: center; color: var(--out);
}
#vault-empty.show { display: flex; }
#vault-empty .ve-icon   { font-size: 48px; opacity: .45; }
#vault-empty .ve-title  { font-size: 16px; font-weight: 800; color: #374151; }
#vault-empty .ve-sub    { font-size: 13px; line-height: 1.7; }
#vault-empty .ve-cta {
  padding: 11px 28px; border-radius: 10px; border: none;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff; font-size: 13px; font-weight: 800;
  cursor: pointer; font-family: inherit;
}

/* 페이지네이션 */
#vault-pagination { display: none; justify-content: center; align-items: center; gap: 6px; padding: 20px 0 4px; }
#vault-pagination.show { display: flex; }
.vp-btn {
  min-width: 34px; height: 34px; border-radius: 9px;
  border: 1.5px solid var(--gray-b); background: #fff;
  font-size: 12px; font-weight: 700; color: #374151;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .15s; padding: 0 8px;
}
.vp-btn:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }
.vp-btn.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.vp-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ══════════════════════════════════════════════
   13. 토스트 알림
══════════════════════════════════════════════ */
.ps-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff;
  padding: 10px 22px; border-radius: 8px;
  font-size: 13px; font-weight: 700;
  z-index: 99999; pointer-events: none;
  opacity: 0; transition: opacity .2s;
  white-space: nowrap;
}
.ps-toast.show { opacity: 1; }
.ps-toast.success { background: #059669; }
.ps-toast.warn    { background: #d97706; }
.ps-toast.error   { background: #dc2626; }

/* ══════════════════════════════════════════════
   13-2. 사이드바 하단 정보 패널
   (시도 횟수 · 단서 수 — 앱 활동형 퍼즐용)
══════════════════════════════════════════════ */
/* 저장 섹션 */
#save-area {
  border-top: 1px solid var(--gray-b);
  padding-top: 8px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.save-section-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--out);
  letter-spacing: .5px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}
/* 현재 문제 저장 버튼 — 연두색 */
#btn-save-current {
  width: 100%;
  padding: 9px 6px;
  border-radius: 7px;
  border: 2px solid #059669;
  background: #f0fdf4;
  color: #065f46;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
#btn-save-current:hover  { background: #dcfce7; border-color: #047857; }
#btn-save-current:disabled { opacity: .4; cursor: not-allowed; }

/* 보관함으로 이동 버튼 */
#btn-load-list {
  width: 100%;
  padding: 7px 6px;
  border-radius: 7px;
  border: 2px solid #6366f1;
  background: var(--blue-l);
  color: #4338ca;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
#btn-load-list:hover { background: #e0e7ff; border-color: #4338ca; }

/* 저장 뱃지 (보관함 개수) */
.save-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  background: var(--blue);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 0 4px;
}

/* 시도 횟수 패널 — 앱 활동형 퍼즐만 사용 */
.side-stat-panel {
  border-top: 1px solid var(--gray-b);
  padding-top: 8px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.side-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.side-stat-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--out);
  letter-spacing: .3px;
}
.side-stat-val {
  font-size: 20px;
  font-weight: 900;
  color: var(--blue);
  min-width: 32px;
  text-align: right;
  line-height: 1;
}
.side-stat-val.small {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
}

/* 인쇄 페이지 수 영역 */
#ps-print-area {
  border-top: 1px solid var(--gray-b);
  padding-top: 8px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ══════════════════════════════════════════════
   13-3. 난이도 배지 (.diff-badge)
   퍼즐별 유일해 검증 결과 표시
   ─ 연두: 유일해 검증 완료
   ─ 노란: 1~2단계 예외 허용
   ─ 파란: 유한해 (복수해 가능)
══════════════════════════════════════════════ */
.diff-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}
/* 연두: 유일해 검증 완료 */
.badge-unique    { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
/* 노란: 1~2단계 예외 허용 */
.badge-exception { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
/* 파란: 유한해 */
.badge-finite    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* 배지 묶음 래퍼 (사이드바 난이도 섹션 하단) */
.diff-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
  margin-top: 4px;
}

/* ══════════════════════════════════════════════
   13-4. 인쇄 설정 표준 컴포넌트
   ─ pm-* 클래스: 인쇄 모달 내 섹션
   ─ QR 크기 기준 주석 포함
══════════════════════════════════════════════ */
/* 인쇄 모달 */
.bp-modal-wide {
  background: #fff; border-radius: 15px; padding: 22px;
  width: 94%; max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  max-height: 90vh; overflow-y: auto;
}
.pm-section { margin-bottom: 14px; }
.pm-label {
  font-size: 10px; font-weight: 800; color: var(--out);
  margin-bottom: 7px; letter-spacing: .5px;
}
.pm-radio-row { display: flex; gap: 10px; }
.pm-radio-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 600; color: #374151; cursor: pointer;
}
.pm-qty-row { display: flex; align-items: center; gap: 8px; }
.pm-qty-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-l); border: 1px solid var(--gray-b);
  border-radius: 8px; cursor: pointer;
  font-size: 18px; font-weight: 700; color: #374151;
  transition: all .15s;
}
.pm-qty-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }
.pm-qty-input {
  width: 56px; text-align: center; padding: 6px;
  border: 1px solid var(--gray-b); border-radius: 8px;
  font-size: 14px; font-weight: 700; outline: none; font-family: inherit;
}
.pm-qty-input:focus { border-color: var(--blue); }
.pm-preview {
  background: var(--blue-l); border: 1.5px solid var(--blue-m);
  border-radius: 8px; padding: 9px 12px;
  font-size: 12px; color: var(--blue); font-weight: 700; line-height: 1.6;
}
/* 인쇄 QR 크기 가이드 (주석)
   @media print 에서:
   .pn-print-qr-box           { width:18mm; height:18mm; }  기본 2열
   .layout-1 .pn-print-qr-box { width:22mm; height:22mm; }  1열 확대
   .layout-6 .pn-print-qr-box { width:14mm; height:14mm; }  4+열 축소
   JS QRCode.js: width:72, height:72 (px) 이상 — M레벨 권장
*/
.pm-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.mb { padding: 8px 16px; border-radius: 8px; border: none; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; }
.mb-p { background: var(--blue); color: #fff; }
.mb-p:hover { opacity: .88; }
.mb-g { background: var(--gray-b); color: #374151; }
.mb-g:hover { background: #d1d5db; }

/* 저장 모달 */
.save-modal {
  background: #fff; border-radius: 14px; padding: 20px;
  width: 92%; max-width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.sbtn { padding: 8px 16px; border-radius: 8px; border: none; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; }
.sbtn-ok     { background: var(--green); color: #fff; }
.sbtn-ok:hover { opacity: .88; }
.sbtn-cancel { background: var(--gray-b); color: #374151; }
.sbtn-cancel:hover { background: #d1d5db; }

/* 힌트 모달 */
.bp-modal {
  background: #fff; border-radius: 15px; padding: 22px;
  width: 94%; max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  max-height: 90vh; overflow-y: auto;
}
.ov {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 999;
  align-items: center; justify-content: center;
}
.ov.show { display: flex; }
.mfoo { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* ══════════════════════════════════════════════
   14. 반응형
══════════════════════════════════════════════ */
@media (max-width: 640px) {
  #side { display: none; }
  #main { padding: 12px; }
  .ps-intro-wrap { padding: 24px 16px; }
  .ps-intro-icon { font-size: 52px; }
  .ps-intro-title { font-size: 20px; }
}

/* ══════════════════════════════════════════════
   14. 표준 레이아웃 별칭 — PuzzleApp 공통 인터페이스
   (2026-05-24 화면 구성 표준화)
   
   .pz-topbar — 모든 퍼즐 탑바 표준 별칭
     ↳ app.html: game-topbar / standalone-topbar / sv-topbar / #play-topbar
     ↳ 독립 파일: #topbar
   
   .pz-side   — 모든 퍼즐 사이드바 표준 별칭
     ↳ app.html: standalone-side / sv-side / #sidebar
     ↳ 독립 파일: #side / #side-left / #sidebar
   
   용도: JS에서 document.querySelector('.pz-topbar') 로
         퍼즐 종류와 무관하게 탑바/사이드바를 찾을 수 있음.
         CSS 스타일 훅으로도 활용 가능.
══════════════════════════════════════════════ */

/* 표준 탑바 별칭 — 기존 #topbar 스타일에 hook만 추가 */
.pz-topbar {
  /* 현재 시각 스타일은 #topbar 가 담당.
     .pz-topbar 는 JS 쿼리용 훅 + 확장 스타일 적용 지점 */
}

/* 탑바 내 구분선 통일 */
.pz-topbar .sep,
.pz-topbar .tsep {
  width: 1px;
  height: 24px;
  background: var(--gray-b);
  flex-shrink: 0;
}

/* 탑바 제목 통일 */
.pz-topbar > strong,
.pz-topbar > b,
.pz-topbar h1 {
  color: var(--blue);
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 표준 사이드바 별칭 — 기존 #side 스타일에 hook만 추가 */
.pz-side {
  /* 현재 시각 스타일은 #side / #sidebar 가 담당 */
}

/* 사이드바 섹션 제목 통일 */
.pz-side .stit {
  font-size: 10px;
  font-weight: 800;
  color: var(--out);
  border-bottom: 1px solid var(--gray-b);
  padding-bottom: 3px;
  margin-bottom: 6px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* 모바일: 사이드바 숨김 */
@media (max-width: 640px) {
  .pz-side {
    display: none !important;
  }
}

/* ============================================================
   Sidebar Standardization V1
   단독 퍼즐 페이지용 공통 사이드바 외형 표준
   ============================================================ */
:root {
  --pz-side-width: 260px;
  --pz-side-pad: 12px;
  --pz-side-gap: 12px;
  --pz-side-border: #e5e7eb;
  --pz-side-muted: #94a3b8;
  --pz-side-text: #374151;
  --pz-side-blue: #4f46e5;
  --pz-side-blue-soft: #eef2ff;
}

.pz-side,
#side.pz-side {
  width: var(--pz-side-width) !important;
  min-width: var(--pz-side-width) !important;
  max-width: var(--pz-side-width) !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  background: #fff !important;
  border-right: 1px solid var(--pz-side-border) !important;
  padding: var(--pz-side-pad) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: var(--pz-side-gap) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-width: thin;
}

.pz-side .stit {
  font-size: 12px !important;
  font-weight: 800 !important;
  color: var(--pz-side-muted) !important;
  letter-spacing: .04em !important;
  line-height: 1.35 !important;
  border-bottom: 1px solid var(--pz-side-border) !important;
  padding-bottom: 5px !important;
  margin: 0 0 7px !important;
  text-transform: none !important;
}

.pz-side .drow,
.pz-side .ps-diff-group,
.pz-side .ps-seed-row,
.pz-side .sv-seed-action-row,
.pz-side .stat-row {
  gap: 6px !important;
}

.pz-side .dbtn,
.pz-side .pss-diff-btn,
.pz-side .pss-type-btn,
.pz-side .pn-sb-btn,
.pz-side .ps-gen-btn,
.pz-side .sv-seed-regen-btn,
.pz-side button:not(.btn-icon):not(.qty-btn) {
  min-height: 34px !important;
  padding: 8px 7px !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 750 !important;
  line-height: 1.25 !important;
  font-family: inherit !important;
  box-sizing: border-box !important;
}

.pz-side .dbtn.on,
.pz-side .pss-diff-btn.on,
.pz-side .pss-type-btn.on {
  background: var(--pz-side-blue) !important;
  border-color: var(--pz-side-blue) !important;
  color: #fff !important;
}

.pz-side .sv-seed-input,
.pz-side .ps-seed-input,
#side.pz-side #side-seed {
  width: 100% !important;
  height: 34px !important;
  border-radius: 8px !important;
  border: 2px solid var(--pz-side-border) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  box-sizing: border-box !important;
}

.pz-side .sv-seed-input:focus,
.pz-side .ps-seed-input:focus,
#side.pz-side #side-seed:focus {
  border-color: var(--pz-side-blue) !important;
  box-shadow: 0 0 0 3px var(--pz-side-blue-soft) !important;
}

.pz-side .hint-text,
.pz-side .seed-lbl,
.pz-side .stat-l {
  font-size: 11px !important;
  line-height: 1.55 !important;
}

.pz-side .stat-n {
  font-size: 18px !important;
  line-height: 1.1 !important;
}

.pz-side .rule-box {
  font-size: 12.5px !important;
  line-height: 1.7 !important;
  padding: 10px 12px !important;
  border-radius: 9px !important;
}

@media (max-width: 640px) {
  .pz-side,
  #side.pz-side {
    display: none !important;
  }
}
