/* ==========================================================================
   100V SPEAKER POWER DETECTOR - INDUSTRIAL EQUIPMENT AESTHETIC
   ========================================================================== */

/* CSS Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* CSS Variables - Industrial Color Palette */
:root {
    /* Core Colors */
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-tertiary: #18181b;
    --bg-elevated: #1f1f23;

    /* Accent Colors - Equipment Inspired */
    --accent-primary: #00ff88;
    --accent-primary-dim: rgba(0, 255, 136, 0.15);
    --accent-secondary: #00d4ff;
    --accent-warning: #ffaa00;
    --accent-danger: #ff3344;

    /* Text Colors */
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;

    /* Borders & Lines */
    --border-color: #27272a;
    --border-active: #3f3f46;

    /* Meter Colors */
    --meter-green: #22c55e;
    --meter-yellow: #eab308;
    --meter-red: #ef4444;

    /* Shadows & Glows */
    --glow-green: 0 0 20px rgba(0, 255, 136, 0.3);
    --glow-cyan: 0 0 20px rgba(0, 212, 255, 0.3);

    /* Typography */
    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* Safe areas for notch devices */
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
    --safe-left: env(safe-area-inset-left);
    --safe-right: env(safe-area-inset-right);
}

/* Base */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-display);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;

    /* Subtle noise texture */
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
}

/* ==========================================================================
   APP SHELL
   ========================================================================== */

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 100%;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .app-shell {
        max-width: 480px;
    }
}

/* ==========================================================================
   STATUS BAR
   ========================================================================== */

.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(var(--safe-top) + 8px) var(--space-md) var(--space-sm);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    position: sticky;
    top: 0;
    z-index: 100;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-danger);
    box-shadow: 0 0 8px var(--accent-danger);
}

.status-indicator.active .status-dot {
    background: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-primary);
    animation: pulse-glow 2s ease-in-out infinite;
}

.status-text {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.status-indicator.active .status-text {
    color: var(--accent-primary);
}

.app-title {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
}

.sample-rate {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.settings-btn {
    width: 28px;
    height: 28px;
    padding: 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn svg {
    width: 18px;
    height: 18px;
}

.settings-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--accent-primary);
}

.settings-btn:active {
    transform: scale(0.92);
}

/* ==========================================================================
   MAIN CONTENT
   ========================================================================== */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   CONNECT SCREEN
   ========================================================================== */

.connect-screen {
    justify-content: center;
    align-items: center;
    padding: var(--space-xl);
    text-align: center;
}

.connect-content {
    max-width: 320px;
}

.mic-icon-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto var(--space-xl);
}

.mic-icon {
    width: 64px;
    height: 64px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--accent-primary);
    filter: drop-shadow(0 0 10px rgba(0, 255, 136, 0.4));
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse-expand 2s ease-out infinite;
    opacity: 0;
}

.pulse-ring.delay-1 {
    animation-delay: 1s;
}

@keyframes pulse-expand {
    0% {
        width: 60px;
        height: 60px;
        opacity: 0.6;
    }
    100% {
        width: 120px;
        height: 120px;
        opacity: 0;
    }
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.connect-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    letter-spacing: -0.02em;
}

.connect-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

.connect-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, var(--accent-primary) 0%, #00cc6a 100%);
    border: none;
    border-radius: 12px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--bg-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--glow-green);
}

.connect-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.5);
}

.connect-button:active {
    transform: translateY(0);
}

.connect-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-arrow {
    font-size: 18px;
    transition: transform 0.2s ease;
}

.connect-button:hover .btn-arrow {
    transform: translateX(4px);
}

.connect-status {
    margin-top: var(--space-md);
    font-size: 12px;
    color: var(--text-muted);
    min-height: 20px;
}

.connect-status.error {
    color: var(--accent-danger);
}

/* ==========================================================================
   MAIN INTERFACE
   ========================================================================== */

.main-interface {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ==========================================================================
   SIGNAL METER SECTION
   ========================================================================== */

.signal-meter-section {
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.meter-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.vu-meter {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.vu-scale {
    display: flex;
    justify-content: space-between;
    padding: 0 2px;
}

.vu-scale span {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-muted);
}

.vu-track {
    position: relative;
    height: 24px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.vu-fill {
    position: absolute;
    top: 2px;
    left: 2px;
    bottom: 2px;
    width: 0%;
    /* Combine segment overlay with color gradient using multiple backgrounds */
    background-image:
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 6px,
            rgba(0, 0, 0, 0.3) 6px,
            rgba(0, 0, 0, 0.3) 8px
        ),
        linear-gradient(90deg,
            var(--meter-green) 0%,
            var(--meter-green) 60%,
            var(--meter-yellow) 75%,
            var(--meter-red) 100%
        );
    border-radius: 2px;
    transition: width 0.05s linear;
}

.vu-peak {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 2px;
}

.db-value {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.db-unit {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
}

/* ==========================================================================
   SPECTRUM SECTION
   ========================================================================== */

.spectrum-section {
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.spectrum-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.section-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

.gesture-hint {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.6;
}

.spectrum-container {
    position: relative;
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

#spectrum-canvas {
    width: 100%;
    height: 140px;
    display: block;
    touch-action: none;
}

.spectrum-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.freq-marker {
    position: absolute;
    top: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
}

.freq-marker.low {
    left: 4px;
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.freq-marker.high {
    right: 4px;
    background: rgba(34, 197, 94, 0.2);
    color: var(--meter-green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* ==========================================================================
   TAB NAVIGATION
   ========================================================================== */

.tab-nav {
    display: flex;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 var(--space-sm);
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-sm) var(--space-md);
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.tab-btn svg {
    width: 20px;
    height: 20px;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--accent-primary);
    transition: width 0.2s ease;
}

.tab-btn.active {
    color: var(--accent-primary);
}

.tab-btn.active::after {
    width: 40px;
}

.tab-btn:active {
    opacity: 0.7;
}

/* ==========================================================================
   TAB PANELS
   ========================================================================== */

.tab-panels {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-panel {
    display: none;
    padding: var(--space-md);
    padding-bottom: calc(var(--safe-bottom) + var(--space-lg));
    animation: fadeIn 0.2s ease;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   MEASURE PANEL
   ========================================================================== */

.result-display {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: var(--space-lg);
    text-align: center;
    margin-bottom: var(--space-md);
}

.result-header {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.power-readout {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    margin-bottom: var(--space-md);
}

.power-value {
    font-family: var(--font-mono);
    font-size: 72px;
    font-weight: 700;
    line-height: 1;
    color: var(--accent-primary);
    text-shadow: 0 0 30px rgba(0, 255, 136, 0.4);
}

.power-unit {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 500;
    color: var(--text-secondary);
}

.confidence-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.confidence-bar-container {
    flex: 1;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.confidence-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-primary);
    border-radius: 3px;
    transition: width 0.3s ease, background 0.3s ease;
}

.confidence-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.result-warning {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 51, 68, 0.1);
    border: 1px solid rgba(255, 51, 68, 0.2);
    border-radius: 8px;
    font-size: 12px;
    color: var(--accent-danger);
}

/* Progress Display */
.progress-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xl);
    margin-bottom: var(--space-md);
}

.progress-ring-container {
    position: relative;
    width: 100px;
    height: 100px;
}

.progress-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 6;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--accent-primary);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 0.1s ease;
    filter: drop-shadow(0 0 6px rgba(0, 255, 136, 0.5));
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-primary);
}

.progress-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    animation: pulse-glow 1s ease-in-out infinite;
}

/* Action Buttons */
.action-button {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.action-button:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--border-active);
}

.action-button:active:not(:disabled) {
    transform: scale(0.98);
}

.action-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-button.detect {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1) 0%, rgba(0, 212, 255, 0.1) 100%);
    border-color: rgba(0, 255, 136, 0.3);
}

.action-button.detect:hover:not(:disabled) {
    border-color: var(--accent-primary);
    box-shadow: var(--glow-green);
}

.action-button.capture {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, rgba(0, 136, 255, 0.1) 100%);
    border-color: rgba(0, 212, 255, 0.3);
}

.action-button.capture:hover:not(:disabled) {
    border-color: var(--accent-secondary);
    box-shadow: var(--glow-cyan);
}

.action-button.secondary {
    background: transparent;
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border-radius: 10px;
    flex-shrink: 0;
}

.btn-icon svg {
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
}

.action-button.capture .btn-icon svg {
    color: var(--accent-secondary);
}

.action-button.secondary .btn-icon svg {
    color: var(--text-muted);
}

.btn-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.btn-title {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.btn-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

/* Warning Banner */
.warning-banner {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid rgba(255, 170, 0, 0.2);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent-warning);
}

/* ==========================================================================
   INFO BANNER - ONBOARDING
   ========================================================================== */

.info-banner {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    margin-bottom: var(--space-md);
    transition: all 0.2s ease;
}

.info-banner.clickable {
    cursor: pointer;
}

.info-banner.clickable:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
}

.info-banner.clickable:active {
    transform: translateY(0);
}

.banner-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 212, 255, 0.2);
    border-radius: 8px;
    color: var(--accent-secondary);
}

.banner-icon svg {
    width: 18px;
    height: 18px;
}

.banner-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.banner-title {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-secondary);
    letter-spacing: 0.05em;
}

.banner-text {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.banner-arrow {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--accent-secondary);
    opacity: 0.6;
    transition: all 0.2s ease;
}

.info-banner.clickable:hover .banner-arrow {
    opacity: 1;
    transform: translateX(2px);
}

/* Reference tab highlight when attention needed */
.tab-btn.needs-attention {
    position: relative;
}

.tab-btn.needs-attention::before {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    background: var(--accent-secondary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-secondary);
    animation: pulse-glow 2s ease-in-out infinite;
}

/* Capture button highlight animation */
@keyframes highlight-pulse {
    0% {
        box-shadow: 0 0 0 rgba(0, 212, 255, 0.4);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
    }
    100% {
        box-shadow: 0 0 0 rgba(0, 212, 255, 0);
    }
}

/* ==========================================================================
   FILTER PANEL
   ========================================================================== */

.control-group {
    margin-bottom: var(--space-lg);
}

.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.control-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.control-value {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-primary);
}

.control-value.warning-color {
    color: var(--accent-warning);
}

.control-value.danger-color {
    color: var(--accent-danger);
}

.slider-track {
    position: relative;
    height: 44px;
    display: flex;
    align-items: center;
}

.slider-track input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-primary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.slider-track input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: 3px solid var(--bg-primary);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.4), inset 0 0 0 2px var(--accent-primary);
    cursor: pointer;
    transition: transform 0.1s ease;
}

.slider-track input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

.slider-track input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: 3px solid var(--bg-primary);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
    cursor: pointer;
}

.control-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-lg) 0;
}

/* ==========================================================================
   REFERENCE PANEL
   ========================================================================== */

.reference-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.reference-card.has-reference {
    border-color: rgba(0, 255, 136, 0.3);
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.05) 0%, transparent 100%);
}

.reference-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.status-icon {
    font-size: 16px;
    color: var(--text-muted);
}

.reference-card.has-reference .status-icon {
    color: var(--accent-primary);
}

.status-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.reference-details {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) 0;
}

.detail-label {
    font-size: 12px;
    color: var(--text-muted);
}

.detail-value {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Power Selector */
.power-selector {
    margin-bottom: var(--space-lg);
}

.selector-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.power-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.power-option {
    padding: var(--space-sm) var(--space-xs);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.power-option:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-active);
}

.power-option.active {
    background: rgba(0, 212, 255, 0.15);
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
}

/* Reference Actions */
.reference-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* ==========================================================================
   CAPTURING STATE
   ========================================================================== */

.capturing .btn-icon {
    animation: pulse-glow 1s ease-in-out infinite;
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

.success {
    color: var(--meter-green);
}

.warning {
    color: var(--accent-warning);
}

.error {
    color: var(--accent-danger);
}

/* ==========================================================================
   SETTINGS DRAWER
   ========================================================================== */

.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.settings-overlay.active {
    opacity: 1;
    visibility: visible;
}

.settings-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 201;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
}

.settings-drawer.active {
    transform: translateX(0);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(var(--safe-top) + var(--space-md)) var(--space-lg) var(--space-md);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.settings-title {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-primary);
}

.settings-close {
    width: 32px;
    height: 32px;
    padding: 6px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-close:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-danger);
    color: var(--accent-danger);
}

.settings-close svg {
    width: 16px;
    height: 16px;
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-lg);
    padding-bottom: calc(var(--safe-bottom) + var(--space-lg));
}

.settings-section {
    margin-bottom: var(--space-xl);
}

.setting-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.setting-description {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.voltage-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.voltage-btn {
    padding: var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.voltage-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-active);
}

.voltage-btn.active {
    background: rgba(0, 255, 136, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.2);
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */

@media (max-width: 360px) {
    .power-value {
        font-size: 56px;
    }

    .power-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .power-option {
        padding: 8px 4px;
        font-size: 11px;
    }
}

@media (min-height: 800px) {
    #spectrum-canvas {
        height: 180px;
    }
}

/* Dark mode is default, but ensure system preference respected */
@media (prefers-color-scheme: light) {
    /* Keep dark theme as this is equipment-style UI */
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
