/* © 2026 김용현 */
/* 편집기(index.html)와 관리자(admin.html)가 함께 쓰는 스타일 — 흑백 에디토리얼 */
:root {
  --bg: #ffffff; --panel: #ffffff; --line: #e5e5e5; --line-strong: #d4d4d4;
  --text: #000000; --muted: #606060; --faint: #a3a3a3;
  --accent: #000000; --accent-ink: #ffffff;
  --danger: #c62828; --ok: #1b7f3b; --warn: #9a6200;
  --code-bg: #fafafa; --stage: #f2f2f2; --hover: rgba(0, 0, 0, .04);
  --foot-bg: #000000;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0b; --panel: #0b0b0b; --line: #262626; --line-strong: #3a3a3a;
    --text: #f5f5f5; --muted: #a3a3a3; --faint: #6b6b6b;
    --accent: #ffffff; --accent-ink: #000000;
    --danger: #ff7b7b; --ok: #6ee7a0; --warn: #f5c86b;
    --code-bg: #111111; --stage: #050505; --hover: rgba(255, 255, 255, .06);
    --foot-bg: #000000;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.6 Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  letter-spacing: -0.3px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 머리줄 ---------- */
header.top {
  display: flex; align-items: center; gap: 28px; height: 72px; padding: 0 40px; flex: 0 0 auto;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 14px; margin-right: auto; min-width: 0; text-decoration: none; color: var(--text); }
.brand b { font-size: 21px; font-weight: 700; letter-spacing: -0.8px; white-space: nowrap; }
.brand span {
  font-size: 13px; color: var(--faint); white-space: nowrap; letter-spacing: 0;
  padding-left: 14px; border-left: 1px solid var(--line-strong); line-height: 1;
}
.brand a, .brand a:link, .brand a:visited, .brand a:hover, .brand a:active { color: inherit; text-decoration: none; }
.brand span a:hover { text-decoration: underline; }
nav.gnb { display: flex; align-items: center; gap: 24px; }
nav.gnb a, nav.gnb button {
  font: inherit; font-size: 15px; color: var(--faint); background: none; border: 0; padding: 4px 0;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
nav.gnb a:hover, nav.gnb button:hover { color: var(--text); }
nav.gnb .on { color: var(--text); font-weight: 600; }
@media (max-width: 760px) {
  header.top { padding: 0 16px; gap: 16px; height: 60px; }
  .brand span { display: none; }
  .brand b { font-size: 18px; }
  nav.gnb { gap: 16px; }
}

/* ---------- 버튼 ---------- */
button, .btn {
  font: inherit; font-size: 14px; line-height: 1.5; letter-spacing: -0.3px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--text);
  border-radius: 2px; padding: 6px 14px; cursor: pointer; white-space: nowrap;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  transition: background-color .15s ease, border-color .15s ease;
}
button:hover:not(:disabled), .btn:hover { background: var(--hover); }
.primary { background: var(--accent) !important; border-color: var(--accent) !important; color: var(--accent-ink) !important; font-weight: 600; }
.primary:hover:not(:disabled) { opacity: .86; }
.danger { color: var(--danger) !important; }
button.on { border-color: var(--text); color: var(--text); font-weight: 600; }
button:disabled { opacity: .4; cursor: not-allowed; }
.small { padding: 3px 10px !important; font-size: 13px; }

/* ---------- 입력 ---------- */
input[type=text], input[type=password], input[type=url], input[type=search] {
  font: inherit; font-size: 15px; padding: 9px 2px; border: 0; border-bottom: 1px solid var(--line-strong);
  border-radius: 0; background: transparent; color: var(--text); width: 100%; outline: none;
}
input[type=text]:focus, input[type=password]:focus, input[type=url]:focus, input[type=search]:focus { border-bottom-color: var(--text); }
input::placeholder { color: var(--faint); }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
label.field { display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
label.check { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; white-space: nowrap; cursor: pointer; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.hint.ok { color: var(--ok); } .hint.err { color: var(--danger); }

/* ---------- 대화상자 ---------- */
dialog {
  border: 1px solid var(--line-strong); border-radius: 3px; background: var(--panel); color: var(--text);
  padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .18);
}
dialog::backdrop { background: rgba(0, 0, 0, .5); }
.dlg-head { display: flex; align-items: center; gap: 8px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 20px; font-weight: 300; letter-spacing: -0.6px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-body { padding: 20px 24px; display: grid; gap: 16px; }
.dlg-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 480px) {
  .grid2 { grid-template-columns: 1fr; }
  .dlg-head, .dlg-body, .dlg-foot { padding-left: 16px; padding-right: 16px; }
}

/* ---------- 상태 줄 ---------- */
.status { flex: 1; min-width: 200px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status.ok { color: var(--ok); }
.status.err { color: var(--danger); }
.status.warn { color: var(--warn); }
.status a { color: var(--text); font-weight: 600; text-underline-offset: 3px; }

/* ---------- 검은 바닥줄 (참고 양식의 푸터) ---------- */
.foot-dark {
  --text: #ffffff; --muted: #a3a3a3; --faint: #6b6b6b; --line: #2a2a2a; --line-strong: #444444;
  --accent: #ffffff; --accent-ink: #000000; --hover: rgba(255, 255, 255, .08);
  --ok: #6ee7a0; --danger: #ff8a8a; --warn: #f5c86b;
  background: var(--foot-bg); color: var(--text);
}

/* ---------- 코드 편집 + 미리보기 ---------- */
textarea.code {
  flex: 1; width: 100%; border: 0; resize: none; padding: 18px 24px; outline: none;
  font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0;
  background: var(--code-bg); color: var(--text); tab-size: 2; white-space: pre; overflow: auto;
}
textarea.code::placeholder { color: var(--faint); font-family: Pretendard, sans-serif; font-size: 15px; }
textarea.code.drag { outline: 1px dashed var(--text); outline-offset: -12px; }
.stage { flex: 1; display: flex; justify-content: center; background: var(--stage); min-height: 0; overflow: auto; }
.stage iframe { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
.stage.mobile iframe { width: 390px; max-width: 100%; box-shadow: 0 0 0 1px var(--line-strong); }
