main.hh { display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: var(--background); }
main.hh[data-state="start"] { overflow-y: auto; }
.hh-start[hidden], .hh-bench[hidden], .hh-status[hidden] { display: none; }

.hh-start {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: var(--space-6) var(--space-12);
  align-items: center;
  width: 100%;
  max-width: 1120px;
  margin: auto;
  padding: var(--space-12) var(--space-6);
}
.hh-start-copy h2 { margin: 0; font-size: clamp(32px, 4.4vw, 50px); font-weight: 650; line-height: 1.05; letter-spacing: -0.035em; text-wrap: balance; }
.hh-lead { max-width: 540px; margin: var(--space-5) 0 0; color: var(--text-muted); font-size: 17px; line-height: 1.6; text-wrap: pretty; }
#dropZone { min-height: 300px; }

.hh-bench {
  --start-gap: 12px;
  --end-gap: 12px;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, var(--start, 300px)) var(--start-gap) minmax(320px, 1fr) var(--end-gap) minmax(0, var(--end, 340px));
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  padding: 0 var(--space-4) var(--space-4);
}
.hh-bar { position: relative; grid-column: 1 / -1; grid-row: 1; display: flex; align-items: center; gap: var(--space-2) var(--space-3); min-width: 0; padding: var(--space-3) 0; }
.hh-dock { grid-row: 2; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.hh-dock[data-dock="start"] { grid-column: 1; }
.hh-dock[data-dock="end"] { grid-column: 5; }
.hh-dock[hidden] { display: none; }
.hh-gutter[data-gutter="start"] { grid-column: 2; grid-row: 2; }
.hh-gutter[data-gutter="end"] { grid-column: 4; grid-row: 2; }
.hh-centre { grid-column: 3; grid-row: 2; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.hh-sheet { display: none; }

.hh-gutter { position: relative; cursor: col-resize; touch-action: none; outline: none; }
.hh-gutter[hidden] { display: none; }
.hh-gutter::after { content: ""; position: absolute; inset: var(--space-4) 5px; border-radius: 2px; transition: background var(--speed-quick); }
.hh-gutter:hover::after, .hh-gutter:focus-visible::after, .hh-gutter[data-state="dragging"]::after { background: var(--border-strong); }
.hh-gutter:focus-visible::after { background: var(--accent); }
.hh-gutter[data-closing]::after { background: var(--danger); }
.hh-gutter-pane { flex: none; height: 12px; cursor: row-resize; }
.hh-gutter-pane::after { inset: 5px var(--space-4); }

.hh-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow-small), var(--highlight);
}
.hh-card[hidden] { display: none; }
.hh-pane { flex: 1 1 0; min-height: 120px; }
.hh-pane-head { display: flex; flex: none; align-items: center; gap: var(--space-2); min-height: 46px; padding: 0 var(--space-2) 0 var(--space-4); border-bottom: 1px solid var(--border); }
.hh-pane-head h2 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: -0.005em; white-space: nowrap; }
.hh-pane-tools { display: flex; align-items: center; gap: var(--space-2); min-width: 0; margin-inline-start: auto; }
.hh-pane-body { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.hh-pane-foot { display: flex; flex: none; gap: var(--space-1); padding: var(--space-2) var(--space-3); border-top: 1px solid var(--border); }
.hh-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.hh-pad { padding: var(--space-4); }
.hh-empty { margin: 0; padding: var(--space-4); color: var(--text-subtle); font-size: 13px; line-height: 1.55; text-wrap: pretty; }
.hh-pad .hh-empty { padding: 0; }
.hh-empty-danger { color: var(--danger); }
.hh-count { color: var(--text-subtle); font-size: 11.5px; font-weight: 500; font-variant-numeric: tabular-nums; }

.hh-file { display: flex; flex: 0 1 auto; align-items: center; gap: var(--space-3); min-width: 0; overflow: hidden; margin-inline-end: var(--space-2); }
.hh-file > .icon { flex: none; width: 18px; height: 18px; color: var(--accent-text); }
.hh-file-text { display: grid; min-width: 0; overflow: hidden; line-height: 1.3; }
.hh-file-text strong { overflow: hidden; max-width: 30ch; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.hh-file-text small { color: var(--text-subtle); font-size: 12px; white-space: nowrap; }
.hh-actions { display: flex; flex: none; align-items: center; gap: 2px; padding-inline-start: var(--space-3); border-inline-start: 1px solid var(--border); }
.hh-panes { display: flex; flex: none; gap: 2px; margin-inline-start: auto; }
.hh-bar .button[aria-disabled="true"] { opacity: 0.42; cursor: not-allowed; }
.hh-bar .button[aria-disabled="true"]:hover { background: none; color: var(--text-muted); }
.hh-toggle[aria-pressed="true"] .icon, .hh-toggle[aria-selected="true"] .icon { color: var(--accent-text); }
.hh-action .kit-chevron { width: 12px; height: 12px; }
.hh-bar .hh-action > span:not(.kit-chevron) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 1180px) {
  .hh-bar .hh-toggle > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

.hh-hexcard, .hh-compare { flex: 1; }
.hh-hex { flex: 1; min-width: 0; min-height: 0; }
.hh .hex-view { padding: 0 var(--space-4) var(--space-3); color: var(--text-muted); font-size: 12.5px; line-height: 1.75; }
.hh .hex-row { gap: 0 var(--space-5); }
.hh .hex-head { margin: 0 calc(-1 * var(--space-4)) var(--space-1); padding: var(--space-2) var(--space-4); }
.hh .hex-byte.hex-zero { color: var(--text-subtle); }
.hh .hex-ascii { color: var(--text-muted); }
.hh .hex-sel { background: color-mix(in oklch, var(--accent) 24%, transparent); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--accent) 65%, transparent); }
.hh .hex-sel.hex-focus { background: color-mix(in oklch, var(--region, var(--accent)) 48%, transparent); }
.hh .hex-modified { color: var(--accent-text); }
.hh .hex-view[data-column="ascii"] .hex-achar.hex-cursor, .hh .hex-view:not([data-column="ascii"]) .hex-byte.hex-cursor { outline: 1.5px solid var(--accent); outline-offset: -1px; }

.hh-tree, .hh-list { position: relative; outline: none; }
.hh-rows { position: relative; }
.hh-node, .hh-hit {
  position: absolute;
  left: var(--space-2);
  right: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}
.hh-node { height: 32px; }
.hh-hit { height: 30px; gap: var(--space-3); font-size: 12.5px; }
.hh-node:hover, .hh-hit:hover { background: var(--surface-hover); color: var(--text); }
.hh-node[aria-selected="true"] { background: var(--accent-soft); color: var(--text); }
.hh-node:focus-visible, .hh-hit:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.hh-node { padding-inline-start: calc(var(--space-3) + var(--depth) * 18px); }
.hh-node-group { color: var(--text); font-weight: 600; }
.hh-node-field { padding-inline-start: calc(30px + var(--depth) * 18px); }
.hh-node-name { overflow: hidden; min-width: 0; text-overflow: ellipsis; white-space: nowrap; }
.hh-node-value { overflow: hidden; max-width: 46%; margin-inline-start: auto; color: var(--text); font-family: var(--font-mono); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.hh-node-meta { flex: none; color: var(--text-subtle); font-family: var(--font-mono); font-size: 11.5px; font-weight: 400; white-space: nowrap; }
.hh-node-group .hh-node-meta { margin-inline-start: auto; }
.hh-node-wrong .hh-node-value { color: var(--danger); }
.hh-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--dot); }
.hh-hit-offset { flex: none; width: 10ch; color: var(--text-subtle); }
.hh-hit-text { overflow: hidden; min-width: 0; color: var(--text); text-overflow: ellipsis; white-space: pre; }

.hh-seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--background-subtle); }
.hh-seg button { display: inline-flex; align-items: center; padding: 3px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.hh-seg button:hover { color: var(--text); }
.hh-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-small); }
.hh-seg button:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.hh-input { width: 100%; height: 36px; padding: 0 var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--background); color: var(--text); font: inherit; font-size: 13px; }
.hh-input:focus-visible { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.hh-input[aria-invalid="true"] { border-color: var(--danger); }
.hh-find-form { display: grid; flex: none; gap: var(--space-2); padding-block: var(--space-3); }
.hh-find-row { display: flex; align-items: center; gap: var(--space-2); }
.hh-find-row .hh-input { flex: 1; min-width: 0; }
.hh-find-state { margin: 0; color: var(--text-subtle); font-size: 12px; }
.hh-find-form:has([aria-invalid="true"]) .hh-find-state { color: var(--danger); }
.hh-tabs { display: flex; flex: none; gap: var(--space-2); padding: 0 var(--space-3); border-bottom: 1px solid var(--border); }
.hh-tabs [role="tab"] { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 var(--space-2); border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--text-muted); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.hh-tabs [role="tab"]:hover { color: var(--text); }
.hh-tabs [role="tab"][aria-selected="true"] { border-bottom-color: var(--accent); color: var(--text); }
.hh-list[hidden], .hh-tree[hidden] { display: none; }

.hh-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px var(--space-4); margin: 0; font-size: 12.5px; }
.hh-facts dt { color: var(--text-subtle); }
.hh-facts dd { min-width: 0; margin: 0; color: var(--text); overflow-wrap: anywhere; }
.hh-facts[hidden] { display: none; }
.hh-hex-note { margin-inline-start: var(--space-2); color: var(--text-subtle); }
.hh-field { margin-bottom: var(--space-4); padding-bottom: var(--space-4); border-bottom: 1px solid var(--border); }
.hh-disasm { margin-top: var(--space-5); }
.hh-disasm h3, .hh-block h3 { margin: 0 0 var(--space-3); font-size: 13px; font-weight: 600; }
.hh-insn { display: grid; grid-template-columns: 10ch 7ch minmax(0, 1fr); font-family: var(--font-mono); font-size: 12px; line-height: 1.75; }
.hh-insn-addr { color: var(--text-subtle); }
.hh-insn-mnem { color: var(--syn-keyword); }
.hh-insn-ops { overflow: hidden; color: var(--syn-register); text-overflow: ellipsis; white-space: nowrap; }

.hh-marks { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.hh-mark { display: flex; align-items: center; gap: 2px; border-radius: 8px; }
.hh-mark:hover { background: var(--surface-hover); }
.hh-mark-main { display: grid; flex: 1; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: var(--space-2); min-width: 0; padding: 6px var(--space-2); border: 0; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: start; cursor: pointer; }
.hh-mark-name { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.hh-mark-meta { grid-column: 2; color: var(--text-subtle); font-size: 11.5px; }
.hh-mark-form { display: grid; gap: var(--space-3); margin-bottom: var(--space-4); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius); background: var(--background-subtle); }
.hh-mark-form[hidden] { display: none; }
.hh-mark-range { margin: 0; color: var(--text-muted); font-size: 12px; }
.hh-label { display: grid; gap: 6px; color: var(--text-muted); font-size: 12px; font-weight: 500; }
.hh-swatches { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.hh-swatches [role="radio"] { width: 22px; height: 22px; padding: 0; border: 2px solid var(--surface); border-radius: 50%; background: var(--dot); box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.hh-swatches [role="radio"][aria-checked="true"] { box-shadow: 0 0 0 2px var(--text); }
.hh-form-actions { display: flex; gap: var(--space-2); }

.hh-block { margin-top: var(--space-6); }
.hh-big { margin: 0; color: var(--text-muted); font-size: 13px; }
.hh-big strong { color: var(--text); font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.hh-meter { position: relative; height: 8px; margin: var(--space-3) 0 var(--space-2); border-radius: 999px; background: var(--background-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.hh-meter-fill { position: absolute; inset: 0 auto 0 0; width: var(--at); border-radius: inherit; background: var(--accent); }
.hh-meter-mark { position: absolute; top: -3px; bottom: -3px; left: 90%; width: 2px; border-radius: 1px; background: var(--text-subtle); }
.hh-note { margin: 0; color: var(--text-muted); font-size: 12.5px; }
.hh-graph { display: block; width: 100%; height: 64px; margin-top: var(--space-4); border-radius: 6px; background: var(--background-subtle); cursor: crosshair; }
.hh-graph-line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.hh-graph-fill { fill: var(--accent-soft); }
.hh-graph-limit { stroke: var(--danger); stroke-dasharray: 3 3; stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0.6; }
.hh-axis { display: flex; justify-content: space-between; margin: 4px 0 0; color: var(--text-subtle); font-size: 11px; }
.hh-stack { display: flex; gap: 2px; height: 10px; overflow: hidden; border-radius: 999px; }
.hh-stack span { width: var(--share); background: var(--dot); }
.hh-legend { display: grid; gap: 4px; margin: var(--space-3) 0 0; padding: 0; list-style: none; font-size: 12.5px; }
.hh-legend li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-2); color: var(--text-muted); }
.hh-heat { display: block; width: 100%; max-width: 256px; }
.hh-heat rect { fill: color-mix(in oklch, var(--accent) var(--heat), var(--background-subtle)); cursor: pointer; }
.hh-heat rect:hover { stroke: var(--text); stroke-width: 1.5; }
.hh-map { display: block; width: 100%; border: 1px solid var(--border); border-radius: 6px; cursor: crosshair; image-rendering: pixelated; }

.hh-compare-start { display: grid; justify-items: center; gap: var(--space-3); width: min(560px, 100%); margin: auto; padding: var(--space-8) var(--space-6); text-align: center; }
.hh-compare-start h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.hh-compare-start p { margin: 0; color: var(--text-muted); font-size: 14px; }
.hh-compare-zone { width: 100%; margin-top: var(--space-3); }
.hh-compare-bar { display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.hh-compare-bar h2 { margin: 0; font-size: 14px; font-weight: 600; }
.hh-compare-bar h2 > span[aria-hidden] { margin: 0 var(--space-1); color: var(--text-subtle); }
.hh-compare-stats { margin: 0; color: var(--text-muted); font-size: 12.5px; }
.hh-compare-bar .hh-actions { margin-inline-start: auto; }
.hh-compare-at { min-width: 9ch; color: var(--text-subtle); font-size: 12px; text-align: center; }
.hh-compare-views { display: grid; flex: 1; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 0; }
.hh-compare-views > .hh-hex + .hh-hex { border-inline-start: 1px solid var(--border); }

.hh-help { width: min(520px, calc(100vw - 32px)); }
.hh-shortcuts { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: var(--space-2) var(--space-4); margin: 0; font-size: 13px; }
.hh-shortcuts dd { margin: 0; color: var(--text-muted); }

.hh-status-field { color: var(--accent-text); }
.hh-modified { color: var(--accent-text); font-weight: 600; }
.hh-status-note { color: var(--text-muted); }
.hh-note-error { color: var(--danger); }

main.hh[data-mode="phone"] .hh-bench { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; padding: 0 var(--space-2); }
main.hh[data-mode="phone"] .hh-dock, main.hh[data-mode="phone"] .hh-gutter { display: none; }
main.hh[data-mode="phone"] .hh-centre { grid-column: 1; }
main.hh[data-mode="phone"] .hh-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: var(--space-2) 0; }
main.hh[data-mode="phone"] .hh-bar .button { min-width: 40px; height: 40px; }
main.hh[data-mode="phone"] .hh-file { flex: none; max-width: 38vw; }
main.hh[data-mode="phone"] .hh-file-text strong { max-width: 100%; }
main.hh[data-mode="phone"] .hex-view { padding: 0 var(--space-3) var(--space-2); font-size: 12px; }
main.hh[data-mode="phone"] .hex-row { gap: 0 var(--space-3); }
main.hh[data-mode="phone"] .hh-sheet { display: flex; flex-direction: column; grid-column: 1; grid-row: 3; margin: var(--space-2) calc(-1 * var(--space-2)) 0; border-top: 1px solid var(--border); border-radius: var(--radius-large) var(--radius-large) 0 0; background: var(--surface); box-shadow: 0 -8px 24px -12px rgb(0 0 0 / 0.35); }
.hh-sheet-head { display: flex; flex-direction: column; flex: none; }
.hh-grip { display: grid; place-items: center; height: 22px; cursor: row-resize; touch-action: none; outline: none; }
.hh-grip::before { content: ""; width: 40px; height: 4px; border-radius: 999px; background: var(--border-strong); }
.hh-grip:focus-visible::before { background: var(--accent); }
.hh-sheet-head .hh-panes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin: 0; padding: 0 var(--space-1) var(--space-1); }
.hh-sheet-head .hh-toggle { display: flex; flex-direction: column; gap: 2px; height: 50px; min-width: 0; padding: 0 2px; border-radius: 10px; font-size: 11px; }
.hh-sheet-head .hh-toggle > span { overflow: hidden; max-width: 100%; text-overflow: ellipsis; }
.hh-sheet-head .hh-toggle[aria-selected="true"] { background: var(--surface-hover); color: var(--text); }
.hh-sheet-body { display: flex; flex-direction: column; height: var(--sheet, 42dvh); min-height: 0; overflow: hidden; transition: height var(--speed-regular) var(--ease-out); }
.hh-sheet[data-size="closed"] .hh-sheet-body { height: var(--sheet, 0px); }
.hh-sheet[data-size="full"] .hh-sheet-body { height: var(--sheet, 70dvh); }
.hh-sheet[style*="--sheet"] .hh-sheet-body { transition: none; }
.hh-sheet-body > .hh-pane { flex: 1; border: 0; border-top: 1px solid var(--border); border-radius: 0; box-shadow: none; }
.hh-sheet-body .hh-close { display: none; }
main.hh[data-mode="phone"] .hh-compare-views { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
main.hh[data-mode="phone"] .hh-compare-views > .hh-hex + .hh-hex { border-inline-start: 0; border-top: 1px solid var(--border); }

@media (max-width: 760px) {
  .hh-status { flex-wrap: wrap; height: auto; min-height: 40px; padding-block: var(--space-2); gap: 2px var(--space-3); overflow: visible; white-space: normal; }
  .hh-status .tool-footer-spacer { display: none; }
  .hh-start { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); padding: var(--space-8) var(--space-4); }
  .hh-lead { font-size: 16px; }
  #dropZone { min-height: 220px; }
}
@media (pointer: coarse) {
  .hh-swatches [role="radio"] { width: 32px; height: 32px; }
}
