@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700;800&display=swap');

/* ═══════════════════════════════════════════════════════════
   AG YAML — YAML ↔ JSON 변환기 (2120 / agyaml)
   DesignKit Console 킷 변형: 웜 터미널 · 모노스페이스 · 신호등 헤더.
   변형 포인트 — amber/gold 기본(형제 2105 green·2106 violet·2108 cyan·
   2109 blue·2110 magenta 와 색으로 구분), 중앙 워크벤치가 아닌
   좌우 듀얼페인 에디터 + 가운데 방향 토글(Console 원본에 없음).
═══════════════════════════════════════════════════════════ */

:root {
  /* ── 컬러(다크 amber 기본) ── */
  --primary:#F59E0B; --primary-dark:#D97706; --accent:#FCD34D;
  --grad:linear-gradient(135deg,#F59E0B,#FCD34D);
  --bg:#100D08; --surface:#1A150D; --surface-2:#141009;
  --border:#2A2114; --border-2:#3D2F1A; --border-soft:#221B10;
  --text:#EDE6D8; --text-strong:#FBF6EC; --text-2:#B7A98C; --text-3:#7E7050;
  --ok:#F59E0B; --err:#F87171; --warn:#FBBF24;
  --primary-alpha: color-mix(in srgb, var(--primary) 18%, transparent);
  --primary-glow:  color-mix(in srgb, var(--primary) 30%, transparent);

  /* ── 형태·모션(킷 고유) ── */
  --bd:1px;
  --r-1:5px; --r-2:6px; --r-3:8px; --r-4:10px;
  --sh-1:0 1px 2px rgba(0,0,0,.34);
  --sh-2:0 4px 14px rgba(0,0,0,.42);
  --glow:0 0 0 1px var(--primary-alpha), 0 8px 24px var(--primary-glow);
  --ease:cubic-bezier(.4,0,.2,1);
  --ease-out:cubic-bezier(.16,1,.3,1);
  --t1:130ms; --t2:240ms;
  /* 레거시 인라인 호환 */
  --bg-card:var(--surface); --text-primary:var(--text-strong);
  --text-secondary:var(--text-2); --text-muted:var(--text-3);
  --accent-primary:var(--primary);
}

/* ── 라이트 모드(웜 크림) ── */
[data-theme="light"] {
  --primary:#B45309; --primary-dark:#92400E; --accent:#D97706;
  --grad:linear-gradient(135deg,#B45309,#D97706);
  --bg:#FBF7EF; --surface:#FFFFFF; --surface-2:#F5EEE0;
  --border:#E9DEC8; --border-2:#DCCBA6; --border-soft:#F0E7D6;
  --text:#2B2318; --text-strong:#1A150D; --text-2:#6B5D42; --text-3:#9C8B6A;
  --ok:#B45309; --err:#DC2626; --warn:#D97706;
}

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

body {
  font-family:'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
  color:var(--text);
  min-height:100vh;
  display:flex; flex-direction:column; align-items:center;
  padding:0 20px 80px;
  overflow-x:hidden;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 33px, color-mix(in srgb, var(--text-strong) 3%, transparent) 34px),
    radial-gradient(1000px 520px at 84% -12%, color-mix(in srgb, var(--primary) 9%, transparent), transparent 60%),
    var(--bg);
  background-attachment:fixed;
}

/* ─── HEADER ─── */
.site-header {
  position:sticky; top:0; z-index:50;
  width:100vw; margin-bottom:8px;
  border-bottom:var(--bd) solid var(--border);
  background:color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px);
}
.site-header__inner {
  max-width:1040px; margin:0 auto; height:58px; padding:0 22px;
  display:flex; align-items:center; justify-content:space-between;
}
.site-header__logo { display:inline-flex; align-items:center; gap:10px; text-decoration:none; color:var(--text-strong); font-weight:800; }
.logo-badge {
  position:relative; width:34px; height:30px;
  display:inline-flex; align-items:flex-end; justify-content:center; padding-bottom:5px;
  border-radius:var(--r-2); border:var(--bd) solid var(--border-2);
  background:var(--surface-2); color:var(--primary); overflow:hidden;
}
.logo-badge::before {
  content:''; position:absolute; top:6px; left:7px;
  width:6px; height:6px; border-radius:50%;
  background:var(--err); box-shadow:9px 0 0 var(--warn), 18px 0 0 var(--primary);
}
.logo-badge svg { width:16px; height:16px; }
.logo-text { display:inline-flex; flex-direction:column; line-height:1.12; gap:1px; }
.logo-main { font-size:1.02rem; font-weight:800; letter-spacing:-0.02em; color:var(--text-strong); }
.logo-main .accent { color:var(--primary); }
.logo-sub { font-size:0.56rem; font-weight:700; letter-spacing:0.2em; color:var(--text-3); }

.header-actions { display:flex; align-items:center; gap:6px; }
.site-header__nav { display:flex; align-items:center; gap:4px; }
.site-header__nav a {
  font-size:0.8rem; font-weight:500; color:var(--text-2); text-decoration:none;
  padding:7px 11px; border-radius:var(--r-1); border:var(--bd) solid transparent;
  transition:all var(--t1) var(--ease);
}
.site-header__nav a:hover { color:var(--primary); border-color:var(--border-2); background:var(--surface-2); }
.theme-toggle-btn {
  width:36px; height:36px; display:inline-flex; align-items:center; justify-content:center;
  background:var(--surface-2); border:var(--bd) solid var(--border-2); border-radius:var(--r-1);
  color:var(--text-2); cursor:pointer; transition:all var(--t1) var(--ease);
}
.theme-toggle-btn:hover { color:var(--primary); border-color:var(--primary); }
.theme-toggle-btn svg { width:17px; height:17px; }
.lang-select {
  font-family:inherit; font-size:0.78rem; font-weight:600; color:var(--text-2);
  background:var(--surface-2); border:var(--bd) solid var(--border-2); border-radius:var(--r-1);
  padding:7px 26px 7px 11px; cursor:pointer; outline:none;
  appearance:none; -webkit-appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237E7050' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 10px center;
  transition:border-color var(--t1) var(--ease), color var(--t1) var(--ease);
}
.lang-select:hover { border-color:var(--primary); color:var(--text-strong); }
@media (max-width:420px){ .lang-select { display:none; } }
.theme-toggle-btn .ic-dark { display:none; }
[data-theme="light"] .theme-toggle-btn .ic-light { display:none; }
[data-theme="light"] .theme-toggle-btn .ic-dark { display:inline-flex; }
@media (max-width:560px){ .site-header__nav { display:none; } }

/* ─── HERO ─── */
.hero { width:100%; max-width:1040px; margin:34px auto 6px; text-align:left; }
.hero-icon {
  display:inline-flex; align-items:center; justify-content:center;
  width:52px; height:52px; margin-bottom:18px;
  background:var(--surface-2); border:var(--bd) solid var(--border-2);
  color:var(--primary); border-radius:var(--r-3);
  box-shadow:var(--sh-2), inset 0 0 0 1px color-mix(in srgb, var(--primary) 16%, transparent);
}
.hero-icon svg { width:26px; height:26px; }
.hero h1 {
  font-size:clamp(1.8rem, 5vw, 2.7rem); font-weight:800; color:var(--text-strong);
  letter-spacing:-0.03em; line-height:1.14; margin-bottom:14px;
}
.hero h1 .grad { background:var(--grad); -webkit-background-clip:text; background-clip:text; color:transparent; }
.hero h1 .grad::before { content:'> '; -webkit-text-fill-color:var(--primary); color:var(--primary); }
.hero p { font-size:0.94rem; color:var(--text-2); line-height:1.7; max-width:640px; word-break:keep-all; }

/* ─── SECTION LABEL (`// 주석`) ─── */
.section-label { width:100%; max-width:1040px; margin:34px auto 14px; }
.section-label span { font-size:0.8rem; font-weight:700; color:var(--text-3); }
.section-label span::before { content:'// '; color:var(--primary); }

/* ─── EDITOR (듀얼페인) ─── */
.editor { width:100%; max-width:1040px; margin:0 auto; }

/* 상단 툴바: 방향 + 옵션 */
.toolbar {
  display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap;
  background:var(--surface); border:var(--bd) solid var(--border); border-radius:var(--r-4);
  box-shadow:var(--sh-1); padding:12px 16px; margin-bottom:14px;
}
.dir-group { display:inline-flex; align-items:center; gap:9px; }
.dir-pill {
  font-family:inherit; font-size:0.82rem; font-weight:800; letter-spacing:0.03em;
  color:var(--primary); background:color-mix(in srgb, var(--primary) 12%, var(--surface-2));
  border:var(--bd) solid var(--primary-alpha); border-radius:var(--r-1); padding:8px 14px;
}
.dir-swap {
  width:38px; height:38px; display:inline-flex; align-items:center; justify-content:center;
  background:var(--surface-2); border:var(--bd) solid var(--border-2); border-radius:var(--r-1);
  color:var(--text-2); cursor:pointer; transition:all var(--t1) var(--ease);
}
.dir-swap:hover { color:var(--primary); border-color:var(--primary); transform:rotate(180deg); }
.dir-swap svg { width:17px; height:17px; }
.dir-static { font-size:0.82rem; font-weight:800; letter-spacing:0.03em; color:var(--text-3); }

.opt-group { display:inline-flex; align-items:center; gap:14px; flex-wrap:wrap; }
.opt { display:inline-flex; align-items:center; gap:7px; }
.opt-lbl { font-size:0.72rem; font-weight:700; color:var(--text-3); text-transform:uppercase; letter-spacing:0.05em; }
.sel-wrap { position:relative; }
.sel-wrap::after { content:'▾'; position:absolute; right:10px; top:50%; transform:translateY(-50%); color:var(--text-3); font-size:0.72rem; pointer-events:none; }
select.sel {
  appearance:none; -webkit-appearance:none;
  font-family:inherit; font-size:0.8rem; font-weight:700; color:var(--text-strong);
  background:var(--surface-2); border:var(--bd) solid var(--border-2); border-radius:var(--r-1);
  padding:7px 26px 7px 11px; cursor:pointer; outline:none; transition:all var(--t1) var(--ease);
}
select.sel:focus { border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-alpha); }
.opt-check { display:inline-flex; align-items:center; gap:6px; cursor:pointer; user-select:none; }
.opt-check input { position:absolute; opacity:0; width:0; height:0; }
.opt-box {
  width:17px; height:17px; display:inline-flex; align-items:center; justify-content:center;
  border:var(--bd) solid var(--border-2); border-radius:4px; background:var(--surface-2);
  color:transparent; transition:all var(--t1) var(--ease); font-size:11px; font-weight:800;
}
.opt-check input:checked + .opt-box { background:color-mix(in srgb, var(--primary) 18%, var(--surface-2)); border-color:var(--primary); color:var(--primary); }
.opt-check .opt-txt { font-size:0.78rem; font-weight:600; color:var(--text-2); }

/* 페인 2단 */
.panes { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
@media (max-width:820px){ .panes { grid-template-columns:1fr; } }
.pane {
  display:flex; flex-direction:column;
  background:var(--surface); border:var(--bd) solid var(--border); border-radius:var(--r-4);
  box-shadow:var(--sh-1); overflow:hidden;
}
.pane.result { border-color:var(--primary-alpha); }
.pane-bar {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:10px 14px; background:var(--surface-2); border-bottom:var(--bd) solid var(--border);
}
.pane-bar-left { display:inline-flex; align-items:center; gap:10px; }
.pane-bar-left::before {
  content:''; width:8px; height:8px; border-radius:50%;
  background:var(--err); box-shadow:13px 0 0 var(--warn), 26px 0 0 var(--primary);
  margin-right:26px;
}
.pane-tag { font-size:0.7rem; font-weight:800; letter-spacing:0.08em; color:var(--primary); }
.pane-fmt { font-size:0.62rem; font-weight:700; letter-spacing:0.05em; color:var(--text-3); text-transform:uppercase; }
.pane-actions { display:inline-flex; align-items:center; gap:5px; }
.mini-btn {
  display:inline-flex; align-items:center; gap:4px;
  font-family:inherit; font-size:0.66rem; font-weight:700; color:var(--text-3);
  background:transparent; border:var(--bd) solid var(--border-2); border-radius:var(--r-1);
  padding:5px 9px; cursor:pointer; transition:all var(--t1) var(--ease);
}
.mini-btn:hover { color:var(--primary); border-color:var(--primary); }
.mini-btn.done { color:var(--ok); border-color:var(--ok); }
.mini-btn svg { width:12px; height:12px; }
.mini-btn .mb-txt { line-height:1; }
@media (max-width:400px){ .mini-btn .mb-txt { display:none; } }

.code-area {
  width:100%; min-height:340px; resize:vertical;
  font-family:inherit; font-size:0.86rem; line-height:1.6; letter-spacing:0.01em;
  color:var(--text-strong); background:transparent; border:none; outline:none;
  padding:15px 16px; white-space:pre; overflow:auto; tab-size:2;
}
.code-area::placeholder { color:var(--text-3); }
.code-area[readonly] { color:var(--text); }
.pane.err-on { border-color:var(--err); }

/* 에러 배너 */
.err-banner {
  display:none; align-items:flex-start; gap:9px;
  padding:10px 14px; border-top:var(--bd) solid var(--border);
  background:color-mix(in srgb, var(--err) 12%, var(--surface-2));
  font-size:0.76rem; line-height:1.55; color:var(--err); word-break:break-word;
}
.err-banner.show { display:flex; }
.err-banner svg { width:15px; height:15px; flex-shrink:0; margin-top:1px; }
.err-banner b { font-weight:800; }

/* 상태줄 */
.status-line {
  display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;
  margin-top:14px; padding:12px 16px;
  background:var(--surface); border:var(--bd) solid var(--border); border-radius:var(--r-3);
}
.status-msg { font-size:0.76rem; color:var(--text-3); }
.status-msg::before { content:'// '; color:var(--primary); font-weight:700; }
.status-msg.ok::before { content:'✓ '; color:var(--ok); }
.status-msg.err { color:var(--err); }
.status-msg.err::before { content:'✕ '; color:var(--err); }
.stat-row { display:inline-flex; align-items:center; gap:16px; }
.stat { display:inline-flex; align-items:baseline; gap:5px; }
.stat-k { font-size:0.62rem; font-weight:700; text-transform:uppercase; letter-spacing:0.05em; color:var(--text-3); }
.stat-v { font-size:0.9rem; font-weight:800; color:var(--text-strong); font-variant-numeric:tabular-nums; }

.quick-row { display:flex; gap:7px; flex-wrap:wrap; margin-top:14px; }
.quick-chip {
  font-family:inherit; font-size:0.72rem; font-weight:600; color:var(--text-2);
  background:var(--surface-2); border:var(--bd) solid var(--border-2); border-radius:var(--r-1);
  padding:6px 11px; cursor:pointer; transition:all var(--t1) var(--ease);
}
.quick-chip:hover { color:var(--primary); border-color:var(--primary); }

/* ─── 안내 노트 ─── */
.note {
  font-size:0.78rem; color:var(--text-3); line-height:1.7;
  background:var(--surface); border:var(--bd) solid var(--border);
  border-left:3px solid var(--primary-alpha); border-radius:var(--r-2);
  padding:14px 16px; margin:22px 0 0; word-break:keep-all; max-width:1040px; width:100%;
}
.note::before { content:'// '; color:var(--primary); font-weight:700; }
.note b { color:var(--text-2); font-weight:700; }

/* ─── FAQ ─── */
.faq { width:100%; max-width:1040px; margin:12px auto 0; }
.faq-item { border-bottom:var(--bd) solid var(--border); padding:16px 2px; }
.faq-q { font-size:0.92rem; font-weight:700; color:var(--text-strong); margin-bottom:7px; }
.faq-q::before { content:'Q '; color:var(--primary); }
.faq-a { font-size:0.84rem; color:var(--text-2); line-height:1.7; word-break:keep-all; }

/* ─── TRUST ─── */
.trust-bar {
  width:100%; max-width:1040px; margin:34px auto 0; padding-top:24px;
  border-top:var(--bd) solid var(--border);
  display:flex; flex-wrap:wrap; gap:14px 30px;
}
.trust-item { display:inline-flex; align-items:center; gap:8px; font-size:0.8rem; font-weight:500; color:var(--text-3); }
.trust-item svg { width:15px; height:15px; color:var(--primary); }

/* ─── 보조 페이지(about/contact) ─── */
.title-bar {
  width:100%; max-width:660px; margin:0 auto;
  display:flex; align-items:center; justify-content:space-between; padding:22px 0 4px;
}
.title-bar__home {
  display:inline-flex; align-items:center; gap:5px; text-decoration:none; color:var(--text-2);
  font-size:0.82rem; font-weight:500; padding:6px 11px;
  border:var(--bd) solid var(--border); border-radius:var(--r-1); background:var(--surface-2);
  transition:all var(--t1) var(--ease);
}
.title-bar__home:hover { color:var(--primary); border-color:var(--primary); }
.title-bar__cat {
  font-size:0.62rem; font-weight:700; letter-spacing:0.08em; text-transform:uppercase; color:var(--primary);
  background:var(--surface-2); border:var(--bd) solid var(--primary-alpha); padding:5px 11px; border-radius:var(--r-1);
}
.title-bar__cat::before { content:'~/'; color:var(--text-3); }
.page-container { width:100%; max-width:660px; margin:0 auto; display:flex; flex-direction:column; }
.page-header { text-align:left; margin:16px 0 20px; }
.page-title { font-size:1.5rem; font-weight:800; color:var(--text-strong); letter-spacing:-0.02em; margin-bottom:7px; }
.page-sub { font-size:0.86rem; color:var(--text-2); }
.page-sub::before { content:'# '; color:var(--text-3); }

/* ─── AD (룰 4-1: 래퍼 border-radius/overflow 금지) ─── */
/* 사이즈별 행 분리: .ad-grid=행 세로 스택, .ad-row=같은 사이즈끼리 한 줄(컨테이너 폭이 개수 제한).
   728×90→1개/행, 250×250→2개/행, 320×50→2개/행(4개=2×2). */
.ad-grid { display:flex; flex-direction:column; align-items:center; gap:14px; width:100%; margin-top:36px; }
.ad-row { display:flex; flex-wrap:wrap; justify-content:center; gap:12px; width:100%; }
.ad-cell { min-height:50px; }

/* ─── FOOTER ─── */
.site-footer {
  width:100%; max-width:1040px; margin:36px auto 0; padding:22px 4px;
  border-top:var(--bd) solid var(--border); text-align:left;
}
.site-footer a { color:var(--text-3); font-size:0.8rem; text-decoration:none; transition:color var(--t1) var(--ease); }
.site-footer a:hover { color:var(--primary); }
.footer-divider { color:var(--border-2); margin:0 10px; }
.sr-title { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }

/* ─── ANIMATIONS ─── */
.animate-fade-in { animation:fadeIn .5s var(--ease-out) both; }
.animate-slide-up { animation:slideUp .5s var(--ease-out) both; }
@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }
@keyframes slideUp { from{opacity:0; transform:translateY(16px);} to{opacity:1; transform:translateY(0);} }

@media (max-width:480px){
  body { padding:0 14px 64px; }
  .hero { margin-top:26px; }
  .code-area { min-height:240px; }
  .toolbar { padding:11px 13px; }
}
