/* hmaclab — OPYEB studio tokens. No external fonts, no images except inline SVG. */
:root {
  color-scheme: dark;
  --bg: #0b0b0d;
  --bg2: #101014;
  --panel: #121216;
  --panel2: #17171c;
  --line: rgba(255, 255, 255, .09);
  --line2: rgba(255, 255, 255, .18);
  --ink: #f5f2ea;
  --muted: #b3ac9f;
  --muted2: #9d968a;
  --accent: #e5b45c;
  --accent-dim: rgba(229, 180, 92, .14);
  --accent-line: rgba(229, 180, 92, .40);
  --accent-strong: #efc172;
  --on-accent: #191104;
  --ok: #86d2ae;
  --ok-dim: rgba(121, 199, 164, .14);
  --warn: #f0b07c;
  --warn-dim: rgba(229, 160, 108, .16);
  --bad: #f0a0a0;
  --bad-dim: rgba(229, 138, 138, .14);
  --info: #a8c6ee;
  --info-dim: rgba(143, 180, 229, .14);
  --panel3: rgba(255, 255, 255, .07);
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, .9);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI",
          "Malgun Gothic", "Noto Sans KR", "Hiragino Kaku Gothic ProN", "Yu Gothic",
          "Microsoft JhengHei", "Helvetica Neue", Arial, "Liberation Sans",
          "DejaVu Sans", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f3ec;
  --bg2: #fbf9f4;
  --panel: #ffffff;
  --panel2: #f3efe6;
  --line: rgba(26, 20, 11, .12);
  --line2: rgba(26, 20, 11, .26);
  --ink: #16120e;
  --muted: #57503f;
  --muted2: #665e4f;
  --accent: #8a5d15;
  --accent-dim: rgba(138, 93, 21, .10);
  --accent-line: rgba(138, 93, 21, .42);
  --accent-strong: #6f4a0d;
  --on-accent: #fffaf0;
  --ok: #185f45;
  --ok-dim: rgba(24, 95, 69, .10);
  --warn: #7d4611;
  --warn-dim: rgba(125, 70, 17, .11);
  --bad: #96302f;
  --bad-dim: rgba(150, 48, 47, .09);
  --info: #274f83;
  --info-dim: rgba(39, 79, 131, .09);
  --panel3: rgba(26, 20, 11, .06);
  --shadow: 0 18px 40px -28px rgba(60, 46, 22, .35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: .9em; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li { margin: 0 0 .45em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 40; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--accent-line); border-radius: 0 0 10px 0;
}
.skip:focus { left: 0; color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ------------------------------------------------------------------ header */
.site-head {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.head-inner { display: flex; align-items: center; gap: 14px; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-flex; color: var(--accent); flex: none; }
.brand-mark svg { width: 22px; height: 22px; display: block; }
.brand-word { font-family: var(--mono); font-size: 15px; color: var(--muted); letter-spacing: .02em; }
.brand-prod { font-weight: 750; font-size: 17px; letter-spacing: -.01em; }
.head-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.head-link { font-size: 14px; color: var(--muted); padding: 6px 2px; }
.head-link:hover { color: var(--ink); text-decoration: none; }
.langs { display: flex; gap: 2px; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.langs a {
  font-size: 12px; color: var(--muted); padding: 4px 9px; border-radius: 999px;
  white-space: nowrap;
}
.langs a[aria-current="page"] { background: var(--accent-dim); color: var(--accent); }
.langs a:hover { color: var(--ink); text-decoration: none; }
.icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--line2); background: var(--panel2); color: var(--ink); }
[data-theme="dark"] .i-sun { display: none; }
[data-theme="light"] .i-moon { display: none; }

/* -------------------------------------------------------------------- hero */
.hero { padding: 46px 22px 22px; }
.eyebrow {
  display: inline-block; font-family: var(--mono); font-size: 12.5px; letter-spacing: .04em;
  color: var(--accent); background: var(--accent-dim); border: 1px solid var(--accent-line);
  padding: 4px 10px; border-radius: 999px; margin-bottom: 16px;
}
.hero h1 { font-size: clamp(30px, 4.6vw, 47px); font-weight: 780; letter-spacing: -.03em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lede { margin-top: 14px; max-width: 800px; color: var(--muted); font-size: 16.5px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; padding: 0; margin: 18px 0 0; }
.chips li {
  font-size: 12.5px; color: var(--muted); border: 1px solid var(--line);
  background: var(--panel); padding: 4px 9px; border-radius: 999px;
}

/* --------------------------------------------------------------------- lab */
.lab { margin-top: 8px; }
.lab-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 0 14px;
}
.lab-status { margin: 0; font-size: 13.5px; color: var(--muted); min-height: 1.4em; }
.lab-status.ok { color: var(--ok); }
.lab-status.bad { color: var(--bad); }
.lab-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.select-wrap { display: inline-flex; }
select {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line2); border-radius: 9px; padding: 7px 10px; max-width: 260px;
}
select:disabled, input:disabled { opacity: .45; cursor: not-allowed; }
.work-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.06fr); gap: 18px; align-items: start; }
.lower-grid { margin-top: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); min-width: 0;
}
.card-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 16px 10px; border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 15px; font-weight: 700; }
.head-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.card-body { padding: 14px 16px 16px; min-width: 0; }
.hint { font-size: 12.5px; color: var(--muted2); margin: 6px 0 0; }
.muted { color: var(--muted2); }
.warn-text { color: var(--warn); min-height: 1.5em; }
.ok-text { color: var(--ok) !important; }
.bad-text { color: var(--bad) !important; }
.pill {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px;
  white-space: nowrap;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 13.5px; font-weight: 650; color: var(--on-accent);
  background: var(--accent); border: 1px solid var(--accent); border-radius: 9px;
  padding: 9px 15px; cursor: pointer; line-height: 1.2;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line2); }
.btn.ghost:hover { background: var(--panel2); }
.btn.sm { font-size: 12.5px; padding: 6px 11px; }
input[type="text"], textarea {
  font: inherit; color: var(--ink); background: var(--bg2);
  border: 1px solid var(--line2); border-radius: 9px; padding: 9px 11px; width: 100%;
}
input[type="text"]:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea.editor { resize: vertical; line-height: 1.55; }
textarea.mono { font-family: var(--mono); font-size: 12.5px; }
textarea.sm { font-size: 12px; }
textarea[rows="0"] { display: none; }

.fld { display: block; min-width: 0; }
.fld > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; align-items: end; margin-top: 10px; }
.row2 .hint { margin: 0 0 4px; }
.fld-inline { margin-top: 10px; }
.field-label { font-size: 12.5px; color: var(--muted); margin: 12px 0 5px; }
.field-row { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.9fr) minmax(0, 1fr); gap: 10px; margin-top: 12px; align-items: end; }
.fld-inline-wrap { display: flex; gap: 6px; align-items: flex-end; min-width: 0; }
.fld-inline-wrap .fld { flex: 1 1 auto; }
#tsInput { font-family: var(--mono); font-size: 12.5px; }

.sig-out {
  display: block; font-family: var(--mono); font-size: 12.5px; line-height: 1.5;
  color: var(--accent); background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px; word-break: break-all;
  height: 4.8em; overflow: auto;
}
.sig-out-sm { font-size: 12px; height: 4.4em; }

.verify-actions { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; min-height: 40px; flex-wrap: wrap; }
dl.kv { display: grid; grid-template-columns: minmax(120px, 168px) minmax(0, 1fr); gap: 0; margin: 8px 0 10px; }
dl.kv dt {
  font-size: 12px; color: var(--muted2); padding: 7px 10px 7px 0; border-top: 1px solid var(--line);
}
dl.kv dd {
  margin: 0; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13.5px;
  overflow-wrap: anywhere; min-width: 0; font-family: var(--mono);
}
.kv-compact dd { font-size: 12.5px; height: 2.1em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700; line-height: 1;
  padding: 6px 10px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent;
}
.badge.ok { color: var(--ok); background: var(--ok-dim); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.badge.warn { color: var(--warn); background: var(--warn-dim); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.badge.bad { color: var(--bad); background: var(--bad-dim); border-color: color-mix(in srgb, var(--bad) 38%, transparent); }
.badge.info { color: var(--info); background: var(--info-dim); border-color: color-mix(in srgb, var(--info) 32%, transparent); }

.bytes-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 14px 0 6px; }
.bytes-head h3 { font-size: 12.5px; color: var(--muted); font-weight: 650; }
.bytes-legend { font-size: 11px; color: var(--muted2); display: flex; align-items: center; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-left: 8px; }
.dot.same { background: var(--ok); }
.dot.diff { background: var(--bad); }
.byte-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: 3px;
  height: 176px; overflow-y: auto; padding: 6px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg2); align-content: start;
}
.byte-cell {
  font-family: var(--mono); font-size: 10px; line-height: 1; text-align: center;
  padding: 5px 0; border-radius: 3px; border: 1px solid var(--line);
  color: var(--muted); background: var(--panel);
}
.byte-cell.same { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 34%, transparent); background: var(--ok-dim); }
.byte-cell.diff { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: var(--bad-dim); }

.tabs { display: flex; gap: 6px; margin: 0 0 8px; flex-wrap: wrap; }
.tab {
  font: inherit; font-size: 11.5px; color: var(--muted2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px; background: transparent; cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab.is-on { color: var(--accent); border-color: var(--accent-line); background: var(--accent-dim); }
.snippet {
  margin: 0; padding: 12px 14px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); height: 322px; overflow: auto;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55; color: var(--ink);
  white-space: pre; tab-size: 2;
}
.snippet code { font-size: inherit; }
.note-details { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.note-details summary { cursor: pointer; font-size: 12.5px; color: var(--muted); list-style: none; }
.note-details summary::-webkit-details-marker { display: none; }
.note-details summary::before { content: "+ "; color: var(--accent); font-family: var(--mono); }
.note-details[open] summary::before { content: "− "; }
.note-details p { margin: 6px 0 0; }
.lab-foot-note { margin: 14px 0 0; }

/* --------------------------------------------------------------- sections */
.section { padding: 34px 22px 6px; }
.section > h2, .section-head h2 { font-size: 22px; font-weight: 730; margin-bottom: 14px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.more { font-size: 13px; }
.lead { color: var(--muted); max-width: 780px; }
.steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.step-n { font-family: var(--mono); font-size: 11px; color: var(--accent); display: block; margin-bottom: 6px; }
.step b { display: block; font-size: 15px; margin-bottom: 4px; }
.step p { margin: 0; font-size: 13px; color: var(--muted); }
.feats { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0; }
.feat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.feat h3 { font-size: 14.5px; margin-bottom: 6px; }
.feat p { margin: 0; font-size: 13px; color: var(--muted); }
.why { border-top: 1px solid var(--line); margin-top: 30px; padding-top: 30px; }
.why-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 16px 0 0; }
.why-item h3 { font-size: 14.5px; margin-bottom: 5px; color: var(--accent); }
.why-item p { margin: 0; font-size: 13px; color: var(--muted); }
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 650; font-size: 14.5px; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+ "; color: var(--accent); font-family: var(--mono); }
.faq details[open] summary::before { content: "− "; }
.faq details p { margin: 8px 0 2px; color: var(--muted); font-size: 13.5px; }
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 14px 0 22px; }
.guide-card {
  display: flex; flex-direction: column; gap: 5px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; color: var(--ink);
}
.guide-card:hover { border-color: var(--accent-line); text-decoration: none; }
.g-kicker { font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em; color: var(--accent); text-transform: uppercase; }
.guide-card b { font-size: 14.5px; line-height: 1.4; }
.guide-card span:last-child { font-size: 12.5px; color: var(--muted2); }
.cta-box {
  margin: 34px 22px; padding: 24px; border-radius: var(--radius);
  border: 1px solid var(--accent-line); background: var(--accent-dim); text-align: center;
}
.cta-box h2 { font-size: 20px; margin-bottom: 6px; }
.cta-box p { color: var(--muted); font-size: 13.5px; max-width: 640px; margin: 0 auto 12px; }
main .cta-box { margin: 26px 0; }

/* --------------------------------------------------------------------- doc */
.doc { padding-top: 38px; padding-bottom: 20px; max-width: 860px; }
.doc h1 { font-size: clamp(27px, 3.6vw, 38px); margin-bottom: 8px; }
.doc .meta { font-size: 12.5px; color: var(--muted2); }
.crumbs { margin-bottom: 10px; }
.doc h2 { font-size: 20px; margin: 30px 0 10px; }
.doc h3 { font-size: 16px; margin: 22px 0 8px; }
.doc p, .doc li { font-size: 14.5px; color: var(--ink); }
.doc ul, .doc ol { margin: 0 0 14px; }
.doc blockquote {
  margin: 16px 0; padding: 10px 14px; border-left: 3px solid var(--accent);
  background: var(--panel); color: var(--muted); font-family: var(--mono); font-size: 13px;
  overflow-wrap: anywhere;
}
.note-inline {
  font-size: 13px; color: var(--muted); background: var(--panel);
  border: 1px solid var(--line); border-left: 3px solid var(--accent-line);
  border-radius: 8px; padding: 10px 13px; margin: 18px 0;
}
.tablewrap { overflow-x: auto; margin: 12px 0 18px; }
table { border-collapse: collapse; width: 100%; min-width: 420px; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 650; background: var(--panel); }
.related { margin: 22px 0; display: flex; flex-direction: column; gap: 6px; }
.related h2 { font-size: 16px; margin: 0 0 4px; }
.related a { font-size: 14px; }

.not-found { padding: 70px 22px 90px; max-width: 720px; }
.nf-code { font-family: var(--mono); font-size: 14px; color: var(--accent); margin-bottom: 4px; }
.not-found h1 { font-size: 32px; margin-bottom: 10px; }
.nf-links { margin: 18px 0; }
.nf-links li { margin-bottom: 6px; }

/* ------------------------------------------------------------------ footer */
.site-foot { border-top: 1px solid var(--line); margin-top: 44px; padding: 26px 0 34px; color: var(--muted2); }
.foot-inner { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 22px; align-items: start; }
.foot-brand { display: flex; align-items: center; gap: 7px; color: var(--ink); font-weight: 650; font-size: 14px; }
.foot-brand .brand-mark svg { width: 19px; height: 19px; }
.foot-note { font-size: 12.5px; margin: 8px 0 0; max-width: 380px; }
.foot-links { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.foot-links a { color: var(--muted); }
.foot-operator { font-size: 12px; text-align: right; }
.foot-copy { margin: 6px 0 0; color: var(--muted2); }
@media (max-width: 860px) {
  .foot-inner { grid-template-columns: 1fr 1fr; }
  .foot-operator { grid-column: 1 / -1; text-align: left; }
}

/* ----------------------------------------------------------------- mobile */
@media (max-width: 1040px) {
  .work-grid { grid-template-columns: minmax(0, 1fr); }
  .lower-grid { grid-template-columns: minmax(0, 1fr); }
  .feats, .steps, .why-list, .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  body { font-size: 15.5px; }
  .head-inner { min-height: 56px; gap: 8px; }
  .brand-word { display: none; }
  .head-link { display: none; }
  .langs a { padding: 4px 6px; font-size: 11px; }
  .hero { padding-top: 30px; }
  .work-grid { gap: 14px; }
  .feats, .steps, .why-list, .guide-grid { grid-template-columns: minmax(0, 1fr); }
  .row2 { grid-template-columns: minmax(0, 1fr); }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  dl.kv { grid-template-columns: minmax(0, 1fr); }
  dl.kv dt { padding-bottom: 0; border-top: 1px solid var(--line); }
  dl.kv dd { padding-top: 3px; border-top: 0; }
  .sig-out { height: 7.4em; }
  .sig-out-sm { height: 5.2em; }
  .byte-grid { height: 208px; }
  .snippet { height: 360px; font-size: 11px; }
  .foot-inner { grid-template-columns: 1fr; }
  .doc { padding-top: 26px; }
}

/* ------------------------------------------------- asn1lab decoder additions */
.work-grid { align-items: start; }
.tree-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-end; }
.pill.sm { font-size: 10.5px; padding: 2px 7px; }

.tree-wrap {
  height: 380px; overflow: auto; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg2); padding: 8px 8px 10px;
}
.tree-empty { margin: 6px 4px; font-size: 12.5px; color: var(--muted2); }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 14px; border-left: 1px solid var(--line); margin-left: 7px; }
.titem { margin: 0; }
.trow { display: flex; align-items: center; }
.tbtn {
  display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0;
  font: inherit; text-align: left; background: transparent; color: var(--ink);
  border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; cursor: pointer;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.45;
}
.tbtn:hover { background: var(--panel2); }
.tbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.titem.is-sel > .trow > .tbtn { background: var(--accent-dim); border-color: var(--accent-line); }
.t-caret { color: var(--accent); flex: none; width: 10px; }
.t-caret.leaf { color: var(--muted2); }
.t-tag { color: var(--ink); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-len { color: var(--muted2); flex: none; }
.t-off { color: var(--accent); flex: none; }
.t-oid { color: var(--ok); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-nested { color: var(--info); flex: none; font-size: 10.5px; border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }
.titem.collapsed > ul { display: none; }

.hex-wrap {
  height: 372px; overflow: auto; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg2); padding: 8px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.7;
}
.hexrow { display: flex; gap: 10px; white-space: nowrap; }
.hoff { color: var(--muted2); flex: none; width: 4.2em; }
.hbytes { display: flex; gap: 2px; flex: none; }
.hb {
  display: inline-block; width: 1.55em; text-align: center; border-radius: 3px;
  color: var(--muted); cursor: pointer; border: 1px solid transparent;
}
.hb.empty { visibility: hidden; }
.hb:hover { border-color: var(--line2); color: var(--ink); }
.hb.is-tag { background: var(--accent-dim); color: var(--accent-strong); border-color: var(--accent-line); }
[data-theme="light"] .hb.is-tag { color: var(--accent); }
.hb.is-len { background: var(--info-dim); color: var(--info); border-color: color-mix(in srgb, var(--info) 38%, transparent); }
.hb.is-val { background: var(--ok-dim); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 34%, transparent); }
.hascii { color: var(--muted2); flex: none; letter-spacing: .02em; }
.hc { display: inline-block; width: .62em; }

.goto-row { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; flex-wrap: wrap; }
.goto-fld { margin-top: 0; flex: 1 1 140px; max-width: 240px; }
.goto-fld input { font-family: var(--mono); font-size: 12px; }
.dot.tag { background: var(--accent); }
.dot.len { background: var(--info); }
.dot.val { background: var(--ok); }

#nodeDetail { height: 316px; overflow: auto; align-content: start; }
#structBody { height: 316px; overflow: auto; }
.kv-tight dt, .kv-tight dd { padding-top: 5px; padding-bottom: 5px; }
.ext-list { list-style: none; padding: 0; margin: 0 0 8px; font-size: 12.5px; }
.ext-list li { margin: 0 0 4px; overflow-wrap: anywhere; }
.ext-list b { color: var(--ink); }
.ext-detail { display: block; color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.ecdsa-box { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.ecdsa-box .sig-out { height: 3.6em; margin-top: 4px; }

.oid-wrap { height: 372px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg2); }
.oid-table { width: 100%; min-width: 0; font-size: 12px; margin: 0; }
.oid-table th { position: sticky; top: 0; z-index: 1; }
.oid-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); }
.oid-table td.mono { color: var(--accent); cursor: pointer; white-space: nowrap; }
.oid-filter { max-width: 190px; font-size: 12px; padding: 5px 9px; }

@media (max-width: 720px) {
  .tree-wrap, .hex-wrap, .oid-wrap { height: 300px; }
  #nodeDetail, #structBody { height: auto; min-height: 200px; }
  .hex-wrap { font-size: 10.5px; }
  .hexrow { gap: 6px; }
  .hascii { display: none; }
  .oid-filter { max-width: 130px; }
}

/* overflow and layout stability fixes */
.doc p, .doc li, .doc dd, .doc h1, .doc h2, .doc h3 { overflow-wrap: anywhere; }
.tree-wrap, .hex-wrap, .oid-wrap, #nodeDetail, #structBody { overflow-y: scroll; scrollbar-gutter: stable; }
#byteCount { width: 92px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fmtPill { width: 152px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#nodeCount { width: 92px; text-align: center; white-space: nowrap; }
#oidCount { width: 66px; text-align: center; white-space: nowrap; }

.struct-card { margin-top: 16px; }
#structBody .kv { grid-template-columns: minmax(92px, 132px) minmax(0, 1fr) minmax(92px, 132px) minmax(0, 1fr); column-gap: 20px; }
#structBody .kv dd { padding-right: 6px; }
#structBody .ext-list { columns: 2; column-gap: 24px; }
#structBody .ext-list li { break-inside: avoid; }
@media (max-width: 1040px) {
  #structBody .kv { grid-template-columns: minmax(92px, 132px) minmax(0, 1fr); }
  #structBody .ext-list { columns: 1; }
}
@media (max-width: 720px) {
  #structBody { height: 340px; }
}

/* visible scrollbars so fixed-height panels are discoverable */
.tree-wrap::-webkit-scrollbar, .hex-wrap::-webkit-scrollbar, .oid-wrap::-webkit-scrollbar,
#nodeDetail::-webkit-scrollbar, #structBody::-webkit-scrollbar { width: 10px; height: 10px; }
.tree-wrap::-webkit-scrollbar-track, .hex-wrap::-webkit-scrollbar-track, .oid-wrap::-webkit-scrollbar-track,
#nodeDetail::-webkit-scrollbar-track, #structBody::-webkit-scrollbar-track { background: var(--bg); border-radius: 8px; }
.tree-wrap::-webkit-scrollbar-thumb, .hex-wrap::-webkit-scrollbar-thumb, .oid-wrap::-webkit-scrollbar-thumb,
#nodeDetail::-webkit-scrollbar-thumb, #structBody::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 8px; }
.tree-wrap, .hex-wrap, .oid-wrap, #nodeDetail, #structBody { scrollbar-color: var(--line2) var(--bg); scrollbar-width: thin; }
#structBody { height: 400px; }

@media (max-width: 520px) {
  .t-off, .t-len { display: none; }
  .tbtn { gap: 5px; font-size: 10.8px; }
}

.select-wrap { min-width: 0; }
#sampleSel { max-width: min(360px, 62vw); }
@media (max-width: 520px) { #sampleSel { max-width: 58vw; } }
