:root {
  --bg: #f6f5f3; --card: #ffffff; --ink: #1d1d1f; --muted: #6b6b70; --line: #e3e1dc;
  --accent: #c8102e; --accent-soft: #fbe9ec; --b: #8a8f98; --ev: #b9bcc3;
  --ok: #1f7a4d; --ok-soft: #e6f4ec; --warn: #9a6200; --warn-soft: #fff4dc;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141416; --card: #1d1d20; --ink: #ececef; --muted: #9a9aa2; --line: #2e2e33;
    --accent: #ff5468; --accent-soft: #3a1a20; --b: #7d828c; --ev: #4b4e55;
    --ok: #4cc38a; --ok-soft: #173126; --warn: #e3b04b; --warn-soft: #33290f;
  }
}
:root[data-theme="dark"] {
  --bg: #141416; --card: #1d1d20; --ink: #ececef; --muted: #9a9aa2; --line: #2e2e33;
  --accent: #ff5468; --accent-soft: #3a1a20; --b: #7d828c; --ev: #4b4e55;
  --ok: #4cc38a; --ok-soft: #173126; --warn: #e3b04b; --warn-soft: #33290f;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: .9em; }
small, .small { font-size: .82em; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .85em; margin: .5em 0 0; }

.top { background: var(--card); border-bottom: 1px solid var(--line); padding-top: 22px; }
.eyebrow { margin: 0; color: var(--accent); font-weight: 600; font-size: .82em; letter-spacing: .02em; }
h1 { margin: .2em 0 .3em; font-size: clamp(1.3rem, 3vw, 1.9rem); line-height: 1.25; }
.sub { margin: 0 0 14px; color: var(--muted); max-width: 820px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tab { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600;
  padding: 10px 14px; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tab.active { color: var(--ink); border-color: var(--accent); }

main { padding-top: 18px; padding-bottom: 24px; }
.panel { display: none; }
.panel.active { display: block; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; margin-bottom: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; }
.card + .card { margin-top: 0; }
.panel > .card { margin-bottom: 14px; }
.card h2 { font-size: 1.05rem; margin: 0 0 10px; }
.card h3 { font-size: .95rem; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.card-head { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; }
.note p { margin: .4em 0; }

textarea, input, select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 7px 9px; width: 100%; }
textarea { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; min-height: 260px; resize: vertical; white-space: pre; }
textarea.short { min-height: 120px; }
.btns select, .btns input { width: auto; min-width: 140px; }
button { font: inherit; cursor: pointer; border-radius: 6px; }
.primary { background: var(--accent); color: #fff; border: 0; padding: 9px 18px; font-weight: 600; margin-top: 10px; }
.ghost { background: none; border: 1px solid var(--line); color: var(--ink); padding: 6px 12px; font-size: .9em; }
.file { position: relative; display: inline-block; cursor: pointer; border-radius: 6px; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.chip { background: var(--bg); border: 1px solid var(--line); color: var(--ink); padding: 5px 11px; border-radius: 999px; font-size: .85em; }
.chip:hover, .ghost:hover { border-color: var(--accent); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 4px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: .82em; color: var(--muted); }
.form .full { grid-column: 1 / -1; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stats.small { margin-bottom: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat b { display: block; font-size: 1.45rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .8em; }
.stat.accent b { color: var(--accent); }
.card .stat { background: var(--bg); }

.bars .row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr; gap: 10px; align-items: center; padding: 3px 0; }
.bars .lbl { font-size: .82em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-line { display: flex; align-items: center; gap: 6px; min-height: 16px; }
.bar { height: 11px; border-radius: 3px; flex: none; max-width: calc(100% - 92px); }
.bar.a { background: var(--accent); }
.bar.b { background: var(--b); }
.bar-line span { font-size: .78em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-line small { color: var(--muted); }
.legend { font-size: .78em; color: var(--muted); font-weight: 400; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.sw.a { background: var(--accent); } .sw.b { background: var(--b); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot.ev { background: var(--ev); border-radius: 2px; width: 4px; } .dot.lg { background: var(--accent); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85em; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td small { color: var(--muted); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .8em; font-weight: 600; background: var(--bg); border: 1px solid var(--line); }
.pill.drop, .pill.reject, .pill.sdrop { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.verdict { padding: 14px; border-radius: 8px; margin-bottom: 12px; font-size: 1rem; }
.verdict.idle { background: var(--bg); color: var(--muted); }
.verdict.drop { background: var(--accent-soft); color: var(--accent); }
.verdict.alert { background: var(--warn-soft); color: var(--warn); }
.verdict.pass { background: var(--ok-soft); color: var(--ok); }
.hit { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; display: grid; gap: 4px; }
.warn { background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 8px; margin-top: 12px; font-size: .85em; }
.warn ul { margin: 6px 0 0; padding-left: 18px; }

canvas { width: 100%; display: block; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.foot { color: var(--muted); font-size: .8em; padding-bottom: 28px; }

@media (max-width: 520px) {
  .grid2 { grid-template-columns: 1fr; }
  .bars .row { grid-template-columns: 1fr; gap: 2px; }
  textarea { min-height: 200px; }
}

.brand { display: flex; gap: 16px; align-items: center; margin-bottom: 6px; }
.brand img { width: 64px; height: 64px; border-radius: 50%; background: #fff; flex: none; object-fit: contain; border: 1px solid var(--line); }
.brand h1 { margin-bottom: 0; }
.ghost.strong { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.top0 { margin: 0 0 8px; }
#base-text { min-height: 90px; }
.qs { margin: 0; padding-left: 20px; }
.qs li { margin: .45em 0; }
.pill.public { background: var(--bg); color: var(--b); }
.pill.likely { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.local { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.diff-list { font-size: .85em; margin: 8px 0 0; }
.diff-list summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.diff-list li { margin: 4px 0; }
.diff-list code { word-break: break-all; }
del { color: var(--accent); } ins { color: var(--ok); text-decoration: none; }
@media (max-width: 560px) { .brand img { width: 48px; height: 48px; } }

/* odt fuzz demo */
.filetree { font-family: var(--mono); font-size: 13px; line-height: 2; }
.filetree .f { display: flex; justify-content: space-between; gap: 12px; padding: 2px 8px; border-radius: 6px; }
.filetree .f:hover { background: var(--bg); }
.filetree .f.sel { background: var(--accent-soft); }
.filetree .nm { cursor: pointer; }
.filetree .meta { color: var(--muted); font-size: .85em; white-space: nowrap; }
.tree { font-family: var(--mono); font-size: 12.5px; line-height: 1.75; max-height: 440px; overflow: auto; }
.tree .node { padding: 1px 4px; border-radius: 4px; cursor: pointer; white-space: pre; }
.tree .node:hover { background: var(--bg); }
.tree .node.sel { background: var(--accent-soft); outline: 1px solid var(--accent); }
.tree .el { color: var(--accent); } .tree .at { color: var(--ok); } .tree .tx { color: var(--muted); }
.tree .tag-el::before { content: '◆ '; color: var(--accent); }
.tree .tag-at::before { content: '• '; color: var(--ok); }
.tree .tag-tx::before { content: '" '; color: var(--muted); }
.bytestrip { font-family: var(--mono); font-size: 12px; line-height: 1.9; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow-x: auto; white-space: nowrap; }
.bytestrip span { padding: 1px 2px; border-radius: 3px; }
.by-chg { background: var(--accent); color: #fff; }
.by-ins { background: #c7ecc9; color: #0f3d14; }
.xmlview { font-family: var(--mono); font-size: 12.5px; line-height: 1.7; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; white-space: pre-wrap; max-height: 360px; }
.xmlview mark { background: #ffe08a; color: #3d2c00; }
.xmlview mark.ins { background: #c7ecc9; color: #0f3d14; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: none; color: var(--muted); padding: 6px 12px; font-size: .85em; }
.seg button.on { background: var(--accent); color: #fff; }
.warnbox { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 10px 12px; font-size: .86em; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .9em; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-family: var(--mono); word-break: break-all; }
.three h4 { margin: 0 0 6px; }
.bad-t { color: var(--accent); }

/* synthetic data lab */
.pix { image-rendering: pixelated; image-rendering: crisp-edges; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 3px; max-height: 280px; overflow-y: auto; }
.thumbs canvas { width: 100%; aspect-ratio: 1; border-radius: 4px; }
.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.gal figure { margin: 0; }
.gal canvas { width: 100%; aspect-ratio: 1; border-radius: 6px; border: 2px solid transparent; display: block; }
.gal canvas.bad { border-color: var(--accent); } .gal canvas.warn { border-color: var(--warn); }
.gal figcaption { font-size: .74em; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.srcpick { display: flex; gap: 8px; flex-wrap: wrap; }
.srcpick canvas { width: 56px; height: 56px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; }
.srcpick canvas.sel { border-color: var(--accent); }
.ctrl { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; margin: 8px 0; }
.ctrl label { display: flex; flex-direction: column; gap: 4px; font-size: .82em; color: var(--muted); }
.ctrl input[type=range] { width: 150px; padding: 0; }
.ctrl select { width: auto; }
.big { width: 100%; max-width: 220px; aspect-ratio: 1; border-radius: 8px; display: block; }
.err { position: relative; height: 14px; background: var(--bg); border-radius: 3px; }
.err .bar { position: absolute; top: 2px; height: 10px; border-radius: 2px; }
.err .ci { position: absolute; top: 0; height: 14px; border-left: 2px solid var(--ink); border-right: 2px solid var(--ink); opacity: .55; }
.err .dot { position: absolute; top: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); opacity: .6; transform: translateX(-3px); }
.rowx { display: grid; grid-template-columns: 130px 1fr 120px; gap: 10px; align-items: center; padding: 4px 0; font-size: .85em; }
.score td, .score th { text-align: right; font-variant-numeric: tabular-nums; }
.score td:first-child, .score th:first-child { text-align: left; }

/* sea visibility demo */
.chart { width: 100%; height: 300px; display: block; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.chart.short { height: 220px; }
.toggles { display: flex; flex-wrap: wrap; gap: 10px; font-size: .84em; margin: 6px 0; }
.toggles label { display: inline-flex; flex-direction: row; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; }
.toggles input { width: auto; }
.toggles i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.whatif { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
td.best { font-weight: 700; color: var(--ok); }
td.worse { color: var(--accent); }

/* MANET SAR demo */
.simwrap { display: grid; grid-template-columns: minmax(280px, 520px) 1fr; gap: 14px; align-items: start; }
@media (max-width: 860px) { .simwrap { grid-template-columns: 1fr; } }
#sim { width: 100%; aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line); background: #fff; display: block; }
.legend2 { display: flex; flex-wrap: wrap; gap: 10px; font-size: .8em; color: var(--muted); margin-top: 6px; }
.legend2 span { display: inline-flex; align-items: center; gap: 5px; }
.legend2 i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }

/* SREM demo */
.fig { width: 100%; height: auto; display: block; border-radius: 6px; background: #fff; }
.figrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.figgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.figgrid figure { margin: 0; }
.figgrid img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.figgrid figcaption { font-size: .78em; color: var(--muted); margin-top: 4px; }
#d-heat { width: 100%; border-radius: 8px; background: #fff; }
@media (max-width: 560px) { .figrow { grid-template-columns: 1fr; } .rowx { grid-template-columns: 90px 1fr 100px; } }
.err .bar { max-width: none; flex: initial; }
#tab-perf .rowx, #tab-sens .rowx { grid-template-columns: minmax(70px, 120px) 1fr 108px; }
