.tunetap-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 14% 16%, rgba(15, 118, 110, 0.22), transparent 28%),
        radial-gradient(circle at 85% 10%, rgba(180, 83, 9, 0.18), transparent 26%),
        linear-gradient(135deg, #101827, #172033 48%, #0f172a);
    color: #f8fafc;
}

.tunetap-page .site-header {
    background: var(--header-bg);
}

.tunetap-shell {
    width: min(1180px, 92vw);
    margin: 0 auto;
    padding: 3.5rem 0 5rem;
}

.tunetap-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tunetap-hero h1 {
    color: #ffffff;
}

.tunetap-hero p:not(.eyebrow) {
    max-width: 720px;
    color: #cbd5e1;
    font-size: 1.12rem;
}

.classic-link {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 800;
    text-decoration: none;
}

.studio-grid,
.performance-grid {
    display: grid;
    gap: 1rem;
}

.studio-grid {
    grid-template-columns: minmax(0, 1fr) 330px;
    align-items: stretch;
}

.performance-grid {
    grid-template-columns: 0.85fr 1.15fr;
    margin-top: 1rem;
}

.main-instrument,
.control-panel,
.pad-panel,
.sequencer-panel {
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.82);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(16px);
}

.main-instrument {
    padding: 1rem;
}

.visualizer {
    width: 100%;
    height: 180px;
    display: block;
    border-radius: 8px;
    background: #07111f;
}

.now-playing {
    min-height: 42px;
    display: flex;
    align-items: center;
    margin: 0.9rem 0;
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #dbeafe;
    font-weight: 900;
}

.keyboard {
    display: grid;
    gap: 0.85rem;
}

.keyboard-set {
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.keyboard-set-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
    color: #cbd5e1;
    font-weight: 900;
}

.keyboard-set-header span {
    color: #2dd4bf;
    font-size: 0.82rem;
    text-transform: uppercase;
}

.control-panel .toggle-row {
    min-height: 48px;
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    margin: 0.9rem 0 0.35rem;
    color: #cbd5e1;
    font-weight: 900;
    cursor: pointer;
}

.control-panel .toggle-row input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.toggle-track {
    position: relative;
    width: 48px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.92);
    transition: background 160ms ease, border-color 160ms ease;
}

.toggle-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #cbd5e1;
    transition: transform 160ms ease, background 160ms ease;
}

.control-panel .toggle-row input:checked + .toggle-track {
    border-color: rgba(45, 212, 191, 0.8);
    background: rgba(15, 118, 110, 0.78);
}

.control-panel .toggle-row input:checked + .toggle-track::after {
    transform: translateX(20px);
    background: #ffffff;
}

.control-panel .toggle-row input:focus-visible + .toggle-track {
    outline: 3px solid rgba(45, 212, 191, 0.32);
    outline-offset: 3px;
}

.key-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(36px, 1fr));
    gap: 0.35rem;
}

.keyboard.hide-black-keys .key-grid {
    grid-template-columns: repeat(7, minmax(38px, 1fr));
}

.keyboard.hide-black-keys .key.black {
    display: none;
}

.key {
    position: relative;
    min-height: 74px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff, #dbe5ef);
    color: #0f172a;
    font-weight: 900;
    cursor: pointer;
}

.key.black {
    border-color: #020617;
    background: linear-gradient(180deg, #1f2937, #020617);
    color: #f8fafc;
}

.key.active {
    transform: translateY(2px);
    box-shadow: inset 0 0 0 999px rgba(37, 99, 235, 0.24);
}

.key span {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.72rem;
    line-height: 1.2;
    text-align: center;
}

.control-panel,
.pad-panel,
.sequencer-panel {
    padding: 1rem;
}

.panel-section + .panel-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.panel-section h2,
.section-title h2 {
    margin-bottom: 0.8rem;
    color: #ffffff;
    font-size: 1.35rem;
}

.control-panel label,
.sequencer-controls label {
    display: block;
    margin: 0.8rem 0 0.35rem;
    color: #cbd5e1;
    font-weight: 900;
}

.control-panel select,
.control-panel input,
.sequencer-controls input {
    width: 100%;
}

.control-panel select {
    min-height: 42px;
    padding: 0.55rem 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: #f8fafc;
    color: #0f172a;
    font: inherit;
    font-weight: 800;
}

.button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.panel-button {
    min-height: 46px;
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

#recordingStatus {
    margin: 0.7rem 0 0;
    color: #cbd5e1;
}

.section-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.chord-pads {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.chord-pad,
.step {
    min-height: 64px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.chord-pad:hover,
.chord-pad:focus-visible,
.step:hover,
.step:focus-visible,
.step.active {
    background: rgba(37, 99, 235, 0.42);
}

.sequencer-controls {
    display: grid;
    grid-template-columns: 76px minmax(160px, 1fr) 80px 88px 88px;
    gap: 0.65rem;
    align-items: center;
    margin-bottom: 1rem;
}

.sequencer-controls label {
    margin: 0;
}

#tempoValue {
    color: #dbeafe;
    font-weight: 900;
}

.step-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 0.45rem;
}

.step {
    min-height: 58px;
}

.step.on {
    background: linear-gradient(135deg, #2563eb, #0f766e);
}

.step.playing {
    outline: 3px solid #f59e0b;
    outline-offset: 2px;
}

@media (max-width: 980px) {
    .studio-grid,
    .performance-grid {
        grid-template-columns: 1fr;
    }

    .tunetap-hero {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 720px) {
    .key-grid {
        grid-template-columns: repeat(6, minmax(34px, 1fr));
    }

    .key,
    .key.black {
        min-height: 64px;
        margin: 0;
    }

    .sequencer-controls {
        grid-template-columns: 1fr 1fr;
    }

    .step-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .chord-pads {
        grid-template-columns: 1fr;
    }
}
