/* Musical Grid System Styles - Modern Blue Theme */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Re-enable text selection for input and textarea elements */
input, textarea, [contenteditable="true"] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Chatbot replies need to be copy-paste-able. The global rule above
   blocks selection everywhere; this re-enables it inside the message
   stream so users can grab a chord progression or key spec. */
.chatbot-messages,
.chatbot-messages * {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #1a202c;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header styles */
.header {
    padding: 40px 0 20px;
    color: #f8fafc;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.logo {
    height: 60px;
    width: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.title {
    font-size: 3.5rem;
    font-weight: 700;
    margin: 0;
    padding: 8px 0;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #1d4ed8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.subtitle {
    font-size: 1.2rem;
    font-weight: 400;
    margin: 0;
    opacity: 0.9;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    color: #94a3b8;
    text-align: center;
}

/* Main content */
.main {
    padding: 30px 0;
}

/* Button styles */
.btn {
    display: inline-block;
    padding: 14px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
    transition: left 1.2s;
}

.btn:hover::before {
    left: 100%;
}

.btn-secondary {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #f8fafc;
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(59, 130, 246, 0.2);
    height: 48px;
    line-height: 1;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #334155 0%, #475569 100%);
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(59, 130, 246, 0.3);
}

/* Note: insert-mode styling removed - buttons now have consistent appearance */

/* American flag red styling for playing state */
.btn-secondary.playing {
    background: #B22234 !important;
    color: white !important;
    border: 2px solid #B22234 !important;
    box-shadow: 
        0 4px 12px rgba(178, 34, 52, 0.3),
        0 0 0 1px rgba(178, 34, 52, 0.2) !important;
}

.btn-secondary.playing:hover {
    background: #A02030 !important;
    border-color: #A02030 !important;
    box-shadow: 
        0 8px 25px rgba(178, 34, 52, 0.4),
        0 0 0 1px rgba(178, 34, 52, 0.3) !important;
}



.btn-play {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    border-color: rgba(5, 150, 105, 0.6);
    box-shadow: 
        0 4px 12px rgba(5, 150, 105, 0.3),
        0 0 0 1px rgba(5, 150, 105, 0.2);
    height: 48px;
    line-height: 1;
}

.btn-play:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    border-color: rgba(4, 120, 87, 0.8);
    box-shadow: 
        0 8px 25px rgba(4, 120, 87, 0.4),
        0 0 0 1px rgba(4, 120, 87, 0.3);
}

/* Key play button - blue styling */
#playKey {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 
        0 4px 12px rgba(59, 130, 246, 0.3),
        0 0 0 1px rgba(59, 130, 246, 0.2);
}

#playKey:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    border-color: rgba(29, 78, 216, 0.8);
    box-shadow: 
        0 8px 25px rgba(29, 78, 216, 0.4),
        0 0 0 1px rgba(29, 78, 216, 0.3);
}

/* Musical section styles */
.musical-section {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 24px;
    padding: 50px;
    margin-bottom: 60px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(59, 130, 246, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.musical-content h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #f8fafc;
    text-align: center;
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.musical-content p {
    font-size: 1.1rem;
    color: #cbd5e1;
    margin-bottom: 20px;
    text-align: center;
}

.musical-content p strong {
    color: #f8fafc;
    font-weight: 600;
}

.musical-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px;
}

/* Force all children to be full width */
.musical-content > * {
    width: 100% !important;
    max-width: 100% !important;
}

/* Force pitch detection section to be full width */
.pitch-detection-section {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
}

/* Force pitch detection section children to be full width */
.pitch-detection-section > * {
    width: 100% !important;
    max-width: 100% !important;
}

.pitch-variance-display {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
}

/* Force stacks display to be full width and vertical */
.stacks-display {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Force stack sections to be full width */
.stack-section {
    width: 100% !important;
    max-width: 100% !important;
}

.chord-buttons {
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.1) 0%, rgba(4, 120, 87, 0.05) 100%);
    border-radius: 20px;
    border: 1px solid rgba(5, 150, 105, 0.2);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.chord-buttons h3 {
    color: #f8fafc;
    margin-bottom: 15px;
    font-size: 1.2rem;
    text-align: center;
    font-weight: 600;
}

.chord-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chord-header h3 {
    margin: 0;
    color: #f8fafc;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: left;
}

.btn-toggle {
    background: rgba(5, 150, 105, 0.2);
    border: 1px solid rgba(5, 150, 105, 0.3);
    color: #f8fafc;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-toggle:hover {
    background: rgba(5, 150, 105, 0.3);
    border-color: rgba(5, 150, 105, 0.4);
}

.chord-content {
    transition: all 0.3s ease;
    overflow: hidden;
    padding-top: 4px;
}

.chord-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

.chord-content.expanded {
    max-height: 1000px;
    opacity: 1;
}

.triad-buttons, .tetrad-buttons, .dominant-buttons {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    gap: 3px;
    margin-bottom: 10px;
    max-width: 100%;
}

.triad-buttons .btn-chord:nth-child(odd),
.tetrad-buttons .btn-chord:nth-child(odd) {
    margin-bottom: 3px;
}

.btn-chord {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    border: 1px solid rgba(5, 150, 105, 0.4);
    box-shadow: 
        0 2px 8px rgba(5, 150, 105, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    padding: 6px 8px;
    font-size: 0.65rem;
    font-weight: 600;
    width: 100%;
    height: 32px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.btn-chord-alternate {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    border: 1px solid rgba(71, 85, 105, 0.4);
    box-shadow: 
        0 2px 8px rgba(71, 85, 105, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    font-size: 0.6rem;
    min-width: 48px;
    max-width: 58px;
    grid-row: 2;
}

.btn-chord:not(.btn-chord-alternate) {
    grid-row: 1;
}

.btn-chord-alternate:hover {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border-color: rgba(51, 65, 85, 0.6);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(51, 65, 85, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2);
}

.btn-chord:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    border-color: rgba(4, 120, 87, 0.6);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(4, 120, 87, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2);
}

.musical-patterns {
    text-align: center;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.musical-info {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.note-map {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    border-radius: 16px;
    padding: 25px;
    margin-top: 25px;
    border-left: 4px solid #3b82f6;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.note-map h3 {
    color: #f8fafc;
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
}

/* Grid controls styles */
.grid-controls {
    background: linear-gradient(135deg, rgba(71, 85, 105, 0.1) 0%, rgba(51, 65, 85, 0.05) 100%);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid rgba(71, 85, 105, 0.2);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.grid-controls h3 {
    color: #f8fafc !important;
    margin: 0 !important;
    font-size: 1.5rem !important;
    text-align: left;
    font-weight: 600 !important;
}

.grid-size-control,
.chord-display-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.grid-size-control label,
.chord-display-control label {
    font-weight: 600;
    color: #f8fafc;
    font-size: 1rem;
}

.interval-slider {
    width: 120px;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    outline: none;
    border: 1px solid rgba(245, 158, 11, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.interval-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.interval-slider::-webkit-slider-thumb:hover {
    transform: key(1.1);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.interval-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.interval-slider::-moz-range-thumb:hover {
    transform: key(1.1);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}



.chord-select {
    padding: 12px 18px;
    border: 1px solid rgba(5, 150, 105, 0.3);
    border-radius: 12px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    font-size: 1rem;
    font-family: inherit;
    color: #f8fafc;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 140px;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

.chord-select:hover {
    border-color: rgba(5, 150, 105, 0.5);
    box-shadow: 
        0 6px 20px rgba(5, 150, 105, 0.3),
        0 0 0 1px rgba(5, 150, 105, 0.2);
    transform: translateY(-1px);
}

.chord-select:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 
        0 0 0 3px rgba(5, 150, 105, 0.2),
        0 6px 20px rgba(5, 150, 105, 0.3);
}

.note-entry {
    margin-bottom: 10px;
    color: #cbd5e1;
    font-size: 0.95rem;
}

.note-entry strong {
    color: #f8fafc;
    font-weight: 600;
}

/* Grid styles */
.grid-wrapper {
    /* Sized for the rectangle-grid layout: 720x500 visible cells + ~70px
       cell-overflow on each side + ~150px button column on each side. */
    width: 1100px;
    height: 600px;
    margin: 30px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#info-background {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1100px;
    height: 600px;
    background: transparent;
    transform: translate(-50%, -50%);
    z-index: 3;
    pointer-events: none;
}

.info-key {
    position: absolute;
    top: 0;
    left: -6px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(37, 99, 235, 0.1) 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    min-width: 140px;
    height: 40px;
    line-height: 16px;
    text-align: left;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(59, 130, 246, 0.3),
        0 0 20px rgba(59, 130, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    pointer-events: none;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(59, 130, 246, 0.4);
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.info-play-key {
    position: absolute;
    top: 54px;
    left: -6px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    min-width: 140px;
    height: 40px;
    line-height: 16px;
    text-align: center;
    box-shadow: 
        0 8px 25px rgba(59, 130, 246, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-play-key:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(29, 78, 216, 0.4),
        0 0 0 1px rgba(29, 78, 216, 0.3);
    border-color: rgba(29, 78, 216, 0.8);
}

.info-play-key.playing {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 8px 25px rgba(29, 78, 216, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.info-play-key.playing:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 12px 35px rgba(30, 64, 175, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.2);
}

.info-grid-labels {
    position: absolute;
    bottom: 50px;
    left: -6px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(37, 99, 235, 0.1) 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    min-width: 140px;
    height: 40px;
    line-height: 16px;
    text-align: center;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(59, 130, 246, 0.3),
        0 0 20px rgba(59, 130, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(59, 130, 246, 0.4);
    cursor: pointer;
}

.info-grid-labels:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2) 0%, rgba(30, 64, 175, 0.15) 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(59, 130, 246, 0.4),
        0 0 25px rgba(59, 130, 246, 0.3);
}

.info-play-mode {
    position: absolute;
    bottom: 50px;
    right: -8px;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.15) 0%, rgba(4, 120, 87, 0.1) 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    min-width: 140px;
    height: 40px;
    line-height: 16px;
    text-align: center;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(5, 150, 105, 0.3),
        0 0 20px rgba(5, 150, 105, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(5, 150, 105, 0.4);
    cursor: pointer;
}

.info-play-mode:hover {
    background: linear-gradient(135deg, rgba(4, 120, 87, 0.2) 0%, rgba(6, 95, 70, 0.15) 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(5, 150, 105, 0.4),
        0 0 25px rgba(5, 150, 105, 0.3);
}

.info-chord {
    position: absolute;
    top: 0;
    right: -8px;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.15) 0%, rgba(4, 120, 87, 0.1) 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    min-width: 140px;
    height: 40px;
    line-height: 16px;
    text-align: right;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(5, 150, 105, 0.3),
        0 0 20px rgba(5, 150, 105, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    pointer-events: none;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(5, 150, 105, 0.4);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    overflow: hidden;
}

.info-clear {
    position: absolute;
    bottom: -4px;
    right: -8px;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.15) 0%, rgba(4, 120, 87, 0.1) 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    min-width: 140px;
    height: 40px;
    line-height: 16px;
    text-align: center;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(5, 150, 105, 0.3),
        0 0 20px rgba(5, 150, 105, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(5, 150, 105, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-clear:hover {
    background: linear-gradient(135deg, rgba(4, 120, 87, 0.2) 0%, rgba(6, 95, 70, 0.15) 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(5, 150, 105, 0.4),
        0 0 25px rgba(5, 150, 105, 0.3);
}

.info-play-chord {
    position: absolute;
    top: 54px;
    right: -8px;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    min-width: 140px;
    height: 40px;
    line-height: 16px;
    text-align: center;
    box-shadow: 
        0 8px 25px rgba(5, 150, 105, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-play-chord:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 12px 35px rgba(4, 120, 87, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.2);
    border-color: rgba(4, 120, 87, 0.8);
}



.info-toggle-clones {
    position: absolute;
    bottom: -4px;
    left: -6px;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.15) 0%, rgba(4, 120, 87, 0.1) 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    min-width: 140px;
    height: 40px;
    line-height: 16px;
    text-align: center;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(5, 150, 105, 0.3),
        0 0 20px rgba(5, 150, 105, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(5, 150, 105, 0.4);
    cursor: pointer;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-toggle-clones:hover {
    background: linear-gradient(135deg, rgba(4, 120, 87, 0.2) 0%, rgba(6, 95, 70, 0.15) 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(5, 150, 105, 0.4),
        0 0 25px rgba(5, 150, 105, 0.3);
}

.info-toggle-clones.hidden {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.15) 0%, rgba(4, 120, 87, 0.1) 100%);
}

.info-toggle-clones.hidden:hover {
    background: linear-gradient(135deg, rgba(4, 120, 87, 0.2) 0%, rgba(6, 95, 70, 0.15) 100%);
}

#grid-container {
    display: grid;
    gap: 2px;
    /* Background, padding, border-radius and box-shadow used to draw the
       rotated diamond plate behind the cells; the rectangle-grid layout
       defines its frame purely by which cells render, so these are off. */
    background: transparent !important;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    transform: rotate(-45deg);
    transform-origin: center;
    justify-content: center;
    align-content: center;
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    pointer-events: auto;
    translate: -50% -50%;
}

#grid-container div {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

#grid-container div.clicked {
    box-shadow: 
        inset 0 0 12px rgba(107, 114, 128, 1.0),
        inset 0 0 0 2px rgba(107, 114, 128, 0.9);
}

#grid-container div.clicked > div {
    box-shadow: 
        inset 0 0 12px rgba(5, 150, 105, 1.0),
        inset 0 0 0 2px rgba(5, 150, 105, 0.9);
}

#grid-container div.clicked > div.real-chord-tone {
    box-shadow: 
        inset 0 0 12px rgba(2, 80, 60, 1.0),
        inset 0 0 0 2px rgba(2, 80, 60, 1.0);
}

/* Musical typing highlight - shows which grid cell corresponds to pressed key */


/* Override any inline styles that might be set */
#grid-container div.typing-highlight[style] {
    box-shadow: 
        inset 0 0 8px rgba(107, 114, 128, 0.6),
        inset 0 0 0 1px rgba(107, 114, 128, 0.3) !important;
}

/* The "More" trigger is mobile-only. On desktop it's hidden; on mobile
   the bottom-bar block below assigns it grid-column 4 (replacing the
   Clones slot — Clones moves into the More sheet). */
.info-more { display: none; }

/* Slide-up sheet that hosts Sequencer / Tuner / Chord buttons / Settings
   on mobile. Desktop never opens it. */
.more-sheet[hidden] { display: none !important; }
.more-sheet {
    position: fixed;
    inset: 0;
    z-index: 1500;
}
/* Belt-and-suspenders: the open class forces display regardless of any
   inline or [hidden] state. */
.more-sheet.is-open {
    display: block !important;
}
.more-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(4px);
    animation: more-sheet-fade-in 0.2s ease-out;
}
.more-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 88vh;
    max-height: 88dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-radius: 24px 24px 0 0;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.55);
    padding: 6px 16px max(16px, env(safe-area-inset-bottom, 16px));
    transform: translateY(0);
    transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
/* Only animate IN when the sheet first opens — the .is-open class lets
   CSS animate the panel from translateY(100%) → 0 on open. Animation
   was originally on .more-sheet-panel unconditionally which caused iOS
   Safari to skip it when transitioning from display:none. */
.more-sheet.is-open .more-sheet-panel {
    animation: more-sheet-slide-up 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.more-sheet-handle {
    width: 44px;
    height: 4px;
    background: rgba(148, 163, 184, 0.4);
    border-radius: 2px;
    margin: 8px auto 12px;
}
.more-sheet-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 -16px 16px;
    padding: 8px 20px 12px;
    background: linear-gradient(180deg, #0f172a 0%, rgba(15, 23, 42, 0.95) 100%);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}
.more-sheet-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #f8fafc;
}
.more-sheet-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    background: rgba(148, 163, 184, 0.15);
    color: #f8fafc;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
.more-sheet-close:hover {
    background: rgba(148, 163, 184, 0.25);
}
.more-sheet-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 12px;
}
@keyframes more-sheet-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes more-sheet-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

/* Tactile press feedback — every tappable element scales down and
   darkens slightly while the user is holding it, then springs back on
   release. iOS Safari fires :active on buttons by default, but we also
   apply it to a few container-style elements that act as buttons. */
.btn:active,
button:active,
.info-key:active,
.info-chord:active,
.info-play-key:active,
.info-play-chord:active,
.info-play-mode:active,
.info-grid-labels:active,
.info-clear:active,
.info-toggle-clones:active,
.info-more:active,
.btn-chord:active,
.btn-chord-alternate:active,
.btn-toggle:active,
.more-sheet-close:active,
.modal-close:active,
.sequence-item-btn:active,
.btn-google:active,
.btn-github:active,
.btn-email:active {
    transform: scale(0.95) !important;
    filter: brightness(0.78);
    transition: transform 0.04s ease-out, filter 0.04s ease-out !important;
}

/* Cells get a parallel `.pressing` class managed in script.js — touch
   events on the inner tapTarget toggle it on the parent cell so the
   diamond visibly depresses while the finger is down. */
#grid-container div.pressing {
    transform: scale(0.85);
    filter: brightness(0.72);
    transition: transform 0.04s ease-out, filter 0.04s ease-out;
    z-index: 11;
}

/* Grid canvas — a positioning context wrapper around #grid-container.
   On desktop it is transparent and full-bleed inside .grid-wrapper, so the
   grid keeps its original centered-absolute layout. On phones it becomes
   the sized box between the top and bottom button bars. */
.grid-canvas {
    display: contents;
}

/* `.info-pair` wraps each Key+Play and Chord+Play pair so they can render
   as a single split-pill on mobile. On desktop the wrapper is transparent
   (display: contents) — children behave exactly as they did before. */
.info-pair {
    display: contents;
}

/* The play buttons split a leading icon from a trailing word label so we
   can hide the word on mobile and keep only the ▶ affordance. */
.play-icon { display: inline; }
.play-label { display: inline; }

/* Responsive design — phone + small tablet.
   Layout splits the viewport into three rows:
     1. Top bar: [▶ Key: …]  [Chord: … ▶]   (split-pill buttons)
     2. Grid canvas: argyle grid fills the middle, never overlapped
     3. Bottom bar: [Mode] [Labels] [Clones] [Clear]
   The chatbot toggle (top-left) and auth icon (top-right) remain
   position:fixed at the top corners; the wrapper's padding-top reserves
   room below them so the top bar doesn't collide. updateGridDimensions-
   ForViewport() in script.js measures the canvas (not the viewport) so
   visibleRectH reflects only the middle row's actual height.

   Breakpoint at 900px so iPad portrait (768/820px) gets this layout —
   the desktop layout's 1100px grid wrapper would overflow on iPad. */
@media (max-width: 900px) {
    html, body {
        overflow: hidden;
        height: 100%;
        height: 100dvh;
    }

    .container {
        padding: 0;
        max-width: 100%;
    }

    .header {
        display: none;
    }

    .main {
        padding: 0;
    }

    /* The .musical-section is dynamically injected by script.js. On
       mobile it lives inside the More sheet; when not inside the sheet,
       hide it. The sheet body is `#moreSheetBody` — anything inside that
       container shows, anything outside (i.e. still attached to .main)
       stays hidden. */
    main.main .musical-section,
    main.main .grid-controls {
        display: none !important;
    }
    /* Inside the sheet, restyle the existing desktop-tuned section for
       a single-column phone layout. */
    #moreSheetBody .musical-section,
    #moreSheetBody .grid-controls {
        display: block !important;
        position: static;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        border-radius: 0;
    }

    /* Each interior card inside the sheet (chord-buttons, sequencer,
       pitch-detection-section, etc.) gets uniform card spacing. */
    #moreSheetBody .musical-section > .musical-content > * + *,
    #moreSheetBody .musical-content > * + *,
    #moreSheetBody .grid-controls + *,
    #moreSheetBody > * + * {
        margin-top: 14px;
    }

    /* Chord buttons — desktop uses repeat(15, 1fr) which collapses to
       sub-touchable ~22px buttons on a phone. Drop to 4 columns. */
    #moreSheetBody .triad-buttons,
    #moreSheetBody .tetrad-buttons,
    #moreSheetBody .dominant-buttons {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    #moreSheetBody .btn-chord {
        height: 40px;
        font-size: 0.85rem;
        padding: 0 8px;
    }
    #moreSheetBody .btn-chord-alternate {
        grid-row: auto;
        min-width: 0;
        max-width: none;
        font-size: 0.8rem;
    }
    #moreSheetBody .chord-header h3 {
        font-size: 1.1rem;
    }

    /* Sequencer — transport buttons in a row, speed below, action
       buttons as a 2x3 grid, sequence input full-width. */
    #moreSheetBody .sequencer-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    #moreSheetBody .sequencer-controls > .btn {
        flex: 1;
        height: 40px;
        font-size: 0.9rem;
        padding: 0 8px;
    }
    /* Put the transport row (Prev / Play / Next) on one flex line and
       drop the speed control to its own line below. */
    #moreSheetBody .sequencer-controls {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-template-areas:
            "prev play next"
            "speed speed speed";
    }
    #moreSheetBody #playPrev   { grid-area: prev; }
    #moreSheetBody #playPause  { grid-area: play; }
    #moreSheetBody #playNext   { grid-area: next; }
    #moreSheetBody .speed-control {
        grid-area: speed;
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }
    #moreSheetBody .speed-slider {
        flex: 1;
        width: auto;
    }
    #moreSheetBody .sequence-controls {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    #moreSheetBody .sequence-controls .btn {
        flex: none;
        min-width: 0;
        height: 38px;
        font-size: 0.8rem;
        padding: 0 6px;
    }
    #moreSheetBody .sequence-loader {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    #moreSheetBody .sequence-input {
        max-width: none;
        width: 100%;
    }
    #moreSheetBody .sequence-loader .btn {
        height: 40px;
    }

    /* Tuner — header stacks on tighter widths. */
    #moreSheetBody .pitch-detection-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    #moreSheetBody .pitch-detection-header-buttons {
        justify-content: space-between;
        width: 100%;
    }
    #moreSheetBody .pitch-detection-header h3,
    #moreSheetBody .sequencer h3,
    #moreSheetBody .chord-header h3,
    #moreSheetBody .grid-controls h3 {
        font-size: 1.1rem !important;
    }
    #moreSheetBody .variance-histogram {
        height: 140px;
        padding: 4px;
    }
    #moreSheetBody .stack-content {
        font-size: 0.75rem;
        padding: 8px;
        max-height: 140px;
    }

    /* Note Detection card — header stacks vertically, two-column
       notes/chords becomes single-column. */
    #moreSheetBody .note-detection-section {
        padding: 16px;
        margin: 0;
        background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.04) 100%);
        border: 1px solid rgba(16, 185, 129, 0.2);
        border-radius: 14px;
        box-shadow: none;
    }
    #moreSheetBody .note-detection-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding-bottom: 12px;
        margin-bottom: 16px;
    }
    #moreSheetBody .note-detection-header h3 {
        font-size: 1.1rem;
        text-align: left;
    }
    #moreSheetBody .note-detection-header-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        align-items: stretch;
    }
    #moreSheetBody .note-detection-header-buttons .checkbox-label {
        grid-column: 1 / -1;
    }
    #moreSheetBody .note-detection-header-buttons .btn {
        min-height: 38px;
        font-size: 0.85rem;
        padding: 0 10px;
        white-space: nowrap;
    }
    #moreSheetBody .note-detection-content {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    #moreSheetBody .notes-section,
    #moreSheetBody .chords-section {
        padding: 12px;
    }
    #moreSheetBody .notes-list,
    #moreSheetBody .chords-list {
        max-height: 240px;
    }

    /* Settings — grid + chord display selects stack as labeled rows. */
    #moreSheetBody .settings-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    #moreSheetBody .settings-control {
        min-width: 0;
        justify-content: space-between;
    }
    #moreSheetBody .settings-control select {
        flex: 1;
        max-width: 60%;
    }
    #moreSheetBody .grid-controls h3 {
        margin-bottom: 8px !important;
    }

    /* Section header emojis — give each card a quick visual marker. */
    #moreSheetBody .chord-header h3::before          { content: '🎹  '; }
    #moreSheetBody .sequencer h3::before             { content: '⏯  '; }
    #moreSheetBody .pitch-detection-header h3::before { content: '🎤  '; }
    #moreSheetBody .note-detection-header h3::before { content: '🎵  '; }
    #moreSheetBody .grid-controls h3::before         { content: '⚙  '; }

    /* Improve toggle (+/−) button hit-target on phones. */
    #moreSheetBody .btn-toggle {
        min-width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    /* Sequence-display readability: bigger min-height, scroll when full. */
    #moreSheetBody .sequence-display {
        min-height: 64px;
        max-height: 160px;
        overflow-y: auto;
        padding: 12px;
    }

    /* The desktop chip/button density gets a touch-target bump. */
    #moreSheetBody .btn,
    #moreSheetBody button.btn-secondary {
        min-height: 36px;
    }

    /* Trim desktop card padding inside the sheet so cards aren't chunky. */
    #moreSheetBody .chord-buttons,
    #moreSheetBody .sequencer,
    #moreSheetBody .pitch-detection-section,
    #moreSheetBody .grid-controls {
        padding: 16px;
        margin: 0;
    }

    .grid-wrapper {
        position: fixed;
        /* Explicit top/left/right (no `bottom`) so `height: 100dvh` actually
           takes effect — `inset: 0` was setting bottom:0 which won the
           conflict-resolution against height, making the wrapper 100vh
           (844) instead of the dynamic viewport (699). The extra 145px
           was hiding the bottom-bar buttons behind the Safari URL bar. */
        top: 0;
        left: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        margin: 0;
        z-index: 10;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        grid-template-rows: auto 1fr auto;
        gap: 6px;
        /* Top padding reserves space for the chatbot/auth icons that
           live at top:12px (40px tall) plus iOS notch safe area. */
        padding-top: calc(env(safe-area-inset-top, 0px) + 60px);
        padding-right: max(12px, env(safe-area-inset-right, 0px));
        padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
        padding-left: max(12px, env(safe-area-inset-left, 0px));
    }

    /* Make #info-background transparent so its grandchildren (the .info-*
       buttons inside .info-pair wrappers, plus the four standalone action
       buttons) become direct grid items of .grid-wrapper. The desktop
       rule sets `pointer-events: none` on #info-background — with
       display:contents iOS Safari was propagating that to descendants
       and making the More button invisible to taps (elementsFromPoint
       returned .grid-wrapper instead of the button). Force pointer-events
       back to auto. */
    #info-background {
        display: contents;
        position: static;
        transform: none;
        pointer-events: auto;
    }
    #info-background > *,
    .info-pair,
    .info-pair > * {
        pointer-events: auto;
    }

    /* On mobile the wrappers become real flex pills. */
    .info-pair {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        height: 44px;
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(51, 65, 85, 0.7) 100%);
        border: 1px solid rgba(148, 163, 184, 0.25);
        border-radius: 14px;
        overflow: hidden;
        backdrop-filter: blur(12px);
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    }

    .info-key-pair {
        grid-column: 1 / 4;
        grid-row: 1;
    }

    .info-chord-pair {
        grid-column: 4 / 6;
        grid-row: 1;
    }

    /* Inside a pair, kill the absolute-positioning that the desktop layout
       set, and let flex divvy up the row. */
    .info-pair .info-key,
    .info-pair .info-chord,
    .info-pair .info-play-key,
    .info-pair .info-play-chord {
        position: static !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        min-width: 0;
        height: 100%;
        margin: 0;
        border-radius: 0;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
        background: transparent;
        font-size: 13px;
        font-weight: 600;
        line-height: 1;
        padding: 0 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: #f1f5f9;
        cursor: pointer;
    }

    /* The play affordance is a fixed-width tab on the outer edge of the
       pair, visually separated from the label by a vertical hairline.
       The Key pair has its play tab on the LEFT; the Chord pair on the
       RIGHT — matching the user's mental model of "play this thing." */
    .info-pair .info-play-key,
    .info-pair .info-play-chord {
        flex: 0 0 44px;
        padding: 0;
        font-size: 14px;
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.35) 0%, rgba(29, 78, 216, 0.25) 100%);
        color: white;
    }

    .info-key-pair .info-play-key {
        border-right: 1px solid rgba(148, 163, 184, 0.25);
    }

    .info-chord-pair .info-play-chord {
        border-left: 1px solid rgba(148, 163, 184, 0.25);
        background: linear-gradient(135deg, rgba(5, 150, 105, 0.35) 0%, rgba(4, 120, 87, 0.25) 100%);
    }

    .info-pair .info-key,
    .info-pair .info-chord {
        flex: 1;
        text-align: left;
        justify-content: flex-start;
    }

    .info-chord-pair .info-chord {
        text-align: right;
        justify-content: flex-end;
    }

    .play-label { display: none; }

    /* Active state — when the scale/chord is playing, the affordance turns
       red (matches the existing .playing class behavior on desktop). */
    .info-pair .info-play-key.playing,
    .info-pair .info-play-chord.playing {
        background: linear-gradient(135deg, #B22234 0%, #A02030 100%) !important;
        color: white !important;
    }

    /* Grid canvas takes the middle row, full width. JS reads its
       getBoundingClientRect() and sizes the diamond grid to fit.
       `touch-action: none` lets the gesture handler in script.js own all
       multi-finger touches on the canvas (pinch-zoom + pan) — the browser
       won't try to do its own page zoom or scroll on top of them. Single-
       finger taps still synthesize click events on the cells. */
    .grid-canvas {
        display: block;
        grid-column: 1 / -1;
        grid-row: 2;
        position: relative;
        width: 100%;
        height: 100%;
        overflow: hidden;
        z-index: 1;
        touch-action: none;
    }

    /* `touch-action` does NOT inherit. iOS Safari evaluates it on the
       element that actually receives the touch (the cell tapTarget
       overlays), so it has to be set on every descendant too — otherwise
       the browser handles its own pinch-zoom on top of ours. */
    .grid-canvas *,
    #grid-container,
    #grid-container * {
        touch-action: none;
    }

    /* The grid container's transform is fully controlled by JS now
       (rotate composed with pan + zoom in applyGridTransform). Do NOT add
       an !important transform here — it would override the inline style
       the gesture handler writes and silently break pinch-zoom/pan. */

    /* Bottom-row action buttons. Reset all the absolute placements that
       the desktop layout sets and let them flow as grid items. */
    .info-play-mode,
    .info-grid-labels,
    .info-clear,
    .info-toggle-clones {
        position: static !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        min-width: 0;
        width: 100%;
        height: 40px;
        margin: 0;
        padding: 0 8px;
        font-size: 12px;
        font-weight: 600;
        line-height: 1.1;
        text-align: center;
        justify-content: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        border-radius: 12px;
        display: flex;
        align-items: center;
        backdrop-filter: blur(12px);
    }

    /* Bottom action bar — 5 columns: Mode | Labels | Clones | Clear | More.
       Clones is restored here (was previously hidden when More took its
       slot). 5 narrow buttons fit ~70px each on a 390px viewport. */
    .info-play-mode    { grid-column: 1; grid-row: 3; }
    .info-grid-labels  { grid-column: 2; grid-row: 3; }
    .info-toggle-clones { grid-column: 3; grid-row: 3; }
    .info-clear        { grid-column: 4; grid-row: 3; }

    /* While the More sheet is open, hide the top-corner chatbot + auth
       icons. They sit at z:1000 — below the backdrop (z:1500) but the
       backdrop blur still leaves a distracting silhouette. Cleaner to
       hide them entirely. */
    body.more-sheet-open .chatbot-container,
    body.more-sheet-open .auth-container,
    body.more-sheet-open .auth-user-info {
        visibility: hidden;
    }

    .info-more {
        display: flex;
        align-items: center;
        justify-content: center;
        grid-column: 5;
        grid-row: 3;
        position: static !important;
        min-width: 0;
        width: 100%;
        height: 40px;
        margin: 0;
        padding: 0 6px;
        font-size: 11px;
        font-weight: 600;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        border-radius: 12px;
        backdrop-filter: blur(12px);
    }
}

/* Phone — small width override for the More button. */
@media (max-width: 420px) {
    .info-more {
        font-size: 11px;
        height: 36px;
        padding: 0 6px;
    }
}

/* Phone — small width. Tighter type. */
@media (max-width: 420px) {
    .info-pair {
        height: 40px;
    }

    .info-pair .info-key,
    .info-pair .info-chord {
        font-size: 12px;
        padding: 0 10px;
    }

    .info-pair .info-play-key,
    .info-pair .info-play-chord {
        flex: 0 0 38px;
    }

    .info-play-mode,
    .info-grid-labels,
    .info-clear,
    .info-toggle-clones {
        font-size: 11px;
        height: 36px;
        padding: 0 6px;
    }
} 

.btn-dominant:hover {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border-color: rgba(51, 65, 85, 0.6);
}

/* Sequencer styles */
.sequencer {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.05) 100%);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid rgba(245, 158, 11, 0.2);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.sequencer h3 {
    color: #f8fafc !important;
    margin: 0 !important;
    font-size: 1.5rem !important;
    text-align: left;
    font-weight: 600 !important;
}

.sequencer-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
}

.speed-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.speed-control label {
    font-size: 1rem;
    color: #f8fafc;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    margin-bottom: 8px;
}

.speed-slider {
    width: 120px;
    height: 4px;
    background: linear-gradient(90deg, #475569 0%, #64748b 100%);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 
        0 2px 8px rgba(156, 163, 175, 0.4),
        0 0 0 2px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.speed-slider::-webkit-slider-thumb:hover {
    transform: key(1.2);
    box-shadow: 
        0 4px 12px rgba(156, 163, 175, 0.6),
        0 0 0 2px rgba(255, 255, 255, 0.2);
}

.speed-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 
        0 2px 8px rgba(156, 163, 175, 0.4),
        0 0 0 2px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.speed-slider::-moz-range-thumb:hover {
    transform: key(1.2);
    box-shadow: 
        0 4px 12px rgba(156, 163, 175, 0.6),
        0 0 0 2px rgba(255, 255, 255, 0.2);
}

.sequence-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

/* Ensure consistent button widths to prevent layout shifts */
.sequence-controls .btn {
    flex: 1;
    min-width: 100px;
    max-width: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.sequence-loader {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.sequence-input {
    flex: 1;
    max-width: 450px;
    padding: 12px 16px;
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #f8fafc;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

.sequence-input:focus {
    outline: none;
    border-color: rgba(245, 158, 11, 0.6);
    box-shadow: 
        0 0 0 3px rgba(245, 158, 11, 0.2),
        0 6px 20px rgba(245, 158, 11, 0.3);
    transform: translateY(-1px);
}

.sequence-input::placeholder {
    color: #94a3b8;
    font-style: italic;
}

.sequence-display {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 12px;
    padding: 20px;
    min-height: 80px;
    border: 1px solid rgba(245, 158, 11, 0.3);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    margin-bottom: 15px;
}

.sequence-info {
    color: #cbd5e1;
    font-size: 0.9rem;
    text-align: center;
    font-style: italic;
}

.sequence-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.sequence-item {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    color: #f8fafc;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    border: 1px solid rgba(59, 130, 246, 0.2);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    min-height: 32px;
}

.sequence-number {
    font-weight: 600;
    color: #f8fafc;
    min-width: 20px;
}

.sequence-icon {
    font-size: 1.1rem;
    color: #f8fafc;
    margin: 0 2px;
}

.sequence-icon.g-clef {
    font-size: 1.6rem;
}

.sequence-icon.rest-icon {
    font-size: 1.4rem;
    color: #94a3b8;
    font-family: 'Times New Roman', serif;
    font-weight: bold;
}

.sequence-name {
    font-weight: 600;
    color: #f8fafc;
    flex: 1;
}

/* Key items - blue theme */
.sequence-item.key {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    border-color: rgba(59, 130, 246, 0.2);
}

.sequence-item.key-current {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(37, 99, 235, 0.2) 100%);
    color: white;
    border-color: rgba(59, 130, 246, 0.5);
    font-weight: 600;
    box-shadow: 
        0 4px 15px rgba(59, 130, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Chord items - green theme */
.sequence-item.chord {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(22, 163, 74, 0.05) 100%);
    border-color: rgba(34, 197, 94, 0.2);
}

.sequence-item.chord-current {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.3) 0%, rgba(22, 163, 74, 0.2) 100%);
    color: white;
    border-color: rgba(34, 197, 94, 0.5);
    font-weight: 600;
    box-shadow: 
        0 4px 15px rgba(34, 197, 94, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Rest items - gray theme */
.sequence-item.rest {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.1) 0%, rgba(100, 116, 139, 0.05) 100%);
    border-color: rgba(148, 163, 184, 0.2);
}

.sequence-item.rest-current {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.3) 0%, rgba(100, 116, 139, 0.2) 100%);
    color: white;
    border-color: rgba(148, 163, 184, 0.5);
    font-weight: 600;
    box-shadow: 
        0 4px 15px rgba(148, 163, 184, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}



.sequence-delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: none;
    color: #94a3b8;
    border: none;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sequence-delete-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.1);
    transform: key(1.1);
}

.sequence-delete-btn:active {
    transform: key(0.95);
}

/* AI Chatbot Styles */
.chatbot-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chatbot-toggle {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 
        0 8px 25px rgba(59, 130, 246, 0.3),
        0 0 0 1px rgba(59, 130, 246, 0.2);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 35px rgba(59, 130, 246, 0.4),
        0 0 0 1px rgba(59, 130, 246, 0.3);
}

.chatbot-icon {
    font-size: 1.2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.chatbot-label {
    font-weight: 500;
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.chatbot-panel {
    position: absolute;
    top: 60px;
    left: 0;
    width: 380px;
    height: 500px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 16px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(59, 130, 246, 0.2);
    display: none;
    flex-direction: column;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.chatbot-panel.active {
    display: flex;
}

.chatbot-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-header h3 {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-message {
    display: flex;
    gap: 12px;
    animation: messageSlideIn 0.3s ease;
}

.chatbot-message.user {
    justify-content: flex-end;
}

.chatbot-message.bot {
    justify-content: flex-start;
}

.message-content {
    max-width: 280px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.chatbot-message.user .message-content {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-message.bot .message-content {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 4px;
}

.message-content p {
    margin: 0 0 8px 0;
    color: rgba(255, 255, 255, 0.9) !important;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin-bottom: 4px;
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Ensure all text in chatbot messages is light */
.chatbot-message.bot .message-content * {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Force all text in chatbot to be white */
.chatbot-messages,
.chatbot-messages *,
.chatbot-message,
.chatbot-message *,
.message-content,
.message-content * {
    color: white !important;
}

/* Target specific elements that might be dark */
.chatbot-message.bot .message-content p,
.chatbot-message.bot .message-content div,
.chatbot-message.bot .message-content span,
.chatbot-message.bot .message-content strong,
.chatbot-message.bot .message-content em {
    color: white !important;
    text-shadow: 0 0 1px rgba(0,0,0,0.5);
}

/* Nuclear option - force bot message text to be white, but preserve user message styling */
.chatbot-message.bot,
.chatbot-message.bot *,
.chatbot-message.bot .message-content,
.chatbot-message.bot .message-content * {
    color: white !important;
}

/* Ensure user messages maintain their blue styling and white text */
.chatbot-message.user .message-content {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    color: white !important;
    border-bottom-right-radius: 4px;
}

/* Override any conflicting styles for user messages */
.chatbot-message.user,
.chatbot-message.user *,
.chatbot-message.user .message-content,
.chatbot-message.user .message-content * {
    color: white !important;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
}

.chatbot-input-container {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px 12px;
    color: #f8fafc;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.chatbot-input:focus {
    border-color: #3b82f6;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.chatbot-input::placeholder {
    color: rgba(248, 250, 252, 0.6);
}

.chatbot-send {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.chatbot-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.chatbot-send:active {
    transform: translateY(0);
}

.chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading animation */
.chatbot-loading {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.chatbot-loading span {
    width: 6px;
    height: 6px;
    background: #3b82f6;
    border-radius: 50%;
    animation: loadingDots 1.4s infinite ease-in-out;
}

.chatbot-loading span:nth-child(1) { animation-delay: -0.32s; }
.chatbot-loading span:nth-child(2) { animation-delay: -0.16s; }

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: key(0.8);
        opacity: 0.5;
    }
    40% {
        transform: key(1);
        opacity: 1;
    }
}

/* Responsive design for chatbot */
@media (max-width: 900px) {
    .chatbot-container {
        top: calc(env(safe-area-inset-top, 0px) + 12px);
        left: calc(env(safe-area-inset-left, 0px) + 12px);
    }

    /* Collapse the toggle to a round icon so it doesn't crowd the title. */
    .chatbot-toggle {
        padding: 0;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        justify-content: center;
        gap: 0;
    }

    .chatbot-label {
        display: none;
    }

    .chatbot-icon {
        font-size: 1.1rem;
    }

    .chatbot-panel {
        width: min(360px, calc(100vw - 24px));
        height: 70vh;
        max-height: 520px;
        top: 50px;
        left: 0;
    }

    .message-content {
        max-width: 220px;
    }
}

@media (max-width: 480px) {
    .chatbot-panel {
        width: calc(100vw - 24px);
        left: 0;
    }

    .message-content {
        max-width: calc(100vw - 96px);
    }
}

/* Authentication UI Styles */
.auth-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  max-width: 300px;
}

/* PWA / mobile: respect the iPhone notch and home indicator. */
@media (max-width: 900px) {
  .auth-container {
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    right: calc(env(safe-area-inset-right, 0px) + 12px);
  }
}

/* Round person icon trigger (logged-out state). */
.auth-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.85);
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.25);
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.auth-icon-btn:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: rgba(148, 163, 184, 0.5);
  transform: translateY(-1px);
}

.auth-icon-btn svg {
  width: 22px;
  height: 22px;
}

/* Centered modal */
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.auth-modal-backdrop[hidden] { display: none; }

body.auth-modal-open { overflow: hidden; }

.auth-modal {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  padding: 28px 24px 24px;
}

.auth-popover-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: 0;
  color: #94a3b8;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

.auth-popover-close:hover { color: #f1f5f9; }

/* Tabs */
.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 10px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: 0;
  color: #94a3b8;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.auth-tab:hover { color: #f1f5f9; }

.auth-tab.is-active {
  background: rgba(96, 165, 250, 0.15);
  color: #f1f5f9;
}

.auth-pane[hidden] { display: none; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Inside the modal, the form shouldn't render as its own nested card. */
.auth-modal .auth-email-form {
  background: transparent;
  border: 0;
  padding: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.auth-login {
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.auth-login h3 {
  margin: 0 0 8px 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #f1f5f9;
}

.auth-login p {
  margin: 0 0 16px 0;
  font-size: 0.9rem;
  color: #94a3b8;
  line-height: 1.4;
}

.auth-providers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.btn-google, .btn-github, .btn-email {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: white;
  color: #374151;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-google:hover {
  background: #f8f9fa;
  border-color: #dadce0;
}

.btn-github:hover {
  background: #f6f8fa;
  border-color: #d0d7de;
}

.auth-divider {
  text-align: center;
  margin: 16px 0;
  position: relative;
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #e5e7eb;
}

.auth-divider span {
  background: rgba(30, 41, 59, 0.95);
  padding: 0 12px;
  color: #94a3b8;
  font-size: 0.8rem;
}

.auth-email-form {
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.auth-email-form h3 {
  margin: 0 0 16px 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #f1f5f9;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #e2e8f0;
}

.form-group input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #475569;
  border-radius: 6px;
  font-size: 0.9rem;
  background: rgba(15, 23, 42, 0.8);
  color: #f1f5f9;
  transition: border-color 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-group input::placeholder {
  color: #64748b;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.form-actions .btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-actions .btn-primary {
  background: #3b82f6;
  color: white;
}

.form-actions .btn-primary:hover {
  background: #2563eb;
}

.form-actions .btn-secondary {
  background: rgba(71, 85, 105, 0.8);
  color: #e2e8f0;
  border: 1px solid #475569;
}

.form-actions .btn-secondary:hover {
  background: rgba(100, 116, 139, 0.8);
  border-color: #64748b;
}

.auth-error-message {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-error-message::before {
  content: '⚠️';
  font-size: 0.9rem;
}

.auth-user-info {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

@media (max-width: 900px) {
  .auth-user-info {
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    right: calc(env(safe-area-inset-right, 0px) + 12px);
  }
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 4px 8px;
  border-radius: 4px;
}

.user-profile:hover {
  background: rgba(59, 130, 246, 0.1);
}

.user-email {
  color: #94a3b8;
  font-size: 14px;
  font-weight: 600;
}

.menu-arrow {
  color: #94a3b8;
  font-size: 12px;
  transition: transform 0.2s ease;
}

.user-profile:hover .menu-arrow {
  color: #e2e8f0;
}

.user-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 120px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  margin-top: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
}

.user-menu.menu-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.menu-item:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.menu-icon {
  font-size: 16px;
  opacity: 0.8;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-actions .btn {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 16px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.modal-body {
    padding: 24px;
}

.key-selector-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.key-selector-controls .chord-select {
    flex: 1;
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.key-selector-controls .chord-select:hover {
    border-color: rgba(59, 130, 246, 0.5);
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
}

.key-selector-controls .chord-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-actions .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.modal-actions .btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.modal-actions .btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-1px);
}

.modal-actions .btn-secondary {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    color: white;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.modal-actions .btn-secondary:hover {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    border-color: rgba(59, 130, 246, 0.5);
}

/* Modal responsive — Key/Chord/Sequence modals need to wrap on phones. */
@media (max-width: 560px) {
    .modal-content {
        width: calc(100vw - 24px);
        max-width: none;
        margin: 0 12px;
        border-radius: 14px;
    }

    .modal-header {
        padding: 16px 18px;
    }

    .modal-header h3 {
        font-size: 1rem;
    }

    .modal-body {
        padding: 18px;
    }

    .key-selector-controls,
    .chord-selector-controls {
        flex-direction: column;
        gap: 10px;
    }

    .key-selector-controls .chord-select,
    .chord-selector-controls .chord-select {
        width: 100%;
        min-width: 0;
    }

    .modal-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-actions .btn {
        width: 100%;
    }
}



.info-key::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
    transition: left 1.2s;
}

.info-key:hover::before {
    left: 100%;
}

/* Make info-key clickable */
.info-key {
    cursor: pointer;
    pointer-events: auto;
}

.info-key:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(37, 99, 235, 0.15) 100%);
    border-color: rgba(59, 130, 246, 0.6);
    transform: translateY(-2px);
}



/* Make info-chord clickable */
.info-chord {
    cursor: pointer;
    pointer-events: auto;
}

.info-chord:hover {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.25) 0%, rgba(4, 120, 87, 0.15) 100%);
    border-color: rgba(5, 150, 105, 0.6);
    transform: translateY(-2px);
}

/* Sequence List Modal Styles */
.sequence-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.sequence-item-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    color: white;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.sequence-item-btn:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
}

.sequence-item-btn:active {
    transform: translateY(0);
}

/* Animation for sequence item deletion */
.sequence-item-btn.deleting {
    animation: deleteSequenceItem 0.3s ease-out forwards;
    pointer-events: none;
}

@keyframes deleteSequenceItem {
    0% {
        opacity: 1;
        transform: translateX(0) key(1);
        max-height: 60px;
        margin-bottom: 8px;
    }
    50% {
        opacity: 0.5;
        transform: translateX(-20px) key(0.95);
        max-height: 60px;
        margin-bottom: 8px;
    }
    100% {
        opacity: 0;
        transform: translateX(-100px) key(0.8);
        max-height: 0;
        margin-bottom: 0;
        padding: 0;
    }
}

.sequence-item-info {
    flex: 1;
}

.sequence-item-name {
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cloud-indicator, .local-indicator {
    font-size: 12px;
    opacity: 0.7;
}

.sequence-item-details {
    font-size: 12px;
    opacity: 0.8;
}

.sequence-item-btn .btn-delete {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 12px;
}

.sequence-item-btn .btn-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

.settings-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 40px;
    margin-top: 16px;
    margin-bottom: 16px;
}

.settings-control {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 180px;
}

.settings-control label {
    font-size: 1rem;
    color: #f8fafc;
    font-weight: 500;
    margin-right: 6px;
}

.settings-control select {
    font-size: 1rem;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #64748b;
    background: #1e293b;
    color: #f8fafc;
    min-width: 90px;
}

/* Tuner Section */
.pitch-detection-section {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
}

/* Note Detection Section */
.note-detection-section {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
}

.pitch-detection-section h3 {
    color: #f8fafc !important;
    margin: 0 !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
}

.note-detection-section h3 {
    color: #f8fafc;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.pitch-detection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

.pitch-detection-header h3 {
    margin: 0;
    color: #f8fafc;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: left;
}

.pitch-detection-header-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pitch-detection-content {
    transition: all 0.3s ease;
    overflow: hidden;
    padding-top: 4px;
}

.pitch-detection-content.collapsed {
    max-height: 300px;
    opacity: 1;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.pitch-detection-content.expanded {
    max-height: none;
    opacity: 1;
    overflow: visible;
}

.pitch-detection-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.note-detection-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}



.stacks-display {
    display: flex !important;
    gap: 20px;
    margin-top: 15px;
    padding: 15px;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.1);
    flex-direction: column !important;
}

.stack-section {
    width: 100%;
}

.stack-section h5 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    color: #3b82f6;
    font-weight: 600;
}

.stack-content {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #e2e8f0;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 4px;
    min-height: 20px;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

/* Histogram styles */
.histogram-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
    font-size: 0.85rem;
}

.histogram-label {
    min-width: 60px;
    font-weight: 600;
    color: #f1f5f9;
}

.histogram-bar-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.histogram-bar {
    height: 16px;
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.histogram-count {
    min-width: 20px;
    text-align: right;
    font-weight: 600;
    color: #fbbf24;
}

.histogram-notes {
    font-size: 0.75rem;
    color: #94a3b8;
    font-style: italic;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pitch-status {
    color: #64748b;
    font-size: 0.9rem;
    font-style: italic;
    min-height: 24px;
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    width: 100%;
    flex-basis: 100%;
}



.btn-small {
    padding: 4px 8px;
    font-size: 0.75rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-small:hover {
    background: #2563eb;
}



/* Pitch Detection Button Styles */
.info-pitch-detect {
    background: #3b82f6;
    color: white;
    border: 1px solid #2563eb;
    transition: all 0.2s ease;
}

.info-pitch-detect:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.info-pitch-detect.active {
    background: #dc2626;
    border-color: #b91c1c;
}

.info-pitch-detect.active:hover {
    background: #b91c1c;
}

/* Pitch detected note highlight */
.pitch-detected {
    background: #fbbf24 !important;
    border: 2px solid #f59e0b !important;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.6) !important;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
    }
    50% {
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.8);
    }
    100% {
        box-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
    }
}

/* Pitch Variance Display Styles */
.pitch-variance-display {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    font-size: 0.85rem;
    color: #f1f5f9;
}

.variance-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #3b82f6;
    text-align: center;
}

.variance-stats {
    text-align: center;
    margin-bottom: 8px;
    color: #94a3b8;
    font-size: 0.8rem;
}

.variance-histogram {
    display: flex;
    align-items: flex-end;
    height: 200px;
    width: 100%;
    gap: 1px;
    margin: 8px 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 4px;
}

.variance-bar {
    flex: 1;
    background: linear-gradient(to top, #3b82f6, #60a5fa);
    min-height: 2px;
    border-radius: 1px;
    transition: height 0.3s ease;
    cursor: pointer;
}

.variance-bar:hover {
    background: linear-gradient(to top, #2563eb, #3b82f6);
    box-shadow: 0 0 4px rgba(59, 130, 246, 0.6);
}



.variance-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 4px;
}

.variance-placeholder {
    text-align: center;
    color: #64748b;
    font-style: italic;
    padding: 20px;
}

.string-tuner {
    margin-bottom: 20px;
    padding: 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
}

.tuner-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #3b82f6;
    text-align: center;
    font-size: 0.9rem;
}

.tuner-stats {
    text-align: center;
    margin-bottom: 8px;
    color: #94a3b8;
    font-size: 0.75rem;
}

.tuner-placeholder {
    text-align: center;
    color: #64748b;
    font-style: italic;
    padding: 10px;
    font-size: 0.8rem;
}

.global-histogram-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(59, 130, 246, 0.2);
}

/* Active state for variance button */
.btn-secondary.active {
    background: #dc2626;
    border-color: #b91c1c;
    color: white;
}

.btn-secondary.active:hover {
    background: #b91c1c;
}

/* Note Detection UI Styles */
.note-detection-section {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(59, 130, 246, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.note-detection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

.note-detection-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #f8fafc;
    margin: 0;
}

.note-detection-header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #f8fafc;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.out-of-key-badge {
    background-color: #dc2626;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    margin-left: 8px;
}

.note-item.in-key,
.chord-item.in-key {
    border-left: 3px solid #10b981;
}

.note-item,
.chord-item {
    position: relative;
}

.delete-note-btn,
.delete-chord-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border: none;
    background: #dc2626;
    color: white;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
}

.delete-note-btn:hover,
.delete-chord-btn:hover {
    background: #b91c1c;
}

.chord-info {
    text-align: center;
}

.note-detection-status {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    text-align: center;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #cbd5e1;
}

.note-detection-status.success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.note-detection-status.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.note-detection-status.warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.note-detection-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.notes-section, .chords-section {
    background: rgba(15, 23, 42, 0.3);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.notes-section h4, .chords-section h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #f8fafc;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

.notes-list, .chords-list {
    max-height: 600px;
    overflow-y: auto;
    padding-right: 8px;
}

.notes-list::-webkit-scrollbar, .chords-list::-webkit-scrollbar {
    width: 6px;
}

.notes-list::-webkit-scrollbar-track, .chords-list::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
    border-radius: 3px;
}

.notes-list::-webkit-scrollbar-thumb, .chords-list::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 3px;
}

.notes-list::-webkit-scrollbar-thumb:hover, .chords-list::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

.empty-state {
    text-align: center;
    color: #64748b;
    font-style: italic;
    padding: 20px;
}

.note-item, .chord-item {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.note-item:hover, .chord-item:hover {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.note-info, .chord-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.note-name, .chord-name {
    font-weight: 600;
    color: #f8fafc;
    font-size: 1.1rem;
}

.note-confidence, .note-count, .chord-count {
    color: #94a3b8;
    font-size: 0.9rem;
}

.chord-notes {
    color: #94a3b8;
    font-size: 0.9rem;
    font-style: italic;
}

.note-actions, .chord-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ffffff;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* OpenAI Settings Button Styles */
#reset-openai-key {
    transition: all 0.2s ease;
}

#reset-openai-key:hover {
    background: #dc2626 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

#save-openai-key {
    transition: all 0.2s ease;
}

#save-openai-key:hover {
    background: #2563eb !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.note-detection-controls {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(59, 130, 246, 0.2);
}

/* Responsive design for note detection */
@media (max-width: 768px) {
    .note-detection-content {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .note-detection-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .note-detection-header h3 {
        text-align: center;
    }
    
    .note-actions, .chord-actions {
        flex-direction: column;
    }
    
    .btn-sm {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .note-detection-section {
        padding: 16px;
        margin: 16px 0;
    }
    
    .notes-section, .chords-section {
        padding: 16px;
    }
    
    .note-item, .chord-item {
        padding: 10px;
    }
    
    .note-info, .chord-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* Suggestion styling */
.suggestion-badge {
    display: none; /* Hide the suggestion badge completely */
}

.chord-item.suggestion {
    /* Remove the red border and background styling */
    border-left: none;
    background: none;
}

.chord-item.suggestion .chord-name {
    /* Use the same color as regular chord names */
    color: #f8fafc;
    font-weight: inherit;
}

/* Circular tap target for grid cells - performance optimized */
.circular-tap-target {
    position: relative;
}

.circular-tap-target::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--tap-size, 100%);
    height: var(--tap-size, 100%);
    border-radius: 50%;
    background: transparent;
    transform: translate(-50%, -50%);
    z-index: 5;
    pointer-events: auto;
    opacity: 0;
}