/* ============================================================
   Overtone Singing Frequency Analyzer — Tool Styles
   ============================================================ */

/* ── Dual Frequency Display ── */
.dual-display {
    display: flex;
    gap: 0;
    margin-bottom: var(--space-sm);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.dual-display__half {
    flex: 1;
    text-align: center;
    padding: var(--space-md) var(--space-sm);
}

.dual-display__half--drone {
    border-right: 1px solid var(--color-border);
}

.dual-display__divider {
    display: none;
}

.dual-display__label {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.dual-display__hz {
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 3.2rem);
    line-height: 1;
    letter-spacing: 0.03em;
    transition: color 0.15s ease, text-shadow 0.15s ease;
}

.dual-display__half--drone .dual-display__hz {
    color: #ffb300;
    text-shadow: 0 0 20px rgba(255, 179, 0, 0.4);
}

.dual-display__half--drone .dual-display__hz--active {
    text-shadow: 0 0 36px rgba(255, 179, 0, 0.7), 0 0 72px rgba(255, 179, 0, 0.2);
}

.dual-display__half--overtone .dual-display__hz {
    color: #00e5ff;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
}

.dual-display__half--overtone .dual-display__hz--active {
    text-shadow: 0 0 36px rgba(0, 229, 255, 0.7), 0 0 72px rgba(0, 229, 255, 0.2);
}

.dual-display__note {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--color-secondary);
    margin-top: 4px;
    letter-spacing: 0.08em;
}

.dual-display__harmonic {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: #00e5ff;
    margin-top: 2px;
    font-weight: 700;
}

/* ── Harmonic Ratio Display ── */
.ratio-display {
    text-align: center;
    padding: var(--space-sm);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.ratio-display__label {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.ratio-display__value {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    color: var(--color-primary);
    text-shadow: 0 0 16px rgba(0, 255, 65, 0.4);
    letter-spacing: 0.05em;
}

/* ── Harmonic Isolation Meter ── */
.isolation-meter {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.isolation-meter__title {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.isolation-meter__row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.isolation-meter__track {
    flex: 1;
    height: 12px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.isolation-meter__fill {
    height: 100%;
    width: 0%;
    border-radius: var(--radius-full);
    transition: width 0.15s ease, background 0.15s ease;
    background: linear-gradient(90deg, #ff1744 0%, #ffb300 40%, #00e676 70%, #00e5ff 100%);
}

.isolation-meter__pct {
    font-family: var(--font-mono);
    font-size: var(--fs-md);
    color: var(--color-primary);
    font-weight: 700;
    min-width: 60px;
    text-align: right;
}

.isolation-meter__hint {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--color-text-muted);
    margin-top: 4px;
    font-style: italic;
}

/* ── Technique Feedback Card ── */
.technique-card {
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.technique-card--active {
    border-color: #00e5ff;
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.15);
}

.technique-card__name {
    font-family: var(--font-mono);
    font-size: var(--fs-md);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.technique-card__feedback {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--color-primary);
    margin-bottom: 4px;
    line-height: 1.5;
}

.technique-card__harmonics {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--color-text-muted);
}

/* ── Reference Examples ── */
.reference-examples {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: var(--space-sm);
}

.reference-card {
    padding: var(--space-sm);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s ease;
}

.reference-card:hover {
    border-color: rgba(0, 229, 255, 0.3);
}

.reference-card__name {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.reference-card__desc {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--color-text-muted);
    line-height: 1.4;
    margin-bottom: 4px;
}

.reference-card__pattern {
    font-family: var(--font-mono);
    font-size: 10px;
    color: #00e5ff;
    font-weight: 600;
}

/* ── Harmonic Bar Chart ── */
.harmonic-chart {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: var(--space-sm);
}

.harmonic-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    transition: background 0.1s ease;
    position: relative;
}

.harmonic-bar-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.harmonic-bar__label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--color-text-muted);
    min-width: 24px;
    text-align: right;
    font-weight: 700;
}

.harmonic-bar__label--fund {
    color: #ffb300;
}

.harmonic-bar__label--dominant {
    color: #00e5ff;
}

.harmonic-bar__track {
    flex: 1;
    height: 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.harmonic-bar__fill {
    height: 100%;
    width: 0%;
    border-radius: var(--radius-sm);
    transition: width 0.12s ease;
    min-width: 0;
}

/* Fundamental (H1) — amber/gold */
.harmonic-bar__fill--fund {
    background: linear-gradient(90deg, #ff8f00, #ffb300);
}

/* Dominant overtone — cyan */
.harmonic-bar__fill--dominant {
    background: linear-gradient(90deg, #00b8d4, #00e5ff);
}

/* Other harmonics — muted grey-green */
.harmonic-bar__fill--other {
    background: linear-gradient(90deg, #37474f, #546e7a);
}

.harmonic-bar__db {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--color-text-muted);
    min-width: 48px;
    text-align: right;
    transition: color 0.15s;
}

.harmonic-bar__hz {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--color-text-muted);
    min-width: 52px;
    text-align: right;
}

.harmonic-bar-row:hover .harmonic-bar__db {
    color: var(--color-text);
}

/* Chart legend */
.harmonic-chart__legend {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-bottom: var(--space-sm);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--color-text-muted);
}

.legend-swatch {
    display: inline-block;
    width: 12px;
    height: 8px;
    border-radius: 2px;
}

.legend-swatch--fund     { background: linear-gradient(90deg, #ff8f00, #ffb300); }
.legend-swatch--overtone { background: linear-gradient(90deg, #00b8d4, #00e5ff); }
.legend-swatch--other    { background: linear-gradient(90deg, #37474f, #546e7a); }

/* ── Spectrogram Canvas ── */
.spectrogram-wrap {
    position: relative;
    background: #000;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 4px;
}

#spectrogram-canvas {
    display: block;
    width: 100%;
    height: 200px;
}

.spectrogram-labels {
    display: flex;
    justify-content: space-between;
    padding: 0 4px;
    margin-bottom: var(--space-sm);
}

.spectrogram-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--color-text-muted);
}

/* ── Privacy Callout (shared pattern) ── */
.privacy-callout {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(0, 255, 65, 0.04);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--color-text-muted);
}

.privacy-callout__icon { font-size: 1rem; }

.browser-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-left: auto;
}

.browser-badge {
    padding: 2px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: 10px;
    color: var(--color-text-muted);
}

/* ── Keyboard hints row ── */
.kbd-hints {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.kbd-hint {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.kbd-hint kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--color-text);
}

/* ── Session Stats ── */
.dom-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: var(--space-sm);
}

/* ── Export Actions ── */
.export-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Freeze Badge ── */
.freeze-badge {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--color-warning, #ffaa00);
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid rgba(255, 170, 0, 0.3);
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    animation: pulse-badge 1s ease infinite alternate;
}

@keyframes pulse-badge {
    from { opacity: 0.7; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .freeze-badge { animation: none; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
    /* design-system.css already collapses .tool-grid to a single column at <=991px;
       tool.css loads after it so the local rule wins on source order — no !important needed */
    .reference-examples { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .dual-display { flex-direction: column; }
    .dual-display__half--drone { border-right: none; border-bottom: 1px solid var(--color-border); }
    .dual-display__hz { font-size: clamp(1.6rem, 8vw, 2.4rem); }
    .dom-stats { grid-template-columns: repeat(2, 1fr); }
    #spectrogram-canvas { height: 140px; }
    .harmonic-bar__hz { display: none; }
    .harmonic-chart__legend { gap: var(--space-sm); }
    .ratio-display__value { font-size: clamp(1.2rem, 6vw, 1.8rem); }
}

/* ── Scrollbar ── */
.spectrogram-wrap::-webkit-scrollbar { width: 4px; }
.spectrogram-wrap::-webkit-scrollbar-track { background: transparent; }
.spectrogram-wrap::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }
