/*
 * devtool-kit.css: shared primitives of the v3.1.2 developer tool family (first used by /network/subnet-calculator).
 *
 * Load it before the tool's own stylesheet:
 *   toolPageStart('<key>', ['css' => ['devtool-kit.css', '<tool>.css'], 'js' => '<tool>.js']);
 * Every class starts with "dk-" (checked against components.css, main.css, style.css, header and footer: no clashes).
 * Only site tokens from main.css are used (var(--...)), so the dark theme ([data-theme="dark"]) follows on its own.
 * Changes go through the coordinator: later tools rely on these names.
 *
 * Layout
 *   .dk-tool                 wrapper of the interactive part of a page (vertical rhythm between blocks)
 *   .dk-toolbar              row above the tool: tabs on the left, page actions on the right; wraps on small screens
 *   .dk-toolbar-actions      a group of buttons (in the toolbar or in a .dk-card-head)
 *   .dk-card                 white panel, 1px border, 12px radius. Children: .dk-card-head > .dk-card-title (h2/h3)
 *                            + .dk-card-sub; .dk-card--flush has no padding (for tables). A <div> in .dk-card-head
 *                            may shrink below its content (min-width:0), so a long title wraps instead of widening the card
 *   .dk-grid / .dk-grid--2   responsive columns (2 from 900px); .dk-stack = vertical gap
 *
 * Navigation
 *   .dk-tabs > .dk-tab       segmented tabs. On screens up to 720px the row stays one line: icons hide, a
 *                            <span class="dk-tab-short"> replaces <span class="dk-tab-long"> when both are given, and
 *                            the row scrolls sideways if it still does not fit (the page never does).
 *                            Roles: role="tablist" / role="tab", aria-selected; or a mode switch with
 *                            role="radiogroup" / role="radio", aria-checked. The selected tab is a raised
 *                            white segment, never filled brand blue (that colour is kept for the one primary action).
 *                            .dk-tabs--sm for an in-card mode switch; it wraps onto two lines on small screens.
 *   .dk-panel                tab panel (role="tabpanel"); hidden attribute hides it
 *
 * Forms
 *   .dk-field                label + control + help + error, stacked
 *   .dk-label                field label (600, 14px); .dk-label-hint = quiet text inside the label
 *   .dk-input / .dk-textarea / .dk-select   44px controls; add .dk-mono for addresses, hashes, code;
 *                            .dk-input--lg (52px, 18px text) for the main input of a view
 *   .dk-input[aria-invalid="true"]          red border
 *   .dk-help                 help line under a control; .dk-row = inline group of controls
 *   .dk-check                checkbox with label, 44px target
 *   .dk-range                range slider with a visible focus ring; track and thumb drawn from tokens, so it looks the
 *                            same in the dark theme
 *
 * Actions
 *   .dk-btn                  secondary button (44px); .dk-btn--primary = the single filled brand action of a view;
 *                            .dk-btn--ghost = text button
 *   .dk-copy                 square 44px icon button for copying one value (aria-label says what it copies);
 *                            .is-copied while the check mark shows; [disabled] while there is nothing current to copy
 *   .dk-chips > .dk-chip     example inputs ("try 10.0.0.0/8"); .dk-chips-label = the word before them
 *   .dk-kbd                  keyboard key; .dk-hint = quiet one-line hint next to controls
 *
 * Results
 *   .dk-results              list of result rows; .dk-results--2 = two columns from 900px
 *   .dk-result               one row, in a <dl class="dk-results">:
 *                              <div class="dk-result"><dt class="dk-result-label">Label</dt>
 *                                <dd class="dk-value-cell"><span class="dk-value">value</span><span class="dk-value-note">note</span></dd>
 *                                <dd><button class="dk-copy" aria-label="Copy ...">...</button></dd></div>
 *                            The note sits beside the value (not inside it) so it keeps the page font.
 *   .dk-value                monospace value, selectable; long values wrap at <wbr> break points (put them after ":",
 *                            "." and "," in IPv6 addresses, arpa names and long numbers; wrap short ones such as an IPv4
 *                            address in .dk-nowrap) and break anywhere as a last resort, never under the copy button;
 *                            .dk-value--lg for the headline value, .dk-value--text for a value that is words, not an address or number
 *   .dk-group-title          small heading over a group of rows
 *   .dk-badge                neutral tag (type, status); .dk-badge--ok / --warn / --err add an icon colour only
 *   .dk-stat-row > .dk-stat  summary numbers (.dk-stat-num + .dk-stat-label)
 *   .dk-table-wrap > .dk-table  data table; the wrapper scrolls sideways, never the page. Cells: .dk-td-num (right
 *                            aligned numbers), .dk-td-text (words in the page font instead of monospace),
 *                            .dk-td-action (holds a 44px .dk-copy; stays visible at the right edge while the
 *                            table scrolls sideways), .dk-td-wrap (a long value, e.g. IPv6, that may wrap at <wbr>
 *                            points: give the td both .dk-td-wrap and .dk-breakable).
 *                            The tool's script adds .is-scrollable to .dk-table-wrap (and to .dk-tabs) when the
 *                            content is wider than the box, and .is-end once scrolled to the right end: the copy
 *                            column (or the tab row) then shows an edge shadow.
 *                            .dk-table--stack: up to 600px wide each row becomes a block of "label value" lines
 *                            (label above value under 400px), labels taken from data-label on each td (set it from
 *                            the th). Cell content stays inline (text, <wbr>, inline spans); addresses never break.
 *                            .dk-table--stack.is-stacked stacks the same way at any width: the script adds it when the
 *                            table is wider than its box, so no column is ever hidden under the copy column.
 *   .dk-scroll-y             caps a long list at 28rem and scrolls it inside (draw a bounded number of items too)
 *   .is-changed              add to a value that just changed: a 240 ms background fade (none with reduced motion)
 *
 * Messages
 *   .dk-notice               inline message box; --error, --warn, --info, --ok set the icon colour and border
 *   .dk-error                short inline error under a field (role="alert"), icon + text
 *   .dk-empty                empty state inside a card
 *   .dk-sr-only              visually hidden, read by screen readers (for aria-live status)
 *   .dk-nowrap               keeps a value or formula on one line (an address inside a sentence, 2^(32-p) - 2)
 *   .dk-breakable            text with <wbr> break points; breaks elsewhere only if one piece cannot fit
 *   .dk-word                 one long value (IPv6 address, arpa name) with <wbr> points inside: moves to the next line
 *                            whole and breaks at its <wbr> points only when it is wider than the line
 *
 * Content below the tool
 *   .dk-content              article typography for the explanation (h2, h3, p, ul, ol, code, pre, table)
 *   .dk-example              a worked example: .dk-example-in (the input line) + an output block (pre or table)
 *   .dk-faq > details > summary   FAQ; summary is a 44px target with a chevron
 *   .dk-refs                 list of standards (RFC links)
 *   Inside a table in .dk-content, <code> never wraps (td code / th code): wrap such a table in .dk-table-wrap so a
 *   long value scrolls inside the box instead of widening the page.
 *
 * Global rules of the kit
 *   [hidden] inside .dk-tool and .dk-content is always display:none (!important), whatever display a kit class sets.
 */

/* ---------------------------------------------------------------------------------------------------- layout */

.dk-tool {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-12);
    color: var(--text-primary);
    font-size: var(--text-base);
    line-height: 1.5;
}

.dk-tool *,
.dk-content * {
    box-sizing: border-box;
}

/* The hidden attribute always wins inside a tool. Kit classes such as .dk-btn, .dk-tabs and .dk-badge set
   display, which would otherwise beat the browser's [hidden] rule and leave hidden controls on screen. */
.dk-tool [hidden],
.dk-content [hidden] {
    display: none !important;
}

/* main.css sets `body.enable-animations * { transition: all ... }`, which animates padding, margin, width and grid
   changes whenever a tool crosses a breakpoint. Inside the kit only colours and opacity may transition. */
body.enable-animations .dk-tool *,
body.enable-animations .dk-content * {
    transition-property: background-color, border-color, color, opacity, box-shadow;
}

.dk-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.dk-toolbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.dk-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-6);
    min-width: 0;
}

.dk-card--flush {
    padding: 0;
    overflow: hidden;
}

.dk-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-4);
}

.dk-card-head > div {
    min-width: 0;
}

.dk-card-title {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 600;
    line-height: 1.33;
    letter-spacing: -0.005em;
    color: var(--text-primary);
}

.dk-card-sub {
    margin: var(--space-1) 0 0;
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.dk-grid {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: minmax(0, 1fr);
}

.dk-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

@media (min-width: 900px) {
    .dk-grid--2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ------------------------------------------------------------------------------------------------ navigation */

.dk-tabs {
    display: flex;
    gap: var(--space-1);
    padding: var(--space-1);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
}

.dk-tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: 0 var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 160ms ease-out, color 160ms ease-out, border-color 160ms ease-out;
}

.dk-tab:hover {
    color: var(--text-primary);
}

.dk-tab[aria-selected="true"],
.dk-tab[aria-checked="true"] {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.dk-tab i {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.dk-tabs--sm {
    align-self: flex-start;
}

.dk-tabs--sm .dk-tab {
    padding: 0 var(--space-3);
}

.dk-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-width: 0;
}

.dk-panel[hidden] {
    display: none;
}

.dk-tab-short {
    display: none;
}

@media (max-width: 720px) {
    /* one row: short labels, no icons; if it still does not fit, the row scrolls sideways (the page never does) */
    .dk-tabs {
        flex-wrap: nowrap;
        overscroll-behavior-x: contain;
    }

    .dk-tab {
        flex: 1 0 auto;
        justify-content: center;
        padding: 0 var(--space-3);
    }

    .dk-tab i {
        display: none;
    }

    .dk-tabs .dk-tab-long {
        display: none;
    }

    .dk-tabs .dk-tab-short {
        display: inline;
    }

    .dk-tabs--sm {
        flex-wrap: wrap;
    }

    /* the tab row scrolls: an inner shadow at the edge that has more */
    .dk-tabs.is-scrollable:not(.is-end) {
        box-shadow: inset -14px 0 10px -10px var(--text-muted);
    }
}

@media (max-width: 400px) {
    .dk-tabs:not(.dk-tabs--sm) .dk-tab {
        padding: 0 var(--space-2);
    }
}

/* ----------------------------------------------------------------------------------------------------- forms */

.dk-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}

.dk-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.dk-label-hint {
    font-weight: 400;
    color: var(--text-secondary);
}

.dk-input,
.dk-textarea,
.dk-select {
    width: 100%;
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--btn-secondary-border);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font: inherit;
    font-size: var(--text-base);
    line-height: 1.5;
    transition: border-color 160ms ease-out;
}

.dk-textarea {
    min-height: 132px;
    resize: vertical;
}

.dk-input--lg {
    min-height: 52px;
    font-size: var(--text-lg);
}

.dk-mono,
.dk-input.dk-mono,
.dk-textarea.dk-mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.dk-input:hover,
.dk-textarea:hover,
.dk-select:hover {
    border-color: var(--text-secondary);
}

.dk-input:focus-visible,
.dk-textarea:focus-visible,
.dk-select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
    border-color: var(--primary-color);
}

.dk-input[aria-invalid="true"],
.dk-textarea[aria-invalid="true"] {
    border-color: var(--error-color);
}

.dk-input::placeholder,
.dk-textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.8;
}

.dk-help {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

.dk-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3);
}

.dk-row > .dk-field {
    flex: 1 1 200px;
}

.dk-check {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    font-size: var(--text-sm);
    color: var(--text-primary);
    cursor: pointer;
}

.dk-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    flex-shrink: 0; /* keep the box 18x18 when a long label wraps at narrow widths */
    accent-color: var(--primary-color);
}

.dk-range {
    width: 100%;
    min-height: 44px;
    margin: 0;
    background: transparent;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

/* the same track and thumb in light and dark themes (tokens only) */
.dk-range::-webkit-slider-runnable-track {
    height: 6px;
    border: 1px solid var(--btn-secondary-border);
    border-radius: 999px;
    background: var(--bg-tertiary);
}

.dk-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    margin-top: -9px;
    border: 2px solid var(--bg-primary);
    border-radius: 50%;
    background: var(--btn-primary-bg);
    box-shadow: 0 0 0 1px var(--btn-primary-bg);
}

.dk-range::-moz-range-track {
    height: 6px;
    border: 1px solid var(--btn-secondary-border);
    border-radius: 999px;
    background: var(--bg-tertiary);
}

.dk-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 2px solid var(--bg-primary);
    border-radius: 50%;
    background: var(--btn-primary-bg);
    box-shadow: 0 0 0 1px var(--btn-primary-bg);
}

.dk-range:focus-visible,
.dk-check input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------------------------------- actions */

.dk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: 0 var(--space-4);
    border: 1px solid var(--btn-secondary-border);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--btn-secondary-fg);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
}

.dk-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.dk-btn--primary {
    background: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
    color: var(--btn-primary-fg);
}

.dk-btn--primary:hover {
    background: var(--btn-primary-hover);
    border-color: var(--btn-primary-hover);
    color: var(--btn-primary-fg);
}

.dk-btn--ghost {
    border-color: transparent;
    background: transparent;
}

.dk-btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

.dk-btn:focus-visible,
.dk-copy:focus-visible,
.dk-tab:focus-visible,
.dk-chip:focus-visible,
.dk-faq summary:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.dk-copy {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 160ms ease-out, color 160ms ease-out;
}

.dk-copy:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.dk-copy[disabled] {
    cursor: not-allowed;
    opacity: 0.55;
}

.dk-copy[disabled]:hover {
    background: transparent;
    color: var(--text-secondary);
}

.dk-copy.is-copied {
    color: var(--success-color);
}

.dk-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.dk-chips-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.dk-chip {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: border-color 160ms ease-out, background-color 160ms ease-out;
}

.dk-chip:hover {
    border-color: var(--text-secondary);
    background: var(--bg-primary);
}

.dk-kbd {
    display: inline-block;
    min-width: 1.6em;
    padding: 0 0.4em;
    border: 1px solid var(--border-color);
    border-bottom-width: 2px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.6;
    text-align: center;
}

.dk-hint {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* --------------------------------------------------------------------------------------------------- results */

.dk-results {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: var(--space-8);
    margin: 0;
}

@media (min-width: 900px) {
    .dk-results--2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.dk-result {
    display: grid;
    grid-template-columns: minmax(112px, 32%) minmax(0, 1fr) 44px;
    align-items: center;
    gap: var(--space-3);
    min-height: 52px;
    padding: var(--space-1) 0;
    border-bottom: 1px solid var(--border-color);
}

.dk-result[hidden] {
    display: none;
}

.dk-result > dt,
.dk-result > dd {
    margin: 0;
}

.dk-result-label {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.4;
}

.dk-value-cell {
    margin: 0;
    min-width: 0;
}

.dk-value {
    display: block;
    margin: 0;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: var(--text-base);
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    overflow-wrap: anywhere;
    line-height: 1.45;
    border-radius: var(--border-radius-sm);
    transition: background-color 240ms ease-out;
}

.dk-value--lg {
    font-size: var(--text-xl);
    font-weight: 600;
}

.dk-value--text {
    font-family: inherit;
}

.dk-value-note {
    display: block;
    margin-top: 2px;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.dk-value.is-changed {
    background: var(--bg-tertiary);
    transition: none;
}

.dk-group-title {
    margin: 0 0 var(--space-1);
    padding-top: var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.dk-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px var(--space-2);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}

.dk-badge i { color: var(--text-secondary); }
.dk-badge--ok i { color: var(--success-color); }
.dk-badge--warn i { color: var(--warning-color); }
.dk-badge--err i { color: var(--error-color); }

.dk-stat-row {
    font-variant-numeric: tabular-nums;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-8);
}

.dk-stat {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dk-stat-num {
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.dk-stat-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.dk-scroll-y {
    max-height: 28rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.dk-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.dk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.dk-table th,
.dk-table td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.dk-table th {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: var(--text-xs);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.dk-table td {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.dk-table td.dk-td-text {
    font-family: inherit;
}

.dk-table td.dk-td-wrap {
    min-width: 12ch;
    white-space: normal;
    overflow-wrap: normal;
}

/* a table wider than its box: an inner shadow at the right edge, and the sticky copy column gets an edge,
   so a cut value never reads as complete */
.dk-table-wrap.is-scrollable:not(.is-end) {
    box-shadow: inset -14px 0 10px -10px var(--text-muted);
}

.dk-table-wrap.is-scrollable:not(.is-end) .dk-td-action {
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 8px -8px var(--text-muted);
}

.dk-table td.dk-td-num,
.dk-table th.dk-td-num {
    text-align: right;
}

.dk-table tr:last-child td {
    border-bottom: 0;
}

.dk-table td.dk-td-action,
.dk-table th.dk-td-action {
    position: sticky;
    right: 0;
    width: 52px;
    background: var(--bg-primary);
    text-align: right;
}

.dk-table th.dk-td-action {
    background: var(--bg-secondary);
}

.dk-table td.dk-td-action {
    padding-top: 2px;
    padding-bottom: 2px;
}

/* -------------------------------------------------------------------------------------------------- messages */

.dk-notice {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.dk-notice > i {
    margin-top: 0.2em;
    color: var(--text-secondary);
}

.dk-notice p {
    margin: 0;
}

.dk-notice--error { border-color: var(--error-color); background: var(--bg-primary); }
.dk-notice--error > i { color: var(--error-color); }
.dk-notice--warn > i { color: var(--warning-color); }
.dk-notice--info > i { color: var(--info-color); }
.dk-notice--ok > i { color: var(--success-color); }

.dk-notice[hidden],
.dk-error[hidden] {
    display: none;
}

.dk-error {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin: 0;
    color: var(--text-primary);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.dk-error > i {
    margin-top: 0.2em;
    color: var(--error-color);
}

.dk-empty {
    padding: var(--space-6);
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.dk-nowrap {
    white-space: nowrap;
}

/* text with <wbr> break points (IPv6 after ":"); breaks elsewhere only if one group cannot fit at all */
.dk-breakable {
    overflow-wrap: anywhere;
}

/* one long value with <wbr> points inside: it moves to the next line whole, and breaks at its <wbr> points only when
   it is wider than the line itself ("8.168.192.in-addr.arpa to 11.168.192.in-addr.arpa" breaks at " to ", not at a dot) */
.dk-word {
    display: inline-block;
    max-width: 100%;
    vertical-align: top;
}

.dk-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------------------------------- content */

.dk-content {
    max-width: 820px;
    margin: var(--space-12) 0 var(--space-8);
    color: var(--text-primary);
    font-size: var(--text-base);
    line-height: 1.65;
}

.dk-content h2 {
    text-wrap: balance;
    margin: var(--space-12) 0 var(--space-3);
    font-size: var(--text-2xl);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.dk-content h2:first-child {
    margin-top: 0;
}

.dk-content h3 {
    text-wrap: balance;
    margin: var(--space-8) 0 var(--space-2);
    font-size: var(--text-lg);
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-primary);
}

.dk-content p,
.dk-content ul,
.dk-content ol {
    text-wrap: pretty;
    margin: 0 0 var(--space-4);
    color: var(--text-primary);
}

.dk-content ul,
.dk-content ol {
    padding-left: 1.25rem;
}

.dk-content li {
    margin-bottom: var(--space-2);
}

.dk-content a {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.dk-content a:hover {
    color: var(--primary-hover);
}

.dk-content code {
    padding: 1px 5px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-tertiary);
    font-family: var(--font-mono);
    font-size: 0.9em;
    overflow-wrap: anywhere;
}

/* Short codes in tables (alg names, prefixes, flags) must not break mid-word ("HS25 / 6"). */
.dk-content td code,
.dk-content th code {
    overflow-wrap: normal;
    white-space: nowrap;
}

.dk-content pre {
    margin: 0 0 var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.6;
}

.dk-content pre code {
    padding: 0;
    background: transparent;
    font-size: inherit;
}

.dk-content table {
    width: 100%;
    margin: 0 0 var(--space-4);
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.dk-content th,
.dk-content td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
}

.dk-content th {
    color: var(--text-secondary);
    font-weight: 600;
}

.dk-content .dk-table-wrap table {
    margin: 0;
}

.dk-example {
    margin: 0 0 var(--space-6);
}

.dk-example-in {
    margin: 0 0 var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.dk-faq {
    border-top: 1px solid var(--border-color);
}

.dk-faq details {
    border-bottom: 1px solid var(--border-color);
}

.dk-faq summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    min-height: 52px;
    padding: var(--space-3) 0;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
}

.dk-faq summary::-webkit-details-marker {
    display: none;
}

.dk-faq summary::after {
    content: "\f078";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: transform 160ms ease-out;
}

.dk-faq details[open] summary::after {
    transform: rotate(180deg);
}

.dk-faq details > div {
    padding: 0 0 var(--space-4);
}

.dk-faq details > div > :last-child {
    margin-bottom: 0;
}

.dk-refs {
    list-style: none;
    padding-left: 0;
}

.dk-refs li {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: var(--space-3);
    padding: var(--space-2) 0;
    margin: 0;
    border-bottom: 1px solid var(--border-color);
}

@media (max-width: 600px) {
    .dk-card {
        padding: var(--space-4);
    }

    .dk-result {
        grid-template-columns: minmax(0, 1fr) 44px;
        grid-template-areas: "label copy" "value copy";
        row-gap: 0;
        padding: var(--space-2) 0;
    }

    .dk-result-label { grid-area: label; }
    .dk-result .dk-value-cell { grid-area: value; }
    .dk-result > dd:last-child { grid-area: copy; }

    .dk-refs li {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .dk-content h2 {
        font-size: var(--text-xl);
    }
}

@media (max-width: 600px) {
    /* .dk-table--stack: each row becomes a block of "label  value" lines; labels come from data-label on the cells */
    .dk-table--stack thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .dk-table--stack,
    .dk-table--stack tbody,
    .dk-table--stack tr,
    .dk-table--stack td {
        display: block;
        width: auto;
    }

    .dk-table--stack tr {
        position: relative;
        min-height: 52px;
        padding: var(--space-2) 56px var(--space-2) var(--space-3);
        border-bottom: 1px solid var(--border-color);
    }

    .dk-table--stack tr:last-child {
        border-bottom: 0;
    }

    /* the label floats left of the value; the value stays inline text, so <wbr> break points keep working */
    .dk-table--stack td {
        display: flow-root;
        padding: 2px 0;
        border: 0;
        white-space: normal;
        overflow-wrap: normal;
        text-align: left;
    }

    .dk-table--stack td.dk-td-text {
        overflow-wrap: anywhere;
    }

    .dk-table--stack td::before {
        content: attr(data-label);
        float: left;
        width: 6.5rem;
        margin-right: var(--space-3);
        color: var(--text-secondary);
        font-family: var(--font-family, inherit);
        font-size: var(--text-xs);
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        line-height: 1.9;
    }

    .dk-table--stack td.dk-td-num {
        text-align: left;
    }

    .dk-table--stack td:empty {
        display: none;
    }

    .dk-table--stack td.dk-td-action {
        position: absolute;
        top: 4px;
        right: 4px;
        width: auto;
        padding: 0;
        background: transparent;
    }

    .dk-table--stack td.dk-td-action::before {
        content: none;
    }
}

/* .dk-table--stack.is-stacked: the same stacked rows at any width (the rules of the 600px block above, repeated) */
.dk-table--stack.is-stacked thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.dk-table--stack.is-stacked,
.dk-table--stack.is-stacked tbody,
.dk-table--stack.is-stacked tr,
.dk-table--stack.is-stacked td {
    display: block;
    width: auto;
}

.dk-table--stack.is-stacked tr {
    position: relative;
    min-height: 52px;
    padding: var(--space-2) 56px var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-color);
}

.dk-table--stack.is-stacked tr:last-child {
    border-bottom: 0;
}

.dk-table--stack.is-stacked td {
    display: flow-root;
    padding: 2px 0;
    border: 0;
    white-space: normal;
    overflow-wrap: normal;
    text-align: left;
}

.dk-table--stack.is-stacked td.dk-td-text {
    overflow-wrap: anywhere;
}

.dk-table--stack.is-stacked td::before {
    content: attr(data-label);
    float: left;
    width: 6.5rem;
    margin-right: var(--space-3);
    color: var(--text-secondary);
    font-family: var(--font-family, inherit);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.9;
}

.dk-table--stack.is-stacked td.dk-td-num {
    text-align: left;
}

.dk-table--stack.is-stacked td:empty {
    display: none;
}

.dk-table--stack.is-stacked td.dk-td-action {
    position: absolute;
    top: 4px;
    right: 4px;
    width: auto;
    padding: 0;
    background: transparent;
}

.dk-table--stack.is-stacked td.dk-td-action::before {
    content: none;
}

@media (max-width: 400px) {
    /* very narrow: each label sits above its value, so the value has the full width */
    .dk-table--stack td {
        padding: 3px 0;
    }

    .dk-table--stack td::before {
        float: none;
        display: block;
        width: auto;
        margin-right: 0;
        line-height: 1.5;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dk-tool *,
    .dk-content *,
    .dk-tool *::after,
    .dk-content *::after {
        transition: none !important;
        animation: none !important;
    }
}
