:root {
    --bg: #080d14;
    --surface: #0e1621;
    --surface-hover: #142030;
    --surface-raised: #111c29;

    --border: #223043;
    --border-hover: #36506d;

    --text: #f3f7fb;
    --text-secondary: #91a1b5;
    --text-muted: #64758a;

    --accent: #4da3ff;
    --accent-hover: #6bb2ff;

    --success: #47d18c;

    --radius: 16px;
}


* {
    box-sizing: border-box;
}

/* Preserve layout while the initial non-default translation is prepared. */
html.i18n-loading {
    background: var(--bg);
}

html.i18n-loading body {
    visibility: hidden;
}


html {
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}


body {
    margin: 0;

    min-height: 100vh;

    background:
        radial-gradient(
            circle at top,
            #101c2a 0,
            var(--bg) 480px
        );

    color: var(--text);
}


button,
select {
    font: inherit;
}


button {
    color: inherit;
}


.topbar {
    height: 76px;

    padding: 0 32px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-bottom: 1px solid var(--border);

    background: rgba(8, 13, 20, 0.88);

    backdrop-filter: blur(14px);

    position: sticky;
    top: 0;

    z-index: 10;
}


.brand {
    display: flex;
    align-items: center;

    gap: 12px;
}


.brand-icon {
    width: 42px;
    height: 42px;

    border-radius: 11px;

    display: grid;
    place-items: center;

    background: var(--accent);

    color: #07111d;

    font-weight: 900;

    letter-spacing: -1px;
}


.brand-icon-image {
    display: block;
    flex-shrink: 0;
    object-fit: contain;
    background: transparent;
    border-radius: 0;
}

.brand-name {
    font-size: 15px;

    font-weight: 800;

    letter-spacing: 1.2px;
}


.brand-subtitle {
    margin-top: 3px;

    color: var(--text-secondary);

    font-size: 12px;
}


.language-selector {
    display: flex;
    align-items: center;

    gap: 10px;

    color: var(--text-secondary);

    font-size: 13px;
}


.language-selector select {
    min-width: 125px;

    padding: 9px 12px;

    border: 1px solid var(--border);

    border-radius: 9px;

    background: var(--surface);

    color: var(--text);

    outline: none;

    cursor: pointer;
}


.language-selector select:focus {
    border-color: var(--accent);
}


.page {
    width: min(1180px, calc(100% - 40px));

    margin: 0 auto;
}


.hero {
    padding: 76px 0 66px;

    text-align: center;
}


.hero-badge {
    display: inline-flex;
    align-items: center;

    gap: 8px;

    padding: 7px 12px;

    border: 1px solid var(--border);

    border-radius: 999px;

    background: rgba(17, 28, 41, 0.75);

    color: var(--text-secondary);

    font-size: 13px;
}


.status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--success);

    box-shadow: 0 0 12px rgba(71, 209, 140, 0.6);
}


.hero h1 {
    margin: 22px auto 14px;

    max-width: 740px;

    font-size: clamp(38px, 6vw, 62px);

    line-height: 1.04;

    letter-spacing: -2.5px;
}


.hero p {
    max-width: 680px;

    margin: 0 auto;

    color: var(--text-secondary);

    font-size: 17px;

    line-height: 1.65;
}


.primary-button {
    margin-top: 30px;

    padding: 15px 25px;

    border: 0;

    border-radius: 11px;

    background: var(--accent);

    color: #07111d;

    font-weight: 800;

    cursor: pointer;

    transition:
        transform 120ms ease,
        background 120ms ease;
}


.primary-button:hover {
    background: var(--accent-hover);

    transform: translateY(-1px);
}


.button-icon {
    margin-right: 6px;
}


.hero-note {
    margin-top: 13px;

    color: var(--text-muted);

    font-size: 12px;
}


.tools-section {
    padding-bottom: 72px;
}

#hardware-tests {
    /* Clear the sticky homepage header without changing section spacing. */
    scroll-margin-top: 92px;
}


.section-heading {
    margin-bottom: 20px;
}


.section-heading h2 {
    margin: 0;

    font-size: 22px;
}


.section-heading p {
    margin: 6px 0 0;

    color: var(--text-secondary);

    font-size: 14px;
}


.tool-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 14px;
}


.tool-card {
    color: inherit;
    text-decoration: none;
    min-height: 174px;

    padding: 20px;

    display: flex;
    flex-direction: column;
    align-items: flex-start;

    border: 1px solid var(--border);

    border-radius: var(--radius);

    background: linear-gradient(
        145deg,
        var(--surface-raised),
        var(--surface)
    );

    text-align: left;

    cursor: pointer;

    position: relative;

    transition:
        transform 140ms ease,
        background 140ms ease,
        border-color 140ms ease;
}


.tool-card:hover {
    transform: translateY(-3px);

    border-color: var(--border-hover);

    background: var(--surface-hover);
}


.tool-icon {
    width: 42px;
    height: 42px;

    display: grid;
    place-items: center;

    border-radius: 11px;

    background: rgba(77, 163, 255, 0.12);

    color: var(--accent);

    font-size: 20px;

    font-weight: 700;
}


.tool-icon svg {
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tool-content h3 {
    margin: 18px 0 6px;

    font-size: 16px;
}


.tool-content p {
    margin: 0;

    padding-right: 16px;

    color: var(--text-secondary);

    font-size: 13px;

    line-height: 1.5;
}


.tool-arrow {
    position: absolute;

    right: 18px;
    bottom: 16px;

    color: var(--text-muted);

    font-size: 18px;
}


.footer {
    min-height: 70px;

    padding: 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 9px;

    border-top: 1px solid var(--border);

    color: var(--text-muted);

    font-size: 12px;
}


.footer-dot {
    color: var(--border-hover);
}


@media (max-width: 900px) {

    .tool-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}


@media (max-width: 600px) {

    .topbar {
        height: auto;

        padding: 14px 18px;

        gap: 14px;
    }


    .brand-subtitle {
        display: none;
    }


    .language-selector label {
        display: none;
    }


    .language-selector select {
        min-width: 110px;
    }


    .page {
        width: min(100% - 28px, 1180px);
    }


    .hero {
        padding: 54px 0 48px;
    }


    .hero h1 {
        letter-spacing: -1.5px;
    }


    .hero p {
        font-size: 15px;
    }


    .tool-grid {
        grid-template-columns: 1fr;
    }


    .tool-card {
        min-height: 145px;
    }

}



/* =========================================================
   Screen Test
   ========================================================= */

.screen-test {
    position: fixed;
    inset: 0;

    display: none;

    z-index: 1000;

    background: #000;
}


.screen-test.is-active {
    display: block;
}


.screen-test-canvas {
    position: absolute;
    inset: 0;

    background: #000;

    cursor: pointer;
}


.screen-test-overlay {
    position: absolute;
    inset: 0;

    display: flex;
    align-items: flex-end;
    justify-content: center;

    padding: 24px;

    pointer-events: none;

    opacity: 1;

    transition: opacity 180ms ease;
}


.screen-test-overlay.is-hidden {
    opacity: 0;
}


.screen-test-panel {
    width: min(720px, calc(100% - 32px));

    padding: 18px;

    border: 1px solid rgba(255, 255, 255, 0.18);

    border-radius: 16px;

    background: rgba(8, 13, 20, 0.88);

    color: #fff;

    backdrop-filter: blur(14px);

    box-shadow:
        0 14px 50px rgba(0, 0, 0, 0.45);

    pointer-events: auto;
}


.screen-test-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    gap: 20px;
}


.screen-test-title {
    font-size: 13px;

    color: #9fb0c4;

    text-transform: uppercase;

    letter-spacing: 0.08em;

    font-weight: 700;
}


.screen-test-color-name {
    margin-top: 5px;

    font-size: 24px;

    font-weight: 800;
}


.screen-test-close {
    width: 38px;
    height: 38px;

    border: 1px solid rgba(255, 255, 255, 0.16);

    border-radius: 10px;

    background: rgba(255, 255, 255, 0.07);

    color: #fff;

    font-size: 23px;

    cursor: pointer;
}


.screen-test-close:hover {
    background: rgba(255, 255, 255, 0.13);
}


.screen-test-instructions {
    margin-top: 14px;

    color: #b7c4d4;

    font-size: 13px;

    line-height: 1.55;
}


.screen-test-actions {
    margin-top: 17px;

    display: grid;

    grid-template-columns:
        1fr auto 1fr;

    gap: 10px;
}


.screen-control-button {
    min-height: 42px;

    padding: 10px 14px;

    border: 1px solid rgba(255, 255, 255, 0.16);

    border-radius: 10px;

    background: rgba(255, 255, 255, 0.08);

    color: #fff;

    font-weight: 700;

    cursor: pointer;
}


.screen-control-button:hover {
    background: rgba(255, 255, 255, 0.14);
}


.screen-control-button.primary {
    background: #4da3ff;

    border-color: #4da3ff;

    color: #07111d;
}


.screen-control-button.primary:hover {
    background: #6bb2ff;
}


.screen-test-hint {
    margin-top: 12px;

    text-align: center;

    color: #7f91a7;

    font-size: 11px;
}


/* Fullscreen clean mode */

.screen-test.is-fullscreen-clean
.screen-test-overlay {
    opacity: 0;
}


/* Mobile */

@media (max-width: 600px) {

    .screen-test-overlay {
        padding: 12px;
    }


    .screen-test-panel {
        padding: 14px;
    }


    .screen-test-actions {
        grid-template-columns: 1fr;
    }


    .screen-test-color-name {
        font-size: 20px;
    }

}



/* =========================================================
   Keyboard Test
   ========================================================= */

.keyboard-test {
    position: fixed;
    inset: 0;

    display: none;

    z-index: 950;

    overflow-y: auto;

    background:
        radial-gradient(
            circle at top,
            #132338 0,
            #080d14 520px
        );
}


.keyboard-test.is-active {
    display: block;
}


.keyboard-test-shell {
    padding: 32px 0 48px;
}


.keyboard-test-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    gap: 24px;
}


.keyboard-test-eyebrow {
    color: var(--accent);

    font-size: 12px;
    font-weight: 800;

    letter-spacing: 0.12em;

    text-transform: uppercase;
}


.keyboard-test-title {
    margin: 7px 0 8px;

    font-size: 34px;

    letter-spacing: -1px;
}


.keyboard-test-description {
    max-width: 680px;

    margin: 0;

    color: var(--text-secondary);

    line-height: 1.6;
}


.keyboard-test-close {
    width: 44px;
    height: 44px;

    flex: 0 0 auto;

    border: 1px solid var(--border);

    border-radius: 11px;

    background: var(--surface);

    color: var(--text);

    font-size: 26px;

    cursor: pointer;
}


.keyboard-test-close:hover {
    background: var(--surface-hover);
}


.keyboard-test-status {
    margin-top: 28px;

    display: grid;

    grid-template-columns:
        1fr
        1fr
        auto;

    gap: 12px;
}


.keyboard-test-progress-card,
.keyboard-last-key {
    min-height: 70px;

    padding: 14px 16px;

    display: flex;
    flex-direction: column;
    justify-content: center;

    border: 1px solid var(--border);

    border-radius: 12px;

    background: rgba(14, 22, 33, 0.88);

    color: var(--text-secondary);

    font-size: 12px;
}


.keyboard-test-progress-card strong,
.keyboard-last-key strong {
    margin-top: 4px;

    color: var(--text);

    font-size: 22px;
}


.keyboard-reset-button {
    min-width: 120px;

    padding: 0 18px;

    border: 1px solid var(--border);

    border-radius: 12px;

    background: var(--surface);

    color: var(--text);

    font-weight: 800;

    cursor: pointer;
}


.keyboard-reset-button:hover {
    background: var(--surface-hover);
}


.keyboard-layout-controls {
    min-width: 0;
    margin: 20px 0 0;
    padding: 0;
    border: 0;
}

.keyboard-layout-controls legend {
    float: left;
    margin-right: 12px;
    padding: 0;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    line-height: 36px;
}

.keyboard-layout-options {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
}

.keyboard-layout-options button {
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
}

.keyboard-layout-options span {
    display: block;
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
}

.keyboard-layout-options button[aria-pressed="true"] span {
    background: rgba(77, 163, 255, 0.12);
    color: var(--accent);
}

.keyboard-layout-options button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.keyboard-layout-controls p {
    clear: both;
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

.keyboard-board:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: -1px;
}

.keyboard-board-wrapper {
    margin-top: 20px;

    overflow-x: auto;

    padding-bottom: 8px;
}


.keyboard-board {
    min-width: 1040px;

    padding: 18px;

    border: 1px solid var(--border);

    border-radius: 18px;

    background:
        linear-gradient(
            145deg,
            #101927,
            #0b121c
        );

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.22);
}


/* Full size fits the 1200px shell; Compact retains its original key geometry. */
.keyboard-board[data-layout="full"] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 152.5px 205px;
    gap: 16px;
    min-width: 1198px;
    padding: 12px;
}

.keyboard-board[data-layout="full"] .keyboard-row {
    display: grid;
    grid-template-columns: repeat(60, minmax(0, 1fr));
    gap: 0;
}

.keyboard-board[data-layout="full"] .keyboard-key {
    width: auto;
    min-width: 0;
}

.keyboard-main .keyboard-key {
    margin-right: 5px;
}

.keyboard-main .keyboard-key:last-child {
    margin-right: 0;
}

.keyboard-main .keyboard-spacer {
    width: auto;
}

.keyboard-navigation,
.keyboard-numpad {
    display: grid;
    grid-template-rows: repeat(6, 52px);
    gap: 7px 5px;
}

.keyboard-navigation {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.keyboard-numpad {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.keyboard-board .keyboard-numpad .keyboard-key {
    height: auto;
}

.keyboard-row {
    display: flex;

    gap: 7px;

    margin-bottom: 7px;
}


.keyboard-row:last-child {
    margin-bottom: 0;
}


.keyboard-key {
    --key-width: 54px;

    width: var(--key-width);
    min-width: var(--key-width);
    height: 52px;

    padding: 4px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #2b3a4d;

    border-radius: 9px;

    background:
        linear-gradient(
            180deg,
            #192536,
            #121b28
        );

    color: #dbe6f2;

    font-size: 12px;
    font-weight: 700;

    text-align: center;

    user-select: none;

    transition:
        transform 80ms ease,
        border-color 100ms ease,
        background 100ms ease,
        color 100ms ease,
        box-shadow 100ms ease;
}





.keyboard-key.is-pressed {
    transform: translateY(2px);

    border-color: #74b9ff;

    background: #1769aa;

    color: #ffffff;

    box-shadow:
        0 0 0 2px rgba(77, 163, 255, 0.22),
        0 0 18px rgba(77, 163, 255, 0.28);
}


.keyboard-key.is-tested {
    border-color: #3dcc83;

    background:
        linear-gradient(
            180deg,
            #15452e,
            #103523
        );

    color: #dffff0;

    box-shadow:
        inset 0 0 0 1px
        rgba(61, 204, 131, 0.15);
}




.keyboard-key.is-tested.is-pressed {
    border-color: #74b9ff;

    background: #1769aa;

    color: #ffffff;
}


.keyboard-key[data-width="1.25"] {
    --key-width: 68px;
}


.keyboard-key[data-width="1.5"] {
    --key-width: 82px;
}


.keyboard-key[data-width="1.75"] {
    --key-width: 96px;
}


.keyboard-key[data-width="2"] {
    --key-width: 110px;
}


.keyboard-key[data-width="2.25"] {
    --key-width: 124px;
}


.keyboard-key[data-width="2.75"] {
    --key-width: 152px;
}


.keyboard-key[data-width="6"] {
    --key-width: 330px;
}


.keyboard-spacer {
    width: 18px;

    flex: 0 0 18px;
}


.keyboard-test-note {
    margin-top: 14px;

    color: var(--text-muted);

    font-size: 12px;

    text-align: center;
}


@media (max-width: 700px) {

    .keyboard-test-shell {
        padding-top: 20px;
    }


    .keyboard-test-title {
        font-size: 27px;
    }


    .keyboard-test-status {
        grid-template-columns: 1fr;
    }


    .keyboard-reset-button {
        min-height: 54px;
    }

}





/* =========================================================
   Mouse Test
   ========================================================= */

.mouse-test {
    position: fixed;
    inset: 0;

    display: none;

    z-index: 940;

    overflow-y: auto;

    background:
        radial-gradient(
            circle at top,
            #132338 0,
            #080d14 520px
        );
}


.mouse-test.is-active {
    display: block;
}


.mouse-test-shell {
    padding: 22px 0 24px;
}


.mouse-test-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    gap: 24px;
}


.mouse-test-eyebrow {
    color: var(--accent);

    font-size: 12px;
    font-weight: 800;

    letter-spacing: 0.12em;

    text-transform: uppercase;
}


.mouse-test-title {
    margin: 5px 0 6px;

    font-size: 30px;

    letter-spacing: -1px;
}


.mouse-test-description {
    max-width: 680px;

    margin: 0;

    color: var(--text-secondary);

    font-size: 14px;
    line-height: 1.5;
}


.mouse-test-close {
    width: 44px;
    height: 44px;

    flex: 0 0 auto;

    border: 1px solid var(--border);

    border-radius: 11px;

    background: var(--surface);

    color: var(--text);

    font-size: 26px;

    cursor: pointer;
}


.mouse-test-close:hover {
    background: var(--surface-hover);
}


.mouse-test-layout {
    margin-top: 18px;

    display: grid;

    grid-template-columns:
        240px
        minmax(0, 1fr);

    gap: 12px;
}


.mouse-visual-card,
.mouse-test-area-card,
.mouse-event-card {
    border: 1px solid var(--border);

    border-radius: 16px;

    background:
        linear-gradient(
            145deg,
            var(--surface-raised),
            var(--surface)
        );
}


.mouse-visual-card {
    grid-row: span 2;
    padding: 20px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}


.mouse-device {
    width: 140px;
    height: 195px;
    flex-shrink: 0;

    position: relative;

    overflow: hidden;

    border: 2px solid #34465c;

    border-radius:
        88px
        88px
        75px
        75px;

    background:
        linear-gradient(
            180deg,
            #182536,
            #0e1722
        );

    box-shadow:
        0 22px 45px
        rgba(0, 0, 0, 0.26);
}


.mouse-button-visual {
    position: absolute;
    top: 0;

    width: 50%;
    height: 92px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 800;

    transition:
        background 100ms ease,
        color 100ms ease,
        box-shadow 100ms ease;
}


.mouse-left-visual {
    left: 0;

    border-right: 1px solid #34465c;
}


.mouse-right-visual {
    right: 0;
}


.mouse-button-visual.is-active {
    background: #1769aa;

    color: #fff;

    box-shadow:
        inset 0 0 30px
        rgba(77, 163, 255, 0.28);
}


.mouse-button-visual.is-tested {
    background: #15452e;

    color: #dffff0;
}


.mouse-button-visual.is-active.is-tested {
    background: #1769aa;

    color: #fff;
}


.mouse-center-line {
    position: absolute;

    top: 92px;
    left: 50%;

    width: 1px;
    height: 32px;

    background: #34465c;
}


.mouse-wheel-visual {
    position: absolute;

    top: 54px;
    left: 50%;

    width: 28px;
    height: 58px;

    transform: translateX(-50%);

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #48617e;

    border-radius: 14px;

    background: #0d1621;

    transition:
        background 100ms ease,
        border-color 100ms ease,
        box-shadow 100ms ease;
}


.mouse-wheel-visual.is-active {
    border-color: #74b9ff;

    background: #1769aa;

    box-shadow:
        0 0 18px
        rgba(77, 163, 255, 0.35);
}


.mouse-wheel-visual.is-tested {
    border-color: #3dcc83;

    background: #15452e;
}


.mouse-wheel-visual.is-active.is-tested {
    border-color: #74b9ff;

    background: #1769aa;
}


.mouse-wheel-groove {
    width: 4px;
    height: 28px;

    border-radius: 99px;

    background: rgba(255, 255, 255, 0.55);
}


.mouse-device-hint {
    margin-top: 16px;

    color: var(--text-secondary);

    font-size: 12px;

    text-align: center;
}


.mouse-status-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 8px;
}


.mouse-status-card {
    min-height: 78px;

    padding: 10px 12px;

    display: flex;
    flex-direction: column;
    justify-content: center;

    border: 1px solid var(--border);

    border-radius: 13px;

    background: rgba(14, 22, 33, 0.88);
}


.mouse-status-card > span {
    color: var(--text-secondary);

    font-size: 12px;
}


.mouse-status-card strong {
    margin-top: 4px;

    color: var(--text);

    font-size: 17px;
}


.mouse-status-card small {
    margin-top: 4px;

    color: var(--text-muted);

    font-size: 11px;
}


.mouse-status-card.is-tested {
    border-color: rgba(61, 204, 131, 0.62);

    background:
        linear-gradient(
            145deg,
            rgba(21, 69, 46, 0.55),
            rgba(14, 22, 33, 0.9)
        );
}


.mouse-status-card.is-tested strong {
    color: #7ee2ad;
}



/* =========================================================
   Webcam Test
   ========================================================= */

.webcam-test {
    position: fixed;
    inset: 0;
    z-index: 930;
    display: none;
    overflow-y: auto;
    background: radial-gradient(circle at top, #132338 0, #080d14 520px);
}

.webcam-test.is-active {
    display: block;
}

.webcam-test-shell {
    padding: 24px 0 30px;
}

.webcam-test-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.webcam-test-eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.webcam-test-title {
    margin: 5px 0 6px;
    font-size: 30px;
    letter-spacing: -1px;
}

.webcam-test-description {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.webcam-test-close {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    font-size: 26px;
    cursor: pointer;
}

.webcam-test-close:hover {
    background: var(--surface-hover);
}

.webcam-privacy-note,
.webcam-error {
    margin-top: 14px;
    padding: 10px 13px;
    border: 1px solid rgba(77, 163, 255, 0.28);
    border-radius: 11px;
    background: rgba(77, 163, 255, 0.08);
    color: #bad9fa;
    font-size: 12px;
}

.webcam-privacy-note {
    display: flex;
    align-items: center;
    gap: 10px;
}

.webcam-privacy-note > span {
    color: var(--success);
    text-shadow: 0 0 9px rgba(71, 209, 140, 0.6);
}

.webcam-privacy-note div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.webcam-privacy-note small {
    color: var(--text-secondary);
    font-size: 11px;
}

.webcam-error {
    border-color: rgba(226, 82, 96, 0.55);
    background: rgba(102, 29, 38, 0.42);
    color: #ffb5bd;
}

.webcam-control-bar {
    margin-top: 12px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: minmax(220px, 1.2fr) minmax(130px, 0.7fr) minmax(250px, 1fr) auto;
    align-items: end;
    gap: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(145deg, var(--surface-raised), var(--surface));
}

.webcam-device-field,
.webcam-status-block {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.webcam-device-field > span,
.webcam-status-block > span {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
}

.webcam-device-field select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #0b131e;
    color: var(--text);
    overflow: hidden;
    outline: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.webcam-device-field select:focus {
    border-color: var(--accent);
}

.webcam-device-field select:disabled {
    opacity: 0.55;
}

.webcam-status-block strong {
    font-size: 13px;
}

.webcam-metadata {
    min-height: 40px;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(100px, 0.8fr);
    gap: 8px;
}

.webcam-metadata > div {
    min-width: 0;
    padding-left: 11px;
    display: flex;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    border-left: 1px solid var(--border);
}

.webcam-metadata span {
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
}

.webcam-metadata strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#webcamStatus[data-state="active"] {
    color: #9ce8bf;
}

#webcamStatus[data-state="requesting"] {
    color: #9ecfff;
}

#webcamStatus[data-state="permissionDenied"],
#webcamStatus[data-state="noCamera"],
#webcamStatus[data-state="unsupported"] {
    color: #ffb5bd;
}

#webcamStatus[data-state="selectedUnavailable"],
#webcamStatus[data-state="disconnected"],
#webcamStatus[data-state="cameraError"] {
    color: #efc779;
}

.webcam-toggle-button {
    min-height: 40px;
    padding: 0 16px;
    justify-self: end;
    border: 1px solid rgba(77, 163, 255, 0.48);
    border-radius: 9px;
    background: rgba(77, 163, 255, 0.16);
    color: #d8ecff;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.webcam-toggle-button:hover:not(:disabled) {
    background: rgba(77, 163, 255, 0.24);
}

.webcam-toggle-button.is-stop {
    border-color: rgba(226, 82, 96, 0.48);
    background: rgba(102, 29, 38, 0.48);
    color: #ffc4ca;
}

.webcam-toggle-button.is-stop:hover:not(:disabled) {
    background: rgba(123, 36, 47, 0.58);
}

.webcam-toggle-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.webcam-toggle-button[aria-busy="true"] {
    cursor: wait;
}

.webcam-test button:focus-visible,
.webcam-test select:focus-visible {
    outline: 2px solid rgba(77, 163, 255, 0.82);
    outline-offset: 2px;
}

.webcam-toggle-icon {
    margin-right: 6px;
}

.webcam-preview-card {
    aspect-ratio: 16 / 9;
    min-height: 320px;
    margin-top: 12px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background:
        radial-gradient(circle at center, rgba(31, 54, 79, 0.45), transparent 58%),
        #070c12;
}

#webcamPreview {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #05080c;
}

#webcamPreview[hidden],
.webcam-placeholder[hidden] {
    display: none;
}

.webcam-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 24px;
    text-align: center;
}

.webcam-placeholder strong {
    margin-top: 22px;
    font-size: 17px;
}

.webcam-placeholder p {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.webcam-camera-icon {
    width: 82px;
    height: 56px;
    position: relative;
    border: 3px solid #60738a;
    border-radius: 13px;
    color: #60738a;
}

.webcam-camera-icon::before {
    content: "";
    position: absolute;
    top: -13px;
    left: 14px;
    width: 28px;
    height: 11px;
    border: 3px solid currentColor;
    border-bottom: 0;
    border-radius: 7px 7px 0 0;
}

.webcam-camera-icon::after {
    content: "";
    position: absolute;
    top: 14px;
    right: -20px;
    width: 16px;
    height: 24px;
    border: 3px solid currentColor;
    border-left: 0;
    border-radius: 0 7px 7px 0;
}

.webcam-camera-icon span {
    width: 26px;
    height: 26px;
    position: absolute;
    top: 12px;
    left: 25px;
    border: 3px solid currentColor;
    border-radius: 50%;
}

@media (max-width: 900px) {
    .webcam-control-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .webcam-test-shell {
        padding: 18px 0 22px;
    }

    .webcam-test-title {
        font-size: 27px;
    }

    .webcam-control-bar {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .webcam-toggle-button {
        width: 100%;
        justify-self: stretch;
    }

    .webcam-preview-card {
        min-height: 0;
    }

    .webcam-metadata {
        grid-template-columns: 1fr;
    }

    .webcam-metadata > div {
        padding: 7px 0 0;
        border-left: 0;
        border-top: 1px solid var(--border);
    }

    .webcam-privacy-note {
        align-items: flex-start;
    }
}

/* =========================================================
   Network Test
   ========================================================= */

.network-test {
    position: fixed;
    inset: 0;
    z-index: 930;
    display: none;
    overflow-y: auto;
    background: radial-gradient(circle at top, #132338 0, #080d14 520px);
}

.network-test.is-active {
    display: block;
}

.network-test-shell {
    padding: 24px 0 30px;
}

.network-test-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.network-test-eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.network-test-title {
    margin: 5px 0 6px;
    font-size: 30px;
    letter-spacing: -1px;
}

.network-test-description {
    max-width: 650px;
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.network-test-close {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    font-size: 26px;
    cursor: pointer;
}

.network-test-close:hover {
    background: var(--surface-hover);
}

.network-status-card,
.network-info-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(145deg, var(--surface-raised), var(--surface));
}

.network-status-card {
    margin-top: 16px;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.network-status-copy {
    min-width: 0;
}

.network-status-label,
.network-metadata-item dt {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 750;
}

#networkStatus {
    display: block;
    margin-top: 3px;
    font-size: 22px;
    letter-spacing: -0.4px;
}

#networkStatus[data-state="online"] {
    color: #9ce8bf;
}

#networkStatus[data-state="offline"] {
    color: #ffb5bd;
}

.network-status-copy p,
.network-info-heading p {
    margin: 5px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
}

.network-status-indicator {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #47d18c;
    box-shadow: 0 0 0 6px rgba(71, 209, 140, 0.12), 0 0 14px rgba(71, 209, 140, 0.56);
}

.network-status-indicator[data-state="offline"] {
    background: #e25260;
    box-shadow: 0 0 0 6px rgba(226, 82, 96, 0.12), 0 0 14px rgba(226, 82, 96, 0.5);
}

.network-info-card {
    margin-top: 12px;
    padding: 16px 18px 18px;
}

.network-info-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.network-info-heading h2 {
    margin: 0;
    font-size: 16px;
}

.network-unsupported-note {
    max-width: 340px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid rgba(77, 163, 255, 0.24);
    border-radius: 9px;
    background: rgba(77, 163, 255, 0.07);
    color: #bad9fa;
    font-size: 11px;
    line-height: 1.4;
}

.network-metadata-list {
    margin: 16px 0 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.network-metadata-item {
    min-width: 0;
    min-height: 78px;
    padding: 12px;
    border: 1px solid rgba(54, 80, 109, 0.72);
    border-radius: 11px;
    background: rgba(6, 13, 22, 0.38);
}

.network-metadata-item dt {
    margin: 0;
}

.network-metadata-item dd {
    margin: 7px 0 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.network-test button:focus-visible {
    outline: 2px solid rgba(77, 163, 255, 0.82);
    outline-offset: 2px;
}

.network-connectivity-controls {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 14px;
}

.network-connectivity-fields {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr));
    gap: 16px;
    flex: 1;
    min-width: 0;
    margin: 0;
}

.network-connectivity-fields dt {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 750;
}

.network-connectivity-fields dd {
    margin: 6px 0 0;
    font-size: 14px;
    font-weight: 750;
    overflow-wrap: anywhere;
}

#networkConnectivityStatus[data-state="reachable"] { color: var(--success); }
#networkConnectivityStatus[data-state="notChecked"] { color: var(--text-secondary); }
#networkConnectivityStatus[data-state="checking"] { color: var(--accent); }
#networkConnectivityStatus[data-state="checkFailed"],
#networkConnectivityStatus[data-state="timeout"],
#networkConnectivityStatus[data-state="offline"] { color: #ffb5bd; }

.network-check-button {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 9px 16px;
    border: 1px solid rgba(77, 163, 255, 0.48);
    border-radius: 9px;
    background: rgba(77, 163, 255, 0.16);
    color: #d8ecff;
    font-weight: 750;
    cursor: pointer;
}

.network-check-button:hover:not(:disabled) { background: rgba(77, 163, 255, 0.24); }
.network-check-button:disabled { opacity: 0.6; cursor: wait; }

.network-connectivity-note {
    margin: 12px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

@media (max-width: 800px) {
    .network-metadata-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .network-test-shell {
        padding: 18px 0 22px;
    }

    .network-test-topbar {
        gap: 14px;
    }

    .network-test-title {
        font-size: 27px;
    }

    .network-status-card,
    .network-info-card {
        padding: 15px;
    }

    .network-status-card {
        align-items: flex-start;
    }

    .network-status-indicator {
        margin-top: 14px;
    }

    .network-info-heading {
        display: block;
    }

    .network-unsupported-note {
        max-width: none;
        margin-top: 12px;
    }

    .network-metadata-list {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .network-metadata-item {
        min-height: 0;
    }

    .network-connectivity-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .network-connectivity-fields {
        grid-template-columns: 1fr;
        gap: 12px;
    }

.network-check-button { width: 100%; }
}

/* =========================================================
   System Info
   ========================================================= */

.system-info-test {
    position: fixed;
    inset: 0;
    z-index: 930;
    display: none;
    overflow-y: auto;
    background: radial-gradient(circle at top, #132338 0, #080d14 520px);
}

.system-info-test.is-active {
    display: block;
}

.system-info-shell {
    padding: 24px 0 30px;
}

.system-info-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.system-info-eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.system-info-title {
    margin: 5px 0 6px;
    font-size: 30px;
    letter-spacing: -1px;
}

.system-info-description {
    max-width: 650px;
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.system-info-close {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    font-size: 26px;
    cursor: pointer;
}

.system-info-close:hover {
    background: var(--surface-hover);
}

.system-info-note {
    margin: 14px 0 0;
    padding: 10px 13px;
    border: 1px solid rgba(77, 163, 255, 0.28);
    border-radius: 11px;
    background: rgba(77, 163, 255, 0.08);
    color: #bad9fa;
    font-size: 12px;
    line-height: 1.45;
}

.system-info-card {
    margin-top: 12px;
    padding: 16px 18px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(145deg, var(--surface-raised), var(--surface));
}

.system-info-card h2 {
    margin: 0;
    font-size: 16px;
}

.system-info-section-note {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
}

.system-info-grid {
    margin: 16px 0 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.system-info-grid > div {
    min-width: 0;
    min-height: 78px;
    padding: 12px;
    border: 1px solid rgba(54, 80, 109, 0.72);
    border-radius: 11px;
    background: rgba(6, 13, 22, 0.38);
}

.system-info-grid dt {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 750;
}

.system-info-field-tag {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
}

.system-info-grid dd {
    margin: 7px 0 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 750;
    overflow-wrap: anywhere;
}

#systemInfoOnline[data-state="online"] {
    color: var(--success);
}

#systemInfoOnline[data-state="offline"] {
    color: #ffb5bd;
}

.system-info-test button:focus-visible {
    outline: 2px solid rgba(77, 163, 255, 0.82);
    outline-offset: 2px;
}

@media (max-width: 800px) {
    .system-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .system-info-shell {
        padding: 18px 0 22px;
    }

    .system-info-topbar {
        gap: 14px;
    }

    .system-info-title {
        font-size: 27px;
    }

    .system-info-card {
        padding: 15px;
    }

    .system-info-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .system-info-grid > div {
        min-height: 0;
    }
}

/* =========================================================
   Speaker Test
   ========================================================= */

.speaker-test {
    position: fixed;
    inset: 0;
    z-index: 930;
    display: none;
    overflow-y: auto;
    background: radial-gradient(circle at top, #132338 0, #080d14 520px);
}

.speaker-test.is-active {
    display: block;
}

.speaker-test-shell {
    padding: 22px 0 26px;
}

.speaker-test-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.speaker-test-eyebrow,
.speaker-section-label {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.speaker-test-title {
    margin: 5px 0 6px;
    font-size: 30px;
    letter-spacing: -1px;
}

.speaker-test-description {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.speaker-test-close {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    font-size: 26px;
    cursor: pointer;
}

.speaker-test-close:hover,
.speaker-reset-button:hover {
    background: var(--surface-hover);
}

.speaker-safety-note,
.speaker-error {
    margin-top: 14px;
    padding: 10px 13px;
    border: 1px solid rgba(77, 163, 255, 0.28);
    border-radius: 11px;
    background: rgba(77, 163, 255, 0.08);
    color: #bad9fa;
    font-size: 12px;
}

.speaker-safety-note {
    display: flex;
    align-items: center;
    gap: 9px;
}

.speaker-safety-note > span:first-child {
    width: 20px;
    height: 20px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: var(--accent);
    color: #07111d;
    font-weight: 900;
}

.speaker-error {
    border-color: rgba(244, 91, 105, 0.55);
    background: rgba(113, 28, 38, 0.34);
    color: #ffb5bd;
}

.speaker-channel-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.speaker-channel-card,
.speaker-controls-card,
.speaker-summary-card {
    border: 1px solid var(--border);
    border-radius: 15px;
    background: linear-gradient(145deg, var(--surface-raised), var(--surface));
}

.speaker-channel-card {
    min-height: 190px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.speaker-channel-card.is-playing {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(77, 163, 255, 0.18), 0 0 24px rgba(77, 163, 255, 0.1);
}

.speaker-channel-heading {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.speaker-channel-heading h2 {
    margin: 0;
    font-size: 17px;
}

.speaker-card-copy {
    min-width: 0;
    flex: 1;
}

.speaker-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.speaker-card-copy p {
    min-height: 34px;
    margin: 7px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.speaker-card-result {
    padding: 3px 7px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
}

.speaker-card-result.is-pass {
    background: rgba(21, 69, 46, 0.7);
    color: #7ee2ad;
}

.speaker-card-result.is-fail {
    background: rgba(102, 29, 38, 0.68);
    color: #ff929d;
}

.speaker-playback-state {
    display: inline-block;
    margin-top: 6px;
    color: var(--accent-hover);
    font-size: 11px;
}

.speaker-playback-state[hidden] {
    display: none;
}

.speaker-channel-card.is-playing .speaker-playback-state {
    color: var(--accent-hover);
}

.speaker-visual {
    width: 58px;
    height: 58px;
    position: relative;
    flex: 0 0 auto;
    color: var(--text-muted);
}

.speaker-cone {
    position: absolute;
    top: 18px;
    left: 4px;
    width: 18px;
    height: 22px;
    border-radius: 4px 1px 1px 4px;
    background: currentColor;
}

.speaker-cone::after {
    content: "";
    position: absolute;
    top: -9px;
    left: 13px;
    border-style: solid;
    border-width: 20px 23px 20px 0;
    border-color: transparent currentColor transparent transparent;
    transform: rotate(180deg);
}

.speaker-wave {
    position: absolute;
    border: 3px solid currentColor;
    border-top-color: transparent;
    border-bottom-color: transparent;
    border-left-color: transparent;
    border-radius: 50%;
}

.speaker-wave.wave-one {
    top: 15px;
    right: 9px;
    width: 17px;
    height: 28px;
}

.speaker-wave.wave-two {
    top: 7px;
    right: 0;
    width: 27px;
    height: 44px;
}

.speaker-channel-card.is-playing .speaker-visual {
    color: var(--accent);
    filter: drop-shadow(0 0 8px rgba(77, 163, 255, 0.45));
}

.speaker-visual-right {
    transform: scaleX(-1);
}

.speaker-play-button,
.speaker-stop-button,
.speaker-reset-button,
.speaker-result-actions button {
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    font-weight: 750;
    cursor: pointer;
}

.speaker-play-button {
    margin-top: 12px;
    padding: 0 15px;
    background: rgba(77, 163, 255, 0.14);
    border-color: rgba(77, 163, 255, 0.38);
    color: #cfe7ff;
}

.speaker-channel-card > .speaker-play-button {
    width: 100%;
    margin-top: auto;
}

.speaker-play-button:hover {
    background: rgba(77, 163, 255, 0.22);
}

.speaker-result-actions {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.speaker-result-actions button {
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-secondary);
    font-size: 12px;
}

.speaker-result-actions button[data-result-value="pass"]:hover,
.speaker-result-actions button.is-selected[data-result-value="pass"] {
    border-color: #3dcc83;
    background: rgba(21, 69, 46, 0.75);
    color: #a7efc8;
}

.speaker-result-actions button[data-result-value="fail"]:hover,
.speaker-result-actions button.is-selected[data-result-value="fail"] {
    border-color: #e25260;
    background: rgba(102, 29, 38, 0.72);
    color: #ffb5bd;
}

.speaker-controls-card {
    margin-top: 12px;
    padding: 12px 15px;
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) auto;
    align-items: end;
    gap: 20px;
}

.speaker-tone-control {
    margin: 0;
    padding: 0;
    border: 0;
}

.speaker-tone-control legend,
.speaker-volume-control > span:first-child {
    margin-bottom: 7px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.speaker-tone-options {
    display: flex;
    gap: 6px;
}

.speaker-tone-options label {
    cursor: pointer;
}

.speaker-tone-options input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.speaker-tone-options span {
    min-height: 36px;
    padding: 0 11px;
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.speaker-tone-options input:checked + span {
    border-color: var(--accent);
    background: rgba(77, 163, 255, 0.14);
    color: #d8ecff;
}

.speaker-volume-control {
    display: flex;
    flex-direction: column;
}

.speaker-volume-control > span:first-child {
    display: flex;
    justify-content: space-between;
}

.speaker-volume-control output {
    color: var(--text);
}

.speaker-volume-control input {
    width: 100%;
    min-height: 36px;
    accent-color: var(--accent);
    cursor: pointer;
}

.speaker-control-actions {
    display: flex;
    gap: 8px;
}

.speaker-stop-button,
.speaker-reset-button {
    padding: 0 14px;
}

.speaker-stop-button {
    border-color: rgba(226, 82, 96, 0.5);
    background: rgba(102, 29, 38, 0.48);
    color: #ffc4ca;
}

.speaker-stop-button:hover {
    background: rgba(126, 35, 46, 0.65);
}

.speaker-reset-button {
    background: var(--surface);
}

.speaker-summary-card {
    margin-top: 10px;
    padding: 0;
    border: 0;
    background: transparent;
}

.speaker-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.speaker-summary-grid > div {
    padding: 9px 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text-secondary);
    font-size: 12px;
}

.speaker-summary-grid strong {
    color: var(--text);
}

.speaker-summary-grid > div.is-pass {
    border-color: rgba(61, 204, 131, 0.55);
    background: rgba(21, 69, 46, 0.38);
}

.speaker-summary-grid > div.is-pass strong {
    color: #7ee2ad;
}

.speaker-summary-grid > div.is-fail {
    border-color: rgba(226, 82, 96, 0.55);
    background: rgba(102, 29, 38, 0.35);
}

.speaker-summary-grid > div.is-fail strong {
    color: #ff929d;
}

.speaker-test-note {
    margin: 10px 0 0;
    color: var(--text-muted);
    font-size: 11px;
    text-align: center;
}

@media (max-width: 800px) {
    .speaker-channel-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .speaker-stereo-card {
        grid-column: 1 / -1;
    }

    .speaker-channel-card {
        min-height: 175px;
        padding: 16px;
    }

    .speaker-controls-card {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

@media (max-width: 600px) {
    .speaker-test-shell {
        padding-top: 18px;
    }

    .speaker-test-title {
        font-size: 27px;
    }

    .speaker-channel-grid,
    .speaker-summary-grid {
        grid-template-columns: 1fr;
    }

    .speaker-stereo-card {
        grid-column: auto;
    }

    .speaker-channel-card {
        min-height: auto;
        padding: 14px;
    }

    .speaker-controls-card {
        gap: 14px;
    }

    .speaker-tone-options,
    .speaker-control-actions {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .speaker-control-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .speaker-tone-options span,
    .speaker-control-actions button {
        justify-content: center;
    }
}


.mouse-status-card[data-status="movement"] {
    grid-column: 1 / -1;
    min-height: 48px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
}


.mouse-status-card[data-status="movement"] strong,
.mouse-status-card[data-status="movement"] small {
    margin-top: 0;
}


.mouse-test-area-card {
    grid-column: 2;
    padding: 14px;
}


.mouse-test-area-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 14px;
}


.mouse-test-area-header h2 {
    margin: 0;

    font-size: 18px;
}


.mouse-test-area-header p {
    margin: 5px 0 0;

    color: var(--text-secondary);

    font-size: 13px;
}


.mouse-reset-button {
    min-height: 42px;
    flex-shrink: 0;

    padding: 0 16px;

    border: 1px solid var(--border);

    border-radius: 10px;

    background: var(--surface);

    color: var(--text);

    font-weight: 800;

    cursor: pointer;
}


.mouse-reset-button:hover {
    background: var(--surface-hover);
}


.mouse-test-area {
    height: 210px;

    margin-top: 12px;

    position: relative;

    overflow: hidden;

    border: 1px dashed #38516e;

    border-radius: 14px;

    background:
        linear-gradient(
            rgba(77, 163, 255, 0.025),
            rgba(77, 163, 255, 0.025)
        ),
        #0a121c;

    cursor: crosshair;

    user-select: none;
}


.mouse-test-area-center {
    position: absolute;

    inset: 0;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 16px;
    text-align: center;

    pointer-events: none;

    color: var(--text-secondary);
}


.mouse-test-area-center strong {
    color: var(--text);

    font-size: 17px;
}


.mouse-test-area-center span {
    margin-top: 6px;

    font-size: 12px;
}


.mouse-crosshair {
    position: absolute;

    pointer-events: none;

    opacity: 0.26;

    background: #4da3ff;
}


.mouse-crosshair.horizontal {
    left: 0;

    width: 100%;
    height: 1px;

    top: 50%;
}


.mouse-crosshair.vertical {
    top: 0;

    height: 100%;
    width: 1px;

    left: 50%;
}


.mouse-pointer-marker {
    width: 14px;
    height: 14px;

    position: absolute;

    left: 50%;
    top: 50%;

    transform:
        translate(-50%, -50%);

    border: 2px solid #4da3ff;

    border-radius: 50%;

    background:
        rgba(77, 163, 255, 0.18);

    pointer-events: none;

    opacity: 0;

    transition: opacity 100ms ease;
}


.mouse-pointer-marker.is-visible {
    opacity: 1;
}


.mouse-event-card {
    margin-top: 12px;

    padding: 12px 16px;

    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 20px;
}


.mouse-event-card div {
    display: flex;
    flex-direction: column;
}


.mouse-event-card span {
    color: var(--text-secondary);

    font-size: 12px;
}


.mouse-event-card strong {
    margin-top: 5px;

    color: var(--text);

    font-size: 15px;
}


.mouse-test-note {
    margin-top: 14px;

    color: var(--text-muted);

    font-size: 12px;

    text-align: center;
}


@media (max-width: 900px) {

    .mouse-test-layout {
        grid-template-columns: 1fr;
    }


    .mouse-visual-card {
        grid-row: auto;
    }


    .mouse-test-area-card {
        grid-column: 1;
    }

}


@media (max-width: 650px) {

    .mouse-test-shell {
        padding-top: 20px;
    }


    .mouse-test-title {
        font-size: 27px;
    }


    .mouse-status-grid {
        grid-template-columns: 1fr;
    }


    .mouse-test-area-header {
        align-items: flex-start;
        flex-direction: column;
    }


    .mouse-reset-button {
        width: 100%;
    }


    .mouse-event-card {
        grid-template-columns: 1fr;
    }

}


/* =========================================================
   Microphone Test
   ========================================================= */

.microphone-test {
    position: fixed;
    inset: 0;
    z-index: 920;
    display: none;
    overflow-y: auto;
    background: radial-gradient(circle at top, #132338 0, #080d14 520px);
}

.microphone-test.is-active {
    display: block;
}

.microphone-test-shell {
    padding: 22px 0 26px;
}

.microphone-test-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.microphone-test-eyebrow,
.microphone-section-label {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.microphone-test-title {
    margin: 5px 0 6px;
    font-size: 30px;
    letter-spacing: -1px;
}

.microphone-test-description {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.microphone-test-close {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    font-size: 26px;
    cursor: pointer;
}

.microphone-test-close:hover,
.microphone-secondary-button:hover:not(:disabled),
.microphone-recording-actions button:hover:not(:disabled) {
    background: var(--surface-hover);
}

.microphone-privacy-note,
.microphone-error {
    margin-top: 14px;
    padding: 10px 13px;
    border: 1px solid rgba(77, 163, 255, 0.28);
    border-radius: 11px;
    background: rgba(77, 163, 255, 0.08);
    color: #bad9fa;
    font-size: 12px;
}

.microphone-privacy-note {
    display: flex;
    align-items: center;
    gap: 10px;
}

.microphone-privacy-note > span {
    color: var(--success);
    text-shadow: 0 0 9px rgba(71, 209, 140, 0.6);
}

.microphone-privacy-note div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.microphone-privacy-note small {
    color: var(--text-secondary);
    font-size: 11px;
}

.microphone-error {
    border-color: rgba(226, 82, 96, 0.55);
    background: rgba(102, 29, 38, 0.42);
    color: #ffb5bd;
}

.microphone-device-bar,
.microphone-live-card,
.microphone-recording-card,
.microphone-result-bar {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(145deg, var(--surface-raised), var(--surface));
}

.microphone-device-bar {
    margin-top: 12px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto auto;
    align-items: end;
    gap: 12px;
}

.microphone-device-field,
.microphone-device-status {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.microphone-device-field[hidden] {
    display: none;
}

.microphone-device-field > span,
.microphone-device-status > span {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
}

.microphone-device-field select {
    min-height: 38px;
    min-width: 220px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #0b131e;
    color: var(--text);
    outline: none;
}

.microphone-device-field select:focus {
    border-color: var(--accent);
}

.microphone-device-status {
    min-width: 155px;
}

.microphone-device-status strong {
    min-height: 38px;
    display: flex;
    align-items: center;
    color: var(--text);
    font-size: 13px;
}

#microphoneStatus[data-state="active"] {
    color: var(--success);
}

#microphoneStatus[data-state="requesting"] {
    color: var(--accent-hover);
}

#microphoneStatus[data-state="permissionDenied"],
#microphoneStatus[data-state="noMicrophone"],
#microphoneStatus[data-state="unsupported"],
#microphoneStatus[data-state="disconnected"],
#microphoneStatus[data-state="startFailed"] {
    color: #ff929d;
}

.microphone-device-actions,
.microphone-recording-actions,
.microphone-result-actions {
    display: flex;
    gap: 8px;
}

.microphone-primary-button,
.microphone-secondary-button,
.microphone-recording-actions button,
.microphone-result-actions button {
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    font-weight: 750;
    cursor: pointer;
}

.microphone-primary-button {
    border-color: rgba(77, 163, 255, 0.45);
    background: rgba(77, 163, 255, 0.16);
    color: #d8ecff;
}

.microphone-primary-button:hover:not(:disabled) {
    background: rgba(77, 163, 255, 0.24);
}

.microphone-secondary-button,
.microphone-recording-actions button,
.microphone-result-actions button {
    background: rgba(255, 255, 255, 0.035);
}

.microphone-test button:disabled,
.microphone-test select:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.microphone-live-card {
    min-height: 190px;
    margin-top: 12px;
    padding: 16px;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    align-items: center;
    gap: 22px;
}

.microphone-live-heading {
    display: flex;
    align-items: center;
    gap: 16px;
}

.microphone-live-heading h2 {
    margin: 5px 0 4px;
    font-size: 18px;
}

.microphone-live-heading p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.45;
}

.microphone-visual {
    width: 62px;
    height: 74px;
    position: relative;
    flex: 0 0 auto;
    color: var(--text-muted);
    transition: color 100ms ease, filter 100ms ease;
}

.microphone-capsule {
    position: absolute;
    top: 0;
    left: 19px;
    width: 28px;
    height: 48px;
    border: 3px solid currentColor;
    border-radius: 18px;
}

.microphone-capsule::after {
    content: "";
    position: absolute;
    left: 5px;
    right: 5px;
    top: 22px;
    height: 3px;
    border-radius: 99px;
    background: currentColor;
    box-shadow: 0 7px 0 currentColor;
}

.microphone-stand {
    position: absolute;
    left: 11px;
    top: 30px;
    width: 44px;
    height: 31px;
    border: 3px solid currentColor;
    border-top: 0;
    border-radius: 0 0 24px 24px;
}

.microphone-stand::before,
.microphone-stand::after {
    content: "";
    position: absolute;
    background: currentColor;
}

.microphone-stand::before {
    width: 3px;
    height: 13px;
    left: 18px;
    bottom: -13px;
}

.microphone-stand::after {
    width: 24px;
    height: 3px;
    left: 8px;
    bottom: -15px;
    border-radius: 99px;
}

.microphone-visual.is-active {
    color: var(--accent);
}

.microphone-visual.is-detecting {
    color: var(--success);
    filter: drop-shadow(0 0 9px rgba(71, 209, 140, 0.48));
}

.microphone-meter-panel {
    min-width: 0;
}

.microphone-level-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 11px;
}

.microphone-level-label strong {
    color: var(--text);
    font-size: 12px;
}

.microphone-level-meter {
    height: 12px;
    margin-top: 7px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 99px;
    background: #08101a;
}

.microphone-level-meter span {
    width: 0;
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--success), #f0c24f);
    transition: width 65ms linear;
}

#microphoneWaveform {
    width: 100%;
    height: 84px;
    margin-top: 10px;
    display: block;
    border: 1px solid rgba(56, 81, 110, 0.7);
    border-radius: 10px;
    background: #09111b;
}

.microphone-recording-card {
    margin-top: 12px;
    padding: 13px 14px;
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
}

.microphone-recording-info {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
}

.microphone-recording-info .microphone-section-label {
    grid-column: 1 / -1;
}

.microphone-recording-info strong {
    font-size: 13px;
}

.microphone-recording-info time {
    color: var(--text-secondary);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.microphone-recording-actions {
    justify-content: flex-end;
}

.microphone-record-button:not(:disabled) {
    border-color: rgba(226, 82, 96, 0.5);
    background: rgba(102, 29, 38, 0.48);
    color: #ffc4ca;
}

.microphone-recording-support {
    grid-column: 1 / -1;
    margin: 0;
    color: #efc779;
    font-size: 11px;
}

.microphone-playback-panel {
    margin-top: 12px;
    padding: 11px 14px 12px;
    display: grid;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(145deg, var(--surface-raised), var(--surface));
}

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

.microphone-playback-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.microphone-playback-header > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.microphone-playback-header strong {
    font-size: 12px;
}

.microphone-playback-header time {
    color: var(--text-secondary);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.microphone-playback-progress {
    height: 7px;
    margin-top: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(100, 117, 138, 0.24);
}

.microphone-playback-progress span {
    width: 0;
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), #76bdff);
    transition: width 65ms linear;
}

#microphonePlaybackWaveform {
    width: 100%;
    height: 56px;
    margin-top: 8px;
    display: block;
    border: 1px solid rgba(56, 81, 110, 0.7);
    border-radius: 9px;
    background: #09111b;
}

.microphone-playback-support {
    margin: 7px 0 0;
    color: #efc779;
    font-size: 11px;
}

.microphone-result-bar {
    margin-top: 12px;
    padding: 11px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.microphone-result-bar > div:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 12px;
}

.microphone-result-bar > div:first-child strong {
    color: var(--text);
}

.microphone-result-actions button[data-microphone-result="pass"].is-selected {
    border-color: #3dcc83;
    background: rgba(21, 69, 46, 0.75);
    color: #a7efc8;
}

.microphone-result-actions button[data-microphone-result="fail"].is-selected {
    border-color: #e25260;
    background: rgba(102, 29, 38, 0.72);
    color: #ffb5bd;
}

.microphone-result-bar.is-pass {
    border-color: rgba(61, 204, 131, 0.55);
}

.microphone-result-bar.is-fail {
    border-color: rgba(226, 82, 96, 0.55);
}

.microphone-summary {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.microphone-summary > div {
    min-height: 36px;
    padding: 0 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text-secondary);
    font-size: 11px;
}

.microphone-summary strong {
    color: var(--text);
}

.microphone-test-note {
    margin: 10px 0 0;
    color: var(--text-muted);
    font-size: 11px;
    text-align: center;
}

@media (max-width: 850px) {
    .microphone-device-bar,
    .microphone-live-card,
    .microphone-recording-card {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .microphone-device-actions,
    .microphone-recording-actions {
        justify-content: flex-start;
    }

    .microphone-live-card {
        gap: 14px;
    }
}

@media (max-width: 600px) {
    .microphone-test-shell {
        padding-top: 18px;
    }

    .microphone-test-title {
        font-size: 27px;
    }

    .microphone-device-actions,
    .microphone-recording-actions,
    .microphone-result-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .microphone-device-actions button,
    .microphone-recording-actions button,
    .microphone-result-actions button {
        width: 100%;
    }

    .microphone-live-card {
        min-height: auto;
        padding: 14px;
    }

    .microphone-summary {
        grid-template-columns: 1fr;
    }

    .microphone-result-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .microphone-playback-header,
    .microphone-playback-header > div {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }
}




/* Standalone test pages and shared navigation. */
body[data-page-test]:not([data-page-test=""]) {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Keep normal tools aligned when only the taller pages need a scrollbar. */
html:has(.standalone-test:not(.screen-test)) {
    background: var(--bg);
    scrollbar-gutter: stable;
}

.standalone-test {
    display: block;
    position: relative;
    inset: auto;
    /* The header and main share the viewport; content can still grow normally. */
    flex: 1;
    min-height: 0;
    overflow: visible;
}

body[data-page-test="screen"] {
    height: 100vh;
    height: 100dvh;
}

.keyboard-test-shell,
.mouse-test-shell,
.speaker-test-shell,
.microphone-test-shell,
.webcam-test-shell,
.network-test-shell,
.system-info-shell {
    width: min(1200px, calc(100% - 32px));
    margin-inline: auto;
}

.standalone-test.screen-test:fullscreen {
    width: 100%;
    height: 100%;
}

.test-topbar {
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.test-topbar-inner {
    width: min(1280px, calc(100% - 32px));
    margin: 0 auto;
    padding: 8px 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
}

.test-brand,
.test-brand picture,
.test-brand img {
    display: block;
}

.test-brand {
    border-radius: 6px;
}

.test-brand img {
    width: 120px;
    height: 40px;
    object-fit: contain;
}

.test-navigation {
    min-width: 0;
}

.test-navigation-links {
    position: relative;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-hover) transparent;
    padding: 4px;
}

.test-navigation a {
    flex-shrink: 0;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 18px;
    text-decoration: none;
    white-space: nowrap;
}

.test-navigation a:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.test-navigation a[aria-current="page"] {
    background: rgba(77, 163, 255, 0.1);
    color: var(--accent);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
}

.test-topbar .language-selector select {
    min-width: 110px;
    padding: 7px 9px;
}

.test-topbar .language-selector label {
    display: block;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.test-brand:focus-visible,
#hardware-tests h2:focus-visible,
.test-navigation a:focus-visible,
.standalone-test a:focus-visible,
.tool-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.standalone-test .screen-test-title {
    margin: 0;
}

/* Keyboard users must be able to see the controls in fullscreen. */
.standalone-test .screen-test-overlay:has(:focus-visible) {
    opacity: 1;
}

@media (max-width: 700px) {
    .standalone-test [class$="-topbar"],
    .standalone-test .screen-test-header {
        flex-wrap: wrap;
    }

}

@media (max-width: 600px) {
    .test-topbar-inner {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 6px;
        width: calc(100% - 24px);
    }

    .test-topbar .language-selector {
        grid-column: 2;
        justify-content: flex-end;
    }

    .test-brand img {
        width: 36px;
        height: 36px;
    }
}
