/* ============================================================
   warehouse/tuner.css - ОНЛАЙН-ТЮНЕР
   Версия: 3.1 - ИСПРАВЛЕН "Резкий маятник" (Удалён transition: left)
   ============================================================ */

/* ============================================================
   ПЕРЕМЕННЫЕ
   ============================================================ */
:root {
    --bg-deep: #0d0b09;
    --bg-card: #14110e;
    --bg-surface: #161310;
    --text-primary: #ede4d8;
    --text-secondary: #d4c8b8;
    --text-muted: #b8aa9a;
    --text-dim: #8a7a6a;
    --accent-gold: #d4a853;
    --accent-gold-light: #e8c878;
    --border-subtle: #2a241e;
    --border-glow: rgba(212,168,83,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,.2);
    --shadow-md: 0 4px 24px rgba(0,0,0,.3);
    --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
    --shadow-gold: 0 4px 20px rgba(212,168,83,.35);
    --transition-fast: .15s ease;
    --transition-smooth: .3s cubic-bezier(.34,1.56,.64,1);
    --gradient-gold: linear-gradient(145deg,#d4a853,#e8c878);
    --font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --z-sticky: 100;
    --z-modal: 1000;
    --z-toast: 9999;
    --container-max: 1200px;
    --font-size-base: 16px;
    --spacing-base: 1rem;
}

/* ============================================================
   КОНТЕЙНЕР
   ============================================================ */
.tuner-wrapper {
    max-width: 540px;
    margin: 0 auto;
    padding: 12px 16px 24px;
    background-color: var(--bg-deep);
    color: var(--text-primary);
    min-height: 85vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.tuner-header {
    text-align: center;
    margin-bottom: 12px;
}

.tuner-header h1 {
    font-size: 1.6rem;
    font-weight: 300;
    letter-spacing: 3px;
    color: var(--accent-gold);
    margin-bottom: 2px;
}

.tuner-header p {
    color: var(--text-muted);
    font-size: .85rem;
    opacity: .7;
}

/* ============================================================
   ДИСПЛЕЙ
   ============================================================ */
.tuner-display {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    margin-bottom: 16px;
}

/* ============================================================
   ИНСТРУМЕНТ-БАДЖ
   ============================================================ */
.instrument-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
    background: rgba(212,168,83,0.1);
    border: 1px solid rgba(212,168,83,0.2);
    color: var(--accent-gold);
    transition: all 0.3s;
}

.instrument-badge.guitar { background: rgba(212,168,83,0.1); border-color: rgba(212,168,83,0.2); color: var(--accent-gold); }
.instrument-badge.classic { background: rgba(200,168,124,0.12); border-color: rgba(200,168,124,0.25); color: #c8a87c; }
.instrument-badge.ukulele { background: rgba(255,107,157,0.12); border-color: rgba(255,107,157,0.25); color: #ff6b9d; }
.instrument-badge.bass { background: rgba(79,195,247,0.12); border-color: rgba(79,195,247,0.25); color: #4fc3f7; }

/* ============================================================
   СТАТУС
   ============================================================ */
.status-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    transition: all .3s ease;
}

.status-badge.on { border-color: #00c864; color: #00c864; background: rgba(0,200,100,0.08); }
.status-badge.off { border-color: var(--border-subtle); color: var(--text-muted); }
.status-badge.flat { border-color: #ff6b6b; color: #ff6b6b; background: rgba(255,107,107,0.08); }
.status-badge.sharp { border-color: #ff6b6b; color: #ff6b6b; background: rgba(255,107,107,0.08); }
.status-badge.tuned { border-color: #00c864; color: #00c864; background: rgba(0,200,100,0.12); }
.status-badge.waiting { border-color: var(--accent-gold); color: var(--accent-gold); background: rgba(212,168,83,0.08); }
.status-badge.error { border-color: #ff6b6b; color: #ff6b6b; background: rgba(255,107,107,0.12); }

/* ============================================================
   НОТА
   ============================================================ */
.note-name {
    font-size: 4.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin: 8px 0 4px;
    transition: color .3s ease;
}

.note-name.on { color: #00c864; }
.note-name.off { color: var(--text-muted); }
.note-name.flat { color: #ff6b6b; }
.note-name.sharp { color: #ff6b6b; }

.note-name .cents {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 6px;
}

.frequency-display {
    font-size: 1rem;
    color: var(--text-muted);
    height: 26px;
}

/* ============================================================
   ГРОМКОСТЬ
   ============================================================ */
.volume-bar {
    width: 100%;
    height: 2px;
    background: var(--border-subtle);
    border-radius: 1px;
    margin: 4px 0 2px;
    overflow: hidden;
}

.volume-bar .fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-gold), #00c864);
    border-radius: 1px;
    transition: width 0.05s;
}

/* ============================================================
   ⭐ МЕТР — ИСПРАВЛЕН КОНФЛИКТ С JS
   ============================================================ */
.meter-container {
    width: 100%;
    height: 52px;
    position: relative;
    margin: 16px 0 8px;
    display: flex;
    align-items: center;
}

.meter-scale {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    position: relative;
    background: linear-gradient(90deg, #ff6b6b 0%, #ff6b6b 10%, #ffa500 25%, #ffd700 40%, #00c864 50%, #ffd700 60%, #ffa500 75%, #ff6b6b 90%, #ff6b6b 100%);
    opacity: .6;
}

.meter-scale::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -6px;
    width: 3px;
    height: 16px;
    background: var(--text-primary);
    transform: translateX(-50%);
    border-radius: 2px;
    z-index: 5;
}

.meter-pointer {
    position: absolute;
    top: -8px;
    left: 50%;
    width: 18px;
    height: 20px;
    background: var(--accent-gold);
    border-radius: 3px;
    transform: translateX(-50%);
    
    /* ✅ ИСПРАВЛЕНИЕ: Удалено 'left .1s ease-out' */
    /* Оставляем только анимацию цвета фона */
    transition: background-color .3s ease;
    
    box-shadow: 0 0 20px rgba(212,168,83,.3);
    z-index: 10;
    pointer-events: none;
    
    /* ✅ ДОПОЛНИТЕЛЬНОЕ УЛУЧШЕНИЕ:
       Подсказываем браузеру, что это свойство будет меняться,
       чтобы он оптимизировал рендеринг. */
    will-change: left;
}

.meter-pointer.tuned {
    background: #00c864;
    box-shadow: 0 0 24px rgba(0,200,100,.3);
}

.meter-pointer.flat,
.meter-pointer.sharp {
    background: #ff6b6b;
    box-shadow: 0 0 24px rgba(255,107,107,.3);
}

.meter-pointer.inactive {
    opacity: .3;
    box-shadow: none;
}

/* ============================================================
   СТРУНЫ
   ============================================================ */
.strings-container {
    display: grid;
    gap: 6px;
    margin: 12px 0 16px;
}

.strings-4 { grid-template-columns: repeat(4, 1fr); }
.strings-5 { grid-template-columns: repeat(5, 1fr); }
.strings-6 { grid-template-columns: repeat(6, 1fr); }

.string-btn {
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: 12px;
    padding: 10px 4px;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-muted);
    transition: all .25s ease;
    cursor: pointer;
    font-family: var(--font-family);
    user-select: none;
    touch-action: manipulation;
}

.string-btn:active { transform: scale(.95); }

.string-btn .octave {
    font-size: .6rem;
    font-weight: 400;
    color: var(--text-dim);
    margin-left: 1px;
}

.string-btn .string-number {
    display: block;
    font-size: .5rem;
    font-weight: 400;
    color: var(--text-dim);
    opacity: .5;
    margin-top: 2px;
}

.string-btn.active-string {
    border-color: var(--accent-gold);
    color: var(--text-primary);
    transform: scale(1.04);
    box-shadow: 0 0 20px rgba(212,168,83,.15);
    animation: stringPulse 1.5s ease-in-out infinite;
}

.string-btn.tuned-string {
    border-color: #00c864;
    background: rgba(0,200,100,.06);
    color: #00c864;
    box-shadow: 0 0 20px rgba(0,200,100,.1);
}

.string-btn.flat-string,
.string-btn.sharp-string {
    border-color: #ff6b6b;
    background: rgba(255,107,107,.06);
    color: #ff6b6b;
}

/* ============================================================
   КНОПКА МИКРОФОНА
   ============================================================ */
.mic-btn {
    width: 100%;
    background: var(--accent-gold);
    border: none;
    border-radius: 14px;
    padding: 18px;
    color: #1a1510;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(212,168,83,.25);
    transition: all .3s ease;
    font-family: var(--font-family);
    touch-action: manipulation;
}

.mic-btn:active { transform: scale(.97); }
.mic-btn.active {
    background: #ff6b6b;
    box-shadow: 0 4px 20px rgba(255,107,107,.25);
    color: #fff;
}
.mic-btn .icon { font-size: 1.3rem; }

/* ============================================================
   ВЫБОР ИНСТРУМЕНТА / СТРОЯ
   ============================================================ */
.selector-group {
    display: flex;
    gap: 4px;
    margin: 6px 0 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.selector-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 4px 10px;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
    white-space: nowrap;
    touch-action: manipulation;
}

.selector-btn:hover { border-color: var(--accent-gold); color: var(--text-primary); }
.selector-btn.active { 
    border-color: var(--accent-gold); 
    color: var(--accent-gold); 
    background: rgba(212,168,83,0.08);
}
.selector-btn.instrument-active {
    border-color: var(--accent-gold);
    background: rgba(212,168,83,0.08);
}

/* ============================================================
   ЧУВСТВИТЕЛЬНОСТЬ
   ============================================================ */
.sensitivity-row {
    display: flex;
    gap: 8px;
    margin: 6px 0 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.sensitivity-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 4px 12px;
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
    touch-action: manipulation;
}

.sensitivity-btn:hover {
    border-color: var(--accent-gold);
    color: var(--text-primary);
}
.sensitivity-btn .label {
    color: var(--accent-gold);
}

/* ============================================================
   ПОДСКАЗКА
   ============================================================ */
.tuner-tip {
    text-align: center;
    font-size: .75rem;
    color: var(--text-dim);
    margin-top: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: rgba(255,255,255,.02);
    line-height: 1.6;
}

.tuner-tip strong {
    color: var(--accent-gold);
}

.tuner-tip kbd {
    background: var(--border-subtle);
    padding: 1px 6px;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: .65rem;
    font-family: inherit;
}

/* ============================================================
   SEO
   ============================================================ */
.seo {
    margin-top: 14px;
    padding: 14px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.65rem;
    color: var(--text-dim);
    line-height: 1.8;
    text-align: center;
}

.seo a { color: var(--accent-gold); text-decoration: none; }
.seo a:hover { text-decoration: underline; }

/* ============================================================
   АНИМАЦИЯ ПУЛЬСАЦИИ
   ============================================================ */
@keyframes stringPulse {
    0% { box-shadow: 0 0 0 0 rgba(212,168,83,.4); }
    100% { box-shadow: 0 0 20px 10px rgba(212,168,83,0); }
}

/* ============================================================
   АДАПТИВ
   ============================================================ */
@media (max-width: 480px) {
    .tuner-wrapper { padding: 8px 10px 16px; }
    .tuner-header h1 { font-size: 1.3rem; }
    .note-name { font-size: 3.5rem; }
    .tuner-display { padding: 14px 10px; }
    .strings-container { gap: 4px; }
    .string-btn { font-size: .85rem; padding: 8px 2px; }
    .string-btn .octave { font-size: .5rem; }
    .mic-btn { padding: 14px; font-size: 1rem; }
    .meter-container { height: 40px; }
    .selector-btn { font-size: 0.55rem; padding: 3px 8px; }
    .string-btn .string-number { font-size: 0.35rem; }
}

@media (max-width: 380px) {
    .note-name { font-size: 2.8rem; }
    .note-name .cents { font-size: 1rem; }
    .string-btn { font-size: .75rem; padding: 6px 2px; }
    .string-btn .string-number { font-size: .4rem; }
    .strings-container { gap: 3px; }
    .tuner-tip { font-size: .65rem; }
    .selector-btn { font-size: 0.5rem; padding: 2px 6px; }
    .sensitivity-btn { font-size: 0.45rem; padding: 2px 6px; }
}

@media (min-width: 1024px) {
    .tuner-wrapper { max-width: 640px; padding: 24px 32px 40px; }
    .tuner-header h1 { font-size: 2rem; letter-spacing: 4px; }
    .tuner-header p { font-size: 0.95rem; }
    .tuner-display { padding: 28px 24px; border-radius: 20px; }
    .note-name { font-size: 5.5rem; }
    .note-name .cents { font-size: 1.4rem; }
    .meter-container { height: 60px; }
    .meter-pointer { width: 22px; height: 24px; }
    .strings-container { grid-template-columns: repeat(6, 1fr); gap: 10px; max-width: 500px; margin: 16px auto; }
    .string-btn { font-size: 1.2rem; padding: 14px 8px; border-radius: 14px; }
    .string-btn .octave { font-size: 0.7rem; }
    .string-btn .string-number { font-size: 0.6rem; }
    .mic-btn { padding: 22px; font-size: 1.2rem; border-radius: 16px; }
    .tuner-tip { font-size: 0.85rem; padding: 10px 16px; }
    .status-badge { font-size: 0.85rem; padding: 6px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .string-btn.active-string { animation: none !important; }
    .string-btn { transition: none !important; }
    .mic-btn { transition: none !important; }
    .meter-pointer { transition: none !important; }
}