:root {
  --bg: #ffffff; --bg-alt: #f5f6f7; --fg: #1d2125; --muted: #646d76; --border: #d5d9de;
  --accent: #2457c5; --accent-fg: #fff; --danger: #b42318; --warn-bg: #fff6df; --warn-bd: #e6c36a;
  --ok-bg: #eaf6ee; --ok-bd: #9ccbab; --err-bg: #fdecea; --err-bd: #e3a39d;
  --code-bg: #fbfbfc; --gutter: #8a929a;
  --c-kw: #a626a4; --c-str: #50833a; --c-num: #b05a00; --c-com: #8a929a; --c-fn: #2457c5; --c-attr: #0e7490;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", "Noto Sans KR", "Malgun Gothic", sans-serif;
}
[data-theme="dark"] {
  --bg: #17191d; --bg-alt: #1e2126; --fg: #d6dae0; --muted: #8b939d; --border: #2d3239;
  --accent: #6c9cff; --accent-fg: #0f1115; --danger: #ff8a80; --warn-bg: #2b2616; --warn-bd: #6b5a24;
  --ok-bg: #16261c; --ok-bd: #2f5a3d; --err-bg: #2c1a19; --err-bd: #6b3430;
  --code-bg: #1a1d22; --gutter: #6b737d;
  --c-kw: #d69cf0; --c-str: #9bc27e; --c-num: #e5a35c; --c-com: #6f7782; --c-fn: #7fb0ff; --c-attr: #5cc4de;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding-bottom: 32px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 440px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--bg); padding: 6px 10px; z-index: 10; }
.muted { color: var(--muted); } .strong { font-weight: 600; color: var(--fg); } .mono { font-family: var(--mono); font-size: 12px; } .nowrap { white-space: nowrap; }
.spacer { flex: 1; }

/* top bar */
.topbar { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.bar { display: flex; align-items: center; justify-content: space-between; height: 48px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--fg); font-size: 15px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 8px; }
.nav-search input { width: 200px; }
.nav-search-link { display: none; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; } .menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: 36px; min-width: 150px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.12); padding: 4px; display: flex; flex-direction: column; z-index: 10; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: 7px 10px; background: none; border: 0; color: var(--fg); font: inherit; cursor: pointer; border-radius: 4px; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--bg-alt); text-decoration: none; }

/* controls */
input[type=text], input[type=search], input[type=email], input[type=password], select, textarea {
  font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 5px 8px; height: 32px; max-width: 100%;
}
select { padding-right: 4px; }
input:focus, select:focus, textarea:focus, button:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-alt); color: var(--fg); font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn-sm { height: 28px; padding: 0 9px; font-size: 13px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-danger { color: var(--danger); }
.chk { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; cursor: pointer; }
.f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.f input, .f select { font-size: 14px; }
.f-title, .f-grow { flex: 1 1 200px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack .f input { width: 100%; }
.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
form.inline { display: inline; }
h1, h2 { line-height: 1.25; margin: 0; }
.h-md { font-size: 18px; margin: 16px 0 12px; } .h-sm { font-size: 14px; margin: 16px 0 8px; }

/* alerts */
.alert { border: 1px solid var(--border); border-radius: 4px; padding: 8px 12px; margin: 12px 0; }
.alert ul { margin: 0; padding-left: 18px; }
.alert.ok { background: var(--ok-bg); border-color: var(--ok-bd); }
.alert.err { background: var(--err-bg); border-color: var(--err-bd); }
.alert.warn { background: var(--warn-bg); border-color: var(--warn-bd); }

/* main layout */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; padding-top: 16px; }
.col-side { border-left: 1px solid var(--border); padding-left: 20px; }
.col-side .h-sm { margin-top: 0; }
.side-more { margin: 8px 0 0; font-size: 13px; }

/* lists */
.plist { list-style: none; margin: 0; padding: 0; }
.plist li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.plist li.empty, .empty { color: var(--muted); border-bottom: 0; padding: 12px 0; }
.ptitle { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmeta { color: var(--muted); font-size: 12px; }
.tag { display: inline-block; padding: 0 6px; border: 1px solid var(--border); border-radius: 3px; font-size: 12px; color: var(--muted); line-height: 18px; }
.tag-private { color: var(--danger); } .tag-public { color: var(--accent); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 16px 0; }
.tablewrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 12px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; margin: 0 0 8px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0; border: 1px solid var(--border); border-radius: 4px; margin: 0 0 16px; }
.stats div { padding: 8px 12px; border-right: 1px solid var(--border); } .stats div:last-child { border-right: 0; }
.stats dt { color: var(--muted); font-size: 12px; } .stats dd { margin: 0; font-size: 18px; font-weight: 600; }
.searchform { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }

/* tabs */
.tabs { display: flex; gap: 2px; }
.tab { background: none; border: 1px solid transparent; border-bottom: 0; padding: 5px 12px; font: inherit; color: var(--muted); cursor: pointer; border-radius: 4px 4px 0 0; }
.tab.is-active { color: var(--fg); border-color: var(--border); background: var(--bg); position: relative; top: 1px; }
.tabs-link { border-bottom: 1px solid var(--border); margin-bottom: 12px; } .tab:hover { text-decoration: none; }

/* editor */
.field-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.editor-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.bar-tools { display: flex; gap: 8px; align-items: center; padding-bottom: 4px; }
.editor-pane { display: flex; border: 1px solid var(--border); border-top: 0; background: var(--code-bg); }
.gutter { margin: 0; padding: 8px 8px 8px 10px; text-align: right; color: var(--gutter); font: 13px/1.5 var(--mono); user-select: none; overflow: hidden; border-right: 1px solid var(--border); min-width: 3ch; }
.editor-pane .gutter { height: 360px; }
.editor-pane textarea { flex: 1; min-width: 0; border: 0; border-radius: 0; background: transparent; height: 360px; resize: vertical; padding: 8px 10px; font: 13px/1.5 var(--mono); white-space: pre; overflow: auto; tab-size: 4; }
.editor-pane.wrap textarea { white-space: pre-wrap; overflow-wrap: anywhere; }
.editor-pane.wrap .gutter { display: none; }
.preview { border: 1px solid var(--border); border-top: 0; max-height: 70vh; overflow: auto; background: var(--code-bg); min-height: 360px; }
.statusbar { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); padding: 5px 2px 8px; flex-wrap: wrap; }

/* code view */
.paste-head .h-md { margin-bottom: 6px; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 12px; align-items: center; margin-bottom: 10px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; } .toolbar form { display: inline; }
.codebox { display: flex; border: 1px solid var(--border); background: var(--code-bg); max-height: 78vh; overflow: auto; border-radius: 4px; }
.codebox .gutter { position: sticky; left: 0; background: var(--code-bg); overflow: visible; height: max-content; }
.codepre { margin: 0; padding: 8px 12px; flex: 1; min-width: max-content; font: 13px/1.5 var(--mono); tab-size: 4; white-space: pre; }
.codepre code { font: inherit; background: none; }
.codebox.wrap .codepre { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.codebox.wrap .gutter { display: none; }
.urlbar { display: flex; gap: 6px; margin-top: 6px; } .urlbar input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; }
.report { margin-top: 16px; font-size: 13px; color: var(--muted); } .report summary { cursor: pointer; width: max-content; }
.report-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 8px; }
.errorbox { padding-top: 48px; text-align: left; } .errcode { font: 600 14px var(--mono); color: var(--muted); margin: 0 0 4px; }
.foot { border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; padding: 12px 0; }

/* likes / comments */
.likebtn { gap: 5px; text-decoration: none; }
.likebtn .heart { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.likebtn:hover .heart { stroke: #e0245e; }
.likebtn.is-liked .heart { fill: #e0245e; stroke: #e0245e; }
.likebtn .count { font-variant-numeric: tabular-nums; }
.comments { margin-top: 24px; }
.cform { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 8px 0 12px; }
.cform textarea { width: 100%; height: auto; min-height: 72px; resize: vertical; font: inherit; padding: 8px; }
.clist { list-style: none; margin: 8px 0; padding: 0; }
.clist li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.clist li.empty { border-bottom: 0; }
.cmeta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.cmeta strong { color: var(--fg); font-weight: 600; }
.cbody { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
.cmenu { margin-left: auto; }
.cmenu summary.dots { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 4px; color: var(--muted); cursor: pointer; list-style: none; }
.cmenu summary.dots::-webkit-details-marker { display: none; }
.cmenu summary.dots:hover, .cmenu[open] summary.dots { background: var(--bg-alt); color: var(--fg); }
.cmenu svg { fill: currentColor; }
.cmenu .menu-pop { top: 28px; min-width: 96px; }
.menu-pop .danger { color: var(--danger); }
.clist .cform { margin: 8px 0 0; }
.clist .report-form { margin-top: 8px; padding: 8px; background: var(--bg-alt); border-radius: 4px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: var(--danger); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* syntax colors (highlight.js 클래스) */
.hljs-keyword, .hljs-selector-tag, .hljs-doctag, .hljs-meta .hljs-keyword, .hljs-type { color: var(--c-kw); }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-meta .hljs-string { color: var(--c-str); }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: var(--c-num); }
.hljs-comment, .hljs-quote { color: var(--c-com); font-style: italic; }
.hljs-title, .hljs-section, .hljs-built_in, .hljs-selector-id, .hljs-selector-class { color: var(--c-fn); }
.hljs-attr, .hljs-attribute, .hljs-name, .hljs-tag, .hljs-variable, .hljs-template-variable, .hljs-property, .hljs-params { color: var(--c-attr); }
.hljs-deletion { color: var(--danger); } .hljs-emphasis { font-style: italic; } .hljs-strong { font-weight: 700; }
.hljs-meta { color: var(--c-com); }

@media (max-width: 800px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .col-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 12px; }
}
@media (max-width: 640px) {
  .nav-search { display: none; } .nav-search-link { display: inline-flex; }
  .bar { height: auto; min-height: 48px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
  .nav { flex-wrap: wrap; gap: 6px; }
  .f { flex: 1 1 45%; } .f-title { flex-basis: 100%; }
  .editor-pane .gutter, .editor-pane textarea { height: 300px; }
  .toolbar .btn-sm { flex: 0 0 auto; }
}
