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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #0f0f1a;
    color: #e0e0e8;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: #888;
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Cards */
.card {
    background: #1a1a2e;
    border: 1px solid #2a2a40;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.card h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #a0a0b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

/* File Upload */
.file-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem;
    border: 2px dashed #3a3a55;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.file-upload:hover {
    border-color: #6e8efb;
    background: rgba(110, 142, 251, 0.05);
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload-icon {
    font-size: 2.5rem;
    color: #6e8efb;
}

.file-upload-text {
    font-size: 1rem;
    font-weight: 500;
    color: #c0c0d0;
}

.file-upload-hint {
    font-size: 0.8rem;
    color: #666;
}

.file-name {
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #a777e3;
    font-weight: 500;
}

.weighting-selector {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.weighting-selector label {
    font-size: 0.85rem;
    color: #888;
}

.weighting-selector select {
    padding: 0.6rem 0.8rem;
    background: #12121f;
    border: 1px solid #2a2a40;
    border-radius: 8px;
    color: #e0e0e8;
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.weighting-selector select:focus {
    outline: none;
    border-color: #6e8efb;
    box-shadow: 0 0 0 3px rgba(110, 142, 251, 0.15);
}

/* Add Band Row */
.add-band-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.add-band-row .input-group {
    flex: 1;
}

.add-band-btn {
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.add-band-btn:hover {
    opacity: 0.85;
}

.add-band-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.card-desc {
    font-size: 0.82rem;
    color: #666;
    margin: -0.5rem 0 1rem;
}

/* Progress Bar */
.progress-bar {
    margin-top: 1rem;
    height: 28px;
    background: #12121f;
    border-radius: 14px;
    border: 1px solid #2a2a40;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6e8efb, #a777e3);
    border-radius: 14px;
    transition: width 0.15s ease-out;
}

.progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #e0e0e8;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Peak Band Result */
.peak-result {
    margin-top: 1rem;
    background: #12121f;
    border-radius: 10px;
    padding: 1rem;
}

.peak-band-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: #4ecca3;
    text-align: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #2a2a40;
}

/* Band Chips */
.band-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.band-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.6rem 0.35rem 0.75rem;
    background: #252540;
    border: 1px solid #3a3a55;
    border-radius: 20px;
    font-size: 0.82rem;
    color: #c0c0d0;
}

.band-chip button {
    background: none;
    border: none;
    color: #888;
    font-size: 1rem;
    cursor: pointer;
    padding: 0 0.15rem;
    line-height: 1;
    transition: color 0.15s;
}

.band-chip button:hover {
    color: #e85d75;
}

/* Frequency Inputs */
.freq-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.4rem;
}

.input-group input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: #12121f;
    border: 1px solid #2a2a40;
    border-radius: 8px;
    color: #e0e0e8;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: #6e8efb;
    box-shadow: 0 0 0 3px rgba(110, 142, 251, 0.15);
}

.input-group input::placeholder {
    color: #444;
}

/* Status */
.status {
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: #a0a0b8;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    display: none;
}

.status.visible {
    display: block;
}

.status.loading {
    color: #6e8efb;
}

.status.error {
    color: #e85d75;
    background: rgba(232, 93, 117, 0.08);
    border: 1px solid rgba(232, 93, 117, 0.2);
}

.status.success {
    color: #4ecca3;
}

/* Results */
.results-card h2 {
    color: #6e8efb;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.result-block {
    background: #12121f;
    border-radius: 10px;
    padding: 1rem;
}

.result-block h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #a777e3;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #2a2a40;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.35rem 0;
}

.result-label {
    font-size: 0.8rem;
    color: #777;
}

.result-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #e0e0e8;
    font-variant-numeric: tabular-nums;
}

/* Spectrum Analyzer */
.spectrum-card {
    overflow: hidden;
}

.canvas-wrap {
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
}

.canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 300px;
    border-radius: 8px;
}

.spectrum-controls {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.spectrum-controls .input-group {
    flex: 1;
    min-width: 100px;
}

.lock-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: #888;
    cursor: pointer;
    padding-bottom: 0.35rem;
    white-space: nowrap;
}

.lock-label input[type="checkbox"] {
    accent-color: #6e8efb;
    width: 16px;
    height: 16px;
}

.spectrum-readout {
    display: flex;
    gap: 1.5rem;
    align-items: baseline;
    margin-top: 0.75rem;
    padding: 0.6rem 0.8rem;
    background: #12121f;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #888;
    flex-wrap: wrap;
}

.readout-band {
    color: #c0c0d0;
    font-weight: 500;
}

.readout-stat strong {
    color: #e0e0e8;
    font-variant-numeric: tabular-nums;
}

/* Responsive */
@media (max-width: 500px) {
    .container {
        padding: 1.25rem 1rem 3rem;
    }

    h1 {
        font-size: 1.4rem;
    }

    .freq-inputs,
    .results-grid {
        grid-template-columns: 1fr;
    }
}
