/**
 * Tool-Specific Layouts, Visualizers and Hardware Stages
 */

/* Camera / Video Stage */
.video-stage-container {
    position: relative;
    width: 100%;
    background: #000000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 440px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.video-wrapper video,
.video-wrapper canvas {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.video-overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* True Fullscreen Viewport for Webcam Test (No black borders, no floating overlays) */
.video-stage-container:fullscreen,
.video-stage-container:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    min-height: 100vh !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

.video-stage-container:fullscreen .video-wrapper,
.video-stage-container:-webkit-full-screen .video-wrapper {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    min-height: 100vh !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
}

.video-stage-container:fullscreen video,
.video-stage-container:-webkit-full-screen video {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    object-fit: cover !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
}

.video-stage-container:fullscreen .stage-top-hud,
.video-stage-container:-webkit-full-screen .stage-top-hud,
.video-stage-container:fullscreen .grid-overlay,
.video-stage-container:-webkit-full-screen .grid-overlay,
.video-stage-container:fullscreen .video-overlay-canvas,
.video-stage-container:-webkit-full-screen .video-overlay-canvas {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Video Placeholder / Start Camera Prompt */
.camera-placeholder {
    width: 100%;
    height: 100%;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
    gap: 16px;
    z-index: 2;
    margin: 0 auto;
    box-sizing: border-box;
}

.camera-placeholder-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    border: 2px dashed var(--border-hover);
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0, 229, 255, 0.15);
}

.camera-placeholder-icon svg {
    width: 36px;
    height: 36px;
}

.camera-placeholder h3 {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    text-align: center;
}

.camera-placeholder p {
    max-width: 480px;
    width: 100%;
    font-size: 0.92rem;
    color: var(--text-muted);
    margin: 0 auto;
    line-height: 1.6;
    text-align: center;
}

.camera-placeholder .btn {
    margin: 0 auto;
}

/* Floating Controls Overlay */
.stage-top-hud {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    pointer-events: none;
}

.stage-top-hud > * {
    pointer-events: auto;
}

.stage-hud-badge {
    background: rgba(10, 13, 20, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-family: var(--font-mono);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stage-bottom-hud {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(10, 13, 20, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Camera Grids */
.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

.grid-thirds {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.grid-thirds > div {
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.grid-crosshair::before, .grid-crosshair::after {
    content: "";
    position: absolute;
    background: rgba(56, 189, 248, 0.4);
}

.grid-crosshair::before {
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
}

.grid-crosshair::after {
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
}

/* Metrics Dashboard Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.metric-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: var(--transition);
}

.metric-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.metric-label {
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.metric-unit {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.metric-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Control Toolbar */
.control-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.control-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.form-group-select {
    min-width: 200px;
    flex: 1;
}

.form-group-slider {
    min-width: 140px;
    flex: 1;
}

.btn-reset-adjust {
    align-self: flex-end;
    margin-bottom: 2px;
}

/* Camera Responsive Layout Grids */
.camera-layout-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

.camera-layout-grid-reverse {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
    align-items: start;
}

.camera-dual-stage,
.audio-dual-stage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.camera-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.false-color-legend {
    margin-top: 16px;
    padding: 14px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    font-family: var(--font-mono);
    overflow-x: auto;
    gap: 8px;
    scrollbar-width: none;
}

.cam-info-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

@media (max-width: 900px) {
    .camera-layout-grid,
    .camera-layout-grid-reverse,
    .camera-dual-stage,
    .audio-dual-stage,
    .browser-specs-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

@media (max-width: 768px) {
    .video-stage-container {
        min-height: 280px !important;
        max-height: 60vh !important;
    }
    .video-stage-container video,
    .video-stage-container canvas {
        max-height: 55vh !important;
    }
    .camera-photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
        gap: 10px !important;
    }
    .webcam-specs-card {
        padding: 16px !important;
    }
    .webcam-specs-card .spec-table th,
    .webcam-specs-card .spec-table td {
        padding: 9px 8px !important;
        font-size: 0.82rem !important;
    }
    .false-color-legend {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        font-size: 0.74rem !important;
        padding: 10px !important;
    }
    .cam-info-header-actions {
        width: 100% !important;
        margin-top: 8px !important;
    }
    .cam-info-header-actions select {
        flex: 1 !important;
        min-width: 0 !important;
    }
    #countdownOverlay {
        font-size: 4.5rem !important;
    }

    /* Audio Responsive Styles (<= 768px) */
    .mic-device-select-group {
        width: 100% !important;
        min-width: 0 !important;
        margin-top: 8px !important;
    }
    .mic-device-select-group select {
        width: 100% !important;
    }
    .db-big-readout {
        font-size: 2.8rem !important;
    }
    .stereo-stage {
        gap: 16px !important;
        padding: 24px 10px !important;
    }
    .stereo-speaker-box {
        width: 130px !important;
        height: 140px !important;
        gap: 8px !important;
        padding: 12px 6px !important;
    }
    .stereo-speaker-box > div:first-child {
        font-size: 1.8rem !important;
    }
    .stereo-speaker-box > div:nth-child(2) {
        font-size: 0.85rem !important;
        text-align: center !important;
    }
    .stereo-speaker-box .btn {
        padding: 5px 8px !important;
        font-size: 0.78rem !important;
    }
    .audio-tab-toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    .audio-tab-buttons {
        width: 100% !important;
    }
    .audio-tab-buttons .btn {
        flex: 1 !important;
        text-align: center !important;
        padding: 7px 8px !important;
        font-size: 0.78rem !important;
    }
    .audio-tab-specs {
        text-align: center !important;
        font-size: 0.75rem !important;
    }
    .playback-controls-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    .playback-speed-group {
        justify-content: center !important;
    }
    .btn-download-audio {
        width: 100% !important;
        justify-content: center !important;
    }
    .stereo-test-buttons-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    .stereo-test-buttons-grid .btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Screen Tools Responsive Styles (<= 768px) */
    .screen-preview-box {
        height: 260px !important;
    }
    .screen-preview-badge {
        font-size: 0.85rem !important;
        padding: 8px 14px !important;
    }
    .ufo-canvas-wrapper {
        height: 280px !important;
    }
    .hz-big-number {
        font-size: 3.5rem !important;
    }
    .hz-big-number .hz-unit {
        font-size: 1.6rem !important;
    }
    .refresh-card-body {
        padding: 24px 14px !important;
    }
    .pixel-color-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
    }
    .pixel-color-grid .btn {
        padding: 10px 4px !important;
        font-size: 0.82rem !important;
    }
    .screen-control-panel {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 14px !important;
    }
    .screen-control-section {
        width: 100% !important;
        min-width: 0 !important;
    }
    .screen-button-row {
        width: 100% !important;
    }
    .screen-pattern-buttons {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .screen-pattern-buttons .btn:last-child {
        grid-column: 1 / -1 !important;
    }

    /* Mouse Tools Responsive Styles (<= 768px) */
    .cps-duration-toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    .cps-duration-pills {
        display: flex !important;
        width: 100% !important;
    }
    .cps-duration-pills .btn {
        flex: 1 !important;
        padding: 6px 4px !important;
        font-size: 0.78rem !important;
        min-width: 0 !important;
        text-align: center !important;
    }
    .cps-stats-bar {
        justify-content: space-between !important;
        font-size: 0.95rem !important;
    }
    .cps-click-zone {
        min-height: 220px !important;
    }
    .cps-big-score {
        font-size: 3.2rem !important;
    }
    .cps-big-score .cps-unit {
        font-size: 1.4rem !important;
    }
    .polling-arena {
        height: 260px !important;
    }
    .polling-big-number {
        font-size: 3.4rem !important;
    }
    .polling-big-number .polling-unit {
        font-size: 1.4rem !important;
    }
    .coalesced-badge-wrapper {
        top: 10px !important;
        right: 12px !important;
    }
    .scroll-arena {
        height: 260px !important;
    }
    .scroll-dir-display {
        font-size: 2.4rem !important;
    }
    .mouse-track-wrapper {
        height: 280px !important;
    }
    .mouse-diagram-wrapper {
        width: 190px !important;
        height: 280px !important;
    }
    .dpi-track-arena {
        height: 220px !important;
    }

    /* Other Tools Responsive Styles (<= 768px) */
    .battery-cell-wrapper {
        width: 130px !important;
        height: 220px !important;
        border-radius: 20px !important;
    }
    #batteryPctBigDisplay {
        font-size: 2.4rem !important;
    }
    .cpu-throughput-box {
        padding: 20px 14px !important;
    }
    .cpu-ops-big-display {
        font-size: 2.8rem !important;
    }
    .cpu-ops-big-display .cpu-unit {
        font-size: 1.25rem !important;
    }
    .gamepad-triggers-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    .gamepad-buttons-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)) !important;
        gap: 8px !important;
    }
    .gps-map-wrapper {
        height: 280px !important;
    }
    .gyro-slider-grid {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }
    .kb-scroll-hint {
        display: flex !important;
    }
    .key-cap {
        height: 40px !important;
        min-width: 40px !important;
        font-size: 0.74rem !important;
    }
    .kb-row {
        gap: 4px !important;
    }
    .browser-hero-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 14px !important;
    }
    .browser-ip-box {
        text-align: left !important;
    }
    .browser-client-ip {
        font-size: 1.35rem !important;
    }
    .browser-hero-name {
        font-size: 1.4rem !important;
    }
}

@media (max-width: 480px) {
    .video-stage-container {
        min-height: 230px !important;
    }
    .false-color-legend {
        grid-template-columns: 1fr !important;
    }

    /* Audio Responsive Styles (<= 480px) */
    .stereo-stage {
        gap: 8px !important;
        padding: 16px 4px !important;
    }
    .stereo-speaker-box {
        flex: 1 !important;
        min-width: 0 !important;
        max-width: 130px !important;
        height: 125px !important;
        gap: 6px !important;
        padding: 8px 4px !important;
    }
    .stereo-speaker-box > div:first-child {
        font-size: 1.5rem !important;
    }
    .stereo-speaker-box > div:nth-child(2) {
        font-size: 0.72rem !important;
        letter-spacing: -0.2px !important;
    }
    .stereo-speaker-box .btn {
        padding: 4px 6px !important;
        font-size: 0.7rem !important;
    }
    .audio-visualizer-container {
        height: 180px !important;
    }
    .volume-meter-markers {
        font-size: 0.6rem !important;
        padding: 0 4px !important;
    }
    .db-big-readout {
        font-size: 2.2rem !important;
    }
    .form-group-slider {
        min-width: 100% !important;
    }

    /* Screen Tools Responsive Styles (<= 480px) */
    .screen-preview-box {
        height: 200px !important;
    }
    .screen-preview-badge {
        font-size: 0.76rem !important;
        padding: 6px 10px !important;
    }
    .ufo-canvas-wrapper {
        height: 230px !important;
    }
    .hz-big-number {
        font-size: 2.7rem !important;
    }
    .hz-big-number .hz-unit {
        font-size: 1.25rem !important;
    }
    .pixel-color-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px !important;
    }
    .pixel-color-grid .btn {
        padding: 8px 2px !important;
        font-size: 0.74rem !important;
    }
    #hudLiveFps {
        font-size: 1.6rem !important;
    }
    #hudLiveFps span {
        font-size: 0.85rem !important;
    }

    /* Mouse Tools Responsive Styles (<= 480px) */
    .cps-duration-pills .btn {
        padding: 5px 2px !important;
        font-size: 0.72rem !important;
    }
    .cps-click-zone {
        min-height: 180px !important;
    }
    .cps-big-score {
        font-size: 2.5rem !important;
    }
    .cps-big-score .cps-unit {
        font-size: 1.1rem !important;
    }
    .polling-arena {
        height: 220px !important;
    }
    .polling-big-number {
        font-size: 2.6rem !important;
    }
    .polling-big-number .polling-unit {
        font-size: 1.1rem !important;
    }
    .coalesced-badge-wrapper {
        position: static !important;
        margin-bottom: 8px !important;
    }
    .coalesced-badge-wrapper .badge {
        font-size: 0.7rem !important;
    }
    .scroll-arena {
        height: 210px !important;
    }
    .scroll-dir-display {
        font-size: 1.8rem !important;
    }
    .mouse-track-wrapper {
        height: 220px !important;
    }
    .mouse-diagram-wrapper {
        width: 160px !important;
        height: 240px !important;
    }
    .dpi-track-arena {
        height: 190px !important;
    }
    .dpi-start-anchor {
        left: 42px !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 0.72rem !important;
    }

    /* Other Tools Responsive Styles (<= 480px) */
    .battery-cell-wrapper {
        width: 110px !important;
        height: 180px !important;
        border-radius: 16px !important;
    }
    #batteryPctBigDisplay {
        font-size: 2rem !important;
    }
    .cpu-ops-big-display {
        font-size: 2.2rem !important;
    }
    .cpu-ops-big-display .cpu-unit {
        font-size: 1.05rem !important;
    }
    .gamepad-buttons-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px !important;
    }
    .gps-map-wrapper {
        height: 230px !important;
    }
    .gyro-stage {
        width: 160px !important;
        height: 160px !important;
        margin: 20px auto !important;
    }
    .cube-face {
        width: 160px !important;
        height: 160px !important;
        font-size: 1rem !important;
    }
    .face-front  { transform: rotateY(0deg) translateZ(80px) !important; }
    .face-back   { transform: rotateY(180deg) translateZ(80px) !important; }
    .face-right  { transform: rotateY(90deg) translateZ(80px) !important; }
    .face-left   { transform: rotateY(-90deg) translateZ(80px) !important; }
    .face-top    { transform: rotateX(90deg) translateZ(80px) !important; }
    .face-bottom { transform: rotateX(-90deg) translateZ(80px) !important; }
    .key-cap {
        height: 35px !important;
        min-width: 35px !important;
        font-size: 0.68rem !important;
    }
    #valDmsFormat {
        font-size: 0.8rem !important;
    }
}

/* Diagnostics Checklist Card */
.diagnostics-checklist-card {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.checklist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

.checklist-title {
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.checklist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    font-size: 0.88rem;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

/* Snapshot Gallery Section */
.snapshot-gallery-section {
    margin-top: 24px;
}

.snapshot-gallery-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

/* FAQ Grid */
.faq-body {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.faq-item h4 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 700;
}

.faq-item p {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.92rem;
    margin-bottom: 8px;
}

.faq-item p:last-child {
    margin-bottom: 0;
}

.faq-item ul, .faq-item ol {
    margin: 8px 0 10px 18px;
    padding: 0;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.65;
}

.faq-item li {
    margin-bottom: 5px;
}

.faq-item code {
    background: var(--bg-tertiary);
    color: var(--color-primary-light, #6366f1);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.85em;
    font-family: var(--font-mono);
    border: 1px solid var(--border-color);
}

/* Zebra Stripes Simulation */
.zebra-active {
    background: repeating-linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.4),
        rgba(255, 255, 255, 0.4) 10px,
        rgba(0, 0, 0, 0.6) 10px,
        rgba(0, 0, 0, 0.6) 20px
    );
    animation: zebraMove 1s linear infinite;
}

@keyframes zebraMove {
    0% { background-position: 0 0; }
    100% { background-position: 40px 0; }
}

/* 9-Zone Lighting Heatmap */
.lighting-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 420px;
    aspect-ratio: 4/3;
    margin: 0 auto;
}

.lighting-zone {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    font-family: var(--font-mono);
    border: 1px solid var(--border-color);
    transition: background-color 0.3s;
}

.lighting-zone-title {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.lighting-zone-val {
    font-size: 1.2rem;
    font-weight: 700;
}

/* Gallery Strip */
.gallery-strip {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 12px 0;
    margin-top: 16px;
}

.gallery-thumb {
    position: relative;
    width: 130px;
    height: 85px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
    cursor: pointer;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumb:hover {
    border-color: var(--primary);
}

/* Audio Visualizers & Controls */
.audio-visualizer-container {
    width: 100%;
    height: 220px;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.audio-visualizer-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.audio-tab-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
    flex-wrap: wrap;
}

.audio-tab-buttons {
    display: flex;
    gap: 8px;
}

.audio-tab-specs {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.mic-device-select-group {
    margin-bottom: 0;
    min-width: 220px;
}

.playback-controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.playback-speed-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-download-audio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.volume-meter-bar-wrapper {
    width: 100%;
    height: 24px;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
}

.volume-meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #10b981 0%, #f59e0b 70%, #ef4444 95%);
    transition: width 0.05s ease-out;
}

.volume-meter-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    pointer-events: none;
    font-size: 0.68rem;
    font-family: var(--font-mono);
    color: rgba(255, 255, 255, 0.7);
    line-height: 24px;
}

/* Sound Meter Gauge */
.sound-gauge-wrapper {
    position: relative;
    width: 280px;
    height: 160px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.db-big-readout {
    font-size: 3.5rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--primary);
    text-align: center;
    line-height: 1;
}

/* Stereo Headphones Animation */
.stereo-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding: 40px 20px;
}

.stereo-speaker-box {
    width: 160px;
    height: 160px;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.stereo-speaker-box.playing {
    border-color: var(--primary);
    box-shadow: 0 0 24px var(--primary-glow);
    animation: speakerThump 0.5s infinite alternate;
}

@keyframes speakerThump {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

.stereo-test-buttons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 10px;
}

.stereo-test-buttons-grid .stereo-stop-btn {
    grid-column: 1 / -1;
}

/* Fullscreen Screen Test Canvas */
.fullscreen-test-viewport {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: none;
    background: #000000;
}

.fullscreen-test-viewport.active {
    display: block;
}

/* Screen Preview Boxes (Black & White Screen) */
.screen-preview-box {
    width: 100%;
    height: 380px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    padding: 16px;
    box-sizing: border-box;
}

.screen-preview-black {
    background: #000000;
}

.screen-preview-white {
    background: #ffffff;
}

.screen-preview-badge {
    font-size: 0.95rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    text-align: center;
    max-width: 90%;
    user-select: none;
}

.screen-preview-black .screen-preview-badge {
    color: #94a3b8;
    background: rgba(15, 20, 30, 0.85);
    border: 1px solid var(--border-color);
}

.screen-preview-white .screen-preview-badge {
    color: #64748b;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* UFO Motion Canvas Wrapper */
.ufo-canvas-wrapper {
    width: 100%;
    height: 380px;
    background: #161b26;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

/* Dead Pixel Swatches & Reviver Box */
.pixel-color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.pixel-reviver-box {
    display: none;
    position: fixed;
    width: 140px;
    height: 140px;
    border: 2px solid #fff;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.85);
    z-index: 10000;
    cursor: move;
    border-radius: 6px;
    touch-action: none;
}

.reviver-close-btn {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 26px;
    text-align: center;
    border: 2px solid #fff;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Screen Controls & Buttons */
.screen-control-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.screen-control-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 200px;
}

.screen-button-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.screen-button-row .btn {
    flex: 1;
    min-width: 65px;
    text-align: center;
    white-space: nowrap;
}

.screen-pattern-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.screen-pattern-buttons .btn {
    flex: 1;
    min-width: 120px;
    text-align: center;
}

/* Refresh Rate Big Display */
.hz-big-number {
    font-size: 5.5rem;
    font-weight: 900;
    font-family: var(--font-mono);
    color: var(--primary);
    line-height: 1;
    text-shadow: 0 0 30px var(--primary-glow);
}

.hz-big-number .hz-unit {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* UFO Motion Ghosting Test Tracks */
.ufo-track-lane {
    position: relative;
    width: 100%;
    height: 90px;
    border-bottom: 2px dashed rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.ufo-object {
    position: absolute;
    top: 15px;
    left: 0;
    width: 70px;
    height: 60px;
    will-change: transform;
}

/* Mouse Tester Interactive Diagram */
.mouse-diagram-wrapper {
    position: relative;
    width: 220px;
    height: 340px;
    margin: 0 auto;
}

.mouse-svg-base {
    width: 100%;
    height: 100%;
}

.mouse-btn-part {
    fill: var(--bg-surface);
    stroke: var(--border-color);
    stroke-width: 2;
    transition: fill 0.1s, filter 0.1s;
}

.mouse-btn-part.pressed {
    fill: var(--primary) !important;
    filter: drop-shadow(0 0 8px var(--primary));
}

/* Click Speed Test (CPS) Arena */
.cps-click-zone {
    width: 100%;
    min-height: 280px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.05), rgba(129, 140, 248, 0.05));
    border: 2px dashed var(--border-hover);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.cps-click-zone:hover {
    border-color: var(--primary);
}

.cps-click-zone:active {
    transform: scale(0.99);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(129, 140, 248, 0.12));
}

.cps-big-score {
    font-size: 4rem;
    font-weight: 900;
    font-family: var(--font-mono);
    color: var(--primary);
}

.cps-big-score .cps-unit {
    font-size: 1.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Mouse Tools Base Styles */
.cps-duration-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.cps-duration-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cps-stats-bar {
    display: flex;
    gap: 16px;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
}

.dpi-start-anchor {
    position: absolute;
    top: 50%;
    left: 80px;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.2);
    border: 2px solid #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #ef4444;
    touch-action: none;
}

.polling-arena {
    width: 100%;
    height: 320px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.05), rgba(129, 140, 248, 0.05));
    border: 2px dashed var(--border-hover);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: crosshair;
    user-select: none;
    position: relative;
    padding: 16px;
    box-sizing: border-box;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.polling-arena.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.1), rgba(129, 140, 248, 0.1));
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.15);
}

.coalesced-badge-wrapper {
    position: absolute;
    top: 16px;
    right: 20px;
}

.polling-big-number {
    font-size: 4.8rem;
    font-weight: 900;
    font-family: var(--font-mono);
    color: var(--primary);
    line-height: 1.1;
    text-align: center;
}

.polling-big-number .polling-unit {
    font-size: 1.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.scroll-arena {
    width: 100%;
    height: 320px;
    background: #07090e;
    border: 2px dashed var(--border-hover);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    user-select: none;
    padding: 16px;
    box-sizing: border-box;
    touch-action: none;
}

.scroll-dir-display {
    font-size: 3.5rem;
    font-weight: 900;
    font-family: var(--font-mono);
    color: var(--primary);
    line-height: 1.1;
    text-align: center;
}

.mouse-track-wrapper {
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    height: 380px;
    position: relative;
    border: 1px solid var(--border-color);
    cursor: crosshair;
}

/* Keyboard Tester Visual Layout */
.keyboard-chassis {
    background: #0f141f;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
    overflow-x: auto;
}

.keyboard-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 900px;
}

.kb-row {
    display: flex;
    gap: 6px;
}

.key-cap {
    height: 48px;
    min-width: 48px;
    background: #1a2233;
    border: 1px solid #2a3754;
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 0 #0d121c;
    user-select: none;
    transition: all 0.06s ease;
    padding: 2px 6px;
}

.key-cap.pressed {
    background: var(--primary) !important;
    color: #fff !important;
    transform: translateY(2px);
    box-shadow: 0 1px 0 #0d121c;
    border-color: var(--primary);
}

.key-cap.tested {
    background: #1e3a5f;
    color: #7dd3fc;
    border-color: #0284c7;
}

/* Special Key Widths */
.key-w-1-25 { min-width: 60px; }
.key-w-1-5  { min-width: 72px; }
.key-w-1-75 { min-width: 84px; }
.key-w-2    { min-width: 96px; }
.key-w-2-25 { min-width: 108px; }
.key-w-2-75 { min-width: 132px; }
.key-w-6-25 { min-width: 300px; }

/* Gamepad Tester Visual Layout */
.gamepad-stage {
    position: relative;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 30px;
    border: 1px solid var(--border-color);
}

.stick-radar {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--border-color);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stick-crosshair-h {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.stick-crosshair-v {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-color);
}

.stick-dot {
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
    transform: translate(-50%, -50%);
    top: 50%;
    left: 50%;
}

/* 3D Gyroscope Cube */
.gyro-stage {
    perspective: 800px;
    width: 200px;
    height: 200px;
    margin: 40px auto;
}

.gyro-cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.05s linear;
}

.cube-face {
    position: absolute;
    width: 200px;
    height: 200px;
    background: rgba(56, 189, 248, 0.2);
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    backdrop-filter: blur(4px);
}

.face-front  { transform: rotateY(0deg) translateZ(100px); }
.face-back   { transform: rotateY(180deg) translateZ(100px); }
.face-right  { transform: rotateY(90deg) translateZ(100px); }
.face-left   { transform: rotateY(-90deg) translateZ(100px); }
.face-top    { transform: rotateX(90deg) translateZ(100px); }
.face-bottom { transform: rotateX(-90deg) translateZ(100px); }

/* Battery Cell Visualizer */
.battery-cell-wrapper {
    width: 160px;
    height: 280px;
    border: 6px solid var(--border-color);
    border-radius: 24px;
    position: relative;
    padding: 8px;
    display: flex;
    align-items: flex-end;
    margin: 0 auto;
}

.battery-cell-terminal {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 14px;
    background: var(--border-color);
    border-radius: 6px 6px 0 0;
}

.battery-fill {
    width: 100%;
    height: 50%;
    background: linear-gradient(180deg, #38bdf8, #0284c7);
    border-radius: 14px;
    transition: height 0.5s ease;
    box-shadow: 0 0 20px var(--primary-glow);
}

/* Info Tables */
.spec-table {
    width: 100%;
    border-collapse: collapse;
}

.spec-table th, .spec-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    font-size: 0.9rem;
}

.spec-table th {
    color: var(--text-muted);
    font-weight: 600;
    width: 35%;
}

.spec-table td {
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.webcam-specs-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.webcam-specs-card .spec-table th {
    width: 44%;
}

/* Other Tools Base Classes */
.cpu-config-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.cpu-throughput-box {
    background: #000;
    border-radius: var(--radius-lg);
    padding: 30px;
    text-align: center;
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.cpu-ops-big-display {
    font-size: 4rem;
    font-weight: 900;
    font-family: var(--font-mono);
    color: var(--danger);
    line-height: 1.1;
}

.cpu-ops-big-display .cpu-unit {
    font-size: 1.6rem;
    color: var(--text-muted);
    font-weight: 500;
}

.gamepad-banner {
    padding: 16px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.gamepad-triggers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 24px;
}

.gamepad-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.gps-map-wrapper {
    width: 100%;
    height: 420px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gyro-slider-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    width: 100%;
}

.kb-scroll-hint {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-size: 0.78rem;
    margin-bottom: 12px;
}

.browser-hero-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
    margin-bottom: 24px;
}

.browser-hero-name {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
}

.browser-ip-box {
    text-align: right;
}

.browser-client-ip {
    font-size: 1.6rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--primary);
}

.browser-specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}
