.network-page {
    --net-blue: #075985;
    --net-ink: #0b1220;
    --net-muted: #52657a;
    --net-line: #b9cad8;
    color: var(--net-ink);
    font-family: system-ui,-apple-system,"Segoe UI",sans-serif;
    line-height: 1.6;
    padding: 0 20px 34px 20px;
}

    .network-page [hidden] {
        display: none !important
    }

.network-header {
    max-width: 900px;
    padding-bottom: 15px;
}

    .network-header > a {
        color: var(--net-muted);
        text-decoration: none;
        font-size: .9rem
    }

.network-eyebrow {
    color: var(--net-blue);
    font-size: .73rem;
    letter-spacing: .14em;
    font-weight: 750;
    margin: 15px 0 10px
}

.network-header > p:last-child {
    color: var(--net-muted);
    font-size: 1.08rem;
    max-width: 780px
}

.network-tool-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px
}

    .network-tool-tabs a {
        display: inline-block;
        padding: 8px 14px;
        border: 1px solid var(--net-line);
        border-radius: 999px;
        color: var(--net-blue);
        font-size: .88rem;
        font-weight: 700;
        text-decoration: none;
        background: #fff
    }

        .network-tool-tabs a[aria-current="page"] {
            background: var(--net-blue);
            border-color: var(--net-blue);
            color: #fff
        }

.network-mode-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--net-line);
    padding-bottom: 13px;
    margin-bottom: 24px
}

    .network-mode-tabs button {
        width: auto;
        margin: 0;
        padding: 9px 18px;
        border: 1px solid var(--net-line);
        background: #fff;
        color: var(--net-blue);
        border-radius: 7px;
        font-weight: 700
    }

        .network-mode-tabs button.active {
            background: var(--net-blue);
            color: #fff;
            border-color: var(--net-blue)
        }

.network-layout {
    display: grid;
    grid-template-columns: minmax(0,.9fr) minmax(0,1.25fr);
    gap: 24px;
    align-items: start
}

.network-card, .network-guide {
    border: 1px solid var(--net-line);
    border-radius: 12px;
    padding: 25px;
    background: #e6eef4;
    min-width: 0
}

    .network-card h2, .network-guide h2 {
        color: var(--net-blue)
    }

.network-page label {
    font-size: .85rem;
    font-weight: 600
}

.network-page input, .network-page select, .network-page textarea {
    font: inherit;
    box-sizing: border-box;
    width: 100%;
    border: 1px solid #aebfc9;
    background: #fff;
    padding: 10px;
    border-radius: 5px;
    color: var(--net-ink);
    margin: 3px 0 13px
}

.network-page textarea {
    resize: vertical
}

.network-form-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 0 14px;
}

.network-page fieldset {
    border: 1px solid var(--net-line);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 2px 0 16px;
}

.network-page legend {
    color: var(--net-blue);
    font-weight: 700;
    padding: 0 5px;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 8px 14px;
}

.option-grid label, .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: 500;
}

.option-grid input, .network-page .checkbox-label input {
    width: auto;
    flex: 0 0 auto;
    margin: 4px 0 0;
}

.network-page .checkbox-label {
    padding-top: 25px;
}

.network-result-group {
    border-top: 1px solid var(--net-line);
    margin-top: 22px;
    padding-top: 18px;
}

.network-answer {
    color: var(--net-blue);
    font-size: 1.05rem;
}

.network-answer.warning {
    color: #8a4b08;
}

.mono-wrap {
    font-family: ui-monospace,monospace;
    overflow-wrap: anywhere;
}

.result-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.result-heading button {
    width: auto;
    border: 1px solid #aebfc9;
    border-radius: 6px;
    background: #fff;
    color: var(--net-blue);
    padding: 8px 12px;
    font-weight: 700;
}

.network-page :is(input,select,textarea,button,a):focus-visible {
    outline: 3px solid #89b8df;
    outline-offset: 3px
}

.prefixed-input {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center
}

    .prefixed-input span {
        font-size: 1.2rem;
        padding: 0 10px 12px 0
    }

.network-actions {
    display: flex;
    gap: 10px
}

    .network-actions button, .network-button {
        display: inline-block;
        border: 0;
        border-radius: 6px;
        background: var(--net-blue);
        color: #fff;
        padding: 11px 18px;
        text-decoration: none;
        font-weight: 700
    }

    .network-actions .secondary {
        background: #fff;
        color: var(--net-blue);
        border: 1px solid #aebfc9
    }

.field-note, .network-status {
    font-size: .83rem;
    color: var(--net-muted)
}

    .network-status.error {
        color: #a12d2d
    }

.network-results {
    background: #fff;
    border-top: 4px solid var(--net-blue)
}

.network-summary h2 {
    font-size: 1.6rem;
    margin-top: 0
}

.network-facts {
    display: grid;
    grid-template-columns: minmax(140px,.7fr) 1fr;
    margin: 20px 0
}

    .network-facts dt, .network-facts dd {
        padding: 9px 10px;
        border-bottom: 1px solid #e5ebef;
        margin: 0
    }

    .network-facts dt {
        font-weight: 700;
        color: var(--net-blue)
    }

    .network-facts dd {
        overflow-wrap: anywhere
    }

.binary-display {
    font: 600 .88rem ui-monospace,monospace;
    background: #edf3f7;
    padding: 14px;
    border-radius: 6px;
    overflow-x: auto;
    white-space: nowrap
}

    .binary-display .network-bits {
        color: #0d5f34
    }

    .binary-display .host-bits {
        color: #a15713
    }

.ipv6-binary {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 2
}

    .ipv6-binary .prefix-divider {
        display: inline-block;
        color: #a12d2d;
        font-size: 1.25em;
        padding: 0 3px
    }

.network-note {
    background: #edf6f0;
    border-left: 3px solid #428262;
    padding: 12px 14px;
    margin-top: 18px;
    color: #28583d
}

.subnet-list-card {
    margin-top: 24px;
    background: #fff
}

.network-table-wrap {
    overflow: auto
}

.network-table {
    border-collapse: collapse;
    width: 100%;
    font-size: .87rem;
    white-space: nowrap
}

    .network-table th, .network-table td {
        text-align: left;
        padding: 10px 12px;
        border-bottom: 1px solid var(--net-line)
    }

    .network-table th {
        background: #edf3f7;
        color: var(--net-blue);
        position: sticky;
        top: 0
    }

.network-guide {
    max-width: 970px;
    margin-top: 36px;
    background: #fff
}

    .network-guide section + section {
        margin-top: 28px
    }

    .network-guide p {
        color: var(--net-muted)
    }

    .wrap .worked-example-card p{
        color:#eee;
        margin-bottom:10px;
    }

.network-guide details {
    border-bottom: 1px solid var(--net-line);
    padding: 14px 0
}

    .network-guide summary {
        cursor: pointer;
        font-weight: 700;
        color: var(--net-blue)
    }

.network-result h2{
    margin:15px 0;
}

@media(max-width:800px) {
    .network-page.wrap {
        width: 100%;
        padding: 0 15px 25px
    }

    .network-layout {
        grid-template-columns: 1fr
    }

    .network-card, .network-guide {
        padding: 20px
    }

    .network-facts {
        grid-template-columns: 1fr
    }

        .network-facts dd {
            padding-top: 2px
        }

    .network-mode-tabs {
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 2;
        padding-top: 6px
    }

        .network-mode-tabs button {
            flex: 1;
            padding: 9px 10px
        }

    .network-actions {
        flex-direction: column
    }

    .network-form-grid, .option-grid {
        grid-template-columns: 1fr
    }

    .network-page .checkbox-label {
        padding-top: 0;
        margin-bottom: 14px;
    }

    .result-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .network-actions button {
        width: 100%
    }
}

/* IEEE 754 floating-point converter */
.ieee-key {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0;
}

    .ieee-key div {
        border: 1px solid var(--net-line);
        border-radius: 8px;
        padding: 12px 14px;
        background: #f6f9fb;
        min-width: 0;
    }

    .ieee-key span {
        display: block;
        font-size: .78rem;
        color: var(--net-muted);
    }

    .ieee-key strong {
        font: 700 1.1rem ui-monospace, monospace;
        overflow-wrap: anywhere;
        color: var(--net-blue);
    }

.ieee-bits {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin: 6px 0 2px;
}

    .ieee-bits .bit {
        width: 22px;
        height: 30px;
        margin: 0;
        padding: 0;
        border: 1px solid transparent;
        border-radius: 4px;
        font: 700 .85rem ui-monospace, monospace;
        cursor: pointer;
    }

    .ieee-bits .bit-s { background: #f6dede; color: #8a1f1f; }
    .ieee-bits .bit-e { background: #dcefe3; color: #1d5c37; }
    .ieee-bits .bit-f { background: #e1ebf6; color: #123f66; }
    .ieee-bits .bit:hover { border-color: #123f66; }
    .ieee-bits .bit-gap { width: 8px; }

.ieee-long {
    font: .8rem ui-monospace, monospace;
    overflow-wrap: anywhere;
    margin-top: 6px;
}

#ieee-working li, #ieee-facts dd {
    overflow-wrap: anywhere;
}

@media(max-width:800px) {
    .ieee-key {
        grid-template-columns: 1fr;
    }

    .ieee-bits .bit {
        width: 18px;
        height: 26px;
    }
}

#ieee-summary {
    overflow-wrap: anywhere;
}

#ieee-app .network-guide li, #ieee-app .network-guide p {
    overflow-wrap: anywhere;
}

.ieee-fields {
    margin: 10px 0 14px;
}

    .ieee-fields .network-table {
        white-space: normal;
    }

    .ieee-fields td.mono {
        font-family: ui-monospace, monospace;
        overflow-wrap: anywhere;
        min-width: 90px;
    }

#ieee-results .network-actions {
    flex-wrap: wrap;
}

@media(min-width:801px) {
    #ieee-results .network-actions button {
        width: auto;
    }
}

/* Two's complement calculator */
.twos-bits {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin: 6px 0 2px;
}

    .twos-bits .tbit {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: auto;
        min-width: 26px;
        flex: 0 0 auto;
        margin: 0;
        padding: 3px 4px;
        border: 1px solid transparent;
        border-radius: 4px;
        background: #edf3f7;
        color: #536775;
        cursor: pointer;
    }

        .twos-bits .tbit.on {
            background: #e1ebf6;
            color: #123f66;
        }

        .twos-bits .tbit-sign {
            background: #f6dede;
            color: #8a1f1f;
        }

        .twos-bits .tbit:hover {
            border-color: #123f66;
        }

    .twos-bits .tbit-v {
        font: 700 .95rem ui-monospace, monospace;
    }

    .twos-bits .tbit-p {
        font-size: .62rem;
        line-height: 1.2;
    }

.twos-column {
    white-space: pre;
}

.twos-flags {
    font: 600 .88rem ui-monospace, monospace;
    color: #123f66;
}

.twos-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    margin: 4px 0 10px;
}

    .twos-check input {
        width: auto;
        margin: 0;
    }

#twos-working li, #twos-facts dd, #twos-summary {
    overflow-wrap: anywhere;
}

#twos-app .network-guide li, #twos-app .network-guide p {
    overflow-wrap: anywhere;
}

@media(min-width:801px) {
    #twos-results .network-actions button {
        width: auto;
    }
}

/* Subnet overlap checker */
.quick-picks {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 4px 0 14px;
}

    .quick-picks span {
        font-size: .85rem;
        font-weight: 600;
        color: var(--net-muted);
    }

    .quick-picks button {
        width: auto;
        margin: 0;
        padding: 6px 12px;
        border: 1px solid #aebfc9;
        border-radius: 999px;
        background: #fff;
        color: var(--net-blue);
        font-size: .82rem;
        font-weight: 700;
    }

.network-code {
    font: .86rem ui-monospace, monospace;
    background: #edf3f7;
    padding: 14px;
    border-radius: 6px;
    max-height: 360px;
    overflow: auto;
    white-space: pre;
}

.network-table tr.row-warning td {
    background: #fdf3e3;
}

.network-table tr.row-best td {
    background: #edf6f0;
    font-weight: 600;
}

.overlap-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    margin: 4px 0 12px;
}

    .overlap-check input {
        width: auto;
        margin: 0;
    }

#overlap-details .subnet-list-card .network-table td {
    white-space: normal;
}

@media(min-width:801px) {
    #overlap-details .network-actions button {
        width: auto;
    }
}

/* Q-format mixed-format arithmetic */
.q-format-row {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 6px;
}

    .q-format-label {
        font-size: .85rem;
        font-weight: 700;
        color: var(--net-blue);
        padding-bottom: 22px;
    }

    .q-format-row .overlap-check {
        padding-bottom: 20px;
    }

.q-steps li {
    margin-bottom: 6px;
    overflow-wrap: anywhere;
}

@media(max-width:800px) {
    .q-format-row {
        grid-template-columns: 1fr 1fr;
    }

        .q-format-label {
            grid-column: 1 / -1;
            padding-bottom: 0;
        }
}

/* Route summarization: binary table and export menu */
.bin-table td.bin-cell {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    white-space: nowrap;
}

.bin-common {
    background: #e3eef6;
    color: var(--net-blue);
    font-weight: 700;
}

.bin-net {
    font-weight: 700;
}

.bin-host {
    color: #8a99a3;
}

.export-label {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 8px;
    font-weight: 600;
}

    .export-label select {
        width: auto;
        min-width: 210px;
        margin: 0;
    }
