:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --line: #dfe3ea;
  --text: #1b2330;
  --muted: #677386;
  --primary: #1f5eff;
  --primary-ink: #ffffff;
  --pass: #12805c;
  --pass-soft: #e3f5ee;
  --fail: #c8312f;
  --fail-soft: #fbe8e7;
  --none-soft: #eef1f5;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 32px 16px; }
.wrap.narrow { max-width: 440px; padding-top: 10vh; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.error { color: var(--fail); font-size: 14px; margin: 0; }

.brand { margin-bottom: 24px; }
.eyebrow { margin: 0 0 4px; color: var(--primary); font-weight: 600; font-size: 14px; }
.brand h1 { font-size: 28px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
form { display: grid; gap: 16px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
input, select {
  font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }

.btn {
  font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 8px; padding: 10px 16px; cursor: pointer;
  background: var(--none-soft); color: var(--text); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; padding: 13px; }
.btn.danger { color: var(--fail); border-color: var(--line); background: transparent; }

/* 분야 선택 */
.cats { display: grid; gap: 12px; margin-top: 16px; }
.cat {
  display: grid; gap: 10px; padding: 22px; text-decoration: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color .15s;
}
.cat:hover { border-color: var(--primary); }
.cat-head { display: flex; justify-content: space-between; align-items: baseline; }
.cat-name { font-size: 20px; font-weight: 700; }
.cat-prog { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--none-soft); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .3s; }

/* 심사 화면 */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 17px; flex: 1; }
.prog { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

.review { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; padding: 16px; max-width: 1600px; margin: 0 auto; }
.stage {
  background: #0d1117; border-radius: var(--radius); min-height: 60vh; height: calc(100vh - 90px);
  display: flex; align-items: center; justify-content: center; overflow: hidden; position: sticky; top: 74px;
}
.stage video, .stage img { max-width: 100%; max-height: 100%; display: block; }
.stage img { cursor: zoom-in; }
.stage iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.stage .placeholder { color: #9aa4b2; }

.panel { display: grid; gap: 16px; align-content: start; }
.panel .card { padding: 20px; display: grid; gap: 14px; }
.counter { margin: 0; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.entry-title { font-size: 20px; word-break: keep-all; overflow-wrap: anywhere; }
.status { margin: 0; font-weight: 600; font-size: 14px; padding: 6px 10px; border-radius: 6px; justify-self: start; }
.status.pass { color: var(--pass); background: var(--pass-soft); }
.status.fail { color: var(--fail); background: var(--fail-soft); }
.status.none { color: var(--muted); background: var(--none-soft); }

.decide { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.decide .btn { padding: 18px 0; font-size: 18px; border-width: 2px; background: var(--surface); }
.btn.pass { color: var(--pass); border-color: var(--pass); }
.btn.fail { color: var(--fail); border-color: var(--fail); }
.btn.pass.on { background: var(--pass); color: #fff; }
.btn.fail.on { background: var(--fail); color: #fff; }
.navs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.chip {
  font: inherit; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 7px 0; border-radius: 6px;
  border: 2px solid transparent; background: var(--none-soft); color: var(--muted); cursor: pointer;
}
.chip.pass { background: var(--pass-soft); color: var(--pass); }
.chip.fail { background: var(--fail-soft); color: var(--fail); }
.chip.current { border-color: var(--text); }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; background: var(--none-soft); }
.legend .l-pass::before { background: var(--pass); }
.legend .l-fail::before { background: var(--fail); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 20;
}

@media (max-width: 900px) {
  .review { grid-template-columns: 1fr; padding: 12px; }
  .stage { position: static; height: auto; min-height: 240px; max-height: 70vh; }
  .stage iframe { height: 70vh; }
}

/* 관리자 */
.admin-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; color: var(--muted); cursor: pointer; }
.tab.on { color: var(--text); border-bottom-color: var(--primary); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: 72vh; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
th { position: sticky; top: 0; background: #f8f9fb; font-weight: 600; z-index: 1; }
td.title, th.title { text-align: left; white-space: normal; min-width: 220px; }
td.num { font-variant-numeric: tabular-nums; color: var(--muted); }
td.r-pass { color: var(--pass); font-weight: 600; }
td.r-fail { color: var(--fail); }
td.r-none { color: #b3bac6; }
td.total, th.total { position: sticky; right: 0; background: #f3f6ff; font-weight: 700; font-variant-numeric: tabular-nums; }
th.total { z-index: 2; }
tbody tr:hover td { background: #fafbfd; }
tbody tr:hover td.total { background: #e9efff; }
