/* Instrument tuner: large note readout + horizontal cents meter with a moving needle. */

.tuner-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

/* --- Controls row --- */

.tuner-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.tuner-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.tuner-toggle.is-active {
    background: var(--bad);
    border-color: var(--bad);
}

.tuner-ref {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.tuner-ref-label {
    font-size: 0.85rem;
    color: var(--muted);
}

.tuner-ref-input {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.tuner-ref-input .field {
    width: 6rem;
}

.tuner-unit {
    color: var(--muted);
    font-size: 0.9rem;
}

/* --- Readout --- */

.tuner-readout {
    text-align: center;
}

.tuner-note {
    font-size: clamp(3.5rem, 18vw, 7rem);
    font-weight: 800;
    line-height: 1;
    color: var(--text);
    transition: color 0.12s ease;
}

.tuner-note.is-in-tune {
    color: var(--good);
}

.tuner-freq {
    margin-top: 0.5rem;
    font-size: 1.1rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* --- Cents meter --- */

.tuner-meter {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tuner-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--muted);
}

.tuner-scale-mid {
    font-weight: 600;
    color: var(--text);
}

.tuner-track {
    position: relative;
    height: 56px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.tuner-center-line {
    position: absolute;
    top: 8%;
    bottom: 8%;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: var(--good);
    opacity: 0.55;
}

.tuner-needle {
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 50%;
    width: 4px;
    transform: translateX(-50%);
    border-radius: 4px;
    background: var(--accent);
    transition: left 0.08s linear, background 0.12s ease;
}

.tuner-needle.is-in-tune {
    background: var(--good);
    box-shadow: 0 0 8px var(--good);
}

/* --- Status --- */

.tuner-status {
    margin: 0;
    text-align: center;
    font-size: 0.95rem;
    color: var(--muted);
    min-height: 1.4em;
}

.tuner-status.is-error {
    color: var(--bad);
    font-weight: 600;
}

@media (max-width: 480px) {
    .tuner-panel {
        padding: 1rem;
    }

    .tuner-controls {
        justify-content: stretch;
    }

    .tuner-toggle {
        flex: 1 1 auto;
        justify-content: center;
    }
}
