* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0a0a0a;
    color: #e0e0e0;
    font-family: 'Segoe UI', sans-serif;
    min-height: 100vh;
    padding: 20px;
}
@media (max-width: 767px) {
    body { padding: 10px; }
}

.calc-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── TWO-COLUMN LAYOUT ── */
.calc-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.col-left, .col-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (min-width: 1024px) {
    .calc-layout {
        flex-direction: row;
        align-items: flex-start;
    }
    .col-left {
        flex: 0 0 40%;
        max-width: 40%;
    }
    .col-right {
        flex: 0 0 60%;
        max-width: 60%;
        position: sticky;
        top: 20px;
    }
}

/* HEADER */
.calc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 4px;
    border-bottom: 1px solid #1e1e1e;
}

.header-brand {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: #ff6600;
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-version {
    font-size: 0.72rem;
    color: #444;
    letter-spacing: 0.5px;
}

.header-feedback {
    font-size: 0.72rem;
    color: #555;
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: color 0.15s;
}

.header-feedback:hover {
    color: #ff6600;
}

/* LANDING */
.landing-hero {
    text-align: center;
    padding: 40px 0 28px;
}

.landing-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: #ff6600;
}

.landing-subtitle {
    color: #666;
    font-size: 0.85rem;
    margin-top: 6px;
    letter-spacing: 1px;
}

.landing-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

@media (min-width: 768px) {
    .landing-grid {
        flex-direction: row;
        align-items: flex-start;
        gap: 32px;
    }
    .landing-cta {
        flex: 0 0 38%;
        max-width: 38%;
    }
    .landing-info {
        flex: 1;
    }
}

.landing-cta {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.select-driver-btn--custom {
    border-style: dashed;
    opacity: 0.85;
}

.select-driver-btn--custom:hover {
    opacity: 1;
    border-style: solid;
}

/* Custom driver button inside the browse modal */
.modal-custom-btn {
    margin: 10px 0 4px;
    width: 100%;
}

.landing-info {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.landing-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #555;
    margin-bottom: 14px;
}

.landing-steps-list {
    list-style: none;
    counter-reset: steps;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.landing-steps-list li {
    counter-increment: steps;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.landing-steps-list li::before {
    content: counter(steps);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    background: rgba(255,102,0,0.12);
    border: 1px solid rgba(255,102,0,0.3);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    color: #ff6600;
    flex-shrink: 0;
    margin-top: 1px;
}

.landing-steps-list li span {
    display: block;
}

.landing-step-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ccc;
    margin-bottom: 2px;
}

.landing-step-desc {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.5;
}

.landing-features-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.landing-features-list li {
    font-size: 0.8rem;
    color: #777;
    padding-left: 16px;
    position: relative;
    line-height: 1.4;
}

.landing-features-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #ff6600;
    font-size: 0.9rem;
    line-height: 1.2;
}

.landing-seo {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #1e1e1e;
}

.landing-seo-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #555;
    margin-bottom: 14px;
}

.landing-seo p {
    font-size: 0.8rem;
    color: #555;
    line-height: 1.7;
    margin-bottom: 10px;
}

.landing-seo p:last-child {
    margin-bottom: 0;
}

/* FOOTER */
.calc-footer {
    text-align: center;
    padding: 20px 0 8px;
    font-size: 0.72rem;
    color: #333;
    letter-spacing: 0.5px;
}

/* Units toggle — small pill inside speaker strip */
.units-toggle {
    display: inline-flex;
    gap: 0;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}
.units-btn {
    background: transparent;
    border: none;
    color: #555;
    font-size: 0.7rem;
    letter-spacing: 0.3px;
    padding: 3px 8px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Segoe UI', sans-serif;
}
.units-btn.active {
    background: #333;
    color: #ff6600;
    font-weight: 600;
}
.units-btn:hover:not(.active) {
    color: #aaa;
}

/* SECTIONS */
.section {
    background: #141414;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 20px;
}

.section-label {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 14px;
}

/* SELECT ROW */
.select-row {
    display: flex;
    gap: 12px;
}

.select-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.select-group label {
    font-size: 0.75rem;
    color: #666;
    letter-spacing: 1px;
    text-transform: uppercase;
}

select {
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #e0e0e0;
    padding: 10px 12px;
    font-size: 0.9rem;
    width: 100%;
    cursor: pointer;
    appearance: none;
    outline: none;
}

select:focus {
    border-color: #ff6600;
}

/* SPEAKER STRIP */
.speaker-strip {
    margin-top: 14px;
    background: #0f0f0f;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.strip-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.strip-name {
    font-size: 1rem;
    font-weight: 700;
    color: #ff6600;
}

.strip-size, .strip-power {
    font-size: 0.85rem;
    color: #888;
    background: #1a1a1a;
    padding: 2px 8px;
    border-radius: 4px;
}

.strip-params {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.strip-param {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.param-label {
    font-size: 0.7rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.param-val {
    font-size: 0.9rem;
    color: #ccc;
    font-weight: 600;
}

.strip-link {
    color: #ff6600;
    font-size: 0.8rem;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    align-self: flex-start;
}

.strip-link:hover {
    opacity: 1;
}

/* BOX TYPE BUTTONS */
.type-buttons {
    display: flex;
    gap: 10px;
}

.type-btn {
    flex: 1;
    padding: 12px;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #888;
    font-size: 0.9rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

.type-btn.active {
    background: #ff6600;
    border-color: #ff6600;
    color: #fff;
    font-weight: 700;
}

.type-btn:hover:not(.active) {
    border-color: #ff6600;
    color: #ff6600;
}

/* SLIDERS */
.slider-group {
    margin-bottom: 20px;
}

.slider-group:last-child {
    margin-bottom: 0;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.slider-header label {
    font-size: 0.85rem;
    color: #aaa;
}

.slider-val {
    font-size: 1rem;
    font-weight: 700;
    color: #ff6600;
}

input[type="range"] {
    width: 100%;
    height: 4px;
    background: #2a2a2a;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: #ff6600;
    border-radius: 50%;
    cursor: pointer;
}

.slider-hints {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.7rem;
    color: #444;
}

/* RESULTS — feedback bar + port dims only */

/* GRAPH PLACEHOLDER */
.graph-placeholder {
    height: 200px;
    background: #0a0a0a;
    border: 1px dashed #2a2a2a;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 0.85rem;
    letter-spacing: 2px;
}

/* MOBILE */
@media (max-width: 480px) {
    .select-row {
        flex-direction: column;
    }
}

/* ── MOBILE: reorder graph above sliders ── */
@media (max-width: 767px) {
    .col-left  { display: contents; }
    .col-right { display: contents; }
    .calc-layout {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    .calc-layout .col-left > .section:first-child { order: 1; }
    .calc-layout #boxSection     { order: 2; }
    .calc-layout #graphSection   { order: 3; }
    .calc-layout #sliderSection  { order: 4; }
    .calc-layout #portDimsBox    { order: 5; }
    .calc-layout #resultsSection { order: 6; }
}

/* ── MOBILE: compact horizontal slider cards ── */
@media (max-width: 767px) {
    .sliders-row {
        flex-direction: column;
        gap: 8px;
    }

    /* Card becomes a flat horizontal row, max 80px tall */
    .vslider-box {
        flex-direction: row !important;
        align-items: center !important;
        padding: 10px 14px !important;
        gap: 10px;
        max-height: 80px;
        min-height: unset;
    }

    /* Label block: fixed width left */
    .vslider-label,
    .power-mode-toggle,
    .vol-toggle {
        min-width: 72px !important;
        max-width: 72px;
        text-align: left !important;
        flex-shrink: 0;
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    /* Track fills remaining space */
    .vslider-track-wrap {
        flex: 1 1 0 !important;
        min-width: 0 !important;      /* critical: allows flex item to shrink */
        min-height: unset !important;
        height: auto !important;
        display: flex;
        align-items: center;
    }

    /* Override vertical slider to horizontal — must beat base styles */
    .vslider-box input[type="range"] {
        writing-mode: horizontal-tb !important;
        direction: ltr !important;
        appearance: auto !important;
        -webkit-appearance: auto !important;
        width: 100% !important;
        height: 36px !important;
        min-height: 36px !important;
    }

    /* Value: fixed width right, tappable */
    .vslider-val {
        min-width: 56px !important;
        max-width: 56px;
        text-align: right !important;
        flex-shrink: 0;
        font-size: 15px !important;
    }

    /* Hide desktop-only derived text and hints */
    .vslider-derived { display: none !important; }
    .vslider-hint    { display: none !important; }

    /* Power warning — hide on mobile (feedback bar has the full text) */
    #powerWarn {
        display: none !important;
    }

    /* Fb slider: force horizontal writing mode — element starts hidden so
       some WebKit builds don't recompute writing-mode on reveal */
    #fbSlider {
        writing-mode: horizontal-tb !important;
        direction: ltr !important;
        -webkit-appearance: auto !important;
        appearance: auto !important;
        width: 100% !important;
        height: 36px !important;
        min-height: 36px !important;
    }
}

/* Touch target: larger thumb on mobile */
@media (max-width: 767px) {
    input[type="range"]::-webkit-slider-thumb {
        width: 24px !important;
        height: 24px !important;
    }
    input[type="range"]::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
}

/* ── MOBILE: port dimensions panel font sizes ── */
@media (max-width: 767px) {
    .port-type-btn {
        font-size: 13px;
        padding: 10px 6px;
    }
    .port-count-btn,
    .port-wall-btn,
    .port-flared-btn,
    .port-end-btn,
    .aeroport-btn {
        font-size: 13px;
        padding: 8px 12px;
        min-height: 36px;
    }
    .port-option-label {
        font-size: 12px;
        min-width: 62px;
    }
    .port-dim-label {
        font-size: 13px;
    }
    .port-dim-val,
    .port-dim-val-hi {
        font-size: 14px;
    }
    .port-result-row .port-dim-val {
        font-size: 14px;
        font-weight: 700;
    }
    .port-wall-desc {
        font-size: 12px;
        padding-left: 74px;
    }
    .port-result-info {
        font-size: 12px;
    }
}

/* Feedback bar bottom safe area on mobile */
@media (max-width: 767px) {
    #resultsSection {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* ── VERTICAL SLIDERS ── */
.sliders-row {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.vslider-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 16px 10px;
    flex: 1;
    min-width: 0;
    gap: 8px;
}

.vslider-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.vslider-val {
    font-size: 18px;
    font-weight: 700;
    color: #e8622a;
}

.vslider-track-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
}

/* Vertical range input — standard writing-mode approach (no slider-vertical) */
input[type=range][orient=vertical],
input[type=range].vertical {
    writing-mode: vertical-lr;
    direction: rtl;
    appearance: auto;
    -webkit-appearance: auto;
    width: 36px;
    height: 150px;
    cursor: pointer;
    accent-color: #e8622a;
}

/* Firefox fallback */
@-moz-document url-prefix() {
    input[type=range][orient=vertical] {
        appearance: auto;
        writing-mode: vertical-lr;
        direction: rtl;
    }
}

.vslider-hint {
    font-size: 10px;
    color: #666;
    text-align: center;
    height: 36px;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 3px;
}

/* ── DESKTOP: cap slider card height ── */
@media (min-width: 768px) {
    .vslider-box {
        max-height: 320px;
    }
    .vslider-track-wrap {
        min-height: 120px;
        max-height: 200px;
    }
}

/* ── POWER MODE TOGGLE — identical to vol-toggle ── */
.power-mode-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
    padding: 3px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.power-mode-toggle:hover {
    background: #222;
}

/* ── SLIDER HEADER ALIGNMENT — ensure all header elements same height ── */
.vslider-box > .vol-toggle,
.vslider-box > .power-mode-toggle,
.vslider-box > .vslider-label {
    min-height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── VOL MODE TOGGLE ── */
.vol-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
    padding: 3px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.vol-toggle:hover {
    background: #222;
}
.vol-toggle-opt {
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 600;
    color: #444;
    transition: color 0.15s;
}
.vol-toggle-opt.active {
    color: #ff6600;
}
.vol-toggle-arrow {
    font-size: 13px;
    color: #444;
}
.vslider-derived {
    font-size: 11px;
    color: #666;
    min-height: 16px;
    text-align: center;
}

/* ── GRAPH SECTION LABEL ── */
.graph-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #444;
    padding: 6px 2px 4px;
    border-bottom: 1px solid #222;
    margin-bottom: 2px;
}

/* ── GRAPH TABS (kept for future use) ── */
.graph-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    border-bottom: 1px solid #333;
}
.graph-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #555;
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 8px 14px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    font-family: 'Segoe UI', sans-serif;
}
.graph-tab:hover {
    color: #aaa;
}
.graph-tab.active {
    color: #ff6600;
    border-bottom-color: #ff6600;
}

/* ── GRAPH ── */
.graph-wrap {
    width: 100%;
    overflow: hidden;
    position: relative;
    min-height: 300px; /* prevents collapse when canvas is display:none */
}
@media (min-width: 1024px) {
    .graph-wrap { min-height: 400px; }
}
.graph-coming-soon {
    position: absolute;
    inset: 0;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    border-radius: 8px;
}
.coming-soon-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px 40px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
}
.coming-soon-icon {
    font-size: 2rem;
    opacity: 0.5;
}
.coming-soon-label {
    color: #888;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 1px;
}
.coming-soon-sub {
    color: #444;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#responseCanvas {
    display: block;
    width: 100% !important;
    height: 300px !important;
}

@media (min-width: 1024px) {
    #responseCanvas {
        height: 400px !important;
    }
}

/* ── REC BAR ── */
.rec-bar {
    margin-top: 0;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}
.rec-bar.good    { background: #1a3a1a; color: #4caf50; border: 1px solid #2d5a2d; display: block; }
.rec-bar.neutral { background: #1a1e2a; color: #7ec8e3; border: 1px solid #2a3050; display: block; }
.rec-bar.warn    { background: #3a2e1a; color: #ff9800; border: 1px solid #5a441a; display: block; }
.rec-bar.bad     { background: #3a1a1a; color: #f44336; border: 1px solid #5a2020; display: block; }

/* Enhanced feedback bar */
.feedback-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}
.feedback-title {
    font-weight: 600;
    color: #ddd;   /* always neutral — never inherits bar's warn/bad color */
}
.feedback-stats {
    font-size: 0.8rem;
    color: #aaa;   /* always gray — never inherits bar's warn/bad color */
}
.feedback-icon {
    font-weight: 700;
    margin-right: 2px;
}
.feedback-warning {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8rem;
}
.feedback-warn { color: #ff9800; }
.feedback-bad  { color: #f44336; }
.feedback-info {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.78rem;
    color: #7ec8e3;
    opacity: 0.9;
}
.feedback-hint {
    margin-top: 2px;
    padding: 1px 0 4px 18px;
    font-size: 0.76rem;
    color: #888;
    font-style: italic;
}
.feedback-alignment {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.78rem;
}
.align-match { color: #7aa2d4; }   /* muted blue — informational, not a warning */
.align-near  { color: #7ec8e3; }
.align-far   { color: #555; }


/* Clickable slider values */
.slider-val-click {
    cursor: pointer;
    border-bottom: 1px dashed #666;
    padding-bottom: 1px;
    transition: color 0.15s;
}
.slider-val-click:hover { color: #e8622a; }

/* Inline edit input */
.inline-edit {
    background: #1a1a1a;
    border: 1px solid #e8622a;
    color: #fff;
    width: 70px;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9rem;
}

/* Power warning */
.slider-warn {
    font-size: 0.8rem;
    color: #f44336;
    margin-top: 4px;
}

/* ── PORT DIMENSION SLIDERS — full-width, styled like main sliders ── */
.port-dim-group {
    margin-bottom: 16px;
}
.port-dim-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.port-dim-val-hi {
    font-size: 1rem;
    font-weight: 700;
    color: #e8622a;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dashed;
    text-underline-offset: 3px;
}
.port-slider {
    width: 100%;
    /* height, thumb, appearance inherited from global input[type="range"] */
}

/* Port dimensions — now a .section in left column, interior styles only */
.port-type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.port-type-btn {
    flex: 1;
    padding: 8px;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #888;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Segoe UI', sans-serif;
}
.port-type-btn.active {
    border-color: #ff6600;
    color: #ff6600;
}
.port-type-btn:hover:not(.active) {
    border-color: #555;
    color: #ccc;
}
.port-dim-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #2a2a2a;
}
.port-dim-row:last-child { border-bottom: none; }
.port-dim-label { color: #888; font-size: 0.85rem; }
.port-dim-val   { color: #fff; font-weight: 600; font-size: 0.85rem; }
.port-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.port-config {
    margin-bottom: 8px;
}
/* Aeroport size buttons */
.aeroport-sizes {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.aeroport-btn {
    flex: 1;
    padding: 8px 4px;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #888;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Segoe UI', sans-serif;
}
.aeroport-btn.active {
    border-color: #ff6600;
    color: #ff6600;
}
.aeroport-btn:hover:not(.active) {
    border-color: #555;
    color: #ccc;
}
/* Port velocity */
.port-velocity {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #333;
}
.port-vel-good { color: #4caf50; }
.port-vel-warn { color: #ff9800; }
.port-vel-bad  { color: #f44336; }

/* ── PORT OPTION ROWS — count, end type, wall sharing ── */
.port-option-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.port-option-label {
    color: #888;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    min-width: 52px;
}
.port-btn-group {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* Shared base for all small port buttons (end type, count, wall, flared) */
.port-end-btn,
.port-count-btn,
.port-wall-btn,
.port-flared-btn {
    padding: 5px 10px;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 5px;
    color: #888;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Segoe UI', sans-serif;
    white-space: nowrap;
}
.port-end-btn.active,
.port-count-btn.active,
.port-wall-btn.active,
.port-flared-btn.active {
    border-color: #ff6600;
    color: #ff6600;
}
.port-end-btn:hover:not(.active),
.port-count-btn:hover:not(.active),
.port-wall-btn:hover:not(.active),
.port-flared-btn:hover:not(.active) {
    border-color: #555;
    color: #ccc;
}

/* Fixed label for aeroport outside (Flared, not a button) */
.port-end-fixed {
    color: #666;
    font-size: 0.8rem;
    font-style: italic;
}

/* Wall sharing description */
.port-wall-desc {
    color: #555;
    font-size: 0.75rem;
    margin-top: -6px;
    margin-bottom: 10px;
    padding-left: 62px;  /* aligns under button group, past label */
    line-height: 1.3;
}

/* Derived value below port slider (gray, secondary) */
.port-dim-derived {
    color: #666;
    font-size: 0.78rem;
    margin-top: 4px;
    text-align: right;
}
.port-ratio-green { color: #4caf50; }
.port-ratio-yellow { color: #ff9800; }
.port-ratio-red    { color: #f44336; }

/* Ø ⇄ Area toggle — reuse vol-toggle appearance */
.port-mode-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
}

/* Aeroport: inline Ø + derived area row */
.port-aero-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0 4px;
    border-top: 1px solid #2a2a2a;
    margin-top: 4px;
}
.port-aero-info .port-dim-derived {
    margin: 0;
    text-align: left;
}

/* ── PORT RESULTS PANEL ── */
.port-results {
    border-top: 1px solid #333;
    margin-top: 8px;
    padding-top: 6px;
}
.port-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #1e1e1e;
}
.port-result-row:last-child { border-bottom: none; }
.port-result-info {
    color: #555;
    font-size: 0.75rem;
    padding: 6px 0 2px;
    font-style: italic;
}
.port-result-minor {
    color: #555;
    font-size: 0.8rem;
}

/* ═══════════════════════════════════════
   SELECT DRIVER BUTTON
═══════════════════════════════════════ */
.select-driver-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    background: #141414;
    border: 1px solid #333;
    border-radius: 10px;
    cursor: pointer;
    color: #e0e0e0;
    font-family: 'Segoe UI', sans-serif;
    text-align: left;
    transition: border-color 0.2s, background 0.2s;
}
.select-driver-btn:hover {
    border-color: #ff6600;
    background: #1a1a1a;
}
.select-driver-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}
.select-driver-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.select-driver-label {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #ff6600;
}
.select-driver-sub {
    font-size: 0.75rem;
    color: #666;
}
.select-driver-arrow {
    font-size: 1.4rem;
    color: #555;
    flex-shrink: 0;
}
.strip-change-hint {
    font-size: 0.7rem;
    color: #555;
    text-align: right;
    padding: 4px 0 0;
    cursor: pointer;
}
.speaker-strip { cursor: pointer; }
.speaker-strip:hover .strip-change-hint { color: #ff6600; }

/* ═══════════════════════════════════════
   DRIVER SELECTION MODAL
═══════════════════════════════════════ */
.driver-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: flex-end;   /* mobile: sheet from bottom */
    justify-content: center;
    padding: 0;
}
@media (min-width: 600px) {
    .driver-modal-overlay {
        align-items: flex-start;
        overflow-y: auto;
        padding: 20px;
    }
}
.driver-modal {
    background: #141414;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 100vw;
    max-height: 92dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}
@media (min-width: 600px) {
    .driver-modal {
        border-radius: 12px;
        width: 480px;
        max-width: calc(100vw - 40px);
        max-height: none;
        margin: auto;
    }
}
.modal-header {
    display: flex;
    align-items: center;
    padding: 16px 18px 14px;
    border-bottom: 1px solid #2a2a2a;
    gap: 12px;
    flex-shrink: 0;
}
.modal-title {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #ff6600;
    text-align: center;
}
.modal-close {
    background: none;
    border: none;
    color: #666;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
    transition: color 0.15s;
    flex-shrink: 0;
}
.modal-close:hover { color: #e0e0e0; }
.modal-back {
    background: none;
    border: none;
    color: #888;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 0;
    flex-shrink: 0;
    font-family: 'Segoe UI', sans-serif;
    transition: color 0.15s;
}
.modal-back:hover { color: #e0e0e0; }
.modal-search-wrap {
    padding: 12px 16px 8px;
    flex-shrink: 0;
}
.modal-search {
    width: 100%;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #e0e0e0;
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.95rem;
    padding: 10px 14px;
    outline: none;
    transition: border-color 0.15s;
}
.modal-search:focus { border-color: #ff6600; }
.modal-search::placeholder { color: #555; }
.modal-custom-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 4px 16px 10px;
    padding: 12px;
    background: #1a1a1a;
    border: 1px dashed #444;
    border-radius: 8px;
    color: #ff6600;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    font-family: 'Segoe UI', sans-serif;
    transition: border-color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.modal-custom-btn:hover {
    border-color: #ff6600;
    background: #202020;
}
.modal-driver-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0 16px;
    overscroll-behavior: contain;
}
.modal-brand-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    cursor: pointer;
    border-top: 1px solid #1e1e1e;
    transition: background 0.15s;
    user-select: none;
}
.modal-brand-header:hover { background: #1a1a1a; }
.modal-brand-header.open { background: #181818; }
.modal-brand-arrow {
    color: #ff6600;
    font-size: 0.8rem;
    width: 12px;
    flex-shrink: 0;
}
.modal-brand-header > span:nth-child(2) {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ccc;
    letter-spacing: 0.3px;
}
.modal-brand-count {
    font-size: 0.75rem;
    color: #555;
    background: #222;
    padding: 2px 7px;
    border-radius: 10px;
}
.modal-driver-item {
    padding: 10px 18px 10px 30px;
    cursor: pointer;
    border-bottom: 1px solid #1a1a1a;
    transition: background 0.1s;
}
.modal-driver-item:hover { background: #1c1c1c; }
.modal-driver-name {
    font-size: 0.9rem;
    color: #e0e0e0;
    font-weight: 500;
}
.modal-driver-name mark {
    background: none;
    color: #ff6600;
    font-weight: 700;
}
.modal-driver-specs {
    font-size: 0.78rem;
    color: #666;
    margin-top: 2px;
}
.modal-empty {
    padding: 24px 18px;
    color: #555;
    font-size: 0.85rem;
    text-align: center;
}

/* ═══════════════════════════════════════
   CUSTOM DRIVER FORM
═══════════════════════════════════════ */
.modal-custom-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 14px 32px;
    overscroll-behavior: contain;
}
.cd-group-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #555;
    margin: 18px 0 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #222;
}
.cd-group-label:first-child { margin-top: 4px; }
.cd-required-label { color: #ff6600; }
.cd-group-note {
    font-size: 0.7rem;
    color: #444;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}
.cd-row {
    display: grid;
    /* label | input | unit — label fixed, unit fixed, input fills rest */
    grid-template-columns: 48px 1fr auto;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
/* rows that have a derived line wrap it below across columns 2-3 */
.cd-row .cd-derived {
    grid-column: 2 / -1;
    margin-top: -2px;
}
.cd-label {
    font-size: 0.82rem;
    color: #888;
    text-align: right;
    white-space: nowrap;
}
.cd-input {
    width: 100%;
    min-width: 0;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #e0e0e0;
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.9rem;
    padding: 8px 10px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.cd-input:focus { border-color: #ff6600; }
.cd-input::placeholder { color: #444; font-size: 0.78rem; }
.cd-unit {
    width: 48px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #888;
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.78rem;
    padding: 8px 4px;
    outline: none;
    cursor: pointer;
    text-align: center;
    /* hide default arrow to save space */
    -webkit-appearance: none;
    appearance: none;
}
.cd-unit-fixed {
    color: #555;
    font-size: 0.78rem;
    text-align: center;
    width: 28px;
}
.cd-derived {
    color: #4caf50;
    font-size: 0.74rem;
    min-width: 0;
}
.cd-error {
    color: #f44336;
    font-size: 0.82rem;
    margin: 8px 0 4px;
    min-height: 1.2em;
}
.cd-submit-btn {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    background: #ff6600;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    font-family: 'Segoe UI', sans-serif;
    transition: background 0.15s;
}
.cd-submit-btn:hover { background: #e05500; }
.cd-missing-note {
    color: #666;
    font-size: 0.76rem;
    text-align: left;
    margin-top: 14px;
    line-height: 1.7;
}

/* ── Custom driver: toggle fields ─────────────────────── */
.cd-field { margin-bottom: 6px; }
.cd-toggle-field {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 10px 12px 8px;
    margin-bottom: 8px;
}
.cd-toggle-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.cd-toggle-tab {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #555;
    cursor: pointer;
    padding: 3px 9px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    user-select: none;
    -webkit-user-select: none;
}
.cd-toggle-tab.active {
    color: #ff6600;
    background: rgba(255,102,0,0.12);
}
.cd-toggle-tab:hover:not(.active) { color: #999; }
.cd-toggle-arrow { color: #333; font-size: 0.9rem; }
.cd-derived-row {
    font-size: 0.74rem;
    color: #555;
    margin-top: 3px;
    padding-left: 2px;
    min-height: 1.1em;
    line-height: 1.4;
}

/* ── Focus info texts ─────────────────────────────────── */
.cd-focus-text {
    display: none;
    font-size: 0.74rem;
    color: #aaa;
    margin-top: 6px;
    padding: 5px 9px;
    background: rgba(255,102,0,0.06);
    border-left: 2px solid #ff6600;
    border-radius: 0 4px 4px 0;
    line-height: 1.4;
}

/* ── Wiring / option buttons ──────────────────────────── */
.cd-row-wiring {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.cd-row-wiring .cd-label { min-width: 48px; flex-shrink: 0; }
.cd-btn-group { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.cd-opt-btn {
    background: #111;
    border: 1px solid #2a2a2a;
    color: #666;
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 5px 11px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}
.cd-opt-btn.active {
    background: rgba(255,102,0,0.14);
    border-color: #ff6600;
    color: #ff6600;
}
.cd-opt-btn:hover:not(.active) { border-color: #444; color: #aaa; }

/* ── Auto-calculated (read-only) inputs ───────────────── */
.cd-auto {
    color: #888 !important;
    font-style: italic;
    background: #0d0d0d !important;
}
.cd-req-star {
    color: #ff6600;
    font-size: 0.6rem;
    vertical-align: super;
}

/* ── FEEDBACK MODAL ────────────────────────── */

.feedback-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.feedback-modal {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 1.5rem;
    width: min(90vw, 420px);
    position: relative;
}

.feedback-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
}

.feedback-modal h3 {
    margin: 0 0 1rem 0;
    color: #ff6600;
}

.feedback-type-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.feedback-type-btn {
    flex: 1;
    min-width: 70px;
    padding: 0.4rem 0.5rem;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    color: #ccc;
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
}

.feedback-type-btn.active {
    border-color: #ff6600;
    color: #ff6600;
    background: #2a1a00;
}

#feedback-message {
    width: 100%;
    background: #111;
    border: 1px solid #444;
    border-radius: 6px;
    color: #e0e0e0;
    padding: 0.75rem;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    box-sizing: border-box;
}

#feedback-message:focus {
    outline: none;
    border-color: #ff6600;
}

.feedback-context {
    margin: 0.75rem 0;
    font-size: 0.75rem;
    color: #666;
    font-family: monospace;
    line-height: 1.4;
}

.feedback-submit-btn {
    width: 100%;
    padding: 0.7rem;
    background: #ff6600;
    color: #000;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
}

.feedback-submit-btn:hover { background: #ff7722; }

.feedback-submit-btn:disabled {
    background: #555;
    cursor: not-allowed;
}

.feedback-status {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    min-height: 1.2em;
}