/* QA Auditor(게임 QA·감사기) — style.css */

:root {
  --bg: #f9f9f7;
  --bg-elev: #fcfcfb;
  --bg-sunk: #f0efec;
  --text: #0b0b0b;
  --text-dim: #52514e;
  --text-muted: #898781;
  --border: #e1e0d9;
  --border-strong: #c3c2b7;
  --accent: #4a3aa7;
  --accent-hover: #3a2d87;
  --accent-soft: #ece9fa;
  --good: #0ca30c;
  --warn: #c98500;
  --danger: #e34948;
  --sev-critical: #b3261e;
  --sev-high: #d97706;
  --sev-medium: #4a3aa7;
  --sev-low: #8a90a0;
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, "Cascadia Code", Consolas, "D2Coding", monospace;
  --sans: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
  --shadow: 0 1px 2px rgba(16, 20, 30, .06), 0 8px 24px rgba(16, 20, 30, .06);
}

html[data-theme="dark"] {
  --bg: #0d0d0d;
  --bg-elev: #1a1a19;
  --bg-sunk: #151514;
  --text: #ffffff;
  --text-dim: #c3c2b7;
  --text-muted: #898781;
  --border: #2c2c2a;
  --border-strong: #383835;
  --accent: #9085e9;
  --accent-hover: #a7a0ee;
  --accent-soft: #211c3a;
  --good: #0ca30c;
  --warn: #c98500;
  --danger: #e66767;
  --sev-critical: #f0736a;
  --sev-high: #e0a34a;
  --sev-medium: #9085e9;
  --sev-low: #9aa0ae;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #0d0d0d;
    --bg-elev: #1a1a19;
    --bg-sunk: #151514;
    --text: #ffffff;
    --text-dim: #c3c2b7;
    --text-muted: #898781;
    --border: #2c2c2a;
    --border-strong: #383835;
    --accent: #9085e9;
    --accent-hover: #a7a0ee;
    --accent-soft: #211c3a;
    --good: #0ca30c;
    --warn: #c98500;
    --danger: #e66767;
    --sev-critical: #f0736a;
    --sev-high: #e0a34a;
    --sev-medium: #9085e9;
    --sev-low: #9aa0ae;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; }

/* ---------- 본문 바로가기(키보드 사용자용) ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px;
  border-radius: 0 0 8px 0; text-decoration: none; font-size: 14px; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- 상단바 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 58px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; cursor: pointer; }
.brand-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 15px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; letter-spacing: -.01em; }
.brand-text small { color: var(--text-dim); font-size: 11.5px; }
.brand:hover .brand-text strong { color: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- 테마 선택 ---------- */
.theme-switch {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--bg-sunk); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px;
}
.theme-opt {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: none; border-radius: 999px;
  color: var(--text-dim); font-family: inherit; font-size: 12.5px; font-weight: 600;
  padding: 5px 11px; cursor: pointer; white-space: nowrap; transition: .15s;
}
.theme-opt:hover { color: var(--text); }
.theme-opt[aria-checked="true"] { background: var(--bg-elev); color: var(--accent); box-shadow: 0 1px 2px rgba(16, 20, 30, .12); }
.theme-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.theme-ico { font-size: 12.5px; line-height: 1; }

/* ---------- 히어로 ---------- */
.hero { padding: 40px 0 26px; }
.hero h1 { margin: 0 0 12px; font-size: 27px; line-height: 1.35; letter-spacing: -.02em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-sub { margin: 0; color: var(--text-dim); max-width: 760px; }

/* ---------- 카드 ---------- */
.card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; display: flex; align-items: center; gap: 9px; }
.card-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.step-no {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
}
.hidden { display: none !important; }
.muted { color: var(--text-dim); font-weight: 400; }
.small { font-size: 12.8px; }
.note-card h2 { font-size: 15px; margin: 0 0 8px; }
.note-card p { margin: 0 0 8px; }

/* ---------- 버튼 ---------- */
.primary-btn, .ghost-btn, .danger-btn {
  font-family: inherit; font-size: 14px; font-weight: 600;
  border-radius: var(--radius-sm); padding: 9px 18px; cursor: pointer;
  border: 1px solid transparent; transition: .15s; text-decoration: none; display: inline-block;
}
.primary-btn { background: var(--accent); color: #fff; }
.primary-btn:hover { background: var(--accent-hover); }
.primary-btn:disabled { opacity: .5; cursor: not-allowed; }
.ghost-btn { background: transparent; color: var(--text-dim); border-color: var(--border-strong); }
.ghost-btn:hover { color: var(--text); border-color: var(--accent); }
.danger-btn { background: transparent; color: var(--danger); border-color: var(--danger); }
.danger-btn:hover { background: var(--danger); color: #fff; }
.primary-btn.small, .ghost-btn.small, .danger-btn.small { padding: 6px 13px; font-size: 13px; }
.primary-btn.tiny, .ghost-btn.tiny, .danger-btn.tiny { padding: 3px 9px; font-size: 12px; }
.badge {
  background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 3px 11px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 5px; white-space: nowrap; }

/* ---------- 폼 ---------- */
textarea, input[type="text"], input[type="number"], input[type="url"], input[type="search"], select {
  width: 100%;
  background: var(--bg-sunk); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; font-family: inherit; font-size: 14.5px; line-height: 1.6;
}
textarea { resize: vertical; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
.field small.muted { font-size: 12px; }
.inline-field {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.8px; color: var(--text-dim); white-space: nowrap;
}
.inline-field select, .inline-field input { width: auto; min-width: 120px; padding: 6px 10px; font-size: 13.5px; }
.inline-field.grow { flex: 1 1 200px; min-width: 180px; }
.inline-field.grow input { width: 100%; }
.mini-input { padding: 4px 7px !important; font-size: 12.5px !important; min-width: 0; }

.rules-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }

/* ---------- 상태/진행 ---------- */
.status-line { font-size: 12.8px; color: var(--text-dim); }
.status-line.error { color: var(--danger); }
.progress { height: 6px; background: var(--bg-sunk); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------- 드롭존 ---------- */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  padding: 26px 20px; text-align: center; cursor: pointer; transition: .15s;
  background: var(--bg-sunk);
}
.dropzone:hover, .dropzone.over, .dropzone:focus-visible {
  border-color: var(--accent); background: var(--accent-soft); outline: none;
}
.dropzone-inner { display: flex; flex-direction: column; gap: 5px; align-items: center; }
.dz-ico { font-size: 26px; }

/* ---------- 문서 목록 ---------- */
.doc-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.doc-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 13px; background: var(--bg-sunk);
}
.doc-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.doc-main strong { font-size: 14px; overflow-wrap: anywhere; }
.doc-warn { color: var(--warn); }
.doc-preview {
  background: var(--bg-sunk); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; max-height: 46vh; overflow: auto; white-space: pre-wrap;
  font-family: var(--mono); font-size: 12px; line-height: 1.6; margin: 0;
}

/* ---------- 요약 ---------- */
.summary { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.sum-box {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 15px; min-width: 84px; background: var(--bg-sunk);
}
.sum-box strong { display: block; font-size: 20px; line-height: 1.2; }
.sum-box span { font-size: 12px; color: var(--text-dim); }
.sum-critical { border-left: 4px solid var(--sev-critical); }
.sum-high { border-left: 4px solid var(--sev-high); }
.sum-medium { border-left: 4px solid var(--sev-medium); }
.sum-low { border-left: 4px solid var(--sev-low); }

/* ---------- 심각도 배지 ---------- */
.sev {
  display: inline-block; border-radius: 999px; padding: 2px 10px;
  font-size: 12px; font-weight: 700; color: #fff; white-space: nowrap;
}
.sev-critical { background: var(--sev-critical); }
.sev-high { background: var(--sev-high); }
.sev-medium { background: var(--sev-medium); }
.sev-low { background: var(--sev-low); }

/* ---------- 테이블 ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th, .data-table td { border-bottom: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.data-table td.wrap-cell { white-space: normal; }
.data-table th { color: var(--text-dim); font-weight: 600; font-size: 12.5px; background: var(--bg-sunk); }
.data-table code { font-family: var(--mono); font-size: 12px; }
.findings-table tbody tr:hover { background: var(--bg-sunk); }
.finding-title { font-weight: 600; }
.finding-sub { margin-top: 1px; }
.row-done { opacity: .55; }
.row-done .finding-title { text-decoration: line-through; }
.table-empty { color: var(--text-muted); font-size: 13.5px; padding: 20px 0; text-align: center; }

/* ---------- 모달 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 12, 18, .55);
  display: grid; place-items: center; padding: 20px; overflow-y: auto;
}
.modal-box {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; max-width: 560px; width: 100%; box-shadow: var(--shadow);
  max-height: 90vh; min-height: 0; overflow-y: auto;
}
.modal-box.wide { max-width: 780px; }
.modal-box h2 { margin-top: 0; font-size: 19px; }
.modal-box h3 { font-size: 14.5px; margin: 18px 0 6px; }
.help-list { padding-left: 20px; margin: 0; display: flex; flex-direction: column; gap: 7px; font-size: 14px; }
.help-list code { background: var(--bg-sunk); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 12.5px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.detail-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.evidence {
  margin: 0 0 4px; padding: 10px 14px; border-left: 3px solid var(--border-strong);
  background: var(--bg-sunk); white-space: pre-wrap; font-size: 14px;
}
.doc-note {
  background: var(--bg-sunk); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 13px; color: var(--text-dim); margin: 16px 0 0;
}

/* ---------- 푸터 ---------- */
.foot { padding: 30px 20px 44px; color: var(--text-dim); font-size: 12.5px; text-align: center; }
.foot p { margin: 0; }
.foot-links { display: flex; justify-content: center; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.foot-links a { color: var(--text-dim); text-decoration: none; font-size: 12.5px; }
.foot-links a:hover { color: var(--accent); }
.foot-links span { color: var(--border-strong); }

/* ---------- 정적 문서 페이지 (가이드 / 방침 / 약관) ---------- */
.doc { padding: 32px 0 60px; max-width: 820px; }
.doc .back-link {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--text-dim); text-decoration: none; font-size: 13.5px; margin-bottom: 20px;
}
.doc .back-link:hover { color: var(--accent); }
.doc h1 { font-size: 23px; margin: 0 0 6px; letter-spacing: -.02em; }
.doc-meta { color: var(--text-dim); font-size: 13px; margin: 0 0 26px; }
.doc h2 { font-size: 17px; margin: 1.9em 0 .6em; letter-spacing: -.01em; border-bottom: 1px solid var(--border); padding-bottom: .3em; }
.doc h3 { font-size: 14.5px; margin: 1.5em 0 .4em; }
.doc p, .doc li { margin: .55em 0; font-size: 14.5px; line-height: 1.75; }
.doc ul, .doc ol { padding-left: 1.4em; margin: .6em 0; }
.doc a { color: var(--accent); }
.doc code {
  background: var(--bg-sunk); padding: 1px 5px; border-radius: 4px;
  font-family: var(--mono); font-size: 12.8px;
}
.doc table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 13.5px; }
.doc th, .doc td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--bg-sunk); font-weight: 600; }
.doc blockquote {
  margin: 1em 0; padding: 10px 15px; border-left: 3px solid var(--accent);
  background: var(--bg-sunk); color: var(--text-dim);
}
.doc-note-box {
  background: var(--bg-sunk); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 13.5px; color: var(--text-dim); margin: 1.6em 0 0;
}

/* ---------- 반응형 ---------- */
@media (max-width: 720px) {
  .hero { padding: 28px 0 20px; }
  .hero h1 { font-size: 21px; }
  .card { padding: 16px; }
  .topbar-inner { height: 52px; }
  .theme-label { display: none; }
  .theme-opt { padding: 5px 9px; }
  .theme-ico { font-size: 14px; }
  .card-head-actions { width: 100%; }
  .findings-table th:nth-child(4), .findings-table td:nth-child(4) { display: none; }
}
