
/* ── reset & base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: #0d1410;
    color: #e8f0e8;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(45, 125, 74, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(201, 168, 76, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 100%, rgba(45, 125, 74, 0.06) 0%, transparent 50%);
}

.card {
    max-width: 1100px; /* увеличено для широкой клавиатуры */
    width: 100%;
    background: rgba(18, 28, 22, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(201, 168, 76, 0.15);
    border-radius: 56px;
    padding: 48px 40px 56px;
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(201, 168, 76, 0.05);
}
@media (max-width: 700px) {
    .card { padding: 32px 20px 40px; border-radius: 32px; max-width: 100%; }
}

/* остальные стили без изменений */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.logo { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 20px; letter-spacing: -0.3px; color: #fff; }
.logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #2d7d4a, #c9a84c);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    box-shadow: 0 8px 24px -6px rgba(45, 125, 74, 0.4);
}
.badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(201, 168, 76, 0.2);
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.2px;
}
.badge span { color: #c9a84c; font-weight: 600; }

.nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 32px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(201, 168, 76, 0.1);
    border-radius: 999px;
    padding: 6px;
}
.nav a {
    flex: 1;
    text-align: center;
    padding: 10px 18px;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.nav a.active {
    color: #fff;
    background: linear-gradient(135deg, #2d7d4a, #c9a84c);
    box-shadow: 0 8px 20px -8px rgba(45, 125, 74, 0.5);
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(201, 168, 76, 0.5);
    margin: 32px 0 12px;
    text-align: center;
}

/* Piano */
.piano-wrapper {
    margin: 20px 0 24px;
    display: flex;
    justify-content: center;
    overflow-x: auto;
    padding: 8px 0 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(201, 168, 76, 0.2) transparent;
}
.piano-wrapper::-webkit-scrollbar { height: 4px; }
.piano-wrapper::-webkit-scrollbar-track { background: transparent; }
.piano-wrapper::-webkit-scrollbar-thumb { background: rgba(201, 168, 76, 0.2); border-radius: 10px; }

.piano { display: flex; gap: 4px; position: relative; padding: 0 4px; }

.key {
    width: 44px; height: 140px;
    border-radius: 8px 8px 4px 4px;
    background: linear-gradient(180deg, #f0f5f0 0%, #dce5dc 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 -2px 0 rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.12s ease;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 12px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.2);
    user-select: none;
}
.key:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
.key:active, .key.pressed {
    transform: translateY(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    background: linear-gradient(180deg, #dce5dc 0%, #c0cdc0 100%);
}
.key.black {
    width: 28px; height: 88px;
    background: linear-gradient(180deg, #1f2a1f 0%, #0d140d 100%);
    border: 1px solid rgba(0, 0, 0, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    margin-left: -16px; margin-right: -16px;
    z-index: 2;
    border-radius: 0 0 6px 6px;
    color: rgba(255, 255, 255, 0.15);
    padding-bottom: 8px;
    font-size: 10px;
}
.key.black:hover { transform: translateY(-2px); background: linear-gradient(180deg, #2a3a2a 0%, #141e14 100%); }
.key.black:active, .key.black.pressed {
    transform: translateY(4px);
    background: linear-gradient(180deg, #141e14 0%, #0a100a 100%);
}
.key .label { font-size: 11px; font-weight: 600; letter-spacing: 0.3px; opacity: 0.5; transition: opacity 0.2s; }
.key.black .label { color: rgba(255, 255, 255, 0.3); opacity: 0.5; }
.key.active .label { opacity: 1; }

.key .chord-badge {
    position: absolute; top: -28px;
    font-size: 11px; font-weight: 700;
    color: #c9a84c;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    padding: 2px 10px;
    border-radius: 20px;
    border: 1px solid rgba(201, 168, 76, 0.15);
    opacity: 0; transform: translateY(6px);
    transition: all 0.2s ease;
    white-space: nowrap;
    pointer-events: none;
}

:root {
    --accent-a: #2d7d4a;
    --accent-b: #c9a84c;
    --neutral-ring: rgba(201, 168, 76, 0.6);
}

.key.active .chord-badge { opacity: 1; transform: translateY(0); }

/* Активные клавиши – усиленный контур и свечение */
.key.active {
    box-shadow: 0 0 0 4px var(--neutral-ring), 0 8px 24px -6px rgba(201, 168, 76, 0.4);
    background: linear-gradient(180deg, #f0f8f0 0%, #d8ecd8 100%);
}
.key.active .chord-badge { color: rgba(255,255,255,0.9); }
.key.black.active {
    background: linear-gradient(180deg, #2d4a2d 0%, #1a2e1a 100%);
    box-shadow: 0 0 0 4px rgba(201, 168, 76, 0.5);
}

/* Тоника – тёмно-зелёная с золотым свечением, контур ярче */
.key.active.is-root {
    box-shadow: 0 0 0 5px #c9a84c, 0 0 24px rgba(201, 168, 76, 0.8);
    background: linear-gradient(180deg, #1a4a2a 0%, #0d2a18 100%);
    color: #fff;
}
.key.active.is-root .label { color: #fff; }
.key.active.is-root .chord-badge { color: #c9a84c; font-weight: 800; }

.key.black.active.is-root {
    background: linear-gradient(180deg, #3a2a0a 0%, #1a1005 100%);
    box-shadow: 0 0 0 5px #c9a84c, 0 0 24px rgba(201, 168, 76, 0.7);
}

/* Цвета ступеней (для гамм) – контур 4px */
.key.active.degree-0 {
    box-shadow: 0 0 0 5px #c9a84c, 0 0 24px rgba(201, 168, 76, 0.7);
    background: linear-gradient(180deg, #1a4a2a 0%, #0d2a18 100%);
    color: #fff;
}
.key.black.active.degree-0 {
    background: linear-gradient(180deg, #3a2a0a 0%, #1a1005 100%);
}
.key.active.degree-1 {
    box-shadow: 0 0 0 4px #5a9e6a, 0 0 20px rgba(90, 158, 106, 0.6);
    background: linear-gradient(180deg, #d8f0e0 0%, #b0d8b8 100%);
}
.key.black.active.degree-1 {
    background: linear-gradient(180deg, #1e4a2a 0%, #142e1a 100%);
}
.key.active.degree-2 {
    box-shadow: 0 0 0 4px #8cb87a, 0 0 20px rgba(140, 184, 122, 0.6);
    background: linear-gradient(180deg, #e8f5e0 0%, #cce8c0 100%);
}
.key.black.active.degree-2 {
    background: linear-gradient(180deg, #2e4a1e 0%, #1e2e14 100%);
}
.key.active.degree-3 {
    box-shadow: 0 0 0 4px #d4a373, 0 0 20px rgba(212, 163, 115, 0.6);
    background: linear-gradient(180deg, #f5ede0 0%, #e8d5b5 100%);
}
.key.black.active.degree-3 {
    background: linear-gradient(180deg, #4a3a1a 0%, #2e2610 100%);
}

/* Легенда */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin: 18px 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
}
.legend-item { display: flex; align-items: center; gap: 7px; }
.legend-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
}
.legend-item.is-root .legend-dot { background: #c9a84c; color: #c9a84c; }
.legend-item.is-neutral .legend-dot { background: rgba(201, 168, 76, 0.7); color: rgba(201, 168, 76, 0.7); }

.pill-selector { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 4px 0; }
.pill-btn {
    padding: 8px 18px;
    border-radius: 999px;
    border: 1px solid rgba(201, 168, 76, 0.15);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.pill-btn:hover { background: rgba(255, 255, 255, 0.07); color: #fff; transform: translateY(-1px); }
.pill-btn.active {
    background: linear-gradient(135deg, #2d7d4a, #c9a84c);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 20px -8px rgba(45, 125, 74, 0.5);
}

.info-display {
    text-align: center;
    margin: 24px 0 16px;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 24px;
    border: 1px solid rgba(201, 168, 76, 0.1);
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.info-display .info-name {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #e8f0e8, #c9a84c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.info-display .info-sub { font-size: 15px; color: rgba(255, 255, 255, 0.4); margin-top: 6px; font-weight: 400; letter-spacing: 0.3px; }
.info-display .info-hint { font-size: 13px; color: rgba(255, 255, 255, 0.2); margin-top: 4px; }
.info-display .info-hint span { color: rgba(201, 168, 76, 0.5); }

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 24px;
    border-radius: 999px;
    border: 1px solid rgba(201, 168, 76, 0.2);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.action-btn:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); }
.action-btn:active { transform: translateY(0) scale(0.97); }
.action-btn.active {
    background: linear-gradient(135deg, #2d7d4a, #c9a84c);
    border-color: transparent;
    box-shadow: 0 8px 24px -8px rgba(45, 125, 74, 0.5);
}

.transpose-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; }
.transpose-btn {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(201, 168, 76, 0.2);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}
.transpose-btn:hover { background: rgba(255, 255, 255, 0.08); transform: scale(1.06); }
.transpose-label { font-size: 12px; color: rgba(255, 255, 255, 0.4); min-width: 90px; text-align: center; }

.footer {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid rgba(201, 168, 76, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.2);
}
.footer a { color: rgba(255, 255, 255, 0.3); text-decoration: none; transition: color 0.2s; }
.footer a:hover { color: rgba(201, 168, 76, 0.7); }
.footer .socials { display: flex; gap: 16px; }

/* ── индикатор загрузки сэмплов ── */
.sample-loader {
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(201, 168, 76, 0.7);
}
.sample-loader.visible {
    display: inline-flex;
}
.sample-loader .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(201, 168, 76, 0.2);
    border-top-color: #c9a84c;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── стили для выпадающих меню ── */
.controls-row select,
.info-display select {
    padding: 6px 14px;
    border-radius: 30px;
    border: 1px solid rgba(201, 168, 76, 0.3);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: 0.15s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23c9a84c'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}
.controls-row select:hover,
.info-display select:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(201, 168, 76, 0.5);
}
.controls-row select:focus,
.info-display select:focus {
    outline: none;
    border-color: #c9a84c;
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}
.controls-row select option,
.info-display select option {
    background: #1a2a1a;
    color: #fff;
}

@media (max-width: 480px) {
    .key { width: 32px; height: 100px; font-size: 10px; padding-bottom: 8px; }
    .key.black { width: 20px; height: 64px; margin-left: -12px; margin-right: -12px; font-size: 8px; padding-bottom: 6px; }
    .piano { gap: 3px; }
    .info-display .info-name { font-size: 28px; }
}