/* ============================================================
   Chromatic Tuner — Tool Styles
   ============================================================ */

/* ── Tuner Frame (in-tune glow wrapper) ── */
.tuner-frame {
    position: relative;
    padding: var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.tuner-frame--intune {
    border-color: #00e676;
    box-shadow: 0 0 20px rgba(0, 230, 118, 0.3), 0 0 40px rgba(0, 230, 118, 0.1), inset 0 0 20px rgba(0, 230, 118, 0.05);
    animation: inTuneGlow 1.5s ease-in-out infinite;
}

.tuner-frame--close {
    border-color: var(--color-warning);
    box-shadow: 0 0 12px rgba(255, 179, 0, 0.2);
}

.tuner-frame--off {
    border-color: var(--color-error);
    box-shadow: 0 0 8px rgba(255, 23, 68, 0.15);
}

@keyframes inTuneGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 230, 118, 0.3), 0 0 40px rgba(0, 230, 118, 0.1), inset 0 0 20px rgba(0, 230, 118, 0.05);
    }
    50% {
        box-shadow: 0 0 30px rgba(0, 230, 118, 0.5), 0 0 60px rgba(0, 230, 118, 0.15), inset 0 0 30px rgba(0, 230, 118, 0.08);
    }
}

/* ── SVG Needle Gauge ── */
.gauge-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-xs);
}

.gauge-svg {
    width: 100%;
    max-width: 400px;
    height: auto;
}

.gauge-needle {
    transform-origin: 200px 200px;
    transition: transform 0.15s ease-out;
    filter: drop-shadow(0 0 4px rgba(0, 255, 65, 0.6));
}

.gauge-needle--intune {
    stroke: #00e676;
    filter: drop-shadow(0 0 8px rgba(0, 230, 118, 0.8));
}

.gauge-needle--close {
    stroke: var(--color-warning);
    filter: drop-shadow(0 0 6px rgba(255, 179, 0, 0.6));
}

.gauge-needle--off {
    stroke: var(--color-error);
    filter: drop-shadow(0 0 6px rgba(255, 23, 68, 0.6));
}

.gauge-pivot {
    filter: drop-shadow(0 0 6px rgba(0, 255, 65, 0.5));
}

.gauge-ticks line {
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 1;
}

.gauge-ticks line.tick-major {
    stroke: rgba(0, 255, 65, 0.4);
    stroke-width: 1.5;
}

.gauge-ticks line.tick-center {
    stroke: rgba(0, 230, 118, 0.8);
    stroke-width: 2;
}

/* ── Note Display ── */
.note-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) 0 0;
    position: relative;
}

.note-display__note {
    font-family: var(--font-display);
    font-size: clamp(4rem, 10vw, 6rem);
    color: var(--color-primary);
    text-shadow: 0 0 24px rgba(0, 255, 65, 0.5);
    line-height: 1;
    letter-spacing: 0.05em;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.note-display__note--intune {
    color: #00e676;
    text-shadow: 0 0 30px rgba(0, 230, 118, 0.6), 0 0 60px rgba(0, 230, 118, 0.2);
    animation: inTunePulse 1.5s ease-in-out infinite;
}

.note-display__note--close {
    color: var(--color-warning);
    text-shadow: 0 0 20px rgba(255, 179, 0, 0.5);
}

.note-display__note--off {
    color: var(--color-error);
    text-shadow: 0 0 20px rgba(255, 23, 68, 0.5);
}

@keyframes inTunePulse {
    0%, 100% {
        text-shadow: 0 0 30px rgba(0, 230, 118, 0.6), 0 0 60px rgba(0, 230, 118, 0.2);
    }
    50% {
        text-shadow: 0 0 40px rgba(0, 230, 118, 0.8), 0 0 80px rgba(0, 230, 118, 0.3);
    }
}

.note-display__octave {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    color: var(--color-secondary);
    text-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
    line-height: 1;
}

.note-display__hz {
    text-align: center;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

/* ── Cents Display ── */
.cents-display {
    text-align: center;
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2rem);
    color: var(--color-primary);
    margin-bottom: var(--space-xs);
    letter-spacing: 0.05em;
}

.cents-display--intune {
    color: #00e676;
}

.cents-display--close {
    color: var(--color-warning);
}

.cents-display--off {
    color: var(--color-error);
}

/* ── Tune Badge ── */
.tune-badge {
    display: block;
    text-align: center;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 4px 16px;
    border-radius: var(--radius-full);
    margin: 0 auto;
    width: fit-content;
    transition: all 0.2s ease;
}

.tune-badge--intune {
    color: #00e676;
    background: rgba(0, 230, 118, 0.12);
    border: 1px solid rgba(0, 230, 118, 0.4);
    animation: badgePulse 1.5s ease-in-out infinite;
}

.tune-badge--close {
    color: var(--color-warning);
    background: rgba(255, 179, 0, 0.1);
    border: 1px solid rgba(255, 179, 0, 0.3);
}

.tune-badge--sharp {
    color: var(--color-warning);
    background: rgba(255, 179, 0, 0.1);
    border: 1px solid rgba(255, 179, 0, 0.3);
}

.tune-badge--flat {
    color: var(--color-error);
    background: rgba(255, 23, 68, 0.1);
    border: 1px solid rgba(255, 23, 68, 0.3);
}

.tune-badge--idle {
    color: var(--color-text-muted);
    background: rgba(128, 128, 128, 0.1);
    border: 1px solid var(--color-border);
}

@keyframes badgePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ── String Selector Buttons ── */
.string-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
    min-height: 40px;
}

.string-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 36px;
    padding: 0 12px;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.string-btn:hover {
    border-color: var(--color-primary);
    background: rgba(0, 255, 65, 0.05);
}

.string-btn--active {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: rgba(0, 255, 65, 0.1);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

.string-btn--intune {
    color: #00e676;
    border-color: #00e676;
    background: rgba(0, 230, 118, 0.15);
    box-shadow: 0 0 14px rgba(0, 230, 118, 0.4);
    animation: stringGlow 1.5s ease-in-out infinite;
}

.string-btn--close {
    color: var(--color-warning);
    border-color: var(--color-warning);
    background: rgba(255, 179, 0, 0.1);
    box-shadow: 0 0 8px rgba(255, 179, 0, 0.3);
}

@keyframes stringGlow {
    0%, 100% { box-shadow: 0 0 14px rgba(0, 230, 118, 0.4); }
    50% { box-shadow: 0 0 20px rgba(0, 230, 118, 0.6); }
}

.string-btn__label {
    font-size: var(--fs-xs);
    color: var(--color-text-muted);
    margin-left: 4px;
}

/* ── A4 Calibration ── */
.a4-calibration {
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.a4-value {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--color-secondary);
    min-width: 70px;
    text-align: right;
    white-space: nowrap;
}

/* ── Strobe Mode ── */
.strobe-wrap {
    margin-top: var(--space-sm);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    height: 120px;
}

.strobe-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.strobe-label {
    position: absolute;
    bottom: 4px;
    right: 8px;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--color-text-muted);
    opacity: 0.6;
}

/* ── Hold / Freeze Badge ── */
.hold-badge {
    display: none;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--color-secondary);
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid var(--color-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    animation: holdPulse 1.5s ease-in-out infinite;
}

.hold-badge.active {
    display: inline-flex;
}

@keyframes holdPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ── Drop Zone ── */
.drop-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    padding: var(--space-md);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    text-align: center;
}

.drop-zone:hover,
.drop-zone--dragover {
    border-color: var(--color-primary);
    background: rgba(0, 255, 65, 0.03);
}

.drop-zone__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--color-text-muted);
}

.drop-zone__icon {
    font-size: 1.5rem;
}

.drop-zone__hint {
    font-size: 0.65rem;
    opacity: 0.6;
}

/* ── Session Stats ── */
.session-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
    margin-top: var(--space-xs);
}

.stat-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    text-align: center;
}

.stat-box__label {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.stat-box__value {
    font-family: var(--font-display);
    font-size: var(--fs-md);
    color: var(--color-primary);
}

/* ── History Table ── */
.history-wrap {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-top: var(--space-sm);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
}

.history-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.history-table th {
    background: var(--color-surface);
    color: var(--color-secondary);
    padding: 6px var(--space-sm);
    text-align: left;
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--color-border);
}

.history-table td {
    padding: 4px var(--space-sm);
    border-bottom: 1px solid rgba(15, 61, 30, 0.2);
    color: var(--color-text);
}

/* ── Export Actions ── */
.export-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.btn--sm {
    padding: 6px 12px;
    font-size: var(--fs-xs);
}

/* ── Privacy Callout ── */
.privacy-callout {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    background: rgba(0, 229, 255, 0.04);
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-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;
    flex-shrink: 0;
}

.browser-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-left: auto;
}

.browser-badge {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--color-secondary);
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: var(--radius-sm);
    padding: 1px 6px;
}

/* ── Keyboard Hints ── */
.kbd-hints {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--color-text-muted);
}

.kbd-hint {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.kbd-hint kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 18px;
    padding: 0 4px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--color-primary);
    background: var(--color-bg);
    border: 1px solid rgba(0, 255, 65, 0.3);
    border-radius: 3px;
    box-shadow: 0 1px 0 rgba(0, 255, 65, 0.2);
}

/* ── Shared form elements ── */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0, 255, 65, 0.5);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0, 255, 65, 0.5);
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .session-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .note-display__note {
        font-size: 3.5rem;
    }
}

@media (max-width: 600px) {
    .tuner-frame {
        padding: var(--space-sm);
    }

    .gauge-svg {
        max-width: 300px;
    }

    .string-buttons {
        gap: 4px;
    }

    .string-btn {
        min-width: 40px;
        height: 32px;
        padding: 0 8px;
        font-size: var(--fs-xs);
    }

    .cents-display {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .session-stats {
        grid-template-columns: 1fr 1fr;
    }

    .export-actions {
        flex-direction: column;
    }

    .strobe-wrap {
        height: 80px;
    }
}
