@font-face {
    font-family: Barlow;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/barlow-400.woff2") format("woff2");
}

@font-face {
    font-family: Barlow;
    font-weight: 600;
    font-display: swap;
    src: url("/fonts/barlow-600.woff2") format("woff2");
}

:root {
    color-scheme: light;
    --paper: #f3eedf;
    --raised: #fcfaf3;
    --ink: #171813;
    --muted: #68675a;
    --line: #ccc6b5;
    --blue: #2047d6;
    --selected: #dce3fd;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --byte-width: 28px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    font-family: Barlow, system-ui, sans-serif;
    color: var(--ink);
    background: var(--paper);
}

* {
    box-sizing: border-box;
}
body {
    margin: 0;
}
main {
    padding: 18px 20px;
    max-width: 1100px;
    margin: auto;
}
button {
    font: inherit;
    cursor: pointer;
    color: inherit;
}
button:disabled {
    cursor: default;
    color: var(--muted);
    opacity: 0.55;
}
button:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}
[hidden] {
    display: none !important;
}
header,
.view-controls,
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
header {
    align-items: flex-start;
    flex-wrap: wrap;
}
h1 {
    margin: 0;
    font-size: 23px;
    font-weight: 600;
    overflow-wrap: anywhere;
}
header > div:first-child {
    min-width: 0;
    flex: 1 1 190px;
}
.pagination button {
    border: 1px solid var(--line);
    background: transparent;
    padding: 6px 9px;
    font-size: 13px;
    min-height: 34px;
}
.pagination button:not(:disabled):hover {
    background: var(--raised);
}
.view-controls {
    margin-top: 18px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
    gap: 8px;
}
.tabs {
    display: flex;
    gap: 14px;
}
.tabs button {
    background: none;
    border: 0;
    border-bottom: 3px solid transparent;
    padding: 8px 0;
    font-weight: 600;
}
.tabs button[aria-selected="true"] {
    border-color: var(--blue);
    color: var(--blue);
}
.count {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    padding-bottom: 4px;
}
#error {
    font-size: 11px;
    margin: 8px 0;
    color: #9a2525;
}
.table-wrap {
    background: var(--raised);
    border-block: 1px solid var(--line);
    overflow-x: auto;
}
table {
    width: 100%;
    min-width: calc(68px + var(--columns, 16) * var(--byte-width) + max(4ch, var(--columns, 16) * 1ch));
    border-collapse: collapse;
    table-layout: fixed;
    font-family: var(--mono);
    font-size: 12px;
}
th {
    font-weight: 400;
    color: var(--muted);
    text-align: left;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}
th:first-child {
    width: 56px;
    padding-left: 4px;
}
th:last-child {
    width: calc(max(4ch, var(--columns, 16) * 1ch) + 12px);
    padding-left: 8px;
    overflow-wrap: anywhere;
}
td {
    padding: 0;
    height: 22px;
}
td:first-child {
    color: var(--muted);
    padding-left: 4px;
    font-size: 11px;
}
td:last-child {
    padding-left: 8px;
}
.hex-bytes {
    display: grid;
    grid-template-columns: repeat(var(--columns, 16), minmax(var(--byte-width), 1fr));
}
#hex-heading span {
    text-align: center;
}
.text-bytes {
    display: grid;
    grid-template-columns: repeat(var(--columns, 16), 1ch);
}
.hex-byte,
.text-byte {
    display: block;
    text-align: center;
    font-family: var(--mono);
    font-size: 12px;
    white-space: pre;
}
.hex-byte {
    border: 0;
    padding: 3px 0;
    margin: 0;
    background: transparent;
    width: 100%;
}
.text-byte {
    padding: 3px 0;
    cursor: pointer;
}
.is-header {
    box-shadow: inset 0 -2px 0 var(--blue);
}
.is-hovered {
    background: #ece8d9;
}
.is-selected {
    background: var(--selected);
    color: #15399b;
}
.hex-byte:focus-visible {
    outline-offset: -1px;
}
.muted {
    color: var(--muted);
}
.pagination {
    margin-top: 10px;
}
#range {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    text-align: center;
}
#selection {
    margin: 10px 0 0;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 620px) {
    main {
        padding: 14px 12px;
    }
    header {
        gap: 8px;
    }
    h1 {
        font-size: 21px;
    }
    .view-controls {
        margin-top: 12px;
    }
    .tabs {
        gap: 12px;
    }
}

@media (max-width: 420px) {
    .pagination {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    #range {
        grid-row: 2;
        grid-column: 1 / -1;
    }
}

@media (pointer: coarse) {
    :root {
        --byte-width: 32px;
    }
    .pagination button,
    .tabs button,
    .hex-byte,
    .text-byte {
        min-height: 44px;
    }
    .text-byte {
        display: grid;
        place-items: center;
    }
}
