/* frontend/css/style.css — LexBank 공통 스타일 */

:root {
  --ink:            #1a1a2e;
  --ink-light:      #2d2d44;
  --parchment:      #f8f5ef;
  --parchment-dark: #ede9df;
  --gold:           #c9952a;
  --gold-light:     #e8b84b;
  --red:            #c0392b;
  --green:          #1e6b3e;
  --blue:           #1a4f8a;
  --border:         #d4c9b0;
  --shadow:         rgba(26,26,46,0.12);
  --radius:         8px;
  --font-serif:     'Noto Serif KR', serif;
  --font-sans:      'Noto Sans KR', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--parchment);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.7;
}

/* ── 버튼 ─────────────────────────────────────────── */
.btn {
  padding: 0.45rem 1.1rem;
  border-radius: 5px;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline  { background: transparent; border: 1px solid var(--border); color: var(--ink); }
.btn-outline:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.btn-gold     { background: var(--gold); color: white; }
.btn-gold:hover:not(:disabled) { background: var(--gold-light); }
.btn-primary  { background: var(--blue); color: white; }
.btn-primary:hover:not(:disabled) { background: #1a5fa0; }
.btn-danger   { background: var(--red); color: white; }
.btn-danger:hover:not(:disabled) { background: #a93226; }
.btn-ghost    { background: none; border: none; color: var(--gold); cursor: pointer; font-size: 0.9rem; font-family: var(--font-sans); }

/* ── 배지 ─────────────────────────────────────────── */
.badge { padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.75rem; font-weight: 500; }
.badge-gold  { background: #fef3d0; color: var(--gold);  border: 1px solid #f0d68a; }
.badge-blue  { background: #dbeafe; color: var(--blue);  border: 1px solid #93c5fd; }
.badge-green { background: #d1fae5; color: var(--green); border: 1px solid #6ee7b7; }
.badge-red   { background: #fee2e2; color: var(--red);   border: 1px solid #fca5a5; }
.badge-new   { background: var(--gold); color: white; font-size: 0.68rem; padding: 0.15rem 0.45rem; }

/* ── 폼 ──────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.4rem; }
.form-control {
  width: 100%; padding: 0.65rem 1rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.9rem; font-family: var(--font-sans);
  background: white; color: var(--ink); transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: var(--gold); }
textarea.form-control { resize: vertical; min-height: 180px; }

/* ── 검색 바 ─────────────────────────────────────── */
.search-box {
  display: flex; align-items: center; gap: 0.5rem;
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.5rem 1rem;
  flex: 1; min-width: 200px;
}
.search-box input { border: none; outline: none; font-size: 0.9rem; width: 100%; background: none; font-family: var(--font-sans); }
.search-icon { color: #999; }

/* ── 카드 ─────────────────────────────────────────── */
.card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  cursor: pointer; transition: all 0.2s; position: relative; overflow: hidden;
}
.card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--gold); }
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--shadow); border-color: var(--gold); }
.card h3 { font-family: var(--font-serif); font-size: 1.15rem; margin-bottom: 0.5rem; }
.card p  { font-size: 0.875rem; color: #666; }
.card-meta { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }

/* ── 페이지네이션 ─────────────────────────────────── */
.pagination { display: flex; justify-content: center; gap: 0.4rem; margin-top: 2rem; flex-wrap: wrap; }
.page-btn {
  width: 36px; height: 36px; border-radius: 5px;
  border: 1px solid var(--border); background: white;
  cursor: pointer; font-size: 0.85rem; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-sans);
}
.page-btn:hover     { border-color: var(--gold); color: var(--gold); }
.page-btn.active    { background: var(--ink); color: white; border-color: var(--ink); }
.page-btn:disabled  { opacity: 0.4; cursor: not-allowed; }

/* ── 토스트 ──────────────────────────────────────── */
.toast {
  position: fixed; bottom: 2rem; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink); color: white;
  padding: 0.75rem 1.75rem; border-radius: 50px;
  font-size: 0.875rem; z-index: 9999;
  transition: transform 0.3s ease; pointer-events: none;
  white-space: nowrap;
}
.toast.show    { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

/* ── 모달 ────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 2000; display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: white; border-radius: 12px; padding: 2.5rem 2rem;
  max-width: 420px; width: 90%; position: relative;
  animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #999; }
.modal h2 { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.modal p  { font-size: 0.875rem; color: #666; margin-bottom: 2rem; }

/* ── 진행 바 ─────────────────────────────────────── */
.progress-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-top: 0.5rem; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; background: var(--gold); }

/* ── 댓글 ────────────────────────────────────────── */
.comments-section { margin-top: 2rem; border-top: 1px solid var(--border); padding-top: 1.5rem; }
.comments-section h3 { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.comment { padding: 0.875rem 0; border-bottom: 1px solid var(--parchment-dark); }
.comment:last-child { border-bottom: none; }
.comment-meta { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.4rem; }
.comment-author { font-weight: 600; font-size: 0.85rem; }
.comment-date   { font-size: 0.78rem; color: #999; }
.comment-body   { font-size: 0.875rem; line-height: 1.7; }
.comment-form   { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }
.comment-form textarea { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; font-size: 0.9rem; font-family: var(--font-sans); resize: vertical; min-height: 80px; background: white; color: var(--ink); }
.comment-form textarea:focus { outline: none; border-color: var(--gold); }
.no-comments { text-align: center; color: #999; font-size: 0.875rem; padding: 1.5rem; }

/* ── 대댓글 스레딩 (2단계) ─────────────────────────── */
.comment-children {
  margin-left: 1.5rem;
  margin-top: 0.4rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--parchment-dark);
}
.comment-reply {
  padding: 0.65rem 0 !important;
  background: #fdfcf8;
  border-bottom-color: var(--parchment) !important;
}
.comment-reply .comment-body { font-size: 0.85rem; }
.comment-reply-arrow {
  color: #bbb; font-weight: 700; font-size: 0.85rem;
  margin-right: 0.1rem;
}

/* ── 수정/삭제/답글 액션 버튼 ──────────────────────── */
.comment-actions {
  margin-left: auto;
  display: inline-flex; gap: 0.35rem;
}
.comment-action {
  font-size: 0.74rem; color: #888;
  background: transparent; border: none;
  padding: 0.2rem 0.5rem; border-radius: 4px;
  cursor: pointer; font-family: var(--font-sans);
  transition: all 0.12s;
}
.comment-action:hover { background: var(--parchment); color: var(--ink); }
.comment-action.btn-delete:hover { background: #fee2e2; color: var(--red); }
.comment-action.btn-edit:hover   { background: #fef3c7; color: var(--gold-dark); }
.comment-action.btn-reply:hover  { background: #dbeafe; color: var(--blue); }
.comment-edited {
  font-size: 0.72rem; color: #aaa; font-style: italic;
  margin-left: 0.2rem;
}

/* ── 인라인 수정/답글 폼 ───────────────────────────── */
.comment-edit-form, .comment-reply-form {
  background: #fafaf7;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.6rem 0.75rem;
  margin: 0.4rem 0;
}

/* ── 삭제된 댓글 ──────────────────────────────────── */
.comment-deleted .comment-meta { opacity: 0.55; }
.comment-deleted-body {
  font-size: 0.83rem; color: #999; font-style: italic;
  padding: 0.25rem 0;
}

/* ── 관리자 더보기 (IP/위치) ───────────────────────── */
.admin-info-box {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-left: 3px solid #475569;
  border-radius: 5px;
  padding: 0.65rem 0.9rem;
  margin: 0.4rem 0;
  font-size: 0.83rem;
  color: #334155;
}
.admin-info-head {
  font-weight: 700;
  font-size: 0.78rem;
  color: #475569;
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}
.admin-info-row {
  display: flex; gap: 0.6rem;
  padding: 0.25rem 0;
  border-top: 1px dashed #cbd5e1;
}
.admin-info-row:first-of-type { border-top: none; padding-top: 0; }
.admin-info-row .lbl {
  flex-shrink: 0; min-width: 6.5rem;
  font-size: 0.76rem; color: #64748b; font-weight: 600;
}
.admin-info-row .val { flex: 1; line-height: 1.55; word-break: break-all; }
.admin-info-row code {
  background: white; padding: 0.05rem 0.35rem;
  border-radius: 3px; font-size: 0.85em;
  border: 1px solid #cbd5e1;
}
.admin-info-sub { font-size: 0.76rem; color: #64748b; margin-top: 0.15rem; }
.country-flag {
  display: inline-block;
  background: #1e293b; color: white;
  font-size: 0.68rem; font-weight: 700;
  padding: 0.05rem 0.4rem; border-radius: 3px;
  margin: 0 0.2rem;
}
.admin-info-error { color: #b91c1c; }

.comment-action.btn-admin-more { color: #64748b; }
.comment-action.btn-admin-more:hover { background: #e2e8f0; color: #1e293b; }

/* ── 오류신고 댓글 ─────────────────────────────────── */
.comment-error-report {
  background: #fff7ed;
  border-left: 3px solid #f97316;
  padding-left: 0.85rem;
  margin-left: -0.85rem;
  border-radius: 0 4px 4px 0;
}
.error-report-badge {
  display: inline-flex; align-items: center;
  font-size: 0.72rem; font-weight: 700;
  padding: 0.18rem 0.55rem; border-radius: 4px;
  background: #fed7aa; color: #9a3412;
  letter-spacing: 0.02em;
}
.error-report-badge[data-resolved="1"] {
  background: #e5e7eb; color: #6b7280; font-weight: 500;
  text-decoration: line-through;
}
.error-report-toggle input[type="checkbox"] { accent-color: #f97316; }
.error-report-toggle:hover { color: #9a3412; }

/* ── 스피너 ──────────────────────────────────────── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 3rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state { text-align: center; padding: 4rem 2rem; color: #888; }
.empty-state   { text-align: center; padding: 4rem 2rem; color: #999; }
.empty-state p { margin-top: 0.5rem; font-size: 0.9rem; }

/* ── 유틸 ────────────────────────────────────────── */
.hidden          { display: none !important; }
.flex            { display: flex; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.text-center { text-align: center; }
.text-muted  { color: #888; font-size: 0.875rem; }

/* ── 인증 모달 (이메일/비밀번호) ──────────────────── */
.auth-modal { max-width: 400px; }

.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}
.auth-tab {
  flex: 1; padding: 0.65rem;
  background: none; border: none;
  font-size: 0.95rem; font-family: var(--font-sans);
  font-weight: 500; cursor: pointer;
  color: #999; transition: all 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.auth-tab.active { color: var(--ink); border-bottom-color: var(--gold); }
.auth-tab:hover:not(.active) { color: var(--ink); }

.auth-submit-btn {
  width: 100%; padding: 0.75rem;
  font-size: 0.95rem; margin-top: 0.25rem;
  justify-content: center;
}

.auth-error {
  color: var(--red);
  font-size: 0.83rem;
  margin: -0.5rem 0 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #fff5f5;
  border-radius: 4px;
  border: 1px solid #fca5a5;
}

.auth-switch {
  text-align: center;
  font-size: 0.83rem;
  color: #888;
  margin-top: 1rem;
}
.auth-switch a { color: var(--gold); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* ── 소셜 로그인 버튼 ─────────────────────────────── */
.oauth-buttons { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.oauth-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 0.6rem; padding: 0.7rem 1rem;
  font-family: var(--font-sans); font-weight: 600; font-size: 0.9rem;
  border-radius: 5px; text-decoration: none;
  transition: all 0.15s; border: 1px solid transparent;
}
.oauth-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.oauth-google {
  background: white; color: #3c4043;
  border-color: #dadce0;
}
.oauth-google:hover { background: #f7f7f7; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.oauth-naver {
  background: #03c75a; color: white;
}
.oauth-naver:hover { background: #02b050; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }

.oauth-divider {
  display: flex; align-items: center;
  margin: 1rem 0; gap: 0.75rem;
  color: #888; font-size: 0.78rem;
}
.oauth-divider::before, .oauth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── 푸터 ─────────────────────────────────────────── */
.site-footer {
  background: var(--ink);
  color: #aaa;
  padding: 1.5rem;
  margin-top: 3rem;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-copy { font-size: 0.83rem; }
.footer-right { display: flex; align-items: center; gap: 1.5rem; }
.footer-privacy {
  font-size: 0.83rem; color: #aaa; text-decoration: none;
  transition: color 0.2s;
}
.footer-privacy:hover { color: var(--gold-light); }
.footer-logo {
  font-family: var(--font-serif); font-size: 0.95rem; font-weight: 700;
  color: white; text-decoration: none;
  display: flex; align-items: center; gap: 0.35rem;
}
.footer-logo:hover { color: var(--gold-light); }

/* ── 추천/비추천 ──────────────────────────────────────── */
.vote-bar { display: inline-flex; align-items: center; gap: 0.15rem; }
.vote-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 4px; padding: 0.2rem 0.5rem;
  font-size: 0.78rem; cursor: pointer; display: inline-flex;
  align-items: center; gap: 0.25rem; color: #888;
  transition: all 0.15s; line-height: 1;
}
.vote-btn:hover { border-color: #999; color: #555; }
.vote-btn.active-like    { border-color: var(--blue); color: var(--blue); background: #eff6ff; }
.vote-btn.active-dislike { border-color: var(--red);  color: var(--red);  background: #fff5f5; }
.vote-btn .vote-icon { font-size: 0.85rem; }
.vote-btn .vote-count { font-weight: 600; }

/* ── 토글 스위치 ──────────────────────────────────────── */
.switch {
  position: relative; display: inline-block;
  width: 44px; height: 24px; vertical-align: middle;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #ccc; transition: 0.2s; border-radius: 24px;
}
.switch .slider::before {
  position: absolute; content: "";
  height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: white; transition: 0.2s; border-radius: 50%;
}
.switch input:checked + .slider        { background: var(--gold); }
.switch input:checked + .slider::before{ transform: translateX(20px); }
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 0; gap: 1rem;
}
.switch-row + .switch-row { border-top: 1px solid rgba(0,0,0,0.04); }
.switch-label { font-size: 0.88rem; color: var(--ink); font-weight: 500; }
.switch-label .sub { display: block; font-size: 0.76rem; color: #888; font-weight: 400; margin-top: 0.2rem; }

/* ── 유저 프로필 모달 ─────────────────────────────────── */
.user-profile-modal {
  background: white; border-radius: var(--radius);
  padding: 2rem; width: 100%; max-width: 520px;
  max-height: 85vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  position: relative;
}
.user-profile-modal .modal-close {
  position: absolute; top: 0.8rem; right: 0.8rem;
  background: none; border: none; font-size: 1.5rem;
  cursor: pointer; color: #888; line-height: 1;
}
.up-header {
  display: flex; align-items: center; gap: 1.25rem;
  padding-bottom: 1.25rem; margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.up-avatar {
  width: 120px; height: 120px; border-radius: 50%;
  border: 3px solid var(--gold); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--parchment-dark); font-size: 3rem; flex-shrink: 0;
}
.up-avatar img { width: 100%; height: 100%; object-fit: cover; }
.up-name {
  font-family: var(--font-serif); font-size: 1.3rem; font-weight: 700;
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
.up-badges { display: flex; gap: 0.4rem; margin-top: 0.5rem; flex-wrap: wrap; }
.up-section { margin-bottom: 1.25rem; }
.up-section h4 {
  font-family: var(--font-serif); font-size: 0.95rem; font-weight: 700;
  margin-bottom: 0.6rem; color: var(--ink);
}
.up-field-row {
  display: grid; grid-template-columns: 120px 1fr;
  font-size: 0.85rem; padding: 0.4rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.up-field-row:last-child { border-bottom: none; }
.up-field-label { color: #888; }
.up-private-notice {
  padding: 0.9rem 1rem; background: var(--parchment);
  border-radius: var(--radius); font-size: 0.85rem;
  color: #888; text-align: center; font-style: italic;
}
.up-career-item {
  padding: 0.75rem 0; border-bottom: 1px solid rgba(0,0,0,0.04);
}
.up-career-item:last-child { border-bottom: none; }
.up-career-org { font-weight: 700; font-size: 0.92rem; }
.up-career-period { font-size: 0.78rem; color: #888; margin-top: 0.15rem; }
.up-career-pos { font-size: 0.83rem; color: var(--gold); font-weight: 600; margin-top: 0.25rem; }
.up-career-desc { font-size: 0.82rem; color: #666; line-height: 1.6; margin-top: 0.35rem; white-space: pre-wrap; }

.clickable-author { cursor: pointer; }
.clickable-author:hover { color: var(--gold); text-decoration: underline; }

/* ── Markdown 에디터 ──────────────────────────────── */
.md-editor textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.65;
  resize: vertical;
  background: #fafafa;
  color: var(--ink);
  box-sizing: border-box;
}
.md-editor textarea:focus {
  outline: none; background: white; border-color: var(--gold);
}
.md-editor.with-preview {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
}
@media (max-width: 680px) {
  .md-editor.with-preview { grid-template-columns: 1fr; }
}
.md-editor-pane { display: flex; flex-direction: column; }
.md-editor-label {
  font-size: 0.76rem; font-weight: 600; color: #666;
  margin-bottom: 0.3rem;
}
.md-editor .md-preview {
  padding: 0.8rem 1rem;
  background: #fcfaf6;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem; line-height: 1.75;
  overflow-y: auto;
}
.md-editor-help {
  grid-column: 1/-1;
  font-size: 0.76rem; color: #888; margin-top: 0.4rem;
}
.md-editor-help a { color: var(--blue); }

/* ── Markdown 렌더링 공통 스타일 ──────────────────── */
.md-body h1, .md-body h2, .md-body h3, .md-body h4, .md-body h5, .md-body h6 {
  font-family: var(--font-serif); font-weight: 700;
  margin: 0.8rem 0 0.4rem; color: var(--ink);
}
.md-body h1 { font-size: 1.35rem; }
.md-body h2 { font-size: 1.2rem; }
.md-body h3 { font-size: 1.05rem; }
.md-body h4 { font-size: 0.95rem; }
.md-body p { margin: 0.4rem 0; text-align: justify; word-break: keep-all; }
.md-body ul, .md-body ol { padding-left: 1.4rem; margin: 0.4rem 0; }
.md-body li { margin-bottom: 0.2rem; text-align: justify; word-break: keep-all; }
.md-body a { color: var(--blue); text-decoration: underline; }
.md-body a:hover { color: var(--gold); }
.md-body blockquote {
  border-left: 3px solid var(--gold); padding: 0.3rem 0.75rem;
  margin: 0.4rem 0; color: #555;
  text-align: justify; word-break: keep-all;
}

/* ── 판례 / 법령 blockquote 구분 ──────────────────── */
/* 법령(시행령·시행규칙 포함): solid 외곽선 + 황금색 톤(양피지 계열) + 📖 아이콘 */
.md-body blockquote.bq-statute,
.ai-explanation .exp-body blockquote.bq-statute {
  border: 2px solid #d4ac0d;
  border-left-width: 5px;
  border-radius: 6px;
  background: #fffbeb;
  color: #4a3a10;
  padding: 0.6rem 0.9rem 0.6rem 2.5rem;
  position: relative;
}
.md-body blockquote.bq-statute::before,
.ai-explanation .exp-body blockquote.bq-statute::before {
  content: "📖";
  position: absolute;
  left: 0.7rem;
  top: 0.55rem;
  font-size: 1.05rem;
  line-height: 1;
}
/* 판례: dotted 외곽선 + 푸른 잉크 톤 + ⚖️ 아이콘 */
.md-body blockquote.bq-precedent,
.ai-explanation .exp-body blockquote.bq-precedent {
  border: 2.5px dotted #2563eb;
  border-radius: 6px;
  background: #eff6ff;
  color: #1e3a5c;
  padding: 0.6rem 0.9rem 0.6rem 2.5rem;
  position: relative;
}
.md-body blockquote.bq-precedent::before,
.ai-explanation .exp-body blockquote.bq-precedent::before {
  content: "⚖️";
  position: absolute;
  left: 0.7rem;
  top: 0.55rem;
  font-size: 1.05rem;
  line-height: 1;
}
.md-body blockquote.bq-statute > :first-child,
.md-body blockquote.bq-precedent > :first-child,
.ai-explanation .exp-body blockquote.bq-statute > :first-child,
.ai-explanation .exp-body blockquote.bq-precedent > :first-child { margin-top: 0; }
.md-body blockquote.bq-statute > :last-child,
.md-body blockquote.bq-precedent > :last-child,
.ai-explanation .exp-body blockquote.bq-statute > :last-child,
.ai-explanation .exp-body blockquote.bq-precedent > :last-child { margin-bottom: 0; }

/* ── 모바일: 법령/판례 blockquote 를 좌측 컬러바로 단순화 ───────────── */
/* 작은 화면에서는 박스 테두리·아이콘 들여쓰기(2.5rem)가 한 줄 글자수를 크게 깎아
   가독성이 나쁘다. 박스를 없애고 좌측 색 바(법령=금색 / 판례=파랑) + 옅은 배경 틴트만
   남겨 본문폭을 최대화한다. 아이콘은 첫 줄 앞으로 흐르도록 float 처리. (배경 틴트·글자색은
   위의 기본 규칙을 그대로 유지) */
@media (max-width: 600px) {
  .md-body blockquote.bq-statute,
  .md-body blockquote.bq-precedent,
  .ai-explanation .exp-body blockquote.bq-statute,
  .ai-explanation .exp-body blockquote.bq-precedent {
    border: none;
    border-radius: 0;
    border-left: 3px solid #d4ac0d;            /* 법령=금색 (판례는 아래에서 파랑) */
    padding: 0.3rem 0.55rem 0.3rem 0.65rem;
  }
  .md-body blockquote.bq-precedent,
  .ai-explanation .exp-body blockquote.bq-precedent {
    border-left-color: #2563eb;                /* 판례=파랑 */
  }
  .md-body blockquote.bq-statute::before,
  .md-body blockquote.bq-precedent::before,
  .ai-explanation .exp-body blockquote.bq-statute::before,
  .ai-explanation .exp-body blockquote.bq-precedent::before {
    position: static;
    float: left;
    top: auto; left: auto;
    margin: 0.1rem 0.3rem 0 0;
    font-size: 0.9rem;
  }
}
.md-body code {
  background: rgba(0,0,0,0.06); padding: 0.1rem 0.35rem;
  border-radius: 3px; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.88em;
}
.md-body pre {
  background: rgba(0,0,0,0.06); padding: 0.7rem 0.9rem;
  border-radius: 5px; overflow-x: auto; margin: 0.4rem 0;
}
.md-body pre code { background: none; padding: 0; }
.md-body img { max-width: 100%; border-radius: 4px; margin: 0.3rem 0; }
.md-body hr { border: none; border-top: 1px solid rgba(0,0,0,0.15); margin: 0.6rem 0; }
.md-body table { border-collapse: collapse; margin: 0.4rem 0; font-size: 0.88em; }
.md-body th, .md-body td { border: 1px solid rgba(0,0,0,0.15); padding: 0.3rem 0.6rem; }
.md-body th { background: rgba(0,0,0,0.05); font-weight: 700; }
.md-body .footnotes {
  margin-top: 1rem; padding-top: 0.5rem;
  border-top: 1px dashed rgba(0,0,0,0.2);
  font-size: 0.82rem; color: #666;
}
.md-body sup.footnote-ref a { color: var(--gold); font-weight: 700; }

/* ── 태그 & 연관 문제 ─────────────────────────────── */
.q-tags {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  margin: 0.75rem 0;
}
.q-tag {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem;
  background: var(--parchment); border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.76rem; color: #666;
  font-weight: 500;
}
.q-tag::before { content: "#"; color: var(--gold); margin-right: 0.15rem; font-weight: 700; }

.related-section {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: #fbf8f0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.related-section h3 {
  font-family: var(--font-serif); font-size: 1rem; font-weight: 700;
  margin-bottom: 0.8rem;
  display: flex; align-items: center; gap: 0.4rem;
}
.related-list {
  display: grid; grid-template-columns: 1fr; gap: 0.5rem;
}
.related-item {
  background: white; border: 1px solid var(--border);
  border-radius: 5px; padding: 0.7rem 0.95rem;
  cursor: pointer; transition: all 0.15s;
  display: grid; grid-template-columns: auto 1fr auto; gap: 0.6rem;
  align-items: center;
}
.related-item:hover { border-color: var(--gold); transform: translateX(2px); box-shadow: 0 2px 6px var(--shadow); }
.related-item-num {
  font-family: var(--font-serif); font-size: 0.8rem; font-weight: 700;
  color: var(--gold); white-space: nowrap;
}
.related-item-preview {
  font-size: 0.84rem; color: #444;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-height: 1.5;
}
.related-item-score {
  font-size: 0.68rem; background: var(--gold); color: white;
  padding: 0.1rem 0.4rem; border-radius: 10px; font-weight: 700;
  white-space: nowrap;
}

/* ── 매칭된 표준판례 ─────────────────────── */
.mp-list { display: flex; flex-direction: column; gap: 0.5rem; }
.mp-item {
  display: block;
  background: white; border: 1px solid var(--border);
  border-radius: 5px; padding: 0.7rem 0.95rem;
  transition: all 0.15s;
  text-decoration: none; color: inherit;
  cursor: pointer;
}
.mp-item:hover { border-color: var(--gold); box-shadow: 0 2px 6px var(--shadow); }
.mp-item-top {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  align-items: center; margin-bottom: 0.3rem;
}
.mp-cat {
  font-size: 0.74rem; color: #999;
  margin-bottom: 0.3rem;
  line-height: 1.4;
}
.mp-badge {
  font-size: 0.68rem; font-weight: 700;
  padding: 0.1rem 0.4rem; border-radius: 4px;
  letter-spacing: 0.03em;
}
.mp-badge-sc  { background: #dbeafe; color: #1d4ed8; }
.mp-badge-cc  { background: #fce7f3; color: #a21caf; }
.mp-badge-etc { background: #f3f4f6; color: #6b7280; }
.mp-citation { font-size: 0.78rem; color: #555; font-weight: 500; }
.mp-source-link {
  margin-left: auto;
  font-size: 0.7rem; color: var(--blue);
  text-decoration: none; font-weight: 500;
  padding: 0.1rem 0.35rem; border-radius: 3px;
}
.mp-source-link:hover { background: rgba(26,79,138,0.08); text-decoration: underline; }
.mp-topic {
  font-family: var(--font-serif); font-weight: 600;
  font-size: 0.92rem; color: var(--ink);
  line-height: 1.5; margin-bottom: 0.3rem;
}
.mp-preview {
  font-size: 0.8rem; color: #666;
  line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}
