:root{
  --bg:#f5f4f0; --surface:#fbfbf9; --panel:#ffffff; --panel-soft:#f7f6f2;
  --ink:#1c1c1a; --ink-hover:#3a3935; --ink-2:#55534d; --sub:#7a776f; --muted:#8a877f;
  --line:#e3e1db; --line-2:#dcdad3; --line-3:#efeee9; --hover:#efeee9; --soft:#f3f2ee; --track:#ebe9e3;
  --accent:#2f5bea; --accent-soft:rgba(47,91,234,.12); --on-accent:#fff;
  --ok:#1f7a45; --warn:#a15c00; --err:#b3261e;
  --font:"IBM Plex Sans KR",sans-serif; --mono:"JetBrains Mono",monospace;
}
*{box-sizing:border-box}
[hidden]{display:none !important}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--font);-webkit-font-smoothing:antialiased}
button{font:inherit;color:inherit}
.mono-label{font-family:var(--mono);font-size:11px;letter-spacing:.12em;color:var(--muted)}
.mono{font-family:var(--mono)}
.hint{font-size:12px;line-height:1.55;color:var(--muted);margin:0}
.app{min-height:100vh;display:flex;flex-direction:column}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 28px;border-bottom:1px solid var(--line);background:var(--surface);flex-wrap:wrap}
.brand{display:flex;align-items:baseline;gap:14px;min-width:0;flex-wrap:wrap}
.brand-title{font-size:17px;font-weight:700;letter-spacing:-.01em;margin:0}
.actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.btn{height:36px;padding:0 14px;background:transparent;border:1px solid var(--line-2);border-radius:999px;font-size:13px;cursor:pointer;white-space:nowrap;display:inline-flex;align-items:center;justify-content:center}
.btn:hover{background:var(--hover)}
.btn--sm{height:30px;padding:0 12px;font-size:12px}
.btn--accent{background:var(--accent);color:var(--on-accent);border:none;font-weight:500}
.btn--accent:hover{filter:brightness(1.08);background:var(--accent)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

/* 불러오기 */
.import{display:flex;flex-direction:column;gap:10px;padding:16px 28px;background:var(--panel-soft);border-bottom:1px solid var(--line)}
.import-actions{display:flex;gap:8px}

/* 레이아웃 */
.layout{flex:1;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.05fr);gap:20px;padding:24px 28px 48px;align-items:start;max-width:1440px;width:100%;margin:0 auto}
.form,.side{display:flex;flex-direction:column;gap:16px;min-width:0}
.card{background:var(--panel);border:1px solid var(--line);border-radius:18px;padding:18px 18px 20px;display:flex;flex-direction:column;gap:14px;min-width:0}
.card-head{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}
.g-title{margin:0;font-size:15px;font-weight:700;letter-spacing:-.01em}

/* 입력 */
.fld{display:flex;flex-direction:column;gap:6px;min-width:0}
.fld-top{display:flex;justify-content:space-between;align-items:baseline;gap:8px}
.fld-k{font-size:12.5px;color:var(--ink-2)}
.fld-k em,.check em{font-style:normal;color:var(--muted);font-size:11.5px;margin-left:4px}
.text-input,.ta,.sel{width:100%;background:var(--surface);color:var(--ink);border:1px solid var(--line-2);border-radius:10px;font:inherit;font-size:14px}
.text-input{height:40px;padding:0 12px}
.text-input.mono{font-family:var(--mono);font-size:13px}
.ta{padding:10px 12px;line-height:1.55;resize:vertical;min-height:64px}
.ta--code{font-family:var(--mono);font-size:12.5px}
.sel{height:40px;padding:0 10px;font-size:13px}
.text-input:focus,.ta:focus,.sel:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.text-input.is-bad{border-color:var(--err)}
.text-input::placeholder,.ta::placeholder{color:var(--muted);opacity:.8}
.pair{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}
.trio{display:grid;grid-template-columns:90px 90px minmax(0,1fr);gap:10px}
.checks{display:flex;flex-direction:column;gap:8px}
.checks--grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px}
.check{display:flex;align-items:flex-start;gap:8px;font-size:13px;color:var(--ink-2);cursor:pointer;line-height:1.45}
.check input{width:16px;height:16px;margin:2px 0 0;accent-color:var(--accent);flex:0 0 auto}
.count{font-family:var(--mono);font-size:11.5px;color:var(--muted);white-space:nowrap}
.meter{height:4px;border-radius:999px;background:var(--track);overflow:hidden}
.meter i{display:block;height:100%;width:0;border-radius:inherit;background:var(--muted);transition:width .2s,background-color .2s}
.meter i.ok{background:var(--ok)}
.meter i.warn{background:var(--warn)}
.meter i.err{background:var(--err)}
.meter-msg{margin:0;font-size:12px;color:var(--muted);line-height:1.5}
.meter-msg.ok{color:var(--ok)}
.meter-msg.warn{color:var(--warn)}
.meter-msg.err{color:var(--err)}
.seg{display:flex;background:var(--soft);border-radius:10px;padding:3px;gap:2px;height:40px}
.seg-btn{flex:1;min-width:0;padding:0 10px;background:transparent;color:var(--sub);border:none;border-radius:8px;font-size:13px;cursor:pointer;white-space:nowrap}
.seg-btn[aria-pressed="true"]{background:#fff;color:var(--ink);box-shadow:0 1px 3px rgba(0,0,0,.12);font-weight:500}
.seg--sm{height:32px;border-radius:999px}
.seg--sm .seg-btn{border-radius:999px;padding:0 12px;font-size:12px}
.color-field{display:flex;gap:6px}
.color-field input[type=color]{flex:0 0 40px;width:40px;height:40px;padding:3px;border:1px solid var(--line-2);border-radius:10px;background:var(--surface);cursor:pointer}
.img-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.img-tools .hint{flex-basis:100%}
.file-btn{position:relative;overflow:hidden;cursor:pointer}
.file-btn input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%}
.file-btn:focus-within{outline:2px solid var(--accent);outline-offset:2px}

/* 검색 결과 미리보기 (중립 디자인) */
.serp-wrap{background:#fff;border-radius:12px;padding:18px 18px 20px;box-shadow:inset 0 0 0 1px #e8e6e0;overflow:hidden}
.serp{max-width:600px;font-family:Arial,"Apple SD Gothic Neo","Malgun Gothic",sans-serif;color:#202124}
.serp.is-m{max-width:360px}
.serp-site{display:flex;align-items:center;gap:10px;margin-bottom:6px;min-width:0}
.serp-fav{flex:0 0 28px;width:28px;height:28px;border-radius:999px;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;color:#fff;background:#2f5bea}
.serp-src{display:flex;flex-direction:column;min-width:0;line-height:1.3}
.serp-src b{font-size:14px;font-weight:400;color:#202124;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.serp-src span{font-size:12px;color:#4d5156;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.serp-title{margin:0 0 4px;font-size:20px;line-height:1.3;color:#1f3fb0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.serp.is-m .serp-title{font-size:18px;white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.serp-desc{margin:0;font-size:14px;line-height:1.58;color:#4d5156;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-all}
.serp.is-m .serp-desc{-webkit-line-clamp:3}
.serp .empty{color:#9aa0a6;font-style:italic}

/* 링크 공유 카드 (중립 디자인) */
.share-wrap{background:#eceef2;border-radius:12px;padding:18px;display:flex;justify-content:flex-end;overflow:hidden}
.bubble{width:100%;max-width:380px;display:flex;flex-direction:column;gap:6px;align-items:flex-end;min-width:0}
.bubble-url{max-width:100%;padding:8px 12px;border-radius:14px 14px 4px 14px;background:#4d6bfe;color:#fff;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.share{width:100%;background:#fff;border-radius:14px;overflow:hidden;box-shadow:0 1px 2px rgba(0,0,0,.08);font-family:var(--font);color:#1c1c1a}
.share-img{position:relative;aspect-ratio:1.91/1;background:linear-gradient(135deg,#dfe4f2,#c9d1e8);background-size:cover;background-position:center}
.share-ph{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:2px;font-family:var(--mono);font-size:11px;color:#5d6680;text-align:center;padding:8px}
.share-body{display:flex;flex-direction:column;gap:3px;padding:10px 12px 12px;min-width:0}
.share-dom{font-size:11px;color:#8a8f99;letter-spacing:.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.share-title{font-size:14px;line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-all}
.share-desc{font-size:12.5px;line-height:1.45;color:#5b606a;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-all}
.share.is-small{display:flex;align-items:stretch}
.share.is-small .share-img{flex:0 0 96px;aspect-ratio:1/1}
.share.is-small .share-ph{font-size:9.5px}
.share.is-small .share-body{justify-content:center}

/* 점검 */
.checklist{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.checklist li{display:flex;gap:10px;align-items:flex-start;font-size:13px;line-height:1.5;color:var(--ink-2)}
.checklist li::before{content:"✓";flex:0 0 20px;height:20px;border-radius:999px;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;background:rgba(31,122,69,.12);color:var(--ok)}
.checklist li.warn::before{content:"!";background:rgba(161,92,0,.13);color:var(--warn)}
.checklist li.err::before{content:"×";background:rgba(179,38,30,.12);color:var(--err)}

/* 코드 */
.code-card{display:flex;flex-direction:column;gap:12px;padding:14px 16px 16px;background:#1c1c1a;border-radius:18px;color:#efeee9;min-width:0}
.code-head{display:flex;justify-content:space-between;align-items:center;gap:10px}
.mono-label--light{color:#9c998f}
.code{margin:0;font-family:var(--mono);font-size:12.5px;line-height:1.7;white-space:pre;overflow:auto;max-height:520px;color:#efeee9}
.code:focus-visible{outline:2px solid #9db2ff;outline-offset:2px;border-radius:6px}
.code .t{color:#9db2ff}
.code .a{color:#e5c07b}
.code .s{color:#a5e3b5}
.code .c{color:#8a877f}

/* 토스트 */
.toast{position:fixed;left:50%;bottom:28px;transform:translate(-50%,20px);background:var(--ink);color:#fff;padding:10px 18px;border-radius:999px;font-size:13px;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;z-index:50;max-width:calc(100% - 32px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.toast.is-on{opacity:1;transform:translate(-50%,0)}

@media (max-width:980px){
  .layout{grid-template-columns:minmax(0,1fr)}
  .side{order:-1}
}
@media (max-width:640px){
  .topbar{padding:14px 16px}
  .actions{width:100%}
  .actions .btn{flex:1 1 auto;padding:0 10px}
  .import{padding:14px 16px}
  .layout{padding:16px 16px 36px;gap:16px}
  .card{padding:16px 14px 18px}
  .pair{grid-template-columns:minmax(0,1fr)}
  .trio{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .trio .fld--wide{grid-column:1/-1}
  .checks--grid{grid-template-columns:minmax(0,1fr)}
  .text-input,.ta,.sel,.text-input.mono{font-size:16px}
  .serp-wrap,.share-wrap{padding:14px 12px}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{transition:none !important;animation:none !important}
}

/* 다크 모드 (인쇄는 라이트 그대로) — 검색 결과 · 공유 카드 미리보기는 밝게 둠 */
@media screen{
  :root[data-theme="dark"]{
    color-scheme:dark;
    --bg:#121419; --surface:#181b21; --panel:#1d2027; --panel-soft:#22262e;
    --ink:#e9ebf1; --ink-hover:#ffffff; --ink-2:#c5c9d3; --sub:#9ca1ad; --muted:#878c98;
    --line:#2b2f38; --line-2:#363b46; --line-3:#242830; --hover:#282c35; --soft:#242830; --track:#323743;
    --accent:#8fa8ff; --accent-soft:rgba(143,168,255,.16); --on-accent:#10131a;
    --ok:#6fd49a; --warn:#ffc46b; --err:#ff8a80;
  }
  :root[data-theme="dark"] .toast{color:var(--bg)}
  :root[data-theme="dark"] .seg-btn[aria-pressed="true"]{background:var(--line-2);box-shadow:0 1px 3px rgba(0,0,0,.4)}
  :root[data-theme="dark"] .code-card{background:#0d0f13;box-shadow:inset 0 0 0 1px var(--line-2)}
  :root[data-theme="dark"] .checklist li::before{background:rgba(111,212,154,.14)}
  :root[data-theme="dark"] .checklist li.warn::before{background:rgba(255,196,107,.14)}
  :root[data-theme="dark"] .checklist li.err::before{background:rgba(255,138,128,.14)}
}
