/* ==========================================================================
   Hard Kick Synthesizer - Cyber-Industrial Dark Theme
   ========================================================================== */

/* Self-contained build: no external font CDNs; system font stacks only. */

:root {
    --bg-dark: #07080c;
    --bg-panel: #0f111a;
    --bg-panel-header: #161926;
    --bg-input: #1b1e2e;
    --border-color: rgba(0, 240, 255, 0.15);
    --border-glow: rgba(0, 240, 255, 0.4);
    
    --neon-cyan: #00f0ff;
    --neon-crimson: #ff0055;
    --neon-amber: #ffb700;
    --neon-lime: #00ff66;
    --neon-purple: #9d00ff;

    --text-main: #e8ecf8;
    --text-muted: #8c96b0;

    --font-heading: 'Avenir Next Condensed', 'Arial Narrow', 'Segoe UI', system-ui, sans-serif;
    --font-body: system-ui, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(0, 240, 255, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 85% 90%, rgba(255, 0, 85, 0.05) 0%, transparent 50%);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.4;
    min-height: 100vh;
    padding-bottom: 40px;
}

.app-status {
    position: fixed;
    top: 76px;
    left: 50%;
    z-index: 1200;
    max-width: min(90vw, 520px);
    padding: 9px 14px;
    border: 1px solid rgba(0, 255, 102, 0.5);
    border-radius: var(--radius-md);
    background: rgba(7, 8, 12, 0.94);
    color: var(--neon-lime);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.42);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -8px);
    transition: opacity 140ms ease, transform 140ms ease;
}

.app-status.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.app-status[data-tone="warning"] {
    border-color: rgba(255, 183, 0, 0.55);
    color: var(--neon-amber);
}

.control-hint {
    margin-top: 7px;
    font-size: 12px;
    line-height: 1.3;
}

.control-hint-warning {
    color: var(--neon-amber);
}

.control-group.is-dsp-unavailable input[type="range"] {
    cursor: not-allowed;
    opacity: 0.45;
}

/* ==========================================================================
   Header & Top Navigation
   ========================================================================== */

header {
    background: rgba(15, 17, 26, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 28px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-crimson));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #ffffff, var(--neon-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-sub {
    font-size: 11px;
    color: var(--neon-amber);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Header Action Controls */
.top-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Button Base */
.btn {
    background: var(--bg-panel-header);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
}

.btn:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #00f0ff, #0080ff);
    color: #000;
    border: none;
    font-weight: 900;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #33f3ff, #1a8cff);
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.8);
}

.btn-danger {
    background: rgba(255, 0, 85, 0.15);
    border-color: rgba(255, 0, 85, 0.4);
    color: var(--neon-crimson);
}

.btn-danger:hover {
    background: rgba(255, 0, 85, 0.3);
    border-color: var(--neon-crimson);
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.5);
}

.btn.active {
    background: var(--neon-amber);
    color: #000;
    border-color: var(--neon-amber);
    box-shadow: 0 0 15px rgba(255, 183, 0, 0.6);
}

/* Select Control */
.preset-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--neon-cyan);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 700;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    outline: none;
    cursor: pointer;
}

.preset-select:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

/* BPM Input */
.bpm-input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.bpm-input-wrapper label {
    font-family: var(--font-heading);
    font-size: 10px;
    color: var(--text-muted);
}

.bpm-input-wrapper input {
    background: transparent;
    border: none;
    color: var(--neon-cyan);
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    width: 48px;
    text-align: center;
    outline: none;
}

/* ==========================================================================
   Main Container Layout
   ========================================================================== */

main {
    max-width: 1400px;
    margin: 24px auto;
    padding: 0 20px;
}

/* Visualizer Dashboard */
.visualizer-section {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.visualizer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 180px;
    gap: 16px;
    align-items: center;
}

@media (max-width: 992px) {
    .visualizer-grid {
        grid-template-columns: 1fr;
    }
}

.vis-card {
    background: #07080d;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    padding: 10px;
    position: relative;
}

.vis-title {
    font-family: var(--font-heading);
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
}

canvas {
    width: 100%;
    height: 120px;
    display: block;
    border-radius: 2px;
}

/* Level VU Meter */
.meter-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.meter-wrapper {
    height: 24px;
    background: #141724;
    border: 1px solid #23283b;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    margin-top: 10px;
}

.meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ff66 0%, #ffb700 70%, #ff0055 100%);
    transition: width 0.05s linear;
}

.clip-led-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.clip-led {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #330011;
    border: 1px solid #660022;
    transition: all 0.1s ease;
}

.clip-led.active {
    background: var(--neon-crimson);
    box-shadow: 0 0 12px var(--neon-crimson);
}

/* ==========================================================================
   Signal Chain Synth Grid
   ========================================================================== */

.synth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 20px;
}

/* Modular Synth Panel Card */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: border-color 0.3s ease;
}

.panel:hover {
    border-color: var(--border-glow);
}

.panel-header {
    background: var(--bg-panel-header);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;

    background: linear-gradient(90deg, #ffffff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.panel-tag {
    font-size: 10px;
    font-family: var(--font-heading);
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(0, 240, 255, 0.1);
    color: var(--neon-cyan);
    border: 1px solid rgba(0, 240, 255, 0.3);
}

.panel-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Control Group / Row */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.control-label-row label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.param-label-cluster {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 1 1 auto;
    min-width: 0;
}

.param-label-cluster > label {
    min-width: 0;
}

.control-val {
    flex: 0 0 auto;
    font-family: var(--font-heading);
    font-size: 12px;
    color: var(--neon-cyan);
    font-weight: 700;
}

.param-lock {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(140, 150, 176, 0.28);
    border-radius: 4px;
    background: rgba(27, 30, 46, 0.72);
    color: #78839d;
    cursor: pointer;
    transition:
        color 0.15s ease,
        border-color 0.15s ease,
        background-color 0.15s ease,
        box-shadow 0.15s ease;
}

.param-lock svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.param-lock:hover {
    color: var(--text-main);
    border-color: rgba(0, 240, 255, 0.58);
}

.param-lock:focus-visible {
    outline: 2px solid var(--neon-cyan);
    outline-offset: 1px;
}

.param-lock.active {
    color: var(--neon-amber);
    border-color: rgba(255, 183, 0, 0.7);
    background: rgba(255, 183, 0, 0.12);
    box-shadow: inset 0 0 8px rgba(255, 183, 0, 0.12);
}

.is-random-locked .control-label-row > .param-label-cluster > label,
.toggle-row.is-random-locked .toggle-caption {
    color: #c9a94f;
}

/* Sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    outline: none;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--neon-cyan);
    cursor: pointer;
    box-shadow: 0 0 10px var(--neon-cyan);
    transition: transform 0.1s ease, background-color 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #ffffff;
}

/* Select inputs inside panel */
.select-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    outline: none;
    width: 100%;
}

.select-input:focus {
    border-color: var(--neon-cyan);
}

/* Checkbox Toggle Switch */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    padding: 4px 0;
}

.toggle-caption {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
    flex: 0 0 42px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    transition: .3s;
    border-radius: 22px;
}

.slider-toggle:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider-toggle {
    background-color: rgba(0, 240, 255, 0.2);
    border-color: var(--neon-cyan);
}

input:checked + .slider-toggle:before {
    transform: translateX(20px);
    background-color: var(--neon-cyan);
    box-shadow: 0 0 8px var(--neon-cyan);
}

/* Sub-section Dividers */
.sub-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 8px 0;
}

.sub-title {
    font-family: var(--font-heading);
    font-size: 11px;
    color: var(--neon-amber);
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

/* Musical variation / character controls */
.panel-accent {
    border-color: rgba(255, 183, 0, 0.38);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 0 28px rgba(255, 183, 0, 0.025);
}

.panel-accent:hover {
    border-color: rgba(255, 183, 0, 0.72);
}

.panel-tag-amber {
    color: var(--neon-amber);
    background: rgba(255, 183, 0, 0.1);
    border-color: rgba(255, 183, 0, 0.35);
}

.panel-note {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
    padding: 10px 12px;
    background: rgba(255, 183, 0, 0.055);
    border-left: 2px solid var(--neon-amber);
    border-radius: 2px;
}

.variation-range::-webkit-slider-thumb {
    background: var(--neon-amber);
    box-shadow: 0 0 10px var(--neon-amber);
}

.range-legends {
    display: flex;
    justify-content: space-between;
    color: #69738c;
    font-family: var(--font-heading);
    font-size: 8px;
    letter-spacing: 0.7px;
    margin-top: 3px;
}

.seed-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.number-input {
    min-width: 0;
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--neon-amber);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    outline: none;
}

.number-input:focus {
    border-color: var(--neon-amber);
    box-shadow: 0 0 10px rgba(255, 183, 0, 0.2);
}

.btn-compact {
    padding: 8px 11px;
    font-size: 10px;
    color: var(--neon-amber);
    white-space: nowrap;
}

.btn-compact.random-action-locked {
    color: var(--neon-amber);
    border-color: rgba(255, 183, 0, 0.45);
    background: rgba(255, 183, 0, 0.08);
}

.variation-targets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.variation-targets span {
    padding: 4px 7px;
    border: 1px solid rgba(0, 240, 255, 0.18);
    border-radius: 999px;
    background: rgba(0, 240, 255, 0.055);
    color: #a8b3ca;
    font-size: 10px;
    letter-spacing: 0.35px;
    text-transform: uppercase;
}

@media (max-width: 420px) {
    header {
        padding: 12px 10px;
    }

    .header-container,
    .top-controls {
        min-width: 0;
    }

    .top-controls {
        width: 100%;
        gap: 8px;
    }

    .top-controls > * {
        max-width: 100%;
    }

    .preset-select {
        width: 100%;
        min-width: 0;
    }

    .top-controls .btn {
        padding: 9px 12px;
    }

    main {
        padding: 0 10px;
    }

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

    .panel-body {
        padding: 14px 12px;
    }
}

/* ==========================================================================
   Export Modal Dialog
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: var(--bg-panel);
    border: 1px solid var(--neon-cyan);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    padding: 24px;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 16px;
    color: var(--neon-cyan);
    text-transform: uppercase;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.export-option-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.export-desc {
    font-size: 13px;
    color: var(--text-muted);
}

.export-title {
    font-family: var(--font-heading);
    font-size: 14px;
    color: #fff;
    font-weight: 700;
}
