/* LoopFlow - Premium Youthful Music Creation Studio */
/* Premium Bright Theme - Glass & Sunshine */



:root {
    /* Primary Colors - Vibrant Youthful Yellow */
    --yellow: #FBBF24;
    --yellow-dark: #D97706;
    --yellow-light: #FDE68A;
    --teal: #10B981;
    --teal-dark: #047857;
    --teal-light: #6EE7B7;

    /* Vibrant Youthful Accents */
    --hot-pink: #EC4899;
    --orange: #F97316;
    --purple: #8B5CF6;
    --cyan: #06B6D4;
    --lime: #84CC16;
    --coral: #F43F5E;

    /* Background */
    --bg: #FFFBF0;
    --bg-card: rgba(255, 255, 255, 0.7);

    /* Text - Proper High-Contrast Soft Slate */
    --text-dark: #1E293B;
    --text-teal: #475569;

    /* Shadows - Soft, Premium, Modern */
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
    --shadow-yellow: 0 10px 20px rgba(251, 191, 36, 0.25);
    --shadow-teal: 0 10px 20px rgba(16, 185, 129, 0.25);

    /* Glass Effect - Light Frost */
    --glass-border: rgba(0, 0, 0, 0.06);
    --glass-bg: rgba(255, 255, 255, 0.6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

html,
body {
    height: 100%;
    overflow: hidden;
    font-family: 'Outfit', 'Inter', system-ui, sans-serif;
    background-color: #3aa9d6;
    background-image:
        repeating-radial-gradient(circle at 50% 42%,
            #FF6F00 0 48px,
            #FF3D00 48px 96px,
            #FFAB00 96px 144px,
            #00B0FF 144px 192px,
            #00E5FF 192px 240px);
    background-size: 100% 100%;
    background-attachment: fixed;
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Onboarding */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3aa9d6;
    background-image:
        repeating-radial-gradient(circle at 50% 42%,
            #FF6F00 0 48px,
            #FF3D00 48px 96px,
            #FFAB00 96px 144px,
            #00B0FF 144px 192px,
            #00E5FF 192px 240px);
    background-size: 100% 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.onboarding-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.onboarding-content {
    text-align: center;
    padding: 2rem;
}

.logo-pulse {
    width: 140px;
    height: 140px;
    margin: 0 auto 2rem;
    background: #fff;
    border-radius: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: wobble 2.5s ease-in-out infinite;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    border: none;
    transform: rotate(-5deg);
}

.logo-pulse i {
    font-size: 4.5rem;
    background: linear-gradient(135deg, #FBBF24, #F59E0B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes wobble {

    0%,
    100% {
        transform: rotate(-5deg) scale(1);
    }

    25% {
        transform: rotate(5deg) scale(1.05);
    }

    50% {
        transform: rotate(-3deg) scale(1);
    }

    75% {
        transform: rotate(3deg) scale(1.05);
    }
}

.onboarding-content h1 {
    font-size: 3.8rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    color: #1E293B;
    letter-spacing: -1px;
    font-family: 'Outfit', sans-serif;
}

.onboarding-content p {
    color: var(--text-teal);
    font-size: 1.3rem;
    margin-bottom: 2rem;
    font-weight: 700;
}

.guest-text {
    margin-top: 1rem;
    font-size: 1rem !important;
    color: var(--teal-dark) !important;
}

/* Tutorial */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tutorial-overlay.hidden {
    display: none;
}

.tutorial-step {
    text-align: center;
    padding: 2rem;
}

.tutorial-hand {
    font-size: 6rem;
    color: var(--yellow);
    animation: point 0.6s ease-in-out infinite;
    margin-bottom: 1rem;
}

@keyframes point {

    0%,
    100% {
        transform: translateX(-20px) rotate(-10deg);
    }

    50% {
        transform: translateX(20px) rotate(10deg);
    }
}

.tutorial-step p {
    font-size: 1.6rem;
    margin-bottom: 2rem;
    color: var(--yellow);
    font-weight: 700;
}

.btn-skip {
    background: var(--hot-pink);
    color: white;
    border: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow);
    font-family: 'Outfit', sans-serif;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--hot-pink), #D81B60);
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 1.2rem 3rem;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin: 0 auto;
    box-shadow: 0 8px 20px rgba(236, 72, 153, 0.3);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Outfit', sans-serif;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(236, 72, 153, 0.4);
}

.btn-primary:active {
    transform: scale(0.96);
    box-shadow: 0 4px 10px rgba(236, 72, 153, 0.3);
}

.btn-secondary {
    background: var(--cyan);
    color: var(--text-dark);
    border: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    box-shadow: var(--shadow);
}

/* Navigation */
.main-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(251, 191, 36, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    padding: 1rem 0;
    border-top: 1px solid var(--glass-border);
    z-index: 100;
}

.nav-btn {
    background: none;
    border: none;
    color: #B45309;
    opacity: 0.6;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 1rem;
    font-family: 'Outfit', sans-serif;
    transition: color 0.3s ease;
}

.nav-btn i {
    font-size: 1.8rem;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.nav-btn.active {
    color: var(--hot-pink);
    opacity: 1;
}

.nav-btn.active i {
    transform: scale(1.1);
    filter: drop-shadow(0 4px 8px rgba(236, 72, 153, 0.3));
}

/* Tab Content */
.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    padding-bottom: 100px;
}

.tab-content.active {
    display: block;
}

/* Studio Header */
.studio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.project-info {
    flex: 1;
}

.project-name-input {
    background: transparent;
    border: none;
    color: var(--text-dark);
    font-size: 1.4rem;
    font-weight: 700;
    width: 100%;
    outline: none;
    font-family: 'Outfit', sans-serif;
}

.project-date {
    font-size: 0.85rem;
    color: var(--teal);
    font-weight: 600;
}

.studio-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-magic {
    background: var(--purple);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.7rem 1.2rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: var(--shadow);
    font-family: 'Outfit', sans-serif;
}

.btn-clear {
    background: var(--orange);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.7rem 1.2rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: var(--shadow);
    font-family: 'Outfit', sans-serif;
    transition: transform 0.1s;
}

.btn-clear:active {
    transform: translate(3px, 3px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.btn-clear:hover {
    background: #FF5722;
}

.btn-play {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--lime);
    border: 1px solid var(--glass-border);
    color: var(--text-dark);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: transform 0.1s;
}

.btn-play:active {
    transform: translate(3px, 3px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.btn-play.playing {
    background: var(--hot-pink);
    animation: bounce-play 0.5s ease-in-out infinite;
}

@keyframes bounce-play {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Genre Selector */
.genre-selector {
    display: flex;
    gap: 0.7rem;
    overflow-x: auto;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.genre-selector::-webkit-scrollbar {
    display: none;
}

.genre-btn {
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(0,0,0,0.04);
    color: var(--text-dark);
    padding: 0.7rem 1.3rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    font-family: 'Outfit', sans-serif;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.genre-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.genre-btn:active {
    transform: scale(0.95);
}

.genre-btn.active {
    background: var(--yellow);
    color: #FFF;
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(251, 191, 36, 0.3);
}

/* Sequencer */
.sequencer-container {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.6rem 0.75rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.track-labels {
    display: grid;
    grid-template-rows: repeat(8, var(--row-height, 36px));
    gap: 0.42rem;
    position: sticky;
    left: 0;
    z-index: 10;
    background: var(--surface, var(--bg));
}

.sequencer-scroll-wrapper {
    overflow-x: auto;
    /* Hide scrollbar for a cleaner look, but keep functionality */
    scrollbar-width: none; /* Firefox */
}
.sequencer-scroll-wrapper::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.step-spacer {
    position: sticky;
    left: 0;
    z-index: 10;
    background: var(--bg); /* To cover scrolled text */
}

.track-label {
    height: 100%;
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-teal);
    width: var(--label-width, 60px);
    font-family: 'Outfit', sans-serif;
}

.voice-track-bar {
    width: 100%;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.voice-track-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.voice-track-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--hot-pink);
    font-family: 'Outfit', sans-serif;
    min-width: 80px;
}

.voice-track-header i {
    font-size: 1.2rem;
}

.voice-progress-bar-container {
    flex: 1;
    height: 16px;
    background: var(--bg);
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.voice-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--hot-pink), var(--purple));
    transition: width 0.1s linear;
    border-radius: 6px;
}

/* Piano Track Bar - Similar to Voice Track Bar */
.piano-track-bar {
    width: 100%;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease-out;
}

.piano-track-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.piano-track-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--purple);
    font-family: 'Outfit', sans-serif;
    min-width: 80px;
}

.piano-track-header i {
    font-size: 1.2rem;
}

.piano-progress-bar-container-inline {
    flex: 1;
    height: 16px;
    background: var(--bg);
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.piano-progress-bar-inline {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--purple), var(--teal));
    transition: width 0.1s linear;
    border-radius: 6px;
}


.sequencer-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.4rem;
    flex: 1;
    min-width: max-content;
}

.grid-cell {
    width: 36px;
    height: 36px;
    aspect-ratio: 1;
    background: #FFF;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 1px 4px rgba(0,0,0,0.02);
    position: relative;
    overflow: hidden;
}

/* Beat grouping: highlight the first step of each 4-step beat */
.grid-cell[data-step="0"], .grid-cell[data-step="4"], .grid-cell[data-step="8"], .grid-cell[data-step="12"],
.grid-cell[data-step="16"], .grid-cell[data-step="20"], .grid-cell[data-step="24"], .grid-cell[data-step="28"] {
    background: #F3F4F6;
    border-left: 2px solid rgba(0,0,0,0.1);
}

.grid-cell::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: var(--yellow);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.grid-cell.active::after {
    width: 80%;
    height: 80%;
}

.grid-cell.active {
    background: var(--yellow);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

.grid-cell.playing {
    background: var(--hot-pink);
}

.grid-cell:active {
    transform: scale(0.9);
}

/* Step Indicators */
.step-indicators {
    display: grid;
    grid-template-columns: var(--label-width, 60px) repeat(8, var(--cell-width, 36px));
    gap: 0.42rem;
    margin-bottom: 0.75rem;
    padding: 0 0.75rem;
    min-width: max-content;
}

.step-indicator {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-teal);
    opacity: 0.7;
    padding: 0.5rem;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    border: 3px solid transparent;
}

.step-indicator.active {
    background: var(--yellow);
    border-color: transparent;
    box-shadow: var(--shadow-yellow);
    color: #FFF;
    opacity: 1;
}

/* BPM Control */
.bpm-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1rem;
    border-radius: 20px;
    margin-bottom: 1rem;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    min-width: 0;
}

.bpm-control label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--teal-dark);
    font-family: 'Outfit', sans-serif;
}

.bpm-control input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 8px;
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
    border: none;
    outline: none;
    min-width: 0;
}

.bpm-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--yellow), #F59E0B);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #FFF;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    transition: transform 0.1s ease;
}

.bpm-control input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.2);
}

#bpm-value {
    font-weight: 700;
    min-width: 50px;
    text-align: right;
    font-size: 1.4rem;
    color: var(--hot-pink);
    font-family: 'Outfit', sans-serif;
}

/* Share Button */
.btn-share {
    width: 100%;
    background: var(--teal);
    border: 1px solid var(--glass-border);
    color: var(--text-dark);
    padding: 1.3rem;
    border-radius: 50px;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow);
    font-family: 'Outfit', sans-serif;
    transition: transform 0.1s;
}

.btn-share:active {
    transform: translate(4px, 4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Discover Tab */
.discover-header {
    margin-bottom: 1rem;
}

.discover-header h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-family: 'Outfit', sans-serif;
}

.mood-filter {
    display: flex;
    gap: 0.7rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.mood-filter::-webkit-scrollbar {
    display: none;
}

.mood-btn {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text-dark);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    font-family: 'Outfit', sans-serif;
    box-shadow: var(--shadow);
    transition: transform 0.1s;
}

.mood-btn:active {
    transform: translate(3px, 3px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.mood-btn.active {
    background: var(--hot-pink);
    color: white;
}

/* Beats Feed */
.beats-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.beat-card {
    background: var(--bg-card);
    border-radius: 25px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.beat-visualizer {
    height: 180px;
    background: linear-gradient(135deg, #FF6F00, #FF3D00, #FFAB00, #00B0FF, #00E5FF);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--glass-border);
}

.beat-visualizer canvas {
    width: 100%;
    height: 100%;
}

.beat-play-overlay {
    position: absolute;
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hot-pink);
    font-size: 1.5rem;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.4);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.beat-play-overlay:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.beat-play-overlay:active {
    transform: scale(0.9);
}

.beat-info {
    padding: 1rem;
}

.beat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.beat-title {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-dark);
    font-family: 'Outfit', sans-serif;
}

.beat-author {
    color: var(--teal);
    font-size: 0.95rem;
    font-weight: 600;
}

.beat-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    align-items: center;
}

.beat-action-btn {
    background: none;
    border: none;
    color: var(--teal);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
}

.beat-action-btn.active {
    color: var(--hot-pink);
}

.remix-btn {
    background: var(--orange);
    color: var(--text-dark);
    border: 1px solid var(--glass-border);
    padding: 0.6rem 1.3rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-left: auto;
    font-family: 'Outfit', sans-serif;
    box-shadow: var(--shadow);
    transition: transform 0.1s;
}

.remix-btn:active {
    transform: translate(3px, 3px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

/* Library Tab */
.library-header {
    margin-bottom: 1rem;
}

.library-header h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-family: 'Outfit', sans-serif;
}

.search-bar {
    background: var(--bg-card);
    border-radius: 20px;
    display: flex;
    align-items: center;
    padding: 1rem;
    gap: 0.75rem;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.search-bar i {
    color: var(--teal);
    font-size: 1.3rem;
}

.search-bar input {
    background: none;
    border: none;
    color: var(--text-dark);
    flex: 1;
    outline: none;
    font-size: 1.1rem;
    font-family: 'Outfit', sans-serif;
}

.search-bar input::placeholder {
    color: var(--teal);
    opacity: 0.6;
}

/* Sound Categories */
.sound-categories {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.category-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    transition: transform 0.1s;
}

.category-card:active {
    transform: translate(3px, 3px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.category-icon {
    width: 60px;
    height: 60px;
    background: var(--yellow);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    color: var(--text-dark);
    font-size: 1.6rem;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-yellow);
}

.category-card span {
    font-size: 1rem;
    color: var(--text-dark);
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

/* Stem Packs */
.stem-packs h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-family: 'Outfit', sans-serif;
}

.stem-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.stem-item {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    transition: transform 0.1s;
}

.stem-item:active {
    transform: translate(3px, 3px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.stem-cover {
    width: 65px;
    height: 65px;
    background: var(--hot-pink);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.stem-info {
    flex: 1;
}

.stem-name {
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-dark);
    font-family: 'Outfit', sans-serif;
}

.stem-artist {
    font-size: 0.9rem;
    color: var(--teal);
    font-weight: 600;
}

.stem-tag {
    background: var(--yellow);
    color: var(--text-dark);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-yellow);
}

/* Profile Tab */
.profile-header {
    text-align: center;
    padding: 2rem 0;
}

.avatar {
    width: 110px;
    height: 110px;
    background: linear-gradient(135deg, var(--yellow) 0%, var(--hot-pink) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 3rem;
    color: var(--text-dark);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.profile-header h2 {
    font-size: 1.6rem;
    margin-bottom: 0.25rem;
    color: var(--text-dark);
    font-family: 'Outfit', sans-serif;
}

.profile-header p {
    color: var(--teal);
    font-size: 1rem;
    font-weight: 600;
}

.profile-stats {
    display: flex;
    justify-content: space-around;
    padding: 1.5rem 0;
    background: var(--bg-card);
    border-radius: 20px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--hot-pink);
    font-family: 'Outfit', sans-serif;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--teal);
    font-weight: 700;
}

.my-beats h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-family: 'Outfit', sans-serif;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--teal);
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: var(--yellow);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 500;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 100%;
    max-height: 85vh;
    border-radius: 30px 30px 0 0;
    padding: 1.5rem;
    animation: slideUp 0.3s ease;
    border: 1px solid var(--glass-border);
    border-bottom: none;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    font-family: 'Outfit', sans-serif;
}

.btn-close {
    background: var(--yellow);
    border: 1px solid var(--glass-border);
    color: var(--text-dark);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-yellow);
}

/* Share Steps */
.share-step {
    min-height: 200px;
}

.visualizer-container {
    height: 180px;
    background: linear-gradient(135deg, var(--yellow) 0%, var(--hot-pink) 50%, var(--teal) 100%);
    border-radius: 20px;
    margin-bottom: 1rem;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.visualizer-container canvas {
    width: 100%;
    height: 100%;
}

.btn-play-large {
    width: 100%;
    background: var(--lime);
    border: 1px solid var(--glass-border);
    color: var(--text-dark);
    padding: 1.2rem;
    border-radius: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.form-group input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--glass-border);
    color: var(--text-dark);
    padding: 1rem;
    border-radius: 15px;
    font-size: 1.1rem;
    outline: none;
    font-family: 'Outfit', sans-serif;
}

.duet-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.duet-toggle label {
    font-weight: 700;
    color: var(--text-dark);
    font-family: 'Outfit', sans-serif;
}

.duet-toggle input[type="checkbox"] {
    width: 60px;
    height: 35px;
    -webkit-appearance: none;
    background: var(--bg);
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    border: 1px solid var(--glass-border);
}

.duet-toggle input[type="checkbox"]::after {
    content: '';
    position: absolute;
    width: 23px;
    height: 23px;
    background: var(--hot-pink);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.2s;
    border: 1px solid var(--glass-border);
}

.duet-toggle input[type="checkbox"]:checked {
    background: var(--lime);
}

.duet-toggle input[type="checkbox"]:checked::after {
    left: 28px;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.export-btn {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text-dark);
    padding: 1.2rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    box-shadow: var(--shadow);
    transition: transform 0.1s;
}

.export-btn i {
    font-size: 2rem;
}

.export-btn:active {
    transform: translate(3px, 3px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.modal-footer {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-footer button {
    flex: 1;
}

.share-progress {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 1.5rem;
}

.progress-dot {
    width: 16px;
    height: 16px;
    background: var(--bg);
    border-radius: 50%;
    transition: all 0.3s;
    border: 1px solid var(--glass-border);
}

.progress-dot.active {
    background: var(--yellow);
    width: 40px;
    border-radius: 10px;
    box-shadow: var(--shadow-yellow);
}

/* Bottom Sheet */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 30px 30px 0 0;
    padding: 1rem 1.5rem 2rem;
    z-index: 400;
    animation: slideUp 0.3s ease;
    border: 1px solid var(--glass-border);
    border-bottom: none;
}

.bottom-sheet.hidden {
    display: none;
}

.sheet-handle {
    width: 60px;
    height: 8px;
    background: var(--yellow);
    border-radius: 4px;
    margin: 0 auto 1rem;
    border: 1px solid var(--glass-border);
}

.sheet-content h3 {
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
}

.sound-preview-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.sound-icon {
    width: 80px;
    height: 80px;
    background: var(--yellow);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-dark);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-yellow);
}

.sound-details h4 {
    margin-bottom: 0.25rem;
    color: var(--text-dark);
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
}

.sound-details p {
    color: var(--teal);
    font-size: 1rem;
    font-weight: 600;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-card);
    color: var(--text-dark);
    padding: 1.2rem 2rem;
    border-radius: 50px;
    box-shadow: var(--shadow);
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    border: 1px solid var(--glass-border);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.toast.success {
    background: var(--lime);
}

.toast.error {
    background: var(--hot-pink);
    color: white;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--yellow);
    border-radius: 4px;
    border: 1px solid var(--glass-border);
}

/* Touch feedback */
@media (hover: none) {

    .grid-cell:active,
    .btn-primary:active,
    .genre-btn:active,
    .mood-btn:active,
    .category-card:active,
    .beat-card:active,
    .stem-item:active {
        opacity: 0.9;
    }
}

/* Landscape mode adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    .sequencer-container {
        max-height: 200px;
    }

    .track-label {
        height: 100%;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) {
    .app-container {
        max-width: 480px;
        margin: 0 auto;
        border-left: 1px solid var(--glass-border);
        border-right: 1px solid var(--glass-border);
    }

    .sound-categories {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ============================================
   VOICE RECORDER STYLES
   ============================================ */

.recorder-section {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.recorder-section h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
    text-align: center;
}

.recorder-section h3#bpm-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    color: var(--text-dark);
    min-width: 50px;
    text-align: center;
}

/* Grid Length Control */
.grid-length-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    border-radius: 20px;
    margin-bottom: 1rem;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.grid-length-control label {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    color: var(--text-dark);
    min-width: 100px;
}

.grid-length-control .grid-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: var(--yellow);
    color: var(--text-dark);
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 16px rgba(0,0,0,0.3);
    transition: transform 0.1s;
    font-family: 'Outfit', sans-serif;
}

.grid-length-control .grid-btn:hover {
    transform: translate(2px, 2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.grid-length-control .grid-btn:active {
    transform: translate(4px, 4px);
    box-shadow: none;
}

#grid-length-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    color: var(--text-dark);
    min-width: 80px;
    text-align: center;
}

.recorder-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.btn-record {
    background: var(--hot-pink);
    color: white;
    border: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Outfit', sans-serif;
    box-shadow: var(--shadow);
    transition: transform 0.1s;
    animation: pulse-record 1.5s ease-in-out infinite;
}

@keyframes pulse-record {

    0%,
    100% {
        transform: scale(1);
        box-shadow: var(--shadow);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 24px rgba(0,0,0,0.4);
    }
}

.btn-record:hover {
    animation: none;
    transform: translate(2px, 2px);
    box-shadow: 0 3px 16px rgba(0,0,0,0.3);
}

.btn-record:active {
    transform: translate(4px, 4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.btn-record.recording {
    background: var(--coral);
    animation: pulse-recording 0.8s ease-in-out infinite;
}

@keyframes pulse-recording {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.btn-stop-record {
    background: var(--coral);
    color: white;
    border: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Outfit', sans-serif;
    box-shadow: var(--shadow);
    transition: transform 0.1s;
    animation: shake-stop 0.5s ease-in-out infinite;
}

@keyframes shake-stop {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px) rotate(-2deg);
    }

    75% {
        transform: translateX(3px) rotate(2deg);
    }
}

.btn-stop-record:hover {
    animation: none;
    transform: translate(2px, 2px);
    box-shadow: 0 3px 16px rgba(0,0,0,0.3);
}

.btn-stop-record:active {
    transform: translate(4px, 4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.recording-timer {
    text-align: center;
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    color: var(--hot-pink);
    margin-bottom: 1rem;
    animation: blink-timer 1s ease-in-out infinite;
}

@keyframes blink-timer {

    0%,
    100% {
        opacity: 1;
        color: var(--hot-pink);
    }

    50% {
        opacity: 0.5;
        color: #ff0000;
    }
}

.recorded-clips {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.recorded-clip {
    background: var(--bg);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 3px 16px rgba(0,0,0,0.3);
    transition: transform 0.1s;
}

.recorded-clip:hover {
    transform: translate(2px, 2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.recorded-clip .clip-icon {
    width: 40px;
    height: 40px;
    background: var(--yellow);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
    font-size: 1.2rem;
    color: var(--text-dark);
}

.recorded-clip .clip-info {
    flex: 1;
}

.recorded-clip .clip-name {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.recorded-clip .clip-duration {
    font-size: 0.8rem;
    color: var(--teal);
    font-weight: 600;
}

.recorded-clip .clip-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.recorded-clip .btn-play-clip {
    background: var(--cyan);
    color: var(--text-dark);
    border: 1px solid var(--glass-border);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: 'Outfit', sans-serif;
    box-shadow: var(--shadow);
    transition: transform 0.1s;
    flex: 1;
    justify-content: center;
}

.recorded-clip .btn-play-clip:active {
    transform: translate(3px, 3px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.btn-add-to-beat {
    background: var(--lime);
    color: var(--text-dark);
    border: 1px solid var(--glass-border);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: 'Outfit', sans-serif;
    box-shadow: var(--shadow);
    transition: transform 0.1s;
    flex: 1;
    justify-content: center;
}

.btn-add-to-beat:hover {
    transform: translate(2px, 2px);
    box-shadow: 0 3px 16px rgba(0,0,0,0.3);
}

.btn-add-to-beat:active {
    transform: translate(4px, 4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ============================================
   PIANO KEYBOARD STYLES
   ============================================ */

.piano-section {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.piano-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px dashed var(--yellow);
}

.piano-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    color: var(--text-dark);
}

.instrument-select {
    background: var(--yellow);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    color: var(--text-dark);
    cursor: pointer;
    box-shadow: 0 3px 16px rgba(0,0,0,0.3);
    outline: none;
}

.instrument-select:focus {
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.piano-roll-container {
    --piano-cell-width: 60px;
    --piano-row-height: 28px;
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-panel);
    padding: 12px;
    gap: 0.5rem;
    height: 380px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-soft);
}

.piano-roll-sidebar {
    width: 64px;
    display: grid;
    grid-template-rows: repeat(13, var(--piano-row-height));
    gap: 3px;
    height: 100%;
    overflow-y: hidden; /* Programmatic sync scroll only */
}

.piano-roll-key {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s, background-color 0.1s, box-shadow 0.1s;
    height: 100%;
}

.piano-roll-key.white {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.piano-roll-key.white:hover {
    background: #f1f5f9;
}

.piano-roll-key.white.active {
    background: var(--yellow);
    color: var(--ink);
    transform: scale(0.95);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.piano-roll-key.black {
    background: #1e293b;
    color: #f8fafc;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.piano-roll-key.black:hover {
    background: #334155;
}

.piano-roll-key.black.active {
    background: var(--hot-pink);
    color: #fff;
    transform: scale(0.95);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.piano-roll-key.scale-disabled {
    opacity: 0.25;
    pointer-events: none;
    filter: grayscale(1);
}

.piano-roll-grid-wrapper {
    flex: 1;
    overflow: auto; /* Enable vertical and horizontal scrollbars */
    height: 100%;
    border-radius: var(--radius-panel);
    border: 1px solid var(--border-soft);
    background: #ffffff;
    position: relative; /* Setup absolute viewport relative to grid if needed */
}

.piano-roll-grid {
    display: grid;
    grid-template-rows: repeat(13, var(--piano-row-height));
    grid-template-columns: repeat(var(--grid-steps, 8), minmax(var(--piano-cell-width), 1fr));
    height: max-content;
    width: 100%;
    min-width: max-content;
    gap: 3px;
    padding: 0;
    position: relative; /* Essential for relative overlay grids */
}

.piano-roll-cell {
    width: 100%;
    height: 100%;
    background: #ffffff;
    border-right: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.piano-roll-cell.black-row {
    background: #f1f5f9;
}

.piano-roll-cell:hover {
    background: #f8fafc;
}

.piano-roll-cell:active {
    transform: scale(0.96);
}

.piano-roll-cell.scale-disabled {
    opacity: 0.25;
    pointer-events: none;
    filter: grayscale(1);
}

.piano-roll-cell.playing {
    background: #fef08a !important; /* Visual progress highlights */
}

/* Piano Zoom Toolbar styles */
.piano-zoom-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.piano-zoom-toolbar .zoom-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.piano-zoom-toolbar label {
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.piano-zoom-toolbar .zoom-slider {
    width: 80px;
    cursor: pointer;
    accent-color: var(--yellow-dark);
}

.piano-zoom-toolbar .btn-zoom-step {
    background: var(--yellow-light);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--yellow-dark);
    transition: background 0.1s, transform 0.1s;
}

.piano-zoom-toolbar .btn-zoom-step:hover {
    background: var(--yellow);
    transform: scale(1.05);
}

.piano-zoom-toolbar .zoom-select {
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    color: var(--text-dark);
}

.piano-zoom-toolbar .btn-zoom-reset {
    margin-left: auto;
    background: var(--yellow);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: transform 0.1s, background-color 0.1s;
    font-family: 'Outfit', sans-serif;
    color: var(--text-dark);
}

.piano-zoom-toolbar .btn-zoom-reset:hover {
    background: var(--yellow-dark);
    color: white;
    transform: scale(1.03);
}

/* Piano Note Block styles */
.piano-note-block {
    position: relative;
    grid-row: var(--note-row);
    grid-column: var(--note-col);
    z-index: 3;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    box-sizing: border-box;
    cursor: grab;
    user-select: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    /* Standard Premium gradient: Teal for white keys, purple for black keys */
    background: linear-gradient(135deg, var(--teal-light), var(--teal-dark));
    border: 1.5px solid var(--teal);
    transition: box-shadow 0.15s ease, border-color 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
    min-height: 0;
    overflow: hidden;
}

.piano-note-block.black-key-note {
    background: linear-gradient(135deg, var(--purple), #6d28d9);
    border: 1.5px solid #7c3aed;
}

.piano-note-block:hover {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    filter: brightness(1.05);
}

.piano-note-block:active {
    cursor: grabbing;
}

/* Dragging state — elevated look during drag/resize */
.piano-note-block.dragging {
    cursor: grabbing;
    opacity: 0.85;
    z-index: 10;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    filter: brightness(1.08);
}

.piano-note-block.selected {
    border: 2px solid var(--yellow);
    box-shadow: 0 0 8px var(--yellow), 0 2px 5px rgba(0, 0, 0, 0.2);
    overflow: visible; /* Show handles outside of bounding box if necessary */
}

/* Resize Handles — only visible when selected */
.piano-note-block .note-resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 8px;
    background: rgba(255, 255, 255, 0.35);
    cursor: ew-resize;
    display: none;
    z-index: 5;
    transition: background-color 0.12s ease, width 0.12s ease;
}

.piano-note-block.selected .note-resize-handle {
    display: block;
}

/* Subtle grip dots on handles for discoverability */
.piano-note-block.selected .note-resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 60%;
    border-left: 1px dotted rgba(255, 255, 255, 0.7);
    border-right: 1px dotted rgba(255, 255, 255, 0.7);
    gap: 2px;
}

.piano-note-block .left-handle {
    left: 0;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.piano-note-block .right-handle {
    right: 0;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.piano-note-block .note-resize-handle:hover {
    background: rgba(255, 255, 255, 0.7);
    width: 10px;
}

/* Delete Button */
.piano-note-block .note-delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    background: var(--coral);
    border: 1px solid white;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    display: none; /* Only visible when selected */
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.2s;
    cursor: pointer;
    z-index: 6;
    line-height: 1;
}

.timeline-clip.selected {
    box-shadow: 0 0 0 2px var(--pool), 0 4px 10px rgba(0,0,0,0.2);
    transform: translateY(-1px);
    z-index: 2;
}

.timeline-clip:hover {
    filter: brightness(1.1);
}

.piano-note-block.selected .note-delete-btn {
    display: flex;
}

.piano-note-block .note-delete-btn:hover {
    background: #e11d48;
    transform: scale(1.15);
}

.piano-note-block .note-content {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none; /* Click goes to block */
    flex: 1;
    text-align: center;
    user-select: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* Playback highlighting */
.piano-note-block.playing {
    filter: brightness(1.2) saturate(1.2);
    box-shadow: 0 0 12px rgba(255,255,255,0.8);
}

.piano-roll-cell.playing {
    background-color: rgba(37, 99, 235, 0.12);
}

.piano-roll-cell.playing.active {
    filter: brightness(1.1);
}

.piano-roll-cell.scale-disabled {
    opacity: 0.35;
    pointer-events: none;
    background: #cbd5e1;
}

.btn-piano-clear {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    background: var(--danger);
    color: #fff;
    border-radius: var(--radius-control);
    border: 1px solid var(--border-soft);
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

.btn-piano-play {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-control);
    border: 1px solid var(--border-soft);
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

.btn-piano-play.playing {
    background: var(--danger) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* ============================================
   RESPONSIVE STYLES FOR RECORDER & PIANO
   ============================================ */

@media (max-width: 480px) {
    .recorder-section {
        padding: 1rem;
    }

    .recorder-controls {
        flex-direction: column;
        align-items: center;
    }

    .btn-record,
    .btn-stop-record {
        width: 100%;
        justify-content: center;
    }

    .recording-timer {
        font-size: 1.5rem;
    }

    .recorded-clip {
        flex-wrap: wrap;
    }

    .piano-keys {
        height: 140px;
    }

    .piano-key.white {
        width: 35px;
    }

    .piano-key.black {
        width: 24px;
        margin-left: -12px;
    }

    .piano-container {
        padding: 0.75rem;
    }

    .piano-controls {
        flex-wrap: wrap;
    }
}

@media (max-width: 360px) {
    .piano-key.white {
        width: 30px;
    }

    .piano-key.black {
        width: 20px;
        margin-left: -10px;
    }

    .piano-keys {
        height: 120px;
    }
}

/* ============================================
   MODERN POLISH PASS
   ============================================ */

:root {
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: #ffffff;
    --surface-muted: #f5f7fb;
    --border-soft: rgba(15, 23, 42, 0.1);
    --border-strong: rgba(15, 23, 42, 0.16);
    --ink: #111827;
    --ink-muted: #64748b;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --success: #059669;
    --warning: #d97706;
    --danger: #e11d48;
    --radius-panel: 16px;
    --radius-card: 8px;
    --radius-control: 10px;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.07);
    --shadow-focus: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

body {
    background-color: #3aa9d6;
    background-image:
        repeating-radial-gradient(circle at 50% 42%,
            #FF6F00 0 48px,
            #FF3D00 48px 96px,
            #FFAB00 96px 144px,
            #00B0FF 144px 192px,
            #00E5FF 192px 240px);
    background-size: 100% 100%;
    background-attachment: fixed;
    color: var(--ink);
}

button,
input,
select {
    font: inherit;
}

button,
.category-card,
.stem-item,
.beat-play-overlay,
.grid-cell,
.piano-key {
    transition:
        transform 160ms ease,
        box-shadow 160ms ease,
        background-color 160ms ease,
        border-color 160ms ease,
        color 160ms ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

.app-container {
    background: rgba(255, 255, 255, 0.3);
}

.tab-content {
    padding: 1.25rem;
    padding-bottom: 108px;
}

.studio-header,
.sequencer-container,
.bpm-control,
.recorder-section,
.piano-section,
.profile-stats,
.empty-state,
.voice-track-bar,
.piano-track-bar,
.search-bar {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-soft);
}

.studio-header {
    align-items: flex-start;
    gap: 1rem;
    padding: 1.1rem;
}

.project-name-input {
    color: var(--ink);
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.15;
}

.project-date,
.beat-author,
.stem-artist,
.profile-header p,
.stat-label,
.sound-details p,
.search-bar input::placeholder {
    color: var(--ink-muted);
}

.studio-actions {
    align-items: center;
    gap: 0.5rem;
}

.btn-primary,
.btn-secondary,
.btn-magic,
.btn-clear,
.btn-share,
.btn-play-large,
.btn-record,
.btn-stop-record,
.btn-piano-record,
.btn-piano-clear,
.btn-add-to-beat,
.recorded-clip .btn-play-clip,
.remix-btn,
.mood-btn,
.genre-btn,
.export-btn,
.btn-skip,
.btn-confirm-cancel,
.btn-confirm-ok {
    border-radius: var(--radius-control);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
}

.btn-primary,
.btn-magic,
.btn-confirm-ok {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
}

.btn-secondary,
.btn-confirm-cancel,
.recorded-clip .btn-play-clip {
    background: var(--surface-muted);
    color: var(--ink);
}

.btn-clear,
.btn-piano-clear,
.btn-stop-record {
    background: var(--danger);
    color: #fff;
}

.btn-share,
.btn-play-large,
.btn-add-to-beat {
    background: var(--success);
    color: #fff;
}

.btn-record,
.btn-piano-record {
    background: var(--danger);
    color: #fff;
}

.btn-play {
    background: var(--accent);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.24);
}

.btn-play.playing {
    background: var(--danger);
    animation: none;
}

.btn-magic:hover,
.btn-share:hover,
.btn-play:hover,
.btn-primary:hover,
.category-card:hover,
.stem-item:hover,
.beat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-clear:active,
.btn-play:active,
.btn-share:active,
.mood-btn:active,
.remix-btn:active,
.category-card:active,
.stem-item:active,
.recorded-clip .btn-play-clip:active,
.btn-add-to-beat:active,
.btn-piano-record:active,
.btn-piano-clear:active,
.export-btn:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-soft);
}

.main-nav {
    left: 50%;
    right: auto;
    bottom: 18px;
    width: min(440px, calc(100% - 28px));
    transform: translateX(-50%);
    padding: 0.45rem;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

.nav-btn {
    flex: 1;
    min-width: 0;
    color: var(--ink-muted);
    opacity: 1;
    border-radius: 12px;
    padding: 0.65rem 0.35rem;
}

.nav-btn i {
    font-size: 1.2rem;
}

.nav-btn span {
    font-size: 0.72rem;
}

.nav-btn.active {
    background: #eef4ff;
    color: var(--accent);
}

.nav-btn.active i {
    filter: none;
    transform: none;
}

.genre-selector,
.mood-filter {
    gap: 0.55rem;
}

.genre-btn,
.mood-btn {
    background: var(--surface-strong);
    color: var(--ink-muted);
    padding: 0.66rem 0.95rem;
}

.genre-btn.active {
    background: var(--genre-color, var(--accent));
    color: #fff;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--genre-color, var(--accent)) 28%, transparent);
}

.mood-btn.active {
    background: var(--ink);
    color: #fff;
}

.sequencer-container {
    overflow-x: auto;
}

.track-label {
    color: var(--ink-muted);
    font-size: 0.68rem;
    letter-spacing: 0;
    width: 64px;
}

.sequencer-grid {
    min-width: 292px;
}

.grid-cell {
    background: #edf2f7;
    border: 1px solid #dbe3ee;
    border-radius: var(--radius-card);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.grid-cell::after {
    background: #fff;
}

.grid-cell.active {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 7px 18px rgba(37, 99, 235, 0.24);
}

.grid-cell.playing {
    background: var(--danger);
    border-color: var(--danger);
    box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.12);
}

.step-indicators {
    display: flex;
    gap: 0.4rem;
    margin: -0.1rem 0 1rem 74px;
    padding: 0;
}

.step-indicator {
    flex: 1 1 0;
    min-width: 28px;
    padding: 0.35rem 0.2rem;
    border-radius: var(--radius-card);
    color: var(--ink-muted);
    border: 1px solid transparent;
}

.step-indicator.active {
    background: var(--ink);
    color: #fff;
    box-shadow: none;
}

.bpm-control label {
    color: var(--ink);
}

.bpm-control input[type="range"] {
    background: linear-gradient(90deg, var(--accent), #dbeafe);
}

.bpm-control input[type="range"]::-webkit-slider-thumb {
    background: #fff;
    border: 3px solid var(--accent);
    box-shadow: 0 5px 16px rgba(37, 99, 235, 0.24);
}

#bpm-value {
    color: var(--accent);
}

.recorder-section h3,
.piano-header h3,
.stem-packs h3,
.my-beats h3,
.discover-header h2,
.library-header h2,
.profile-header h2 {
    color: var(--ink);
    letter-spacing: 0;
}

.recorder-section h3,
.piano-header {
    text-align: left;
}

.piano-header {
    border-bottom: 1px solid var(--border-soft);
    gap: 0.75rem;
}

.instrument-select {
    background: var(--surface-muted);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-control);
    box-shadow: none;
}

.piano-container {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-card);
}

.piano-key.white {
    border-radius: 0 0 6px 6px;
}

.piano-key.black {
    border-radius: 0 0 5px 5px;
}

.piano-controls {
    align-items: center;
    border-top: 1px solid var(--border-soft);
}

.piano-label {
    color: var(--ink-muted);
    font-weight: 700;
}

.beat-card,
.category-card,
.stem-item,
.recorded-clip,
.export-btn {
    background: var(--surface-strong);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
}

.beat-card {
    overflow: hidden;
}

.beat-visualizer,
.visualizer-container {
    border-radius: var(--radius-card);
    background: linear-gradient(135deg, #111827 0%, #1d4ed8 55%, #059669 100%);
}

.beat-info {
    padding: 1rem 1.1rem 1.1rem;
}

.beat-actions {
    gap: 0.55rem;
    flex-wrap: wrap;
}

.beat-action-btn {
    color: var(--ink-muted);
}

.beat-action-btn.active {
    color: var(--danger);
}

.remix-btn {
    background: var(--surface-muted);
    color: var(--ink);
}

.sound-categories {
    gap: 0.7rem;
}

.category-card {
    padding: 0.9rem 0.7rem;
}

.category-icon,
.stem-cover,
.sound-icon {
    border-radius: var(--radius-card);
    background: #eef4ff;
    color: var(--accent);
    box-shadow: none;
}

.stem-tag {
    background: #ecfdf5;
    color: var(--success);
    border: 1px solid rgba(5, 150, 105, 0.16);
    border-radius: 999px;
    box-shadow: none;
}

.avatar {
    background: linear-gradient(135deg, var(--accent), var(--success));
    color: #fff;
    box-shadow: var(--shadow);
}

.stat-value {
    color: var(--accent);
}

.modal {
    background: rgba(15, 23, 42, 0.58);
}

.modal-content,
.bottom-sheet,
.confirm-content {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border-soft);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

.modal-content,
.bottom-sheet {
    border-radius: 18px 18px 0 0;
}

.confirm-content {
    border-radius: var(--radius-panel);
}

.confirm-icon {
    background: #fff7ed;
    color: var(--warning);
    box-shadow: none;
}

.confirm-icon i {
    color: var(--warning);
}

.progress-dot {
    background: #dbe3ee;
    border: none;
}

.progress-dot.active {
    background: var(--accent);
    box-shadow: none;
}

#toast-container {
    top: 18px;
    width: min(440px, calc(100% - 28px));
    pointer-events: none;
}

.toast {
    width: 100%;
    justify-content: center;
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.2);
}

.toast.success {
    background: rgba(5, 150, 105, 0.94);
    color: #fff;
}

.toast.error {
    background: rgba(225, 29, 72, 0.94);
}

.onboarding-overlay {
    background-color: #3aa9d6;
    background-image:
        repeating-radial-gradient(circle at 50% 42%,
            #FF6F00 0 48px,
            #FF3D00 48px 96px,
            #FFAB00 96px 144px,
            #00B0FF 144px 192px,
            #00E5FF 192px 240px);
    background-size: 100% 100%;
}

.onboarding-content h1 {
    color: var(--ink);
    letter-spacing: 0;
}

.onboarding-content p {
    color: var(--ink-muted);
}

.logo-pulse {
    border-radius: 24px;
    box-shadow: var(--shadow);
    animation: none;
    transform: none;
}

.logo-pulse i {
    background: linear-gradient(135deg, var(--accent), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border: none;
}

@media (min-width: 768px) {
    .app-container {
        max-width: 1120px;
        border-left: 1px solid var(--border-soft);
        border-right: 1px solid var(--border-soft);
    }

    .tab-content {
        padding: 1.5rem 1.75rem 112px;
    }

    #discover-tab.active .beats-feed,
    #saved-tab.active .beats-feed {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sound-categories {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

/* Old 1024px constraints removed — handled by desktop overhaul at end of file */

@media (max-width: 560px) {
    .step-indicators {
        margin-left: 72px;
        overflow-x: auto;
        padding-bottom: 0.2rem;
    }

    .piano-header {
        align-items: stretch;
        flex-direction: column;
    }

    .instrument-select {
        width: 100%;
    }
}

@media (max-width: 390px) {
    .tab-content {
        padding-left: 0.9rem;
        padding-right: 0.9rem;
    }

    .track-label {
        width: 56px;
    }

    .step-indicators {
        margin-left: 64px;
    }

    .sound-categories {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   YOUTHFUL PROFESSIONAL BRAND REFINEMENT
   ============================================ */

:root {
    --sun: #facc15;
    --sun-soft: #fff4b8;
    --sun-deep: #d97706;
    --aqua: #14b8a6;
    --aqua-deep: #0f766e;
    --aqua-soft: #ccfbf1;
    --berry: #ec4899;
    --tangerine: #fb923c;
    --violet-pop: #8b5cf6;
    --sky-pop: #38bdf8;
    --page: #fffaf0;
    --page-tint: #ecfeff;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-strong: #ffffff;
    --surface-muted: #fff9db;
    --border-soft: rgba(113, 63, 18, 0.12);
    --border-strong: rgba(20, 184, 166, 0.26);
    --ink: #1f2937;
    --ink-muted: #667085;
    --accent: var(--sun);
    --accent-strong: #eab308;
    --success: var(--aqua);
    --warning: var(--tangerine);
    --danger: #f43f5e;
    --shadow: 0 22px 55px rgba(113, 63, 18, 0.1);
    --shadow-soft: 0 10px 30px rgba(113, 63, 18, 0.08);
    --shadow-focus: 0 0 0 4px rgba(20, 184, 166, 0.18);
}

body {
    background-color: #3aa9d6;
    background-image:
        repeating-radial-gradient(circle at 50% 42%,
            #FF6F00 0 48px,
            #FF3D00 48px 96px,
            #FFAB00 96px 144px,
            #00B0FF 144px 192px,
            #00E5FF 192px 240px);
    background-size: 100% 100%;
    background-attachment: fixed;
}

.app-container {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.12)),
        transparent;
}

.studio-header,
.sequencer-container,
.bpm-control,
.recorder-section,
.piano-section,
.profile-stats,
.empty-state,
.voice-track-bar,
.piano-track-bar,
.search-bar,
.beat-card,
.category-card,
.stem-item,
.recorded-clip,
.export-btn {
    border-color: var(--border-soft);
    box-shadow: var(--shadow-soft);
}

.studio-header,
.sequencer-container,
.recorder-section,
.piano-section {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 253, 242, 0.9));
}

.project-name-input {
    color: #202124;
    font-weight: 850;
}

.project-date {
    color: var(--aqua-deep);
}

.btn-primary,
.btn-magic,
.btn-confirm-ok {
    background: linear-gradient(135deg, var(--sun), #f59e0b);
    color: #2a2112;
    border-color: rgba(217, 119, 6, 0.28);
    box-shadow: 0 14px 28px rgba(217, 119, 6, 0.18);
}

.btn-primary:hover,
.btn-magic:hover {
    box-shadow: 0 18px 38px rgba(217, 119, 6, 0.22);
}

.btn-play,
.btn-share,
.btn-play-large,
.btn-add-to-beat {
    background: linear-gradient(135deg, var(--aqua), var(--aqua-deep));
    color: #ffffff;
    border-color: rgba(15, 118, 110, 0.22);
    box-shadow: 0 14px 32px rgba(20, 184, 166, 0.22);
}

.btn-play.playing,
.btn-record,
.btn-piano-record,
.btn-clear,
.btn-piano-clear,
.btn-stop-record {
    background: linear-gradient(135deg, #fb7185, var(--danger));
    color: #ffffff;
    border-color: rgba(244, 63, 94, 0.2);
}

.btn-secondary,
.btn-confirm-cancel,
.recorded-clip .btn-play-clip,
.remix-btn {
    background: #ffffff;
    color: var(--ink);
    border-color: var(--border-soft);
}

.btn-skip {
    background: var(--berry);
}

.main-nav {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(20, 184, 166, 0.18);
    box-shadow: 0 20px 48px rgba(15, 118, 110, 0.14);
}

.nav-btn {
    color: var(--ink-muted);
}

.nav-btn.active {
    background: linear-gradient(180deg, #fff8cc, #ffef8a);
    color: #713f12;
}

.nav-btn.active i {
    color: var(--aqua-deep);
}

.genre-btn,
.mood-btn {
    background: rgba(255, 255, 255, 0.88);
    color: var(--ink);
    border-color: rgba(113, 63, 18, 0.12);
}

.genre-btn.active {
    color: #241a05;
    border-color: rgba(113, 63, 18, 0.14);
    box-shadow: 0 12px 26px color-mix(in srgb, var(--genre-color, var(--sun)) 24%, transparent);
}

.mood-btn.active {
    background: linear-gradient(135deg, var(--aqua), var(--aqua-deep));
    color: #fff;
}

.track-label {
    color: #64748b;
    font-weight: 800;
}

.grid-cell {
    background:
        linear-gradient(180deg, #fffefa, #f8fafc);
    border-color: rgba(15, 118, 110, 0.12);
    box-shadow: inset 0 1px 0 #fff, 0 1px 3px rgba(15, 118, 110, 0.04);
}

.grid-cell::after {
    background: linear-gradient(135deg, var(--sun), #f59e0b);
    border-radius: 7px;
}

.grid-cell.active {
    background: #fff6b5;
    border-color: rgba(217, 119, 6, 0.22);
    box-shadow: 0 9px 18px rgba(217, 119, 6, 0.16);
}

.grid-cell.playing {
    background: var(--aqua);
    border-color: var(--aqua-deep);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.14);
}

.step-indicator.active {
    background: linear-gradient(135deg, var(--aqua), var(--aqua-deep));
    color: #fff;
}

.bpm-control {
    background: linear-gradient(135deg, #ffffff, #ecfeff);
}

.bpm-control label {
    color: var(--aqua-deep);
}

.bpm-control input[type="range"] {
    background: linear-gradient(90deg, var(--sun), var(--aqua));
}

.bpm-control input[type="range"]::-webkit-slider-thumb {
    border-color: var(--aqua);
    box-shadow: 0 5px 16px rgba(20, 184, 166, 0.24);
}

#bpm-value,
.stat-value {
    color: var(--aqua-deep);
}

.piano-header {
    border-bottom-color: rgba(20, 184, 166, 0.18);
}

.instrument-select {
    background: #fff8cc;
    border-color: rgba(217, 119, 6, 0.22);
}

.piano-container {
    background:
        linear-gradient(180deg, #253044, #111827);
    border-color: rgba(20, 184, 166, 0.2);
}

.piano-key.white.active {
    background: var(--sun);
}

.piano-key.black.active {
    background: var(--aqua);
}

.piano-controls {
    border-top-color: rgba(20, 184, 166, 0.18);
}

.voice-track-header {
    color: var(--berry);
}

.voice-progress-bar {
    background: linear-gradient(90deg, var(--berry), var(--tangerine));
}

.piano-track-header {
    color: var(--violet-pop);
}

.piano-progress-bar-inline {
    background: linear-gradient(90deg, var(--violet-pop), var(--aqua));
}

.beat-visualizer,
.visualizer-container {
    background:
        linear-gradient(135deg, rgba(31, 41, 55, 0.96), rgba(20, 184, 166, 0.88) 58%, rgba(250, 204, 21, 0.9));
}

.beat-play-overlay {
    color: var(--aqua-deep);
}

.beat-action-btn.active {
    color: var(--berry);
}

.category-icon,
.sound-icon {
    background: linear-gradient(135deg, #fff6b5, #ccfbf1);
    color: var(--aqua-deep);
}

.stem-cover {
    background: linear-gradient(135deg, var(--sun), var(--berry));
    color: #fff;
}

.stem-tag {
    background: #ccfbf1;
    color: var(--aqua-deep);
    border-color: rgba(15, 118, 110, 0.18);
}

.avatar {
    background: linear-gradient(135deg, var(--sun), var(--aqua));
    color: #1f2937;
}

.empty-state i {
    color: var(--sun-deep);
}

.search-bar i {
    color: var(--aqua-deep);
}

.modal-content,
.bottom-sheet,
.confirm-content {
    background: rgba(255, 255, 255, 0.97);
    border-color: rgba(20, 184, 166, 0.16);
}

.confirm-icon {
    background: #fff8cc;
    border-color: rgba(217, 119, 6, 0.2);
}

.confirm-icon i {
    color: var(--sun-deep);
}

.progress-dot.active {
    background: var(--aqua);
}

.toast {
    background: rgba(31, 41, 55, 0.94);
}

.toast.success {
    background: rgba(15, 118, 110, 0.95);
}

.toast.error {
    background: rgba(244, 63, 94, 0.95);
}

.onboarding-overlay {
    background-color: #3aa9d6;
    background-image:
        repeating-radial-gradient(circle at 50% 42%,
            #FF6F00 0 48px,
            #FF3D00 48px 96px,
            #FFAB00 96px 144px,
            #00B0FF 144px 192px,
            #00E5FF 192px 240px);
    background-size: 100% 100%;
}

.logo-pulse {
    background: #fffef7;
    border: 1px solid rgba(217, 119, 6, 0.12);
    box-shadow: 0 24px 60px rgba(113, 63, 18, 0.14);
}

.logo-pulse i {
    background: linear-gradient(135deg, var(--sun-deep), var(--aqua-deep));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.onboarding-content h1 {
    color: #202124;
}

.onboarding-content p {
    color: #667085;
}

.guest-text {
    color: var(--aqua-deep) !important;
}

/* ============================================
   ANTI-TEMPLATE STUDIO PASS
   ============================================ */

:root {
    --paper: #fff8df;
    --paper-clean: #fffdf6;
    --charcoal: #171a1f;
    --charcoal-2: #252a32;
    --line: #262114;
    --mustard: #f4c430;
    --mustard-deep: #c88719;
    --pool: #18b7a0;
    --pool-deep: #0b756c;
    --sherbet: #ff6b6b;
    --grape: #7c5cff;
    --chalk: #f7f4ea;
    --ink: #171a1f;
    --ink-muted: #656b76;
    --surface: #fffdf6;
    --surface-strong: #ffffff;
    --surface-muted: #fff1aa;
    --border-soft: rgba(38, 33, 20, 0.14);
    --border-strong: rgba(38, 33, 20, 0.28);
    --radius-panel: 8px;
    --radius-card: 6px;
    --radius-control: 7px;
    --shadow: 8px 8px 0 rgba(23, 26, 31, 0.1);
    --shadow-soft: 4px 4px 0 rgba(23, 26, 31, 0.08);
    --shadow-focus: 0 0 0 4px rgba(24, 183, 160, 0.22);
    --row-height: 38px;
    --label-width: 68px;
    --cell-width: 36px;
}

html,
body {
    background-color: #3aa9d6;
    background-image:
        repeating-radial-gradient(circle at 50% 42%,
            #FF6F00 0 48px,
            #FF3D00 48px 96px,
            #FFAB00 96px 144px,
            #00B0FF 144px 192px,
            #00E5FF 192px 240px);
    background-size: 100% 100%;
    background-attachment: fixed;
}

.app-container {
    background: transparent;
}

.tab-content {
    scrollbar-gutter: stable;
    padding-top: 1.75rem;
}

.studio-header,
.sequencer-container,
.bpm-control,
.recorder-section,
.piano-section,
.profile-stats,
.empty-state,
.voice-track-bar,
.piano-track-bar,
.search-bar,
.beat-card,
.category-card,
.stem-item,
.recorded-clip,
.export-btn,
.modal-content,
.bottom-sheet,
.confirm-content {
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-soft);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.studio-header {
    position: sticky;
    top: 0.75rem;
    z-index: 20;
    padding: 0.95rem;
    box-shadow: var(--shadow);
}

.studio-header::before {
    content: "LOOPFLOW STUDIO";
    position: absolute;
    top: -11px;
    left: 14px;
    background: var(--pool);
    color: white;
    border: 2px solid var(--line);
    border-radius: 999px;
    padding: 0.16rem 0.58rem;
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.project-name-input {
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 900;
    color: var(--charcoal);
}

.project-date {
    color: var(--pool-deep);
    font-weight: 850;
}

.btn-primary,
.btn-secondary,
.btn-magic,
.btn-clear,
.btn-share,
.btn-play-large,
.btn-record,
.btn-stop-record,
.btn-piano-record,
.btn-piano-clear,
.btn-add-to-beat,
.recorded-clip .btn-play-clip,
.remix-btn,
.mood-btn,
.genre-btn,
.export-btn,
.btn-skip,
.btn-confirm-cancel,
.btn-confirm-ok,
.btn-close,
.instrument-select {
    border: 2px solid var(--line);
    border-radius: var(--radius-control);
    box-shadow: 4px 4px 0 rgba(23, 26, 31, 0.16);
    transform: translate(0, 0);
}

.btn-primary,
.btn-magic,
.btn-confirm-ok {
    background: var(--mustard);
    color: var(--charcoal);
}

.btn-play,
.btn-share,
.btn-play-large,
.btn-add-to-beat {
    background: var(--pool);
    color: #ffffff;
    border: 2px solid var(--line);
    box-shadow: 5px 5px 0 rgba(23, 26, 31, 0.16);
}

.btn-clear,
.btn-piano-clear,
.btn-stop-record,
.btn-record,
.btn-piano-record {
    background: var(--sherbet);
    color: var(--charcoal);
}

.btn-secondary,
.btn-confirm-cancel,
.recorded-clip .btn-play-clip,
.remix-btn {
    background: #ffffff;
}

.btn-primary:hover,
.btn-magic:hover,
.btn-share:hover,
.btn-play:hover,
.btn-play-large:hover,
.category-card:hover,
.stem-item:hover,
.beat-card:hover,
.export-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 7px 7px 0 rgba(23, 26, 31, 0.18);
}

.btn-clear:active,
.btn-play:active,
.btn-share:active,
.mood-btn:active,
.remix-btn:active,
.category-card:active,
.stem-item:active,
.recorded-clip .btn-play-clip:active,
.btn-add-to-beat:active,
.btn-piano-record:active,
.btn-piano-clear:active,
.export-btn:active,
.genre-btn:active,
.btn-primary:active,
.btn-magic:active {
    transform: translate(3px, 3px);
    box-shadow: 1px 1px 0 rgba(23, 26, 31, 0.16);
}

.main-nav {
    background: var(--charcoal);
    border: 2px solid var(--line);
    border-radius: 12px;
    box-shadow: 8px 8px 0 rgba(23, 26, 31, 0.16);
}

.nav-btn {
    color: #d9ded8;
    border-radius: 7px;
}

.nav-btn.active {
    background: var(--mustard);
    color: var(--charcoal);
}

.nav-btn.active i {
    color: var(--pool-deep);
}

.genre-selector,
.mood-filter {
    padding-top: 0.1rem;
}

.genre-btn,
.mood-btn {
    background: #fffdf6;
    color: var(--charcoal);
}

.genre-btn.active {
    background: var(--genre-color, var(--mustard));
    color: var(--charcoal);
}

.mood-btn.active {
    background: var(--pool);
    color: white;
}

.sequencer-container {
    background:
        linear-gradient(90deg, rgba(24, 183, 160, 0.08), transparent 42%),
        var(--paper-clean);
}

.track-label {
    color: var(--charcoal-2);
    font-size: 0.66rem;
    font-weight: 900;
}

.sequencer-grid {
    gap: 0.42rem;
}

.grid-cell {
    background: #fffdf6;
    border: 2px solid rgba(38, 33, 20, 0.16);
    border-radius: 6px;
    box-shadow: inset 0 -3px 0 rgba(23, 26, 31, 0.04);
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    height: var(--row-height, 36px);
    width: 100%;
}

.grid-cell:hover {
    transform: translateY(-2px);
    border-color: var(--line);
    box-shadow: 2px 2px 0 rgba(23, 26, 31, 0.1);
}

.grid-cell:active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.grid-cell:nth-child(4n + 1) {
    background: #fff9d7;
}

.grid-cell::after {
    display: none;
}

.grid-cell.active {
    border-color: var(--line);
    box-shadow: 3px 3px 0 rgba(23, 26, 31, 0.16);
}

/* Per-track active colors */
.grid-cell.active[data-track="0"] { background: var(--orange); }
.grid-cell.active[data-track="1"] { background: var(--hot-pink); }
.grid-cell.active[data-track="2"] { background: var(--cyan); }
.grid-cell.active[data-track="3"] { background: var(--purple); }
.grid-cell.active[data-track="4"] { background: var(--lime); }
.grid-cell.active[data-track="5"] { background: var(--mustard); }
.grid-cell.active[data-track="6"] { background: var(--coral); }
.grid-cell.active[data-track="7"] { background: var(--pool); }

/* Playhead Sweep Highlight for Inactive Cells */
.grid-cell.playing {
    background: #f1f5f9; /* soft slate-100 playhead highlight */
    border-color: rgba(38, 33, 20, 0.32);
    box-shadow: inset 0 -3px 0 rgba(23, 26, 31, 0.08);
}

.grid-cell.playing:nth-child(4n + 1) {
    background: #fef08a; /* soft yellow-200 for grouping highlight when sweep passes */
}

/* Playhead Sweep Highlight for Active Cells (Scale & Glow) */
.grid-cell.active.playing {
    transform: scale(1.08);
    z-index: 5;
}

.grid-cell.active.playing[data-track="0"] { box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.4), 3px 3px 0 var(--line); }
.grid-cell.active.playing[data-track="1"] { box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.4), 3px 3px 0 var(--line); }
.grid-cell.active.playing[data-track="2"] { box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.4), 3px 3px 0 var(--line); }
.grid-cell.active.playing[data-track="3"] { box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.4), 3px 3px 0 var(--line); }
.grid-cell.active.playing[data-track="4"] { box-shadow: 0 0 0 4px rgba(132, 204, 22, 0.4), 3px 3px 0 var(--line); }
.grid-cell.active.playing[data-track="5"] { box-shadow: 0 0 0 4px rgba(244, 196, 48, 0.4), 3px 3px 0 var(--line); }
.grid-cell.active.playing[data-track="6"] { box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.4), 3px 3px 0 var(--line); }
.grid-cell.active.playing[data-track="7"] { box-shadow: 0 0 0 4px rgba(24, 183, 160, 0.4), 3px 3px 0 var(--line); }

.step-indicator {
    background: transparent;
    color: var(--charcoal);
    font-weight: 900;
}

.step-indicator.active {
    background: var(--charcoal);
    color: var(--mustard);
}

.bpm-control {
    background: var(--charcoal);
    color: white;
}

.bpm-control label {
    color: var(--mustard);
}

.bpm-control input[type="range"] {
    background: linear-gradient(90deg, var(--mustard), var(--pool));
}

#bpm-value {
    color: #ffffff;
}

.recorder-section,
.piano-section {
    position: relative;
}

.recorder-section::before,
.piano-section::before {
    content: "";
    position: absolute;
    inset: 0.55rem auto auto 0.55rem;
    width: 9px;
    height: 9px;
    background: var(--sherbet);
    border: 2px solid var(--line);
    border-radius: 50%;
}

.piano-section::before {
    background: var(--pool);
}

.recorder-section h3,
.piano-header h3,
.stem-packs h3,
.my-beats h3,
.discover-header h2,
.library-header h2,
.profile-header h2 {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--charcoal);
    font-weight: 900;
}

.piano-header,
.piano-controls {
    border-color: var(--line);
}

.instrument-select {
    background: var(--mustard);
    color: var(--charcoal);
}

.piano-container {
    background:
        linear-gradient(180deg, #222833, #111418);
    border: 2px solid var(--line);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.04);
}

.piano-key.white {
    background: #fffdf6;
    border-color: var(--line);
    box-shadow: inset 0 -7px 0 rgba(23, 26, 31, 0.09);
}

.piano-key.black {
    background: var(--charcoal);
    border-color: #050607;
}

.piano-key.white.active {
    background: var(--mustard);
}

.piano-key.black.active {
    background: var(--pool);
}

.voice-track-bar,
.piano-track-bar {
    background: var(--charcoal);
    color: white;
}

.voice-track-header {
    color: var(--sherbet);
}

.piano-track-header {
    color: var(--mustard);
}

.voice-progress-bar-container,
.piano-progress-bar-container-inline {
    background: #323844;
    border: 2px solid rgba(255, 255, 255, 0.14);
}

.voice-progress-bar {
    background: var(--sherbet);
}

.piano-progress-bar-inline {
    background: var(--pool);
}

.beat-card {
    overflow: hidden;
}

.beat-visualizer,
.visualizer-container {
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.11) 0 6px, transparent 6px 14px),
        linear-gradient(135deg, #00E5FF 0%, #002A5C 100%);
    border-bottom: 2px solid var(--line);
}

.beat-play-overlay {
    background: var(--paper-clean);
    border: 2px solid var(--line);
    color: var(--pool-deep);
    box-shadow: 5px 5px 0 rgba(23, 26, 31, 0.16);
}

.beat-title {
    color: var(--charcoal);
    font-weight: 900;
}

.beat-author,
.stem-artist,
.profile-header p,
.stat-label,
.sound-details p,
.search-bar input::placeholder,
.piano-label {
    color: var(--ink-muted);
}

.beat-action-btn {
    color: var(--ink-muted);
}

.beat-action-btn.active {
    color: var(--sherbet);
}

.category-card,
.stem-item {
    background: #fffdf6;
}

.category-icon,
.sound-icon {
    background: var(--mustard);
    color: var(--charcoal);
    border: 2px solid var(--line);
}

.stem-cover {
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.18) 0 5px, transparent 5px 11px),
        var(--pool);
    border: 2px solid var(--line);
}

.stem-tag {
    background: var(--mustard);
    color: var(--charcoal);
    border: 2px solid var(--line);
}

.search-bar {
    background: #fffdf6;
}

.search-bar i {
    color: var(--pool-deep);
}

.avatar {
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.2) 0 6px, transparent 6px 12px),
        var(--mustard);
    border: 2px solid var(--line);
    color: var(--charcoal);
}

.stat-value {
    color: var(--pool-deep);
    font-weight: 900;
}

.empty-state {
    background: #fffdf6;
}

.empty-state i {
    color: var(--mustard-deep);
}

.modal {
    background: rgba(23, 26, 31, 0.62);
}

.modal-content,
.bottom-sheet {
    border-radius: 12px 12px 0 0;
}

.btn-close {
    background: var(--mustard);
    color: var(--charcoal);
}

.progress-dot {
    background: #d7d1bd;
    border: 2px solid var(--line);
}

.progress-dot.active {
    background: var(--pool);
}

.toast {
    background: var(--charcoal);
    border: 2px solid var(--line);
    border-radius: 8px;
    box-shadow: 5px 5px 0 rgba(23, 26, 31, 0.2);
}

.toast.success {
    background: var(--pool-deep);
}

.toast.error {
    background: var(--sherbet);
    color: var(--charcoal);
}

.onboarding-overlay {
    background-color: #3aa9d6;
    background-image:
        repeating-radial-gradient(circle at 50% 42%,
            #FF6F00 0 48px,
            #FF3D00 48px 96px,
            #FFAB00 96px 144px,
            #00B0FF 144px 192px,
            #00E5FF 192px 240px);
    background-size: 100% 100%;
}

.onboarding-content {
    position: relative;
}

.onboarding-content::before {
    content: "MAKE A LOOP";
    display: inline-flex;
    margin-bottom: 1rem;
    background: var(--charcoal);
    color: var(--mustard);
    border: 2px solid var(--line);
    border-radius: 999px;
    padding: 0.28rem 0.72rem;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.logo-pulse {
    background: #fffdf6;
    border: 2px solid var(--line);
    border-radius: 18px;
    box-shadow: 9px 9px 0 rgba(23, 26, 31, 0.14);
}

.logo-pulse i {
    background: linear-gradient(135deg, var(--mustard-deep), var(--pool-deep));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.onboarding-content h1 {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--charcoal);
    font-weight: 900;
}

.onboarding-content p {
    color: var(--ink-muted);
}

.guest-text {
    color: var(--pool-deep) !important;
}

@media (min-width: 768px) {
    .tab-content {
        max-width: 1060px;
        margin: 0 auto;
    }

    #create-tab.active {
        display: block;
    }

    .piano-keys {
        justify-content: center;
    }
}

@media (max-width: 767px) {
    html,
    body {
        background-color: #3aa9d6;
    background-image:
        repeating-radial-gradient(circle at 50% 42%,
            #FF6F00 0 48px,
            #FF3D00 48px 96px,
            #FFAB00 96px 144px,
            #00B0FF 144px 192px,
            #00E5FF 192px 240px);
    background-size: 100% 100%;
        background-attachment: fixed;
    }

    .studio-header {
        position: static;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .studio-actions {
        flex-wrap: wrap;
        width: 100%;
        justify-content: space-between;
    }

    .studio-actions button {
        flex: 1;
        justify-content: center;
        min-width: calc(50% - 0.5rem);
    }

    .controls-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .controls-row .bpm-control {
        width: 100%;
        margin-bottom: 0;
    }
}

@media (min-width: 768px) {
    #create-tab.active {
        display: block;
        max-width: 760px;
    }

    #create-tab .studio-header,
    #create-tab .genre-selector,
    #create-tab .sequencer-container,
    #create-tab .step-indicators,
    #create-tab .bpm-control,
    #create-tab .btn-share,
    #create-tab .recorder-section,
    #create-tab .piano-section {
        grid-area: auto;
        grid-column: auto;
        grid-row: auto;
    }

    #create-tab .btn-share {
        margin-top: 0;
    }
}

/* ============================================
   STUDIO TOOLS: MIXER, FX, PATTERNS
   ============================================ */

/* Controls Row */
.controls-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.controls-row .bpm-control {
    flex: 1;
    margin-bottom: 0;
    min-width: 0;
}

/* Controls Row 2 */
.controls-row-2 {
    align-items: center;
    flex-wrap: wrap;
}

.btn-tool {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 0.85rem;
    border: 2px solid var(--line, #262114);
    border-radius: var(--radius-control, 7px);
    background: var(--surface, #fffdf6);
    color: var(--ink, #171a1f);
    font-family: 'Outfit', sans-serif;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 3px 3px 0 rgba(23, 26, 31, 0.12);
    transition: all 160ms ease;
}

.btn-tool:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 rgba(23, 26, 31, 0.12);
}

.btn-tool.active {
    background: var(--pool, #18b7a0);
    color: #fff;
}

/* Pattern Bank */
.pattern-bank {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
}

.pattern-bank-label {
    font-size: 0.72rem;
    font-weight: 900;
    color: var(--ink-muted, #656b76);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pattern-bank-btns {
    display: flex;
    gap: 0.3rem;
}

.pattern-btn {
    width: 34px;
    height: 34px;
    border: 2px solid var(--line, #262114);
    border-radius: 6px;
    background: var(--surface, #fffdf6);
    color: var(--ink, #171a1f);
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 3px 3px 0 rgba(23, 26, 31, 0.12);
    transition: all 160ms ease;
}

.pattern-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 rgba(23, 26, 31, 0.12);
}

.pattern-btn.active {
    background: var(--mustard, #f4c430);
    color: var(--charcoal, #171a1f);
    box-shadow: 4px 4px 0 rgba(23, 26, 31, 0.16);
}

/* Mixer Strip */
.mixer-strip {
    background: var(--surface, #fffdf6);
    border: 2px solid var(--line, #262114);
    border-radius: var(--radius-panel, 8px);
    box-shadow: var(--shadow-soft, 4px 4px 0 rgba(23, 26, 31, 0.08));
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.mixer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.85rem;
    border-bottom: 2px solid var(--line, #262114);
    background: var(--charcoal, #171a1f);
    color: var(--mustard, #f4c430);
}

.mixer-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.btn-mixer-toggle {
    background: none;
    border: none;
    color: var(--mustard, #f4c430);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.2rem;
    transition: transform 200ms ease;
}

.btn-mixer-toggle.collapsed {
    transform: rotate(-90deg);
}

.mixer-tracks {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0;
}

.mixer-tracks.collapsed {
    display: none;
}

.mixer-track {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.6rem 0.2rem;
    border-right: 1px solid rgba(38, 33, 20, 0.1);
}

.mixer-track:last-child {
    border-right: none;
}

.mixer-track-name {
    font-size: 0.55rem;
    font-weight: 900;
    color: var(--ink-muted, #656b76);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.mixer-vol-slider {
    -webkit-appearance: none;
    width: 4px;
    height: 50px;
    background: rgba(0,0,0,0.08);
    border-radius: 3px;
    writing-mode: vertical-lr;
    direction: rtl;
}

.mixer-vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 8px;
    background: var(--pool, #18b7a0);
    border-radius: 2px;
    border: 1px solid var(--line, #262114);
    cursor: pointer;
}

.mixer-btn-row {
    display: flex;
    gap: 0.15rem;
}

.btn-mute, .btn-solo {
    width: 20px;
    height: 18px;
    border: 1.5px solid var(--line, #262114);
    border-radius: 3px;
    font-size: 0.5rem;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 120ms ease;
}

.btn-mute {
    background: var(--surface, #fffdf6);
    color: var(--ink, #171a1f);
}

.btn-mute.active {
    background: var(--sherbet, #ff6b6b);
    color: #fff;
}

.btn-solo {
    background: var(--surface, #fffdf6);
    color: var(--ink, #171a1f);
}

.btn-solo.active {
    background: var(--mustard, #f4c430);
    color: var(--charcoal, #171a1f);
}

/* Effects Rack */
.fx-rack {
    background: var(--surface, #fffdf6);
    border: 2px solid var(--line, #262114);
    border-radius: var(--radius-panel, 8px);
    box-shadow: var(--shadow-soft, 4px 4px 0 rgba(23, 26, 31, 0.08));
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.fx-rack-header {
    padding: 0.55rem 0.85rem;
    border-bottom: 2px solid var(--line, #262114);
    background: var(--charcoal, #171a1f);
    color: var(--pool, #18b7a0);
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fx-rack-header span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fx-context-badge {
    font-size: 0.6rem;
    background: var(--pool);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: bold;
    letter-spacing: 0.05em;
    cursor: pointer;
}
.fx-context-badge.global {
    background: #656b76;
}

/* Modular Effects Processor */
.fx-modular-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.fx-card {
    background: var(--surface, #fffdf6);
    border: 2px solid var(--line, #262114);
    border-radius: 12px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: var(--shadow-soft, 4px 4px 0 rgba(23, 26, 31, 0.08));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.55;
    filter: grayscale(30%);
}

/* Active Glow states per FX card */
.fx-card.active {
    opacity: 1;
    filter: none;
}

#fx-card-reverb.active {
    border-color: var(--cyan);
    box-shadow: 4px 4px 0 rgba(6, 182, 212, 0.15), 0 0 12px rgba(6, 182, 212, 0.1);
}

#fx-card-delay.active {
    border-color: var(--hot-pink);
    box-shadow: 4px 4px 0 rgba(236, 72, 153, 0.15), 0 0 12px rgba(236, 72, 153, 0.1);
}

#fx-card-distortion.active {
    border-color: var(--yellow);
    box-shadow: 4px 4px 0 rgba(251, 191, 36, 0.15), 0 0 12px rgba(251, 191, 36, 0.1);
}

#fx-card-chorus.active {
    border-color: var(--purple);
    box-shadow: 4px 4px 0 rgba(139, 92, 246, 0.15), 0 0 12px rgba(139, 92, 246, 0.1);
}

/* Header */
.fx-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(38, 33, 20, 0.08);
    padding-bottom: 0.5rem;
}

.fx-name {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--ink, #171a1f);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Color Coding for Icons when active */
#fx-card-reverb.active .fx-name i { color: var(--cyan); }
#fx-card-delay.active .fx-name i { color: var(--hot-pink); }
#fx-card-distortion.active .fx-name i { color: var(--yellow-dark); }
#fx-card-chorus.active .fx-name i { color: var(--purple); }

/* Switch Toggle Styling */
.fx-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.fx-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.fx-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(38, 33, 20, 0.15);
    border: 2px solid var(--line, #262114);
    transition: .3s;
    border-radius: 20px;
}

.fx-switch-slider:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 3px;
    bottom: 3px;
    background-color: var(--line, #262114);
    transition: .3s;
    border-radius: 50%;
}

.fx-switch input:checked + .fx-switch-slider {
    background-color: var(--teal, #10B981);
}

#fx-card-reverb .fx-switch input:checked + .fx-switch-slider { background-color: var(--cyan); }
#fx-card-delay .fx-switch input:checked + .fx-switch-slider { background-color: var(--hot-pink); }
#fx-card-distortion .fx-switch input:checked + .fx-switch-slider { background-color: var(--yellow); }
#fx-card-chorus .fx-switch input:checked + .fx-switch-slider { background-color: var(--purple); }

.fx-switch input:checked + .fx-switch-slider:before {
    transform: translateX(18px);
    background-color: #fff;
}

/* Card Body & Params */
.fx-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.fx-param {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.fx-param-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 700;
}

.fx-param-info label {
    color: var(--ink-muted, #656b76);
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.04em;
}

.fx-param-info span {
    color: var(--ink, #171a1f);
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
}

/* Parameter Sliders */
.fx-param-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(38, 33, 20, 0.08);
    border-radius: 4px;
    border: none;
    outline: none;
    transition: background 0.2s;
}

.fx-card:not(.active) .fx-param-slider,
.fx-card:not(.active) .fx-param-select {
    pointer-events: none;
    opacity: 0.5;
}

.fx-param-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--surface-strong, #ffffff);
    border: 2px solid var(--line, #262114);
    cursor: pointer;
    box-shadow: 1px 1px 0 rgba(23, 26, 31, 0.15);
    transition: transform 0.1s, background-color 0.2s;
}

#fx-card-reverb.active .fx-param-slider::-webkit-slider-thumb { background: var(--cyan); }
#fx-card-delay.active .fx-param-slider::-webkit-slider-thumb { background: var(--hot-pink); }
#fx-card-distortion.active .fx-param-slider::-webkit-slider-thumb { background: var(--yellow); }
#fx-card-chorus.active .fx-param-slider::-webkit-slider-thumb { background: var(--purple); }

.fx-param-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Select Dropdown */
.fx-param-select {
    padding: 0.25rem 0.5rem;
    border: 2px solid var(--line, #262114);
    border-radius: 6px;
    background: var(--surface-strong, #ffffff);
    color: var(--ink, #171a1f);
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    outline: none;
    cursor: pointer;
    box-shadow: 1px 1px 0 rgba(23, 26, 31, 0.08);
}



/* ============================================
   PER-TRACK RANDOMIZE BUTTONS
   ============================================ */
.track-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
}

.btn-rand-track {
    width: 22px;
    height: 22px;
    border: 1.5px solid var(--line, #262114);
    border-radius: 5px;
    background: var(--surface, #fffdf6);
    color: var(--purple);
    font-size: 0.55rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 1px 1px 0 rgba(23, 26, 31, 0.1);
    transition: all 140ms ease;
    opacity: 0.5;
}

.track-label:hover .btn-rand-track {
    opacity: 1;
}

.btn-rand-track:hover {
    background: var(--purple);
    color: #fff;
    transform: rotate(20deg);
}

.btn-rand-track:active {
    transform: rotate(180deg) scale(0.9);
}

/* ============================================
   DJ PERFORMANCE TOOLS ROW
   ============================================ */
.controls-row-3 {
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-tool-accent {
    background: linear-gradient(135deg, #1a1a2e, #16213e) !important;
    color: #fff !important;
    border-color: var(--purple) !important;
    box-shadow: 3px 3px 0 rgba(139, 92, 246, 0.2) !important;
    position: relative;
    overflow: hidden;
}

.btn-tool-accent::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.15), transparent);
    transition: left 400ms ease;
}

.btn-tool-accent:hover::before {
    left: 100%;
}

.btn-tool-accent:hover {
    border-color: var(--hot-pink) !important;
    box-shadow: 3px 3px 0 rgba(236, 72, 153, 0.3) !important;
}

.btn-tool-accent.active {
    background: linear-gradient(135deg, var(--purple), var(--hot-pink)) !important;
    border-color: #fff !important;
    animation: dj-pulse 1s ease-in-out infinite;
}

@keyframes dj-pulse {
    0%, 100% { box-shadow: 3px 3px 0 rgba(139, 92, 246, 0.3); }
    50% { box-shadow: 3px 3px 12px rgba(236, 72, 153, 0.5); }
}

/* ============================================
   LIVE AUDIO VISUALIZER
   ============================================ */
.live-visualizer-section {
    background: var(--surface, #fffdf6);
    border: 2px solid var(--line, #262114);
    border-radius: var(--radius-panel, 8px);
    box-shadow: var(--shadow-soft, 4px 4px 0 rgba(23, 26, 31, 0.08));
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.live-vis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.85rem;
    border-bottom: 2px solid var(--line, #262114);
    background: #0f0f1a;
    color: var(--cyan);
}

.live-vis-header h3 {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.vis-mode-selector {
    display: flex;
    gap: 0.25rem;
}

.vis-mode-btn {
    padding: 0.25rem 0.6rem;
    border: 1.5px solid rgba(6, 182, 212, 0.3);
    border-radius: 4px;
    background: transparent;
    color: rgba(6, 182, 212, 0.6);
    font-family: 'Inter', sans-serif;
    font-size: 0.6rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 160ms ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.vis-mode-btn.active {
    background: var(--cyan);
    color: #0f0f1a;
    border-color: var(--cyan);
}

.vis-mode-btn:hover:not(.active) {
    border-color: var(--cyan);
    color: var(--cyan);
}

.live-visualizer-canvas {
    width: 100%;
    height: 120px;
    display: block;
    background: #0a0a14;
}

/* ============================================
   CHORD PROGRESSION GENERATOR
   ============================================ */
.chord-generator-section {
    background: var(--surface, #fffdf6);
    border: 2px solid var(--line, #262114);
    border-radius: var(--radius-panel, 8px);
    box-shadow: var(--shadow-soft, 4px 4px 0 rgba(23, 26, 31, 0.08));
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.chord-gen-header {
    padding: 0.6rem 0.85rem;
    border-bottom: 2px solid var(--line, #262114);
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: var(--yellow);
}

.chord-gen-header h3 {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.chord-key-row {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.key-select-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
}

.key-select-group label {
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
    font-weight: 900;
    color: var(--ink-muted, #656b76);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.chord-progression-btns {
    display: flex;
    gap: 0.4rem;
    padding: 0.65rem 0.85rem;
    overflow-x: auto;
    flex-wrap: wrap;
}

.chord-progression-btns::-webkit-scrollbar {
    display: none;
}

.chord-btn {
    padding: 0.5rem 0.85rem;
    border: 2px solid var(--line, #262114);
    border-radius: 6px;
    background: var(--surface, #fffdf6);
    color: var(--ink, #171a1f);
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 2px 2px 0 rgba(23, 26, 31, 0.1);
    transition: all 160ms ease;
    white-space: nowrap;
    min-width: 50px;
    text-align: center;
}

.chord-btn:hover {
    transform: translateY(-2px);
    box-shadow: 3px 4px 0 rgba(23, 26, 31, 0.15);
}

.chord-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 rgba(23, 26, 31, 0.1);
}

.chord-btn.active {
    background: var(--yellow);
    color: var(--charcoal, #171a1f);
    border-color: var(--yellow-dark);
    box-shadow: 3px 3px 0 rgba(251, 191, 36, 0.3);
}

.chord-btn.minor-chord {
    border-color: var(--purple);
}

.chord-btn.minor-chord.active {
    background: var(--purple);
    color: #fff;
    border-color: #7c3aed;
}

.chord-btn.dim-chord {
    border-color: var(--coral);
}

/* Diatonic Chord Processor */
.chord-section-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--ink-muted, #656b76);
    letter-spacing: 0.05em;
    padding: 0.6rem 0.85rem 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.chord-pads-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding: 0.5rem 0.85rem 0.85rem;
}

@media (max-width: 500px) {
    .chord-pads-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.chord-pad {
    padding: 0.75rem 0.5rem;
    border: 2px solid var(--line, #262114);
    border-radius: 8px;
    background: var(--surface-strong, #ffffff);
    color: var(--ink, #171a1f);
    cursor: pointer;
    box-shadow: 2px 2px 0 rgba(23, 26, 31, 0.1);
    transition: all 120ms cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    text-align: center;
}

.chord-pad-degree {
    font-size: 0.55rem;
    font-weight: 800;
    color: var(--ink-muted, #656b76);
    text-transform: uppercase;
}

.chord-pad-name {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 800;
}

.chord-pad:hover {
    transform: translateY(-2px);
    box-shadow: 3px 4px 0 rgba(23, 26, 31, 0.15);
}

.chord-pad:active, .chord-pad.active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 rgba(23, 26, 31, 0.1);
}

/* Pad Color Types */
.chord-pad.major-pad {
    border-color: var(--yellow);
}
.chord-pad.major-pad:active, .chord-pad.major-pad.active {
    background: var(--yellow);
    color: var(--charcoal, #171a1f);
    border-color: var(--yellow-dark);
}

.chord-pad.minor-pad {
    border-color: var(--purple);
}
.chord-pad.minor-pad:active, .chord-pad.minor-pad.active {
    background: var(--purple);
    color: #fff;
    border-color: #7c3aed;
}

.chord-pad.dim-pad {
    border-color: var(--coral);
}
.chord-pad.dim-pad:active, .chord-pad.dim-pad.active {
    background: var(--coral);
    color: #fff;
    border-color: #e11d48;
}

/* Chord Recording Controls */
.chord-recording-row {
    display: flex;
    gap: 0.5rem;
    padding: 0 0.85rem 0.85rem;
}

.btn-chord-record, .btn-chord-play-prog, .btn-chord-clear {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 0.5rem;
    border: 2px solid var(--line, #262114);
    border-radius: 6px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 2px 2px 0 rgba(23, 26, 31, 0.1);
    transition: all 120ms ease;
    white-space: nowrap;
}

.btn-chord-record {
    background: var(--surface-strong, #ffffff);
    color: var(--ink, #171a1f);
}
.btn-chord-record:hover {
    background: #fff5f5;
    border-color: var(--coral);
}
.btn-chord-record.recording {
    background: var(--coral);
    color: #fff;
    border-color: #e11d48;
    animation: recording-pulse 1s infinite alternate;
}

@keyframes recording-pulse {
    from { box-shadow: 0 0 4px rgba(244, 63, 94, 0.4); }
    to { box-shadow: 0 0 12px rgba(244, 63, 94, 0.8); }
}

.btn-chord-play-prog {
    background: linear-gradient(135deg, var(--teal), var(--cyan));
    color: #fff;
    border-color: var(--line, #262114);
}
.btn-chord-play-prog:hover {
    transform: translateY(-1px);
    box-shadow: 3px 3px 0 rgba(16, 185, 129, 0.25);
}

.btn-chord-clear {
    background: var(--surface-strong, #ffffff);
    color: var(--ink-muted, #656b76);
}
.btn-chord-clear:hover {
    background: #f3f4f6;
    color: var(--ink, #171a1f);
}

.btn-chord-record:active, .btn-chord-play-prog:active, .btn-chord-clear:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 rgba(0,0,0,0.1);
}

/* ============================================
   MASTER OUTPUT SECTION
   ============================================ */
.master-output-section {
    background: var(--surface, #fffdf6);
    border: 2px solid var(--line, #262114);
    border-radius: var(--radius-panel, 8px);
    box-shadow: var(--shadow-soft, 4px 4px 0 rgba(23, 26, 31, 0.08));
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.master-header {
    padding: 0.6rem 0.85rem;
    border-bottom: 2px solid var(--line, #262114);
    background: var(--charcoal, #171a1f);
    color: var(--coral);
}

.master-header h3 {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.master-controls {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 0.85rem;
    align-items: center;
    justify-content: space-between;
}

.master-control-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.master-control-item label {
    font-family: 'Inter', sans-serif;
    font-size: 0.6rem;
    font-weight: 900;
    color: var(--ink-muted, #656b76);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.master-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 4px;
    border: none;
    outline: none;
}

.master-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--coral), #e11d48);
    border: 2px solid var(--line, #262114);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 2px 2px 0 rgba(23, 26, 31, 0.1);
}

.master-val {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 900;
    color: var(--coral);
    min-width: 36px;
    text-align: center;
}

.btn-limiter {
    padding: 0.35rem 0.75rem;
    border: 2px solid var(--line, #262114);
    border-radius: 5px;
    background: var(--surface, #fffdf6);
    color: var(--ink, #171a1f);
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 2px 2px 0 rgba(23, 26, 31, 0.1);
    transition: all 160ms ease;
}

.btn-limiter.active {
    background: var(--coral);
    color: #fff;
    border-color: #e11d48;
    box-shadow: 2px 2px 0 rgba(244, 63, 94, 0.3);
}

.master-meter {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.85rem 0.65rem;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.meter-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.55rem;
    font-weight: 900;
    color: var(--ink-muted, #656b76);
}

.meter-bar-container {
    flex: 1;
    height: 10px;
    background: rgba(0,0,0,0.04);
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.06);
    overflow: hidden;
}

.meter-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--teal), var(--yellow), var(--coral));
    border-radius: 2px;
    transition: width 60ms linear;
}

/* ============================================
   PIANO HEADER CONTROLS & SCALE LOCK
   ============================================ */
.piano-header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-scale-lock {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.btn-scale-lock.active {
    background: var(--hot-pink) !important;
    color: #fff !important;
    border-color: #be185d !important;
}

.btn-scale-lock.active i::before {
    content: "\f023"; /* fa-lock */
}

.piano-key.scale-disabled {
    opacity: 0.25;
    pointer-events: none;
    filter: grayscale(1);
}

/* ============================================
   PERFORMANCE & BUG FIXES
   ============================================ */

/* Disable all backdrop-filters to eliminate severe repaint delays during page switches */
* {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* ============================================
   DAW ARRANGEMENT TIMELINE
   ============================================ */

/* Song Transport Bar */
.song-transport {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--charcoal, #171a1f);
    border: 2px solid var(--line, #262114);
    border-radius: var(--radius-panel, 8px);
    box-shadow: var(--shadow, 8px 8px 0 rgba(23, 26, 31, 0.1));
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 20;
}

.transport-left {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.transport-center {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex: 1;
    justify-content: center;
}

.transport-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.transport-btn {
    width: 40px;
    height: 40px;
    border: 2px solid var(--line, #262114);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.08);
    color: #d9ded8;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2);
    transition: all 160ms ease;
}

.transport-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.25);
}

.transport-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2);
}

.transport-btn.active {
    background: var(--pool, #18b7a0);
    color: #fff;
}

.transport-play {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--pool, #18b7a0);
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.25);
}

.transport-play.playing {
    background: var(--sherbet, #ff6b6b);
    animation: transport-pulse 0.8s ease-in-out infinite;
}

@keyframes transport-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

.transport-export {
    width: auto;
    padding: 0 0.8rem;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.02em;
    background: var(--mustard, #f4c430);
    color: var(--charcoal, #171a1f);
}

.transport-position {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    font-family: 'Inter', monospace, sans-serif;
}

.position-label {
    font-size: 0.6rem;
    font-weight: 900;
    color: var(--mustard, #f4c430);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.position-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    min-width: 28px;
    text-align: center;
    line-height: 1;
}

.position-sep {
    font-size: 1rem;
    color: rgba(255,255,255,0.3);
    font-weight: 400;
}

.position-total {
    font-size: 1rem;
    color: rgba(255,255,255,0.5);
    font-weight: 700;
}

.transport-bpm {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--pool, #18b7a0);
    font-size: 0.78rem;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
}

.song-length-control {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.transport-btn-sm {
    width: 26px;
    height: 26px;
    border: 2px solid var(--line, #262114);
    border-radius: 5px;
    background: rgba(255,255,255,0.08);
    color: #d9ded8;
    font-size: 0.65rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
    transition: all 160ms ease;
}

.transport-btn-sm:active {
    transform: translate(1px, 1px);
    box-shadow: 0 0 0;
}

.song-length-val {
    font-size: 0.7rem;
    font-weight: 800;
    color: rgba(255,255,255,0.7);
    font-family: 'Inter', sans-serif;
    min-width: 52px;
    text-align: center;
}

/* Pattern Palette */
.arrange-pattern-palette {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    background: var(--surface, #fffdf6);
    border: 2px solid var(--line, #262114);
    border-radius: var(--radius-panel, 8px);
    box-shadow: var(--shadow-soft, 4px 4px 0 rgba(23, 26, 31, 0.08));
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.palette-label {
    font-size: 0.72rem;
    font-weight: 900;
    color: var(--ink-muted, #656b76);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: 'Inter', sans-serif;
}

.palette-btns {
    display: flex;
    gap: 0.25rem;
}

.palette-btn {
    width: 32px;
    height: 32px;
    border: 2px solid var(--line, #262114);
    border-radius: 6px;
    background: var(--surface, #fffdf6);
    color: var(--ink, #171a1f);
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 3px 3px 0 rgba(23, 26, 31, 0.12);
    transition: all 160ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.palette-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 rgba(23, 26, 31, 0.12);
}

.palette-btn.active {
    background: var(--mustard, #f4c430);
    color: var(--charcoal, #171a1f);
    box-shadow: 4px 4px 0 rgba(23, 26, 31, 0.16);
}

.palette-erase {
    background: var(--sherbet, #ff6b6b);
    color: #fff;
}

.palette-erase.active {
    background: var(--sherbet, #ff6b6b);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.3), 4px 4px 0 rgba(23, 26, 31, 0.16);
}

/* Timeline Wrapper */
.timeline-wrapper {
    background: var(--surface, #fffdf6);
    border: 2px solid var(--line, #262114);
    border-radius: var(--radius-panel, 8px);
    box-shadow: var(--shadow, 8px 8px 0 rgba(23, 26, 31, 0.1));
    overflow: hidden;
    margin-bottom: 0.75rem;
}

/* Timeline Header (bar numbers) */
.timeline-header {
    display: flex;
    border-bottom: 2px solid var(--line, #262114);
    background: var(--charcoal, #171a1f);
    position: sticky;
    top: 0;
    z-index: 5;
}

.timeline-track-spacer {
    width: 100px;
    min-width: 100px;
    border-right: 2px solid var(--line, #262114);
}

.bar-headers {
    display: flex;
    overflow-x: hidden;
    flex: 1;
}

.bar-header {
    min-width: 80px;
    width: 80px;
    padding: 0.4rem 0;
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 0.62rem;
    font-weight: 900;
    color: var(--mustard, #f4c430);
    letter-spacing: 0.04em;
    border-right: 1px solid rgba(255,255,255,0.06);
    user-select: none;
}

.bar-header:nth-child(4n+1) {
    background: rgba(244, 196, 48, 0.06);
}

/* Timeline Body */
.timeline-body {
    display: flex;
    max-height: 440px;
    overflow: hidden;
}

/* Track Sidebar */
.timeline-tracks-sidebar {
    width: 100px;
    min-width: 100px;
    border-right: 2px solid var(--line, #262114);
    background: linear-gradient(180deg, #f8f6ee, #fffdf6);
    overflow-y: auto;
}

.timeline-track-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid rgba(38, 33, 20, 0.1);
    height: 52px;
    min-height: 52px;
}

.timeline-track-name {
    font-family: 'Inter', sans-serif;
    font-size: 0.6rem;
    font-weight: 900;
    color: var(--charcoal, #171a1f);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-track-icon {
    font-size: 0.7rem;
    color: var(--pool, #18b7a0);
    width: 16px;
    text-align: center;
}

.track-mini-controls {
    display: flex;
    gap: 0.15rem;
}

.track-mini-btn {
    width: 18px;
    height: 16px;
    border: 1.5px solid var(--line, #262114);
    border-radius: 3px;
    font-size: 0.45rem;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 120ms ease;
    background: var(--surface, #fffdf6);
    color: var(--ink, #171a1f);
}

.track-mini-btn.muted {
    background: var(--sherbet, #ff6b6b);
    color: #fff;
}

.track-mini-btn.soloed {
    background: var(--mustard, #f4c430);
    color: var(--charcoal, #171a1f);
}

/* Timeline Grid Scroll Container */
.timeline-grid-scroll {
    flex: 1;
    overflow: auto;
    position: relative;
}

/* Timeline Grid */
.timeline-grid {
    display: grid;
    width: max-content;
    min-width: 100%;
    position: relative;
}

.timeline-row {
    display: flex;
    border-bottom: 1px solid rgba(38, 33, 20, 0.1);
    height: 52px;
    min-height: 52px;
}

.timeline-cell {
    min-width: 80px;
    width: 80px;
    height: 100%;
    border-right: 1px solid rgba(38, 33, 20, 0.08);
    cursor: pointer;
    position: relative;
    transition: background-color 120ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-cell:nth-child(4n+1) {
    border-right-color: rgba(38, 33, 20, 0.18);
}

.timeline-cell:hover {
    background: rgba(244, 196, 48, 0.08);
}

.timeline-cell.has-clip {
    background: transparent;
    cursor: pointer;
}

/* Timeline Clips */
.timeline-clip {
    position: absolute;
    inset: 3px;
    border-radius: 5px;
    border: 2px solid var(--line, #262114);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 900;
    color: var(--charcoal, #171a1f);
    box-shadow: 2px 2px 0 rgba(23, 26, 31, 0.12);
    cursor: pointer;
    transition: all 140ms ease;
    user-select: none;
    overflow: hidden;
}

.timeline-clip::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0,0,0,0.15);
    border-radius: 3px 3px 0 0;
}

.timeline-clip:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 rgba(23, 26, 31, 0.18);
    filter: brightness(1.05);
}

.timeline-clip:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 rgba(23, 26, 31, 0.12);
}

/* Pattern clip colors */
.timeline-clip[data-pattern="A"] { background: var(--mustard, #f4c430); }
.timeline-clip[data-pattern="B"] { background: var(--pool, #18b7a0); }
.timeline-clip[data-pattern="C"] { background: var(--sherbet, #ff6b6b); }
.timeline-clip[data-pattern="D"] { background: var(--grape, #7c5cff); color: #fff; }
.timeline-clip[data-pattern="E"] { background: var(--sky-pop, #38bdf8); }
.timeline-clip[data-pattern="F"] { background: var(--tangerine, #fb923c); }
.timeline-clip[data-pattern="G"] { background: #a3e635; }
.timeline-clip[data-pattern="H"] { background: #f0abfc; }
.timeline-clip[data-pattern="VOICE"] { background: #14b8a6; color: #fff; }

.palette-divider {
    width: 2px;
    height: 24px;
    background: rgba(38, 33, 20, 0.1);
    margin: 0 4px;
}

.palette-voice {
    background: #14b8a6;
    color: #fff;
    padding: 0 10px;
    width: auto;
}
.palette-voice.active {
    background: #0f9183;
    border-color: #0f9183;
}

/* Clip has-content indicator */
.timeline-clip .clip-indicator {
    position: absolute;
    bottom: 3px;
    right: 4px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(0,0,0,0.25);
}

.timeline-clip .clip-indicator.has-data {
    background: var(--charcoal, #171a1f);
}

/* Song Playhead */
.song-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    z-index: 10;
    pointer-events: none;
    transition: left 50ms linear;
    display: none;
}

.song-playhead.active {
    display: block;
}

.playhead-head {
    width: 12px;
    height: 12px;
    background: var(--sherbet, #ff6b6b);
    border: 2px solid var(--line, #262114);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg) translateX(-3px);
    position: absolute;
    top: -2px;
    left: -5px;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

.playhead-line {
    position: absolute;
    top: 10px;
    bottom: 0;
    left: 0;
    width: 2px;
    background: var(--sherbet, #ff6b6b);
    box-shadow: 0 0 6px rgba(255, 107, 107, 0.4);
}

/* Arrange Info */
.arrange-info {
    padding: 0.8rem 1rem;
    background: rgba(24, 183, 160, 0.06);
    border: 2px solid var(--line, #262114);
    border-radius: var(--radius-panel, 8px);
    margin-bottom: 0.75rem;
}

.arrange-info p {
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    color: var(--ink-muted, #656b76);
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.arrange-info i {
    color: var(--pool, #18b7a0);
    margin-top: 2px;
}

.arrange-info strong {
    color: var(--ink, #171a1f);
}

/* Export Modal */
.export-progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(23, 26, 31, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 600;
}

.export-progress-card {
    background: var(--surface, #fffdf6);
    border: 2px solid var(--line, #262114);
    border-radius: var(--radius-panel, 8px);
    padding: 2rem;
    width: 320px;
    text-align: center;
    box-shadow: var(--shadow, 8px 8px 0 rgba(23, 26, 31, 0.1));
}

.export-progress-card h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--charcoal, #171a1f);
    margin-bottom: 1rem;
}

.export-progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(38, 33, 20, 0.08);
    border: 2px solid var(--line, #262114);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.6rem;
}

.export-progress-fill {
    height: 100%;
    background: var(--pool, #18b7a0);
    border-radius: 4px;
    transition: width 200ms ease;
    width: 0%;
}

.export-progress-text {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink-muted, #656b76);
    font-family: 'Inter', sans-serif;
}

/* Responsive adjustments for Arrange tab */
@media (max-width: 600px) {
    .song-transport {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .transport-left {
        justify-content: center;
    }
    
    .transport-center {
        justify-content: center;
    }
    
    .transport-right {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .timeline-track-spacer,
    .timeline-tracks-sidebar {
        width: 72px;
        min-width: 72px;
    }
    
    .timeline-track-name {
        font-size: 0.5rem;
    }
    
    .timeline-track-icon {
        display: none;
    }
    
    .bar-header,
    .timeline-cell {
        min-width: 64px;
        width: 64px;
    }
    
    .arrange-pattern-palette {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================
   DESKTOP LAYOUT OVERHAUL (≥1024px)
   Full-width layouts, sidebar nav, better grids
   ============================================ */

@media (min-width: 1024px) {
    :root {
        --row-height: 48px;
        --label-width: 88px;
        --cell-width: minmax(44px, 1fr);
    }

    /* --- App Container: full width --- */
    .app-container {
        max-width: 100% !important;
        border-left: none !important;
        border-right: none !important;
    }

    /* --- Navigation: left sidebar --- */
    .main-nav {
        position: fixed !important;
        left: 0;
        top: 0;
        bottom: 0;
        right: auto !important;
        width: 82px !important;
        transform: none !important;
        flex-direction: column;
        justify-content: center;
        gap: 0.15rem;
        padding: 1.5rem 0.4rem;
        border-top: none !important;
        border-right: 2px solid var(--line, #262114) !important;
        border-left: none !important;
        border-bottom: none !important;
        border-radius: 0 !important;
        box-shadow: 4px 0 16px rgba(23, 26, 31, 0.08) !important;
        z-index: 200;
    }

    .nav-btn {
        padding: 0.7rem 0.25rem;
        border-radius: 10px;
        flex: 0 0 auto;
    }

    .nav-btn i {
        font-size: 1.25rem;
    }

    .nav-btn span {
        font-size: 0.58rem;
        letter-spacing: 0.02em;
    }

    /* --- Tab Content: offset for sidebar, full width --- */
    .tab-content {
        margin-left: 82px;
        width: calc(100% - 82px) !important;
        max-width: 100% !important;
        padding: 1.75rem 2.5rem 2rem !important;
        padding-bottom: 2rem !important;
        box-sizing: border-box;
    }

    /* ==== CREATE TAB ==== */
    #create-tab.active {
        display: grid !important;
        grid-template-columns: 1fr 380px;
        grid-auto-rows: min-content;
        gap: 1.5rem;
        max-width: 100% !important;
        align-items: start;
    }

    #create-tab .sequencer-container {
        display: grid !important;
        grid-template-columns: var(--label-width, 80px) 1fr;
        gap: 0.5rem;
        align-items: stretch;
    }

    #create-tab .sequencer-scroll-wrapper {
        min-height: max-content;
        height: auto;
    }

    /* Studio header spans full width (both columns) */
    #create-tab .studio-header {
        grid-column: 1 / -1;
        min-width: 0;
    }

    /* Left column elements (column 1 only) */
    #create-tab .sequencer-scroll-wrapper,
    #create-tab .mixer-strip,
    #create-tab .controls-row,
    #create-tab .fx-rack,
    #create-tab .master-output-section,
    #create-tab .btn-share {
        grid-column: 1;
        min-width: 0;
    }

    /* Group right side elements in the new sidebar wrapper */
    #create-tab .studio-sidebar {
        grid-column: 2;
        grid-row: 2 / span 10;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        min-width: 0;
        width: 100%;
        align-self: stretch;
    }

    #create-tab .recorder-section,
    #create-tab .piano-section {
        width: 100%;
        display: block;
        min-width: 0;
    }

    /* Sequencer grid cells adapt to available width */
    .grid-cell {
        min-width: 0;
        min-height: 0;
    }

    .track-label {
        width: var(--label-width, 80px);
        font-size: 0.72rem;
    }

    .step-indicators {
        margin-left: 0 !important;
        padding-left: calc(0.75rem + 2px) !important;
        padding-right: calc(0.75rem + 2px) !important;
        grid-template-columns: var(--label-width, 80px) repeat(8, var(--cell-width, 1fr)) !important;
        gap: 0.5rem !important;
    }

    .step-indicator {
        min-width: 0;
        padding: 0.4rem 0.1rem;
        font-size: 0.8rem;
    }

    /* FX rack: 4 columns */
    .fx-modular-container {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Master output: horizontal controls */
    .master-controls {
        display: flex;
        gap: 2rem;
    }

    .master-control-item {
        flex: 1;
    }

    /* Controls rows side by side */
    .controls-row {
        flex-direction: row !important;
    }

    /* ==== DISCOVER TAB ==== */
    #discover-tab .discover-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1.5rem;
        margin-bottom: 1.5rem;
    }

    #discover-tab .discover-header h2 {
        margin-bottom: 0;
        white-space: nowrap;
    }

    #discover-tab .mood-filter {
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    #discover-tab .beats-feed,
    #saved-tab .beats-feed {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.25rem;
    }

    /* ==== SOUNDS / LIBRARY TAB ==== */
    #library-tab .library-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1.5rem;
        margin-bottom: 1.5rem;
    }

    #library-tab .library-header h2 {
        margin-bottom: 0;
        white-space: nowrap;
    }

    #library-tab .search-bar {
        max-width: 400px;
        flex: 1;
    }

    #library-tab .sound-categories {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        gap: 1rem;
    }

    #library-tab .stem-list {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    /* ==== PROFILE TAB ==== */
    #profile-tab .profile-header {
        display: flex;
        align-items: center;
        gap: 1.5rem;
        text-align: left;
        padding: 2rem 0;
    }

    #profile-tab .avatar {
        margin: 0;
        flex-shrink: 0;
    }

    #profile-tab .profile-header h2 {
        margin-bottom: 0.15rem;
    }

    #profile-tab .profile-stats {
        max-width: 480px;
    }

    #profile-tab .empty-state {
        max-width: 100%;
    }

    /* ==== ARRANGE TAB ==== */
    #arrange-tab.active {
        max-width: 100% !important;
    }
}

/* Extra wide: 4-column discover, 3-column stems */
@media (min-width: 1440px) {
    .tab-content {
        padding: 2rem 4rem 2rem !important;
    }

    #discover-tab .beats-feed,
    #saved-tab .beats-feed {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }

    #library-tab .stem-list {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .grid-cell {
        /* Keep fixed 36px size */
    }
}

/* Tablet in-between: still bottom nav but wider content */
@media (min-width: 768px) and (max-width: 1023px) {
    .app-container {
        max-width: 100% !important;
        border-left: none !important;
        border-right: none !important;
    }

    .tab-content {
        max-width: 100% !important;
        padding: 1.5rem 2rem 112px !important;
    }

    #create-tab.active {
        max-width: 100% !important;
    }

    .main-nav {
        width: min(680px, calc(100% - 36px));
    }

    #discover-tab .beats-feed,
    #saved-tab .beats-feed {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    #library-tab .stem-list {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }
}

/* ============================================
   ACCESSIBILITY: respect reduced-motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================
   COMPREHENSIVE MOBILE RESPONSIVE OVERHAUL
   Covers all pages < 768px (mobile-first fixes)
   ============================================ */

/* ============================================
   FOLLOW SYSTEM: Follow Button + Following List
   ============================================ */

/* Follow button inside beat card header */
.btn-follow {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 2px solid var(--aqua, #14b8a6);
    background: transparent;
    color: var(--aqua, #14b8a6);
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-follow:hover {
    background: var(--aqua, #14b8a6);
    color: #fff;
    transform: scale(1.04);
}

.btn-follow.following {
    background: var(--aqua, #14b8a6);
    color: #fff;
    border-color: var(--aqua, #14b8a6);
}

.btn-follow.following:hover {
    background: var(--danger, #f43f5e);
    border-color: var(--danger, #f43f5e);
}

/* Make beat-header space between title and follow btn */
.beat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Following section on profile */
.following-section {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    border: 1px solid var(--border-soft, rgba(113,63,18,0.12));
    box-shadow: var(--shadow-soft);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.following-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.following-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--ink, #1f2937);
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.following-header h3 i {
    color: var(--aqua, #14b8a6);
}

.following-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.following-empty {
    color: var(--ink-muted, #667085);
    font-size: 0.9rem;
    text-align: center;
    padding: 0.5rem 0;
}

.following-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: rgba(255,255,255,0.7);
    border-radius: 12px;
    border: 1px solid var(--border-soft, rgba(113,63,18,0.1));
    transition: background 0.15s;
}

.following-item:hover {
    background: rgba(255,255,255,0.95);
}

.following-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sun, #facc15), var(--berry, #ec4899));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}

.following-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.following-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--ink, #1f2937);
    font-family: 'Outfit', sans-serif;
}

.following-label {
    font-size: 0.75rem;
    color: var(--ink-muted, #667085);
    font-weight: 600;
}



@media (max-width: 767px) {

    /* ---- General Tab Layout ---- */
    .tab-content {
        padding: 1rem 1rem 110px;
        overflow-x: hidden;
    }

    /* ---- Onboarding ---- */
    .onboarding-content h1 {
        font-size: 2.4rem;
        letter-spacing: -0.5px;
    }

    .onboarding-content p {
        font-size: 1rem;
    }

    .logo-pulse {
        width: 100px;
        height: 100px;
        margin-bottom: 1.5rem;
    }

    .logo-pulse i {
        font-size: 3rem;
    }

    /* ---- Navigation ---- */
    .main-nav {
        padding: 0.65rem 0;
    }

    .nav-btn {
        padding: 0.4rem 0.6rem;
        gap: 0.2rem;
        font-size: 0.7rem;
    }

    .nav-btn i {
        font-size: 1.4rem;
    }

    /* ---- Studio Header (Create Page) ---- */
    .studio-header {
        position: static;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.9rem;
    }

    .project-info {
        width: 100%;
    }

    .project-name-input {
        font-size: 1.2rem;
        width: 100%;
    }

    .studio-actions {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        gap: 0.5rem;
    }

    .studio-actions .btn-magic {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 0;
        justify-content: center;
        padding: 0.6rem 0.5rem;
        font-size: 0.85rem;
    }

    .studio-actions .btn-clear {
        flex: 0 0 48px;
        width: 48px;
        height: 48px;
        padding: 0;
        justify-content: center;
        align-items: center;
        border-radius: 12px;
    }

    .studio-actions .btn-play {
        flex: 0 0 48px;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        padding: 0;
        justify-content: center;
    }

    /* ---- Discover / Saved Headers ---- */
    .discover-header {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .discover-header h2 {
        font-size: 1.6rem;
        margin-bottom: 0;
    }

    .discover-header .search-bar {
        margin-left: 0 !important;
        width: 100%;
    }

    /* ---- Beat Cards ---- */
    .beat-visualizer {
        height: 140px;
    }

    .beat-title {
        font-size: 1rem;
    }

    .beat-author {
        font-size: 0.85rem;
    }

    .beat-info {
        padding: 0.75rem;
    }

    .beat-actions {
        gap: 0.6rem;
        flex-wrap: wrap;
    }

    /* ---- Profile Page ---- */
    .profile-header {
        padding: 1.25rem 0;
    }

    .avatar {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }

    .profile-header h2 {
        font-size: 1.3rem;
    }

    .profile-stats {
        padding: 1rem 0.5rem;
    }

    .stat-value {
        font-size: 1.6rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    /* ---- Arrange Page Transport ---- */
    .song-transport {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .transport-left {
        justify-content: center;
    }

    .transport-center {
        justify-content: center;
    }

    .transport-right {
        justify-content: center;
        flex-wrap: nowrap;
        gap: 0.4rem;
        width: 100%;
    }

    .transport-right .song-length-control {
        flex-shrink: 1;
    }

    #save-song-btn,
    #export-song-btn {
        padding: 0.45rem 0.7rem;
        font-size: 0.8rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .transport-btn {
        padding: 0.45rem 0.65rem;
        font-size: 0.82rem;
    }

    /* ---- Controls Row (BPM / Steps) ---- */
    .controls-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Pattern bank row stays horizontal on mobile */
    .controls-row-2 {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .pattern-bank {
        flex: 1 1 auto;
        min-width: 0;
        overflow-x: auto;
    }

    .pattern-bank-btns {
        flex-wrap: nowrap;
    }

    .controls-row .bpm-control {
        width: 100%;
        margin-bottom: 0;
    }

    /* ---- Search Bar ---- */
    .search-bar {
        width: 100%;
    }

    .search-bar input {
        width: 100%;
        font-size: 0.95rem;
    }

    /* ---- Share Button ---- */
    .btn-share {
        padding: 1rem;
        font-size: 1.1rem;
    }

    /* ---- Modals ---- */
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    /* ---- BPM value ---- */
    .bpm-value {
        font-size: 1.1rem;
    }
}

/* Very small screens (< 390px) */
@media (max-width: 390px) {
    .nav-btn {
        padding: 0.35rem 0.4rem;
    }

    .nav-btn i {
        font-size: 1.2rem;
    }

    .nav-btn span {
        font-size: 0.6rem;
    }

    .studio-actions .btn-magic {
        padding: 0.5rem 0.4rem;
        font-size: 0.78rem;
    }

    .beat-visualizer {
        height: 110px;
    }

    .project-name-input {
        font-size: 1rem;
    }
}

/* ============================================
   Discover: feed mode tabs + suggested creators
   ============================================ */
.feed-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 0 0 1rem;
    flex-wrap: wrap;
}
.feed-tab {
    border: 2px solid var(--text-dark, #111827);
    background: transparent;
    color: var(--text-dark, #111827);
    font-weight: 700;
    border-radius: var(--radius-full, 999px);
    padding: 0.4rem 1.1rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.feed-tab:hover { transform: translateY(-1px); }
.feed-tab.active {
    background: var(--text-dark, #111827);
    color: #fff;
}

.suggested-creators { margin: 0 0 1.25rem; }
.suggest-title {
    font-weight: 800;
    margin-bottom: 0.6rem;
    color: var(--text-dark, #111827);
}
.suggest-row {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.4rem;
    scroll-snap-type: x mandatory;
}
.suggest-card {
    flex: 0 0 140px;
    scroll-snap-align: start;
    border: 2px solid var(--text-dark, #111827);
    border-radius: 14px;
    padding: 0.9rem 0.75rem;
    text-align: center;
    background: rgba(255,255,255,0.6);
}
.suggest-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--genre-color, #FACC15);
    color: #111827;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 0.5rem;
    font-size: 1.1rem;
}
.suggest-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-dark, #111827);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.suggest-handle {
    font-size: 0.78rem;
    color: var(--text-muted, #6b7280);
    margin-bottom: 0.6rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.suggest-follow {
    border: 2px solid var(--text-dark, #111827);
    background: var(--text-dark, #111827);
    color: #fff;
    font-weight: 700;
    border-radius: var(--radius-full, 999px);
    padding: 0.3rem 0.9rem;
    cursor: pointer;
    width: 100%;
}
.suggest-follow.following {
    background: transparent;
    color: var(--text-dark, #111827);
    cursor: default;
}
