/* Modal Styles - all modal dialogs and overlays */

/* Fret count button and modal */
.fret-count-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    height: 30px;
    min-width: 6em;
    background-color: #2196F3;
    color: white;
    border: 2px solid transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
}

.fret-count-button:hover {
    background-color: #1976D2;
    border-color: rgba(0, 230, 118, 0.3);
    box-shadow: 0 0 8px rgba(33, 150, 243, 0.3), 0 0 4px rgba(0, 230, 118, 0.15);
}

.fret-count-button:active {
    transform: translateY(0);
}

.fret-count-button .fret-indicator {
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.fret-count-modal-content {
    max-width: 660px;
    padding: 46px 38px 34px;
    position: relative;
    text-align: center;
}

.modal-content.fret-count-modal-content {
    height: 28em;
    padding: 1em;
}

.fret-count-modal-header {
    margin-bottom: 12px;
    margin-top: 2em;
}

.modal-description {
    text-align: center;
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 30px;
}

#fretCountModal .modal-description {
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    margin-bottom: 24px;
}

.fret-count-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 6px;
    margin-left: auto;
    margin-right: auto;
    width: 95%;
}

.fret-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 22px 14px;
    background: linear-gradient(135deg, rgba(18, 26, 62, 0.95), rgba(12, 14, 32, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 16px 36px rgba(3, 5, 20, 0.75);
}

.fret-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, rgba(96, 118, 255, 0.15), rgba(12, 16, 44, 0.85));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.fret-option:hover::before {
    opacity: 1;
}

.fret-option.active {
    border-color: rgba(103, 140, 255, 0.95);
    background: linear-gradient(135deg, rgba(101, 118, 234, 0.98), rgba(12, 19, 46, 0.98));
    box-shadow: 0 24px 45px rgba(25, 44, 111, 0.75);
    transform: translateY(-3px);
}

.fret-option.active .fret-number,
.fret-option.active .fret-label {
    color: #ffffff;
}

.fret-option:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 34px rgba(0, 0, 0, 0.65);
}

.fret-number {
    font-size: 32px;
    font-weight: 700;
    color: #f3f6ff;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
    transition: color 0.3s ease;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
}

.fret-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(209, 223, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
    transition: color 0.3s ease;
}
/* Base modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 12000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, var(--panel-bg) 0%, var(--panel-muted) 100%);
    margin: 5vh auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 900px;
    height: 90vh;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    animation: modalFadeIn 0.3s;
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
}

#helpModal .modal-content {
    width: 95vw;
    max-width: 1400px;
    height: 95vh;
    max-height: 95vh;
    margin: 2.5vh auto;
}

/* Balloon settings modal */
.modal-content.balloon-modal-content {
    max-width: 520px;
    height: auto;
    padding: 34px 36px 40px;
    margin: 12vh auto;
    gap: 18px;
    position: relative;
    overflow: visible;
}

.balloon-modal-content > *:not(.balloon-confetti-canvas) {
    position: relative;
    z-index: 2;
}

.balloon-modal-content .settings-modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 8px;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.balloon-modal-content .settings-modal-header .modal-title {
    margin: 0;
}

.balloon-modal-content .close-button.balloon-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--close-button-bg);
    color: var(--close-button-icon, var(--text-primary));
    border: 2px solid var(--close-button-border);
    box-shadow: 0 0 12px var(--close-button-shadow);
    transition: all 0.2s ease;
}

.balloon-modal-content .close-button.balloon-close:hover {
    background: var(--close-button-hover-bg);
    border-color: var(--close-button-hover-border);
    box-shadow: 0 0 16px var(--close-button-hover-shadow);
    color: var(--close-button-icon, var(--text-primary));
}

.balloon-modal-content .modal-title {
    font-size: 26px;
}

.balloon-modal-content .modal-description {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
}

.balloon-modal-content .spacing-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
}

.balloon-modal-content .spacing-control label,
.balloon-modal-content .spacing-control span {
    font-size: 18px;
}

.balloon-settings-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.balloon-toggle-option {
    display: flex;
    justify-content: center;
}

.balloon-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

.balloon-toggle-label input {
    width: 18px;
    height: 18px;
    accent-color: rgba(255, 214, 102, 0.9);
}

.balloon-presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 10px;
}

.balloon-preset {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(20, 25, 45, 0.5);
    color: var(--text-primary);
    font-size: 18px;
    min-height: 50px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.balloon-preset:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 214, 102, 0.5);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.balloon-preset-default {
    display: block;
    margin-top: 2px;
    font-size: 14px;
    opacity: 0.75;
    letter-spacing: 0.4px;
}

.balloon-confetti-canvas {
    position: absolute;
    pointer-events: none;
    border-radius: 16px;
    background: transparent;
    z-index: 3;
}

/* Lightning settings modal */
.modal-content.lightning-modal-content {
    max-width: 520px;
    height: auto;
    padding: 34px 36px 40px;
    margin: 12vh auto;
    gap: 18px;
    position: relative;
    overflow: visible;
}

.lightning-modal-content > *:not(.lightning-preview-canvas) {
    position: relative;
    z-index: 2;
}

.lightning-modal-content .settings-modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 8px;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.lightning-modal-content .settings-modal-header .modal-title {
    margin: 0;
}

.lightning-modal-content .close-button.lightning-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--close-button-bg);
    color: var(--close-button-icon, var(--text-primary));
    border: 2px solid var(--close-button-border);
    box-shadow: 0 0 12px var(--close-button-shadow);
    transition: all 0.2s ease;
}

.lightning-modal-content .close-button.lightning-close:hover {
    background: var(--close-button-hover-bg);
    border-color: var(--close-button-hover-border);
    box-shadow: 0 0 16px var(--close-button-hover-shadow);
    color: var(--close-button-icon, var(--text-primary));
}

.lightning-modal-content .modal-title {
    font-size: 26px;
}

.lightning-modal-content .modal-description {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
}

.lightning-modal-content .spacing-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
}

.lightning-modal-content .spacing-control label,
.lightning-modal-content .spacing-control span {
    font-size: 18px;
}

.lightning-modal-content .spacing-control select {
    background: rgba(20, 25, 45, 0.65);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 16px;
}

.lightning-settings-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.lightning-toggle-option {
    display: flex;
    justify-content: center;
}

.lightning-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

.lightning-toggle-label input {
    width: 18px;
    height: 18px;
    accent-color: rgba(110, 220, 255, 0.9);
}

.lightning-presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 10px;
}

.lightning-preset {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(20, 25, 45, 0.5);
    color: var(--text-primary);
    font-size: 18px;
    min-height: 50px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.lightning-preset:hover {
    transform: translateY(-1px);
    border-color: rgba(110, 220, 255, 0.6);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.lightning-preset-default {
    display: block;
    margin-top: 2px;
    font-size: 14px;
    opacity: 0.75;
    letter-spacing: 0.4px;
}

.lightning-preview-canvas {
    position: absolute;
    pointer-events: none;
    border-radius: 16px;
    background: transparent;
    z-index: 3;
}

/* Video settings modal */
.modal-content.video-modal-content {
    width: 50vw;
    max-width: 600px;
    min-width: 360px;
    height: auto;
    max-height: 96vh;
    padding: 34px 36px 40px;
    margin: 2vh auto;
    position: relative;
    overflow-y: auto;
    border: 1px solid rgba(100, 180, 255, 0.25);
    box-shadow: 0 12px 50px rgba(0, 0, 0, 0.4), 0 0 40px rgba(100, 180, 255, 0.12);
}

.video-modal-content .settings-modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.video-modal-content .settings-modal-header .modal-title {
    margin: 0;
}

.video-modal-content .close-button.video-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    font-size: 32px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 2px solid var(--close-button-border);
    background: var(--close-button-bg);
    color: var(--close-button-icon, var(--text-primary));
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.video-modal-content .close-button.video-close:hover {
    background: var(--close-button-hover-bg);
    border-color: var(--close-button-hover-border);
    box-shadow: 0 0 16px var(--close-button-hover-shadow);
}

.video-modal-content .modal-title {
    font-size: 26px;
}

.video-modal-content .modal-description {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: center;
}

.video-settings-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.video-toggle-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.video-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    cursor: pointer;
}

.video-toggle-label input {
    width: 18px;
    height: 18px;
    accent-color: rgba(100, 180, 255, 0.9);
}

.video-toggle-hint {
    font-size: 14px;
    color: rgba(180, 200, 220, 0.75);
    text-align: center;
    margin: 0;
    max-width: 360px;
}

/* Advanced divider */
.video-advanced-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 6px 0 2px;
}

.video-advanced-divider::before,
.video-advanced-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(100, 180, 255, 0.18);
}

.video-advanced-divider span {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(140, 180, 220, 0.6);
    white-space: nowrap;
}

/* Camera option sub-panel */
.video-camera-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 16px 6px;
    border-radius: 8px;
    background: rgba(100, 180, 255, 0.05);
    border: 1px solid rgba(100, 180, 255, 0.1);
}

.video-camera-option-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.video-camera-option-row label {
    font-size: 15px;
    color: rgba(200, 215, 230, 0.85);
}

.video-camera-option-row select {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid rgba(100, 180, 255, 0.25);
    background: rgba(20, 30, 50, 0.6);
    color: rgba(220, 230, 240, 0.95);
    font-size: 14px;
    cursor: pointer;
    outline: none;
    min-width: 140px;
}

.video-camera-option-row select:focus {
    border-color: rgba(100, 180, 255, 0.5);
    box-shadow: 0 0 8px rgba(100, 180, 255, 0.15);
}

/* Camera inline preview (inside settings modal) */
.video-camera-preview-container {
    display: flex;
    justify-content: center;
    padding: 4px 0 2px;
}

.camera-inline-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(100, 180, 255, 0.4);
    background: #111;
    box-shadow: 0 0 16px rgba(100, 180, 255, 0.12);
    transform: scaleX(-1);
}

/* Floating camera preview (visible in settings modal) */
.camera-settings-floating-preview {
    position: fixed;
    width: 120px;
    height: 120px;
    z-index: 100001;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(100, 180, 255, 0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    cursor: grab;
    background: #111;
    transition: top 0.3s ease, right 0.3s ease, bottom 0.3s ease, left 0.3s ease;
}

.camera-settings-floating-preview:active {
    cursor: grabbing;
    transition: none;
}

.camera-settings-floating-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    transform: scaleX(-1);
}

/* Hint text in camera options */
.video-camera-preview-hint {
    margin: 0 0 4px;
    font-style: italic;
}

.video-position-hint {
    margin: 0 0 4px;
    font-size: 12px;
}

/* Position diagram — mini video frame thumbnail */
.video-position-diagram-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 2px 0 6px;
}

.video-position-diagram {
    position: relative;
    width: 140px;
    height: 80px;
    border: 2px solid rgba(100, 180, 255, 0.35);
    border-radius: 6px;
    background: rgba(10, 20, 40, 0.5);
}

.video-position-diagram-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    color: rgba(140, 180, 220, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    pointer-events: none;
}

.video-position-dot {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(100, 180, 255, 0.6);
    border: 2px solid rgba(100, 180, 255, 0.9);
    box-shadow: 0 0 8px rgba(100, 180, 255, 0.3);
    transition: top 0.3s ease, left 0.3s ease, right 0.3s ease, bottom 0.3s ease;
}

/* Position states */
.video-position-dot[data-position="bottom-right"] {
    bottom: 6px;
    right: 6px;
    top: auto;
    left: auto;
}

.video-position-dot[data-position="bottom-left"] {
    bottom: 6px;
    left: 6px;
    top: auto;
    right: auto;
}

.video-position-dot[data-position="top-right"] {
    top: 6px;
    right: 6px;
    bottom: auto;
    left: auto;
}

.video-position-dot[data-position="top-left"] {
    top: 6px;
    left: 6px;
    bottom: auto;
    right: auto;
}

/* Floating camera preview (visible during recording) */
.camera-floating-preview {
    position: fixed;
    bottom: 20px;
    right: 20px;
    /* width/height set inline by JS (default 120px, resizable 80-300px) */
    z-index: 99999;
    border-radius: 50%;
    overflow: visible;
    border: 3px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.camera-floating-preview.dragging {
    cursor: grabbing;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.camera-floating-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scaleX(-1);
    pointer-events: none;
    border-radius: 50%;
}

/* Pulsing red recording dot */
.camera-floating-rec-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e74c3c;
    box-shadow: 0 0 6px rgba(231, 76, 60, 0.7);
    animation: cam-rec-pulse 1.2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes cam-rec-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Mic indicator on floating preview */
.camera-floating-mic-dot {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2ecc71;
    box-shadow: 0 0 6px rgba(46, 204, 113, 0.7);
    animation: cam-rec-pulse 1.2s ease-in-out infinite;
    pointer-events: none;
}

/* Hover overlay with control buttons */
.camera-hover-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.4) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 3;
}

.camera-floating-preview:not(.dragging):hover .camera-hover-overlay {
    opacity: 1;
    pointer-events: none;
}

.camera-floating-preview:not(.dragging):hover .camera-overlay-btn {
    pointer-events: auto;
}

/* Button row — horizontal layout */
.camera-overlay-btn-row {
    display: flex;
    gap: 6px;
    pointer-events: none;
}

/* Unified overlay button (camera, pause, mute) */
.camera-overlay-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    padding: 6px 8px 4px;
    background: rgba(0, 0, 0, 0.55);
    color: rgba(255, 255, 255, 0.85);
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: none;
}

.camera-overlay-btn .cam-btn-icon {
    display: block;
    pointer-events: none;
}

.camera-overlay-btn .cam-btn-label {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1;
    pointer-events: none;
}

.camera-overlay-btn:active {
    transform: scale(0.92);
}

/* State: video hidden (red) */
.camera-overlay-btn.cam-btn-off {
    color: rgba(231, 76, 60, 0.9);
}

/* State: paused (amber) */
.camera-overlay-btn.cam-btn-paused {
    color: rgba(255, 179, 71, 0.95);
}

/* State: mic muted (red) */
.camera-overlay-btn.mic-muted {
    color: rgba(231, 76, 60, 0.9);
}

/* Privacy overlay — shown when camera video is hidden */
.camera-privacy-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(10, 12, 18, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
}

.camera-privacy-overlay svg {
    opacity: 0.5;
}

/* Paused recording dot — stop pulsing, dim */
.camera-floating-rec-dot.paused {
    animation: none;
    opacity: 0.4;
    background: #b03a2e;
    box-shadow: 0 0 4px rgba(176, 58, 46, 0.5);
}

/* Compact mode — hide labels when preview is small */
.camera-preview-compact .cam-btn-label {
    display: none;
}

.camera-preview-compact .camera-overlay-btn {
    padding: 5px 6px 5px;
}

.camera-preview-compact .camera-overlay-btn-row {
    gap: 4px;
}

/* Resize handle on floating preview */
.camera-resize-handle {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(30, 60, 120, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: nwse-resize;
    z-index: 3;
    transition: transform 0.15s ease, background 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.camera-resize-handle:hover {
    transform: scale(1.15);
    background: rgba(0, 0, 0, 0.6);
}

.camera-resize-handle svg {
    pointer-events: none;
}

/* Volume meter canvas overlay — sits outside the circle, not clipped */
.camera-volume-meter {
    position: absolute;
    top: 50%;
    left: 50%;
    /* width/height set inline by JS (diameter + 16px) */
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
    background: transparent;
    margin: 0;
}

/* Thin divider between camera and mic sections */
.video-mic-divider {
    height: 1px;
    background: rgba(100, 180, 255, 0.12);
    margin: 4px 0 2px;
}

/* Mic options sub-panel */
.video-mic-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Flame settings modal */
.modal-content.flame-modal-content {
    max-width: 520px;
    height: auto;
    padding: 34px 36px 40px;
    margin: 12vh auto;
    gap: 18px;
    position: relative;
    overflow: visible;
}

.flame-modal-content > *:not(.flame-preview-canvas) {
    position: relative;
    z-index: 2;
}

.flame-modal-content .settings-modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 8px;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.flame-modal-content .settings-modal-header .modal-title {
    margin: 0;
}

.flame-modal-content .close-button.flame-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--close-button-bg);
    color: var(--close-button-icon, var(--text-primary));
    border: 2px solid var(--close-button-border);
    box-shadow: 0 0 12px var(--close-button-shadow);
    transition: all 0.2s ease;
}

.flame-modal-content .close-button.flame-close:hover {
    background: var(--close-button-hover-bg);
    border-color: var(--close-button-hover-border);
    box-shadow: 0 0 16px var(--close-button-hover-shadow);
    color: var(--close-button-icon, var(--text-primary));
}

.flame-modal-content .modal-title {
    font-size: 26px;
}

.flame-modal-content .modal-description {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
}

.flame-modal-content .spacing-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
}

.flame-modal-content .spacing-control label,
.flame-modal-content .spacing-control span {
    font-size: 18px;
}

.flame-settings-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.flame-toggle-option {
    display: flex;
    justify-content: center;
}

.flame-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

.flame-toggle-label input {
    width: 18px;
    height: 18px;
    accent-color: rgba(255, 150, 80, 0.9);
}

.flame-presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
}

.flame-preset {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(20, 25, 45, 0.5);
    color: var(--text-primary);
    font-size: 18px;
    min-height: 50px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.flame-preset:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 150, 80, 0.6);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.flame-preset-default {
    display: block;
    margin-top: 2px;
    font-size: 14px;
    opacity: 0.75;
    letter-spacing: 0.4px;
}

.flame-preview-canvas {
    position: absolute;
    pointer-events: none;
    border-radius: 16px;
    background: transparent;
    z-index: 3;
}

/* Bass Strum Settings Modal */
.modal-content.bass-strum-modal-content {
    max-width: 640px;
    height: auto;
    padding: 36px 40px 42px;
    margin: 10vh auto;
    gap: 18px;
    position: relative;
    overflow: visible;
    background: linear-gradient(155deg, rgba(20, 22, 34, 0.98), rgba(12, 14, 24, 0.98));
    border: 1px solid rgba(214, 184, 98, 0.25);
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.bass-strum-modal-content .settings-modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 8px;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.bass-strum-modal-content::before {
    content: '';
    position: absolute;
    inset: 10px;
    border-radius: 18px;
    border: 1px solid rgba(255, 244, 214, 0.08);
    box-shadow: inset 0 0 28px rgba(214, 184, 98, 0.12);
    pointer-events: none;
}

.bass-strum-modal-content .settings-modal-header .modal-title {
    margin: 0;
    font-size: 27px;
    letter-spacing: 0.4px;
}

.bass-strum-modal-content .close-button.bass-strum-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(24, 26, 36, 0.9);
    color: var(--text-primary);
    border: 1px solid rgba(214, 184, 98, 0.35);
    box-shadow: 0 0 14px rgba(214, 184, 98, 0.18);
    transition: all 0.2s ease;
}

.bass-strum-modal-content .close-button.bass-strum-close:hover {
    background: rgba(30, 32, 44, 0.95);
    border-color: rgba(214, 184, 98, 0.6);
    box-shadow: 0 0 20px rgba(214, 184, 98, 0.32);
    color: #fff;
}

.bass-strum-modal-content .modal-description {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 14px;
    text-align: center;
    color: var(--text-secondary);
}

.bass-strum-settings-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.phrase-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 0 auto;
    max-width: 560px;
}

.phrase-option {
    display: block;
    cursor: pointer;
    position: relative;
    border-radius: 16px;
    background: linear-gradient(160deg, rgba(30, 32, 46, 0.9), rgba(16, 18, 30, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 44px 20px 18px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
}

.phrase-option:hover {
    border-color: rgba(214, 184, 98, 0.5);
    box-shadow: 0 16px 32px rgba(12, 12, 20, 0.5), 0 0 18px rgba(214, 184, 98, 0.16);
    transform: translateY(-2px);
}

.phrase-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.phrase-option input[type="radio"]:checked ~ .option-content {
    color: var(--text-primary);
}

.phrase-option:has(input[type="radio"]:checked) {
    background: linear-gradient(160deg, rgba(60, 52, 28, 0.6), rgba(22, 20, 28, 0.95));
    border-color: rgba(214, 184, 98, 0.7);
    box-shadow: 0 18px 36px rgba(10, 10, 18, 0.55), 0 0 22px rgba(214, 184, 98, 0.28);
}

.phrase-option::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 18px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(214, 184, 98, 0.4);
    background: rgba(12, 12, 18, 0.8);
    box-shadow: inset 0 0 6px rgba(214, 184, 98, 0.2);
    transform: translateX(-50%);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.phrase-option::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 23px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f3e7c2, #d6b862);
    opacity: 0;
    transform: translateX(-50%) scale(0.8);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.phrase-option:has(input[type="radio"]:checked)::before {
    border-color: rgba(214, 184, 98, 0.9);
    box-shadow: 0 0 10px rgba(214, 184, 98, 0.45);
    transform: translateX(-50%) scale(1.05);
}

.phrase-option:has(input[type="radio"]:checked)::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.option-content h3 {
    margin: 0 0 6px 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.option-content p {
    margin: 0 0 4px 0;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.option-content small {
    font-size: 12px;
    color: rgba(220, 210, 180, 0.7);
    font-style: normal;
}

@media (max-width: 720px) {
    .phrase-options {
        grid-template-columns: 1fr;
    }

    .phrase-option {
        padding: 42px 18px 16px;
    }

    .bass-strum-modal-content {
        margin: 8vh auto;
        padding: 32px 28px 36px;
    }
}

/* Wider, scrollable tuning modal */
#tuningModal .modal-content {
    width: calc(100% - 4em);
    max-width: 860px;
    height: 90vh;
    max-height: 100vh;
    margin: 0 auto;
    padding: 28px 28px 36px;
    overflow: auto;
}

#tuningModal .settings-modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 12px;
    padding-bottom: 8px;
    margin-bottom: 10px;
}

#tuningModal .settings-modal-header .modal-title {
    margin-top: 0;
    margin-bottom: 0;
}

#tuningModal .close-button.tuning-close {
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--close-button-bg);
    color: var(--close-button-icon, var(--text-primary));
    border: 2px solid var(--close-button-border);
    box-shadow: 0 0 12px var(--close-button-shadow);
    transition: all 0.2s ease;
}

#tuningModal .close-button.tuning-close:hover {
    background: var(--close-button-hover-bg);
    border-color: var(--close-button-hover-border);
    box-shadow: 0 0 16px var(--close-button-hover-shadow);
    color: var(--close-button-icon, var(--text-primary));
}

/* Sample sustain modal matches tuning modal styling */
#sampleSustainModal .modal-content {
    width: calc(100% - 4em);
    max-width: 860px;
    height: 90vh;
    max-height: 100vh;
    margin: 0 auto;
    padding: 28px 28px 36px;
    overflow: auto;
}

#sampleSustainModal .settings-modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 12px;
    padding-bottom: 8px;
    margin-bottom: 10px;
}

#sampleSustainModal .settings-modal-header .modal-title {
    margin-top: 0;
    margin-bottom: 0;
}

#sampleSustainModal .close-button.sample-sustain-close {
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--close-button-bg);
    color: var(--close-button-icon, var(--text-primary));
    border: 2px solid var(--close-button-border);
    box-shadow: 0 0 12px var(--close-button-shadow);
    transition: all 0.2s ease;
}

#sampleSustainModal .close-button.sample-sustain-close:hover {
    background: var(--close-button-hover-bg);
    border-color: var(--close-button-hover-border);
    box-shadow: 0 0 16px var(--close-button-hover-shadow);
    color: var(--close-button-icon, var(--text-primary));
}

#pianoSampleModal .modal-content {
    width: calc(100% - 4em);
    max-width: 860px;
    height: 90vh;
    max-height: 100vh;
    margin: 0 auto;
    padding: 28px 28px 36px;
    overflow: auto;
}

#pianoSampleModal .settings-modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 12px;
    padding-bottom: 8px;
    margin-bottom: 10px;
}

#pianoSampleModal .settings-modal-header .modal-title {
    margin-top: 0;
    margin-bottom: 0;
}

#pianoSampleModal .close-button.piano-sample-close {
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--close-button-bg);
    color: var(--close-button-icon, var(--text-primary));
    border: 2px solid var(--close-button-border);
    box-shadow: 0 0 12px var(--close-button-shadow);
    transition: all 0.2s ease;
}

#pianoSampleModal .close-button.piano-sample-close:hover {
    background: var(--close-button-hover-bg);
    border-color: var(--close-button-hover-border);
    box-shadow: 0 0 16px var(--close-button-hover-shadow);
    color: var(--close-button-icon, var(--text-primary));
}

#fretCountModal .settings-modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 12px;
    padding-bottom: 8px;
    margin-bottom: 10px;
}

#fretCountModal .settings-modal-header .modal-title {
    margin-top: 0;
    margin-bottom: 0;
}

#fretCountModal .close-button.fret-close {
    position: absolute;
    top: 63%;
    right: 27px;
    transform: translateY(-50%);
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--close-button-bg);
    color: var(--close-button-icon, var(--text-primary));
    border: 2px solid var(--close-button-border);
    box-shadow: 0 0 12px var(--close-button-shadow);
    transition: all 0.2s ease;
}

#fretCountModal .close-button.fret-close:hover {
    background: var(--close-button-hover-bg);
    border-color: var(--close-button-hover-border);
    box-shadow: 0 0 16px var(--close-button-hover-shadow);
    color: var(--close-button-icon, var(--text-primary));
}


.modal-content-inner {
    padding: 40px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-glow, #3cf5b0) rgba(11, 16, 28, 0.9);
}

.modal-content-inner::-webkit-scrollbar {
    width: 8px;
}

.modal-content-inner::-webkit-scrollbar-track {
    background: rgba(11, 16, 28, 0.9);
    border-radius: 999px;
}

.modal-content-inner::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(22, 249, 190, 0.95), rgba(14, 114, 243, 0.9));
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.modal-content-inner::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(34, 201, 119, 0.95), rgba(37, 99, 235, 0.9));
}

#settingsModal .modal-content {
    width: 95vw;
    max-width: 1400px;
    height: 95vh;
    max-height: 95vh;
    margin: 2.5vh auto;
}

#settingsModal .modal-content-inner {
    padding: 32px 48px 36px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    flex: 1;
}

.sampler-modal-content {
    max-width: 520px;
    text-align: center;
    background: linear-gradient(135deg, var(--panel-bg) 0%, var(--panel-muted) 100%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.06);
    height: auto;
    max-height: 80vh;
    margin: 10vh auto;
    padding: 28px 30px 32px;
    overflow-y: auto;
}

.sampler-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 20px auto 10px;
}

.sampler-led {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 10px rgba(10, 16, 30, 0.45);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.sampler-led.recording {
    background: #ff4b2b;
    box-shadow: 0 0 18px rgba(255,75,43,0.75);
}

.sampler-timer {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
    color: var(--text-primary);
}

.sampler-status-text {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.sampler-hero-emoji {
    font-size: 7rem;
    line-height: 1;
    padding: 0.5em 0;
    text-shadow:
        0 0 2px rgba(7, 12, 24, 0.85),
        0 0 6px rgba(7, 12, 24, 0.6),
        0 8px 14px rgba(255, 255, 255, 0.12);
}

.sampler-subtext {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 auto;
    max-width: 420px;
}

.sampler-meter-wrapper {
    width: 80%;
    max-width: 360px;
    margin: 0 auto 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sampler-meter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sampler-meter-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--text-secondary);
}

.sampler-gain-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sampler-gain-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: var(--text-primary);
    width: 22px;
    height: 22px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.sampler-gain-btn:hover {
    background: rgba(34, 201, 119, 0.18);
    border-color: rgba(34, 201, 119, 0.6);
    box-shadow: 0 0 10px rgba(34, 201, 119, 0.35);
}

.sampler-gain-btn:active {
    transform: scale(0.96);
}

.sampler-gain-value {
    font-size: 0.75rem;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
    color: var(--text-primary);
}

.sampler-meter {
    width: 100%;
    height: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    margin: 0;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35);
}

.sampler-meter-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #22c977, #5aa6ff);
    box-shadow: 0 0 12px rgba(34, 201, 119, 0.35);
    transition: width 0.08s ease;
}

/* Sampler action buttons (Save / Download / Clear) */
.sampler-action-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 14px 0 6px;
}

.sampler-action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: var(--text-primary);
    padding: 7px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sampler-action-btn:hover {
    background: rgba(34, 201, 119, 0.18);
    border-color: rgba(34, 201, 119, 0.6);
    box-shadow: 0 0 10px rgba(34, 201, 119, 0.3);
}

.sampler-action-btn:active {
    transform: scale(0.96);
}

.sampler-action-btn--danger:hover {
    background: rgba(255, 75, 43, 0.18);
    border-color: rgba(255, 75, 43, 0.6);
    box-shadow: 0 0 10px rgba(255, 75, 43, 0.3);
}

.sampler-action-btn--confirm {
    background: rgba(34, 201, 119, 0.15);
    border-color: rgba(34, 201, 119, 0.4);
}

.sampler-action-btn--cancel {
    opacity: 0.7;
}

/* Sampler save form */
.sampler-save-form {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 14px 0 6px;
}

.sampler-save-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    width: 180px;
    outline: none;
    transition: border-color 0.2s ease;
}

.sampler-save-input:focus {
    border-color: rgba(34, 201, 119, 0.6);
    box-shadow: 0 0 8px rgba(34, 201, 119, 0.2);
}

/* Sampler library section */
.sampler-library-section {
    margin-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 14px;
}

.sampler-library-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 10px;
}

.sampler-library-list {
    max-height: 160px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sampler-library-empty {
    font-size: 0.82rem;
    color: var(--text-secondary);
    opacity: 0.6;
    margin: 8px 0;
}

.sampler-library-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.15s ease;
}

.sampler-library-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sampler-library-item-name {
    flex: 1;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sampler-library-item-date {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.7;
    white-space: nowrap;
}

.sampler-library-item-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    padding: 3px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sampler-library-item-btn:hover {
    background: rgba(34, 201, 119, 0.18);
    border-color: rgba(34, 201, 119, 0.5);
}

.sampler-library-item-btn--delete:hover {
    background: rgba(255, 75, 43, 0.18);
    border-color: rgba(255, 75, 43, 0.5);
}

#samplerModal .close-button {
    position: absolute;
    top: 18px;
    right: 16px;
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--close-button-bg);
    color: var(--close-button-icon, var(--text-primary));
    border: 2px solid var(--close-button-border);
    box-shadow: 0 0 12px var(--close-button-shadow);
    transition: all 0.2s ease;
    float: none;
}

#samplerModal .close-button:hover {
    background: var(--close-button-hover-bg);
    border-color: var(--close-button-hover-border);
    box-shadow: 0 0 16px var(--close-button-hover-shadow);
    color: var(--close-button-icon, var(--text-primary));
}

@keyframes modalFadeIn {
    from {opacity: 0; transform: translateY(-20px);}
    to {opacity: 1; transform: translateY(0);}
}

.close-button {
    position: sticky;
    float: right;
    top: 10px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 2;
}

.close-button:hover {
    color: #555;
}

#humSettingsModal .close-button {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--close-button-bg);
    color: var(--close-button-icon, var(--text-primary));
    border: 1px solid var(--close-button-border);
    box-shadow: 0 0 8px var(--close-button-shadow);
    transition: all 0.2s ease;
}

#humSettingsModal .close-button:hover {
    background: var(--close-button-hover-bg);
    color: var(--close-button-icon, var(--text-primary));
    border-color: var(--close-button-hover-border);
    border-width: 2px;
    box-shadow: 0 0 18px var(--close-button-hover-shadow);
}

#settingsModal .settings-modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 12px;
    padding-bottom: 8px;
    margin-bottom: 10px;
}

#settingsModal .settings-modal-header .modal-title {
    margin-top: 0;
    margin-bottom: 0;
}

#settingsModal .close-button {
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--close-button-bg);
    color: var(--close-button-icon, var(--text-primary));
    border: 2px solid var(--close-button-border);
    box-shadow: 0 0 12px var(--close-button-shadow);
    transition: all 0.2s ease;
}

#settingsModal .close-button:hover {
    background: var(--close-button-hover-bg);
    border-color: var(--close-button-hover-border);
    box-shadow: 0 0 16px var(--close-button-hover-shadow);
    color: var(--close-button-icon, var(--text-primary));
}

.modal-title {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 20px;
    margin-top: 20px;
    color: var(--text-primary);
    text-align: center;
    padding-bottom: 0;
    letter-spacing: -0.5px;
    text-shadow: 0 0 14px rgba(255, 255, 255, 0.08);
}

#settingsModal .modal-title {
    margin: 0 0 32px;
}

#fretCountModal .modal-title {
    margin: 0;
}

/* Hum settings modal only */
.hum-modal-content {
    max-width: 620px;
    height: auto;
    max-height: 80vh;
    padding: 32px 30px 28px;
    background: linear-gradient(160deg, #0f2038 0%, #0b1526 100%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

#humSettingsModal .modal-title {
    font-size: 26px;
    margin-bottom: 18px;
    color: #e7f4ff;
    text-shadow: 0 0 14px rgba(34, 201, 119, 0.35);
}

#humSettingsModal .tuning-section {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#humSettingsModal .tuning-section-title {
    color: #e7f4ff;
    text-align: center;
    margin-bottom: 6px;
}

#humSettingsModal .tuning-instructions-text,
#humSettingsModal label,
#humSettingsModal span,
#humSettingsModal p {
    color: #cdd9eb;
}

#humSettingsModal input[type="range"] {
    accent-color: #22c977;
}

#humSettingsModal .hum-presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

#humSettingsModal .hum-preset {
    background: rgba(34, 201, 119, 0.12);
    color: #e7f4ff;
    border: 1px solid rgba(34, 201, 119, 0.35);
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    transition: all 0.2s ease;
    box-shadow: 0 8px 20px rgba(34, 201, 119, 0.18);
}

#humSettingsModal .hum-preset:hover {
    background: rgba(34, 201, 119, 0.2);
    border-color: rgba(34, 201, 119, 0.7);
    box-shadow: 0 12px 24px rgba(34, 201, 119, 0.3);
    transform: translateY(-1px);
}

#humSettingsModal .hum-preset:active {
    transform: translateY(0);
}

/* ===== Harmonize Settings Modal ===== */
.harmonize-modal-content {
    max-width: 440px;
    height: auto;
    padding: 28px 32px 32px;
    margin: 14vh auto;
    gap: 14px;
    position: relative;
    overflow: visible;
}

.harmonize-modal-content .close-button.harmonize-close {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 26px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--close-button-bg);
    color: var(--close-button-icon, var(--text-primary));
    border: 2px solid var(--close-button-border);
    box-shadow: 0 0 12px var(--close-button-shadow);
    transition: all 0.2s ease;
}

.harmonize-modal-content .close-button.harmonize-close:hover {
    background: var(--close-button-hover-bg);
    border-color: var(--close-button-hover-border);
    box-shadow: 0 0 16px var(--close-button-hover-shadow);
}

.harmonize-modal-content .modal-title {
    font-size: 24px;
    margin-bottom: 14px;
}

.harmonize-settings-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.harmonize-toggle-option {
    display: flex;
    justify-content: center;
}

.harmonize-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
}

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

.harmonize-control-row {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.harmonize-control-row label {
    font-size: 16px;
    font-weight: 600;
    min-width: 70px;
    text-align: right;
}

.harmonize-control-row select {
    font-size: 15px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: inherit;
    min-width: 160px;
    cursor: pointer;
}

.harmonize-control-row select:focus {
    outline: 2px solid var(--accent-color, #5a9bff);
    outline-offset: 1px;
}

/* Harmonize active indicator on Play Mode button */
#pianoPlayModeToggle.harmonize-active {
    box-shadow: 0 0 8px rgba(255, 180, 50, 0.6), inset 0 0 4px rgba(255, 180, 50, 0.3);
    border-color: rgba(255, 180, 50, 0.5);
}

#pianoPlayModeToggle.harmonize-active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ffb432;
    box-shadow: 0 0 4px rgba(255, 180, 50, 0.8);
}

.modal-instructions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
    margin-top: 20px;
}

@media (max-width: 600px) {
    .modal-instructions {
        grid-template-columns: 1fr;
    }
}

.instruction-item {
    margin: 0;
    padding: 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.instruction-item:hover {
    background-color: #f8f9fa;
    border-color: #e1e4e8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.instruction-heading {
    font-weight: 600;
    font-size: 15px;
    color: #1a1a1a;
    margin: 0 0 6px 0;
    letter-spacing: -0.2px;
}

.instruction-text {
    font-weight: 400;
    font-size: 14px;
    color: #5a5a5a;
    margin: 0;
    line-height: 1.6;
}

.instruction-category {
    grid-column: 1 / -1;
    font-weight: 700;
    font-size: 22px;
    color: #2563eb;
    margin: 20px 0 10px 0;
    padding-bottom: 8px;
    letter-spacing: -0.3px;
    text-align: center;
}

.instruction-category:first-of-type {
    margin-top: 0;
}

.instruction-category {
    padding: 10px 26px;
    background: rgba(30, 64, 175, 0.15);
    border: 1px solid rgba(37, 99, 235, 0.35);
    border-radius: 16px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    max-width: min(420px, 90%);
    margin-left: auto;
    margin-right: auto;
}

.help-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
    padding: 18px;
    background: rgba(15, 23, 42, 0.65);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 30px rgba(7, 24, 44, 0.5);
}

.help-grid.shortcut-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 14px;
}

@media (min-width: 1100px) {
    .help-grid.shortcut-grid {
        grid-template-columns: repeat(3, minmax(260px, 1fr));
    }
}

@media (min-width: 1500px) {
    .help-grid.shortcut-grid {
        grid-template-columns: repeat(3, minmax(300px, 1fr));
    }
}

.help-grid.single-column {
    grid-template-columns: 1fr;
}

.help-grid .help-button-demo:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    max-width: 50%;
    margin: 0 auto;
}

body:not([data-instrument-id="pedal-steel"]) [data-instrument-only="pedal-steel"] {
    display: none;
}

body:not([data-instrument-id="violin-family"]) [data-instrument-only="violin-family"] {
    display: none;
}

body:not([data-instrument-id="guitar-6string"]) [data-instrument-only="guitar-6string"] {
    display: none;
}

body:not([data-instrument-id="banjo-5string"]) [data-instrument-only="banjo-5string"] {
    display: none;
}

body:not([data-instrument-id="four-string"]) [data-instrument-only="four-string"] {
    display: none;
}

@media (max-width: 700px) {
    .help-grid {
        grid-template-columns: 1fr;
    }

    /* Remove centering on mobile since it's single column */
    .help-grid .help-button-demo:last-child:nth-child(odd) {
        max-width: 100%;
    }
}

.shortcut-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(140deg, rgba(20, 32, 58, 0.88), rgba(9, 18, 36, 0.95));
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 16px;
    box-shadow: 0 12px 26px rgba(8, 15, 30, 0.45);
}

.shortcut-card-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(226, 232, 240, 0.7);
    font-weight: 600;
}

.shortcut-list {
    display: grid;
    grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
    row-gap: 8px;
    column-gap: 12px;
}

.shortcut-row {
    display: contents;
}

.shortcut-key {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    padding: 3px 8px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.7);
    color: rgba(226, 232, 240, 0.92);
    font-family: "SFMono-Regular", "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    letter-spacing: 0.01em;
    line-height: 1.4;
    min-height: 26px;
}

.shortcut-desc {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

/* Note Loss Modal Styles */
.note-loss-modal-content {
    max-width: 500px;
    text-align: center;
}

.warning-title {
    color: #f39c12;
    font-size: 24px;
    margin-bottom: 20px;
}

.warning-message {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 30px;
}

.warning-message strong {
    color: #e74c3c;
    font-weight: 600;
}

.modal-button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-button {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 140px;
}

.modal-button-secondary {
    background-color: #95a5a6;
    color: white;
}

.modal-button-secondary:hover {
    background-color: #7f8c8d;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.modal-button-danger {
    background-color: #e74c3c;
    color: white;
}

.modal-button-danger:hover {
    background-color: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

/* Help Modal Button Demos - Match UI exactly */
.help-button-demo,
.help-button-demo-full {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--panel-bg);
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    margin-bottom: 8px;
}

.help-button-demo-full {
    grid-column: 1 / -1;
}

.help-desc {
    margin: 0;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.help-modal-footer {
    display: flex;
    justify-content: center;
    padding: 10px 0 4px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 16px 18px;
    margin-top: 10px;
}

#settingsModal .settings-grid {
    margin-top: 32px;
}

@media (max-width: 1100px) {
    .settings-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }
}

.settings-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 12px 32px var(--shadow-strong);
}

#settingsModal[data-instrument="piano"] .settings-card.theme-card {
    /* add more breathing room for the palette controls */
    padding: 24px 28px 28px;
}

.settings-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.settings-card-header.theme-header {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
}

.midi-input-card-body {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-primary);
}

.settings-checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #22c977;
    border-radius: 4px;
}

.theme-subtext {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-label {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

#settingsModal[data-instrument="piano"] .settings-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

#settingsModal[data-instrument="piano"] .settings-card {
    padding: 24px;
}

@media (max-width: 900px) {
    #settingsModal[data-instrument="piano"] .settings-grid {
        grid-template-columns: 1fr;
    }
}

#settingsModal[data-instrument="piano"] .settings-card-header {
    margin-bottom: 16px;
}

#settingsModal[data-instrument="piano"] .settings-label {
    font-size: 17px;
}

#settingsModal[data-instrument="piano"] .invert-key-row {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--panel-border);
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

#settingsModal[data-instrument="piano"] .invert-key-row .palette-reset-btn {
    min-width: auto;
    width: auto;
}

#settingsModal[data-instrument="piano"] .invert-key-row .settings-hint {
    flex: 1;
    min-width: 150px;
}

#settingsModal[data-instrument="piano"] .invert-key-row .palette-reset-btn.active {
    background: linear-gradient(135deg, #1f2c5c 0%, #4961ef 100%);
    border-color: rgba(255, 255, 255, 0.5);
}

.settings-hint {
    font-size: 13px;
    color: var(--text-secondary);
}

.settings-toggle {
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 700;
    min-width: 160px;
    box-shadow: 0 12px 28px var(--shadow-strong);
    cursor: pointer;
    pointer-events: auto;
}

.settings-toggle.active {
    background: linear-gradient(135deg, #0f7bff 0%, #5a9bff 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: var(--button-primary-text);
}

.theme-palette-block {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.theme-palette {
    display: none;
}

.theme-palette.active {
    display: block;
}

.settings-color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.color-input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 10px;
    background: var(--panel-muted);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
}

.color-input-row span {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 12px;
}

.color-input-row input[type="color"] {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 2px solid var(--panel-border);
    border-radius: 999px;
    background: var(--panel-bg);
    cursor: pointer;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.45);
}

.palette-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
}

.palette-actions.palette-actions-stack {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
}

.palette-actions.palette-actions-center {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.fingerboard-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
    padding-top: 6px;
}

.fingerboard-subheading {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 14px;
}

.palette-reset-btn {
    background: linear-gradient(135deg, #111a33, #1a2b59);
    color: #f8fbff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 700;
    box-shadow: 0 10px 28px rgba(7, 11, 31, 0.65);
    min-width: 180px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.palette-reset-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(7, 11, 31, 0.7);
}

#fingerboardDarkReset,
#darkPaletteReset {
    background: linear-gradient(135deg, #11204a 0%, #1f3ba6 100%);
    color: #f1f5fb;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 10px 28px rgba(9, 12, 32, 0.65);
    text-shadow: 0 1px 2px rgba(31, 54, 88, 0.6);
}

#fingerboardDarkReset:hover,
#darkPaletteReset:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 36px rgba(9, 12, 32, 0.75);
}

/* Demo button base styles */
.demo-btn {
    background-color: #4a90e2;
    color: white;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: default;
    font-size: 13px;
    font-family: Arial, sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    pointer-events: none;
    user-select: none;
    width: fit-content;
}

/* Auto Label button */
.demo-auto-label {
    background-color: #34495e;
}

/* Note preference toggles */
.demo-note-preference {
    display: inline-flex;
    gap: 2px;
}

.demo-note-toggle {
    background: linear-gradient(135deg, #9fa8da 0%, #7986cb 100%);
    outline: 3px solid transparent;
    outline-offset: -3px;
    border: none;
    margin: 0;
    padding: 0;
    width: 46px;
    height: 38px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.demo-note-toggle.demo-active {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    outline: 3px solid #00E676;
    color: white;
    box-shadow: 0 0 20px rgba(0, 230, 118, 0.8), 0 2px 6px rgba(0, 0, 0, 0.3);
}

.demo-note-toggle.demo-neutral {
    width: auto;
    min-width: 40px;
    padding: 0 6px;
    font-size: 9px;
    letter-spacing: 0.2px;
}

/* Fret count / Octaves button */
.demo-fret-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.demo-fret-indicator {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    opacity: 0.8;
}

/* Octave shift controls */
.demo-octave-shift {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(135deg, rgba(16, 24, 44, 0.95), rgba(32, 41, 63, 0.95));
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6);
    width: fit-content;
}

.demo-octave-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(48, 194, 165, 0.7);
    border-radius: 999px;
    width: 30px;
    height: 30px;
    font-size: 18px;
    font-weight: 700;
    color: rgba(243, 248, 255, 0.95);
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(16, 24, 32, 0.8);
}

.demo-octave-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 62px;
    gap: 2px;
}

.demo-octave-label {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

.demo-octave-value {
    font-size: 18px;
    font-weight: 700;
    color: #f8fbff;
    text-shadow: 0 0 8px rgba(0, 230, 188, 0.25);
}

/* Undo/Redo buttons */
.demo-undo {
    background-color: #f39c12;
    font-size: 16px;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0 2px;
}

/* Clear button */
.demo-clear {
    background-color: #e74c3c;
}

/* Canvas overlay buttons */
.demo-canvas-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    color: #6c757d;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0;
    margin: 0 2px;
    pointer-events: none;
}

.demo-canvas-btn.demo-canvas-active {
    background: linear-gradient(135deg, #fff3cd 0%, #f1c40f 100%);
    border: 2px solid #f39c12;
    color: #856404;
    box-shadow: 0 0 12px rgba(241, 196, 15, 0.4), 0 4px 8px rgba(0,0,0,0.15);
}

.demo-midi {
    font-size: 13px;
    letter-spacing: 0.5px;
}

/* Playback buttons */
.demo-playback {
    background-color: #64b5f6;
    min-width: 100px;
}

.demo-default {
    background-color: #4a90e2;
}

.demo-loop {
    background-color: #3498db;
}

/* Rhythm buttons */
.demo-rhythm {
    background-color: #4CAF50;
    border: 2px solid transparent;
    padding: 3px 5px;
    font-size: 10px;
    min-width: 50px;
}

.demo-rhythm-active {
    background-color: #2c7d59;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.7);
    font-weight: bold;
}

/* Sequence buttons */
.demo-sequence {
    background-color: #4CAF50;
    border: 2px solid transparent;
    padding: 3px 5px;
    font-size: 10px;
    min-width: 60px;
}

.demo-sequence-active {
    background-color: #2c7d59;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.7);
    font-weight: bold;
}

/* Tempo/Volume controls */
.demo-tempo-group,
.demo-volume-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.demo-slider {
    width: 120px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    outline: none;
    border-radius: 2px;
}

.demo-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #4a90e2;
    cursor: default;
    border-radius: 50%;
}

.demo-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #4a90e2;
    cursor: default;
    border-radius: 50%;
    border: none;
}

.demo-vol-slider {
    width: 80px;
}

.demo-tap {
    background-color: #4a90e2;
    padding: 6px 12px;
    font-size: 12px;
}

/* Mute button */
.demo-mute {
    background-color: #f0f0f0;
    color: #555;
    border: 2px solid transparent;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: var(--mute-button-font-size);
    border-radius: 4px;
}

/* Speed buttons */
.demo-speed {
    background-color: #1abc9c;
    border: 2px solid transparent;
    padding: 4px 6px;
    font-size: 12px;
    min-width: 38px;
    margin: 0 1px;
}

.demo-speed-active {
    background-color: #2c7d59;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.7);
    font-weight: bold;
}

/* Waveform buttons */
.demo-wave {
    background-color: #5c6bc0;
    border: 2px solid transparent;
    padding: 4px 6px;
    font-size: 12px;
    height: 26px;
    margin: 0 1px;
}

.demo-wave-active {
    background-color: #2c3e50;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.7);
    font-weight: bold;
}

/* Memory buttons */
.demo-memory {
    background-color: #4a90e2;
    padding: 6px 10px;
    gap: 4px;
}

.demo-memory-slot {
    background-color: #9e9e9e;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
}

.demo-memory-saved {
    background-color: #4a90e2;
    box-shadow: 0 2px 6px rgba(74, 144, 226, 0.3);
}

.demo-memory-add {
    background-color: #4CAF50;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 18px;
    border-radius: 6px;
}

/* Download button */
.demo-download {
    background: #4CAF50;
    padding: 10px 20px;
    font-size: 16px;
}

/* Update modal-instructions to single column for help content */
#helpModal .modal-instructions {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 20px;
}

#helpModal .settings-modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 12px;
    padding-bottom: 8px;
    margin-bottom: 10px;
}

#helpModal .settings-modal-header .modal-title {
    margin-top: 0;
    margin-bottom: 0;
}

#helpModal .close-button {
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--close-button-bg);
    color: var(--close-button-icon, var(--text-primary));
    border: 2px solid var(--close-button-border);
    box-shadow: 0 0 12px var(--close-button-shadow);
    transition: all 0.2s ease;
}

#helpModal .close-button:hover {
    background: var(--close-button-hover-bg);
    border-color: var(--close-button-hover-border);
    box-shadow: 0 0 16px var(--close-button-hover-shadow);
    color: var(--close-button-icon, var(--text-primary));
}

/* Row layout for multiple buttons */
.demo-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

/* Chord Detective indicator demo */
.demo-chord-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 10px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 2px solid #81c784;
    color: #2e7d32;
    width: fit-content;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    pointer-events: none;
    user-select: none;
}

.demo-chord-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.7);
}

.demo-chord-emoji {
    font-size: 18px;
    line-height: 1;
}

.demo-chord-label {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* Oracle AI API Key Section */
.api-key-section {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.api-key-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--panel-muted);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
}

.status-indicator {
    font-size: 16px;
    line-height: 1;
}

.status-text {
    font-weight: 600;
    color: var(--text-primary);
}

.api-key-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.api-key-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.api-key-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
}

.api-key-input {
    flex: 1;
    padding: 12px 50px 12px 12px;
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    background: var(--panel-bg);
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    transition: border-color 0.3s ease;
}

.api-key-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.api-key-input.valid {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.05);
}

.api-key-input.invalid {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.05);
}

.api-key-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.api-key-toggle-btn:hover {
    background: var(--panel-muted);
    color: var(--text-primary);
}

.api-key-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.api-key-btn {
    flex: 1;
    min-width: 120px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.api-key-save {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.api-key-save:hover:not(:disabled) {
    background: linear-gradient(135deg, #45a049, #3d8b40);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.api-key-clear {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
}

.api-key-clear:hover:not(:disabled) {
    background: linear-gradient(135deg, #d32f2f, #c62828);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.api-key-test {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.api-key-test:hover:not(:disabled) {
    background: linear-gradient(135deg, #1976D2, #1565C0);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

.api-key-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.api-key-help {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.api-key-help a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 600;
}

.api-key-help a:hover {
    text-decoration: underline;
}

/* API Key Status States */
.api-key-status.connected .status-indicator {
    color: #4CAF50;
}

.api-key-status.connected .status-text {
    color: #4CAF50;
}

.api-key-status.disconnected .status-indicator {
    color: #f44336;
}

.api-key-status.disconnected .status-text {
    color: #f44336;
}

.api-key-status.testing .status-indicator {
    color: #FF9800;
    animation: pulse 1s ease-in-out infinite;
}

.api-key-status.testing .status-text {
    color: #FF9800;
}
/
* ============================================
   API Key Management Styles
   ============================================ */

.api-key-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}

.api-key-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-icon {
  font-size: 20px;
  line-height: 1;
}

.status-text {
  font-size: 15px;
  font-weight: 600;
  transition: color 0.3s ease;
}

.status-text.connected {
  color: #4ade80;
  text-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
}

.status-text.disconnected {
  color: #f87171;
  text-shadow: 0 0 10px rgba(248, 113, 113, 0.5);
}

.status-text.testing {
  color: #fbbf24;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.api-key-input-group {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.api-key-input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #ffffff;
  font-size: 15px;
  font-family: 'Courier New', monospace;
  font-weight: 500;
  transition: all 0.3s ease;
  pointer-events: auto;
  user-select: text;
  letter-spacing: 0.5px;
}

.api-key-input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.8);
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  color: #ffffff;
}

.api-key-input.valid {
  border-color: rgba(74, 222, 128, 0.5);
}

.api-key-input.invalid {
  border-color: rgba(248, 113, 113, 0.5);
}

.api-key-input.visible {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
}

.api-key-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 400;
}

.toggle-visibility-btn {
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 56px;
}

.toggle-visibility-btn:hover {
  background: rgba(99, 102, 241, 0.3);
  border-color: rgba(99, 102, 241, 0.5);
  transform: scale(1.05);
}

.toggle-visibility-btn:active {
  transform: scale(0.95);
  background: rgba(99, 102, 241, 0.5);
}

.toggle-visibility-btn.active {
  background: rgba(99, 102, 241, 0.4);
  border-color: rgba(99, 102, 241, 0.6);
}

.api-key-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: auto !important;
  position: relative;
  z-index: 10;
}

.modal-action-button {
  flex: 1;
  min-width: 120px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 8px;
  color: white !important;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer !important;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  pointer-events: auto !important;
  position: relative;
  z-index: 10;
}

.modal-action-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.modal-action-button:active {
  transform: translateY(0);
}

.modal-action-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.modal-action-button.secondary {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.modal-action-button.secondary:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* Test Connection button - higher contrast blue */
#apiKeyTest {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#apiKeyTest:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* Clear button - higher contrast */
#apiKeyClear {
  color: #ffffff !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.api-key-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.info-text {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary, #cdd9eb);
  line-height: 1.5;
}

.info-text a {
  color: #818cf8;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.info-text a:hover {
  color: #a5b4fc;
  text-decoration: underline;
}

.privacy-note {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.9);
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  max-width: 400px;
  border-left: 4px solid;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-left-color: #4ade80;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(0, 0, 0, 0.9) 100%);
}

.toast-error {
  border-left-color: #f87171;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(0, 0, 0, 0.9) 100%);
}

.toast-info {
  border-left-color: #60a5fa;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(0, 0, 0, 0.9) 100%);
}

/* Settings Modal Specific Styles */
.settings-modal-content {
  max-width: 600px;
}

/* Ensure input fields work properly in modals */
.api-key-section input,
.api-key-section button {
  pointer-events: auto;
}

.api-key-section {
  pointer-events: auto;
}

/* API Key Activity Log */
.api-key-log {
  margin-top: 16px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  font-weight: 600;
  color: #a0aec0;
}

.clear-log-btn {
  padding: 4px 10px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 4px;
  color: #f87171;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-log-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.5);
}

.log-content {
  padding: 12px;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #e2e8f0;
}

.log-content:empty::before {
  content: 'No activity yet...';
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
}

.log-entry {
  margin-bottom: 4px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.log-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.log-entry.success {
  color: #4ade80;
}

.log-entry.error {
  color: #f87171;
}

.log-entry.info {
  color: #60a5fa;
}

.log-entry.warning {
  color: #fbbf24;
}

/* Scrollbar styling for log */
.log-content::-webkit-scrollbar {
  width: 8px;
}

.log-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.log-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.log-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}


/* ============================================
   API Key Setup Modal (Dedicated)
   ============================================ */

.api-key-setup-modal {
  max-width: 600px;
  max-height: 96vh;
  overflow-y: auto;
  position: relative;
}

.api-key-setup-modal .modal-title {
  padding-top: 1rem;
}

.api-key-setup-modal .close-button {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 32px;
  font-weight: 300;
  color: var(--close-button-icon, var(--text-primary));
  background: var(--close-button-bg);
  border: 1px solid var(--close-button-border);
  border-radius: 14px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px var(--close-button-shadow);
  transition: all 0.2s ease;
  z-index: 10;
}

.api-key-setup-modal .close-button:hover {
  color: var(--close-button-icon, var(--text-primary));
  background: var(--close-button-hover-bg);
  border-color: var(--close-button-hover-border);
  box-shadow: 0 0 14px var(--close-button-hover-shadow);
  transform: scale(1.1);
}

.open-api-setup-btn {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  margin: 16px 0;
}

.open-api-setup-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.6);
}

.api-setup-container {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  pointer-events: auto;
}

.api-setup-input-row {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.api-setup-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.setup-status-icon {
  font-size: 24px;
}

.setup-status-text {
  font-size: 16px;
  font-weight: 600;
}

.setup-status-text.connected {
  color: #4ade80;
  text-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
}

.setup-status-text.disconnected {
  color: #f87171;
}

.setup-status-text.testing {
  color: #fbbf24;
  animation: pulse 1.5s ease-in-out infinite;
}

.api-setup-input-row {
  display: flex;
  gap: 10px;
}

.api-setup-input {
  flex: 1;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #ffffff;
  font-size: 15px;
  font-family: 'Courier New', monospace;
  font-weight: 500;
  transition: all 0.3s ease;
  pointer-events: auto !important;
  cursor: text;
}

.api-setup-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
  background: rgba(0, 0, 0, 0.6);
}

.api-setup-input.valid {
  border-color: #4ade80;
}

.api-setup-input.invalid {
  border-color: #f87171;
}

.api-setup-input.visible {
  background: rgba(102, 126, 234, 0.15);
  border-color: #667eea;
}

.setup-toggle-btn {
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 60px;
}

.setup-toggle-btn:hover {
  background: rgba(102, 126, 234, 0.3);
  border-color: #667eea;
}

.setup-toggle-btn.active {
  background: rgba(102, 126, 234, 0.4);
  border-color: #667eea;
}

.api-setup-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.setup-btn {
  padding: 14px 20px;
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.setup-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

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

.save-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  grid-column: 1 / -1;
}

.save-btn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.clear-btn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.clear-btn:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.test-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.test-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.api-setup-help {
  padding: 16px;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(102, 126, 234, 0.2);
}

.api-setup-help p {
  margin: 8px 0;
  font-size: 14px;
  color: #e2e8f0;
}

.api-setup-help a {
  color: #818cf8;
  text-decoration: none;
  font-weight: 600;
}

.api-setup-help a:hover {
  text-decoration: underline;
}

.cost-note {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 4px !important;
}

.cost-note-list {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin: 8px 0;
  padding-left: 20px;
}

.cost-note-list li {
  margin: 4px 0;
}

.privacy-text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

.api-setup-log {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.setup-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  font-weight: 600;
  color: #a0aec0;
}

.setup-clear-log {
  padding: 4px 10px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 4px;
  color: #f87171;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.setup-clear-log:hover {
  background: rgba(239, 68, 68, 0.3);
}

.setup-log-content {
  padding: 12px;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #e2e8f0;
}

.setup-log-content:empty::before {
  content: 'No activity yet...';
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
}

.setup-log-entry {
  margin-bottom: 4px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setup-log-entry:last-child {
  border-bottom: none;
}

.setup-log-entry.success {
  color: #4ade80;
}

.setup-log-entry.error {
  color: #f87171;
}

.setup-log-entry.info {
  color: #60a5fa;
}

.setup-log-entry.warning {
  color: #fbbf24;
}

/* ============================================
   Print Preview Modal - Constrained Layout
   ============================================ */

#printPreviewModal .modal-content {
    width: 100vw;
    max-width: none;
    height: 100vh;
    max-height: none;
    margin: 0;
    border-radius: 0;
    padding: 0;
    overflow: auto;
    background: linear-gradient(135deg, var(--panel-bg), var(--panel-muted));
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

#printPreviewModal .close-button {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--close-button-bg);
    color: var(--close-button-icon, var(--text-primary));
    border: 2px solid var(--close-button-border);
    transition: all 0.25s ease;
    font-size: 26px;
    line-height: 1;
    z-index: 10000;
    cursor: pointer;
    box-shadow: 0 4px 16px var(--close-button-shadow);
}

#printPreviewModal .close-button:hover {
    background: var(--close-button-hover-bg);
    border-color: var(--close-button-hover-border);
    box-shadow: 0 0 24px var(--close-button-hover-shadow);
    transform: scale(1.05);
}

/* Note Size Settings Styles */
.note-size-controls {
  padding: 0.6rem 0;
}

 .note-size-preview {
   display: flex;
   align-items: center;
   justify-content: center;
   gap: 0.25rem;
   margin-bottom: 0.45rem;
 }

 .note-size-preview-label {
   display: flex;
   flex-direction: column;
   align-items: center;
   font-size: 11px;
   letter-spacing: 0.08rem;
   color: var(--text-primary);
   text-transform: uppercase;
   line-height: 1;
 }

.note-size-preview-label small {
   font-size: 10px;
   letter-spacing: 0.15rem;
   color: var(--text-secondary);
 }

.note-size-preview-canvas {
  width: 180px;
  height: 72px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--panel-muted), var(--panel-bg));
  border: 1px solid var(--panel-border);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.35), 0 10px 18px rgba(0, 0, 0, 0.2);
}
.note-border-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.6rem 0;
}

.note-border-control {
  border-top: 1px solid var(--panel-border);
  padding-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.note-border-control:first-of-type {
  border-top: none;
  padding-top: 0;
}

.note-border-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  letter-spacing: 0.08rem;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.note-border-controls input[type="range"] {
  width: 100%;
  accent-color: #22c977;
}

.preset-buttons {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  margin-bottom: 0.6rem;
  justify-content: center;
  flex: 1;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.note-size-preset {
  background-color: #1abc9c;
  border: 2px solid #dddcdc;
  margin: 0;
  padding: 5px 10px;
  font-size: 13px;
  min-width: 40px;
  border-radius: 6px;
  flex: 0 0 auto;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.note-size-preset:hover {
  background-color: #16a085;
}

.note-size-preset.active {
  background-color: #2c7d59;
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* ===== CALIBRATION MODAL STYLES ===== */

/* Calibrate button in pitch detector header */
.pitch-calibrate-btn {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 18px;
  margin: 0 4px;
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0.7;
}

.pitch-calibrate-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Calibration modal content */
.calibration-modal-content {
  max-width: 600px;
  height: auto;
  max-height: 80vh;
  padding: 2rem;
}

.calibration-modal-content h2 {
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Wizard container */
.calibration-wizard {
  min-height: 350px;
  margin-bottom: 1.5rem;
}

.calibration-step {
  display: block;
  animation: fadeIn 0.3s ease;
}

.calibration-step.hidden {
  display: none;
}

.calibration-step-content {
  padding: 1rem 0;
}

.calibration-step-content h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.calibration-step-content p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* Introduction step */
.calibration-tips {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}

.calibration-tips li {
  padding: 0.75rem;
  margin: 0.5rem 0;
  background: var(--panel-muted);
  border-radius: 8px;
  color: var(--text-primary);
}

/* Profile setup */
.calibration-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.calibration-form label {
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.calibration-input,
.calibration-select {
  padding: 0.75rem;
  border-radius: 8px;
  border: 2px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.calibration-input:focus,
.calibration-select:focus {
  outline: none;
  border-color: var(--button-primary-bg);
}

/* Training step */
.calibration-tone-display {
  text-align: center;
  padding: 2rem 0;
  background: var(--panel-muted);
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.calibration-tone-name {
  font-size: 3rem;
  font-weight: bold;
  color: var(--button-primary-bg);
  margin-bottom: 0.5rem;
}

.calibration-tone-freq {
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.calibration-tone-number {
  font-size: 1rem;
  color: var(--text-muted);
}

.calibration-play-btn {
  width: 100%;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-radius: 10px;
  border: none;
  background: var(--button-primary-bg);
  color: var(--button-primary-text);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.calibration-play-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.calibration-play-btn:active {
  transform: translateY(0);
}

.calibration-play-btn.playing {
  background: var(--error-color);
  animation: pulse 1s ease infinite;
}

.play-icon {
  font-size: 1.3rem;
}

/* Detection feedback */
.calibration-detection {
  background: var(--panel-bg);
  border-radius: 12px;
  padding: 1.5rem;
  border: 2px solid var(--panel-muted);
}

.calibration-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.status-icon {
  font-size: 1.5rem;
  animation: pulse 2s ease infinite;
}

.status-text {
  color: var(--text-primary);
  font-weight: 600;
}

.calibration-frequency-display {
  display: flex;
  justify-content: space-around;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--panel-muted);
  border-radius: 8px;
}

.detected-frequency {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--text-primary);
}

.frequency-diff {
  font-size: 1.2rem;
  color: var(--text-secondary);
}

.frequency-diff.good {
  color: #4caf50;
}

.frequency-diff.ok {
  color: #ff9800;
}

.frequency-diff.bad {
  color: var(--error-color);
}

/* Accuracy bar */
.calibration-accuracy-bar {
  width: 100%;
  height: 30px;
  background: var(--panel-muted);
  border-radius: 15px;
  overflow: hidden;
  margin-bottom: 1rem;
  position: relative;
}

.accuracy-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--error-color) 0%, #ff9800 50%, #4caf50 100%);
  width: 0%;
  transition: width 0.3s ease, background 0.3s ease;
  border-radius: 15px;
}

.accuracy-fill.good {
  background: #4caf50;
}

.accuracy-fill.ok {
  background: #ff9800;
}

.accuracy-fill.bad {
  background: var(--error-color);
}

.calibration-confidence {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.confidence-value {
  font-weight: 600;
  color: var(--text-primary);
}

/* Results step */
.calibration-results {
  padding: 1rem;
}

.result-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.result-item {
  background: var(--panel-muted);
  padding: 1rem;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.result-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.result-value {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: bold;
}

.result-grade {
  font-size: 2rem;
}

.result-grade.grade-a {
  color: #4caf50;
}

.result-grade.grade-b {
  color: #8bc34a;
}

.result-grade.grade-c {
  color: #ff9800;
}

.result-grade.grade-d {
  color: var(--error-color);
}

.result-message {
  text-align: center;
  padding: 1.5rem;
  background: var(--success-bg);
  color: var(--success-text);
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
}

/* Progress indicator */
.calibration-progress {
  margin-bottom: 1.5rem;
  padding: 0 1rem;
}

.calibration-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--panel-muted);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.calibration-progress-fill {
  height: 100%;
  background: var(--button-primary-bg);
  width: 25%;
  transition: width 0.3s ease;
  border-radius: 4px;
}

.calibration-progress-text {
  display: block;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Navigation buttons */
.calibration-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem;
}

.calibration-btn {
  flex: 1;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calibration-btn-back {
  background: var(--panel-muted);
  color: var(--text-primary);
}

.calibration-btn-back:hover {
  background: var(--panel-bg);
}

.calibration-btn-next,
.calibration-btn-finish {
  background: var(--button-primary-bg);
  color: var(--button-primary-text);
}

.calibration-btn-next:hover,
.calibration-btn-finish:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.calibration-btn-skip,
.calibration-btn-retry {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.calibration-btn-skip:hover,
.calibration-btn-retry:hover {
  opacity: 0.8;
}

.calibration-btn.hidden {
  display: none;
}

.calibration-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Mobile responsive */
@media (max-width: 600px) {
  .calibration-modal-content {
    padding: 1rem;
    width: 95%;
    max-height: 85vh;
  }

  .calibration-tone-name {
    font-size: 2.5rem;
  }

  .calibration-tone-freq {
    font-size: 1.2rem;
  }

  .result-summary {
    grid-template-columns: 1fr;
  }

  .calibration-nav {
    flex-direction: column;
  }

  .calibration-btn {
    width: 100%;
  }
}

/* ===== PITCH DETECTOR PROFILE SELECTOR ===== */

.pitch-profile-selector {
  padding: 1rem;
  margin: 0.5rem 0;
  background: var(--panel-muted);
  border-radius: 8px;
}

.pitch-profile-label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pitch-profile-dropdown {
  width: 100%;
  padding: 0.5rem;
  border-radius: 6px;
  border: 2px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pitch-profile-dropdown:hover {
  border-color: var(--button-primary-bg);
}

.pitch-profile-dropdown:focus {
  outline: none;
  border-color: var(--button-primary-bg);
  box-shadow: 0 0 0 3px rgba(34, 201, 119, 0.1);
}

/* ========================================
   MIDI Setup / Keyboard Calibration
   ======================================== */

.midi-setup-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Status pills */
.midi-setup-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.midi-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--panel-muted);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
}

.midi-status-pill.midi-status-detected {
  background: linear-gradient(135deg, rgba(34,201,119,0.12), rgba(34,201,119,0.06));
  border-color: rgba(34,201,119,0.35);
  color: #22c977;
}

/* Wizard states */
.midi-wizard-hidden {
  display: none !important;
}

.midi-wizard-state {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Calibrate button */
.midi-calibrate-btn {
  background: linear-gradient(135deg, #111a33, #1a2b59);
  color: #f8fbff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(7, 11, 31, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.midi-calibrate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(7, 11, 31, 0.6);
}

/* Step cards */
.midi-wizard-step-card {
  background: var(--panel-muted);
  border: 1px solid rgba(74, 144, 226, 0.35);
  border-left: 3px solid #4a90e2;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.midi-wizard-step-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.midi-step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a90e2, #5a9bff);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.midi-step-title {
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 600;
}

/* Listening indicator */
.midi-wizard-listening {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #22c977;
  font-weight: 600;
}

.midi-listening-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c977;
  animation: midiListeningPulse 1.2s ease-in-out infinite;
}

@keyframes midiListeningPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.midi-wizard-detected {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  min-height: 18px;
}

.midi-wizard-cancel {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.midi-wizard-cancel:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* Result card */
.midi-wizard-result-card {
  background: var(--panel-muted);
  border: 1px solid rgba(34,201,119,0.3);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.midi-result-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.midi-result-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(34,201,119,0.1);
  border: 1px solid rgba(34,201,119,0.25);
  color: #22c977;
}

.midi-result-actions {
  display: flex;
  gap: 8px;
}

.midi-apply-btn {
  background: linear-gradient(135deg, #1a8a4a, #22c977);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(34,201,119,0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.midi-apply-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(34,201,119,0.35);
}

/* Manual transpose row */
.midi-transpose-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
}

.midi-transpose-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.midi-transpose-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.midi-transpose-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--panel-muted);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.midi-transpose-btn:hover {
  background: var(--panel-bg);
  border-color: var(--text-secondary);
}

.midi-transpose-value {
  min-width: 42px;
  text-align: center;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Mono', monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.midi-reset-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.midi-reset-btn:hover {
  border-color: #e74c3c;
  color: #e74c3c;
}

/* ========================================
   MIDI Pitch Wheel Sensitivity UI
   ======================================== */

.midi-pitch-wheel-container {
  padding: 16px;
}

.pitch-wheel-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* Visual Pitch Wheel - Vertical Pill Shape */
.pitch-wheel-visual-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pitch-wheel-visual {
  width: 48px;
  height: 140px;
  background: linear-gradient(135deg, #1a1d2e 0%, #252838 100%);
  border: 2px solid var(--panel-border);
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Active zones (green) - top and bottom */
.pitch-wheel-active-zone-top,
.pitch-wheel-active-zone-bottom {
  background: linear-gradient(135deg, #1a5c3a 0%, #22c977 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height 0.2s ease;
  position: relative;
  z-index: 1;
}

.pitch-wheel-active-zone-top {
  height: 28px;
  border-radius: 22px 22px 0 0;
}

.pitch-wheel-active-zone-bottom {
  height: 28px;
  border-radius: 0 0 22px 22px;
}

.active-zone-top-label,
.active-zone-bottom-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Dead zone (red) - center */
.pitch-wheel-dead-zone {
  flex: 1;
  background: linear-gradient(135deg, #8b2942 0%, #c24560 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height 0.2s ease;
  min-height: 10px;
  position: relative;
  z-index: 1;
}

.dead-zone-label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Center tick mark */
.pitch-wheel-center-tick {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: rgba(255, 255, 255, 0.6);
  transform: translateY(-50%);
  z-index: 2;
}

/* Position indicator - shows live pitch wheel position */
.pitch-wheel-position-indicator {
  position: absolute;
  left: 4px;
  right: 4px;
  height: 4px;
  background: #fff;
  border-radius: 2px;
  bottom: 70px; /* Center by default */
  transition: bottom 0.05s linear;
  z-index: 3;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.pitch-wheel-position-indicator.in-dead-zone {
  background: #ffcc00;
  box-shadow: 0 0 8px rgba(255, 204, 0, 0.5);
}

.pitch-wheel-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
}

/* Controls Column */
.pitch-wheel-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Slider Row */
.sensitivity-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sensitivity-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 70px;
}

.pitch-sensitivity-decrement,
.pitch-sensitivity-increment {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--panel-muted);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.pitch-sensitivity-decrement:hover,
.pitch-sensitivity-increment:hover {
  background: var(--button-primary-bg);
  border-color: var(--button-primary-bg);
  color: var(--button-primary-text);
}

.pitch-sensitivity-slider {
  flex: 1;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--panel-muted);
  border-radius: 4px;
  outline: none;
}

.pitch-sensitivity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22c977 0%, #1a9c5a 100%);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.pitch-sensitivity-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22c977 0%, #1a9c5a 100%);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.pitch-sensitivity-value {
  min-width: 40px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
}

/* Preset Buttons */
.sensitivity-presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.sensitivity-preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--panel-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sensitivity-preset:hover {
  border-color: #22c977;
  background: rgba(34, 201, 119, 0.1);
}

.sensitivity-preset.active {
  background: linear-gradient(135deg, #1a5c3a 0%, #22c977 100%);
  border-color: #22c977;
}

.sensitivity-preset.active .preset-name,
.sensitivity-preset.active .preset-value {
  color: #fff;
}

.preset-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}

.preset-value {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Special styling for Ignore preset */
.sensitivity-preset-ignore {
  border-color: rgba(194, 69, 96, 0.5);
}

.sensitivity-preset-ignore:hover {
  border-color: #c24560;
  background: rgba(194, 69, 96, 0.1);
}

.sensitivity-preset-ignore.active {
  background: linear-gradient(135deg, #8b2942 0%, #c24560 100%);
  border-color: #c24560;
}

/* Auto Calibrate Button */
.pitch-auto-calibrate-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.pitch-auto-calibrate-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(59, 130, 246, 0.5);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
  color: #60a5fa;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pitch-auto-calibrate-btn:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(59, 130, 246, 0.15) 100%);
  border-color: #60a5fa;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.pitch-auto-calibrate-btn:active {
  transform: scale(0.98);
}

.pitch-auto-calibrate-btn.calibrating {
  background: linear-gradient(135deg, rgba(34, 201, 119, 0.3) 0%, rgba(34, 201, 119, 0.15) 100%);
  border-color: #22c977;
  color: #22c977;
  animation: calibratePulse 0.5s ease;
}

@keyframes calibratePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.auto-calibrate-icon {
  font-size: 14px;
}

.auto-calibrate-hint {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

/* Help text */
.pitch-wheel-hint {
  margin: 0;
  font-size: 12px;
}

/* Device Dropdown Row */
.pitch-device-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pitch-device-dropdown {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--panel-muted);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pitch-device-dropdown:hover {
  border-color: var(--button-primary-bg);
}

.pitch-device-dropdown:focus {
  outline: none;
  border-color: var(--button-primary-bg);
  box-shadow: 0 0 0 3px rgba(34, 201, 119, 0.1);
}

/* Output Meter Row */
.pitch-output-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pitch-output-meter {
  flex: 1;
  height: 12px;
  background: var(--panel-muted);
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  position: relative;
  overflow: hidden;
}

.pitch-output-meter-center {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.4);
  transform: translateX(-50%);
  z-index: 2;
}

.pitch-output-meter-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 50%;
  background: linear-gradient(90deg, #22c977, #4de8a1);
  transition: width 0.05s linear;
  z-index: 1;
}

.pitch-output-meter-fill.positive {
  left: 50%;
  width: 0%;
  background: linear-gradient(90deg, #22c977, #4de8a1);
}

.pitch-output-meter-fill.negative {
  right: 50%;
  left: auto;
  width: 0%;
  background: linear-gradient(270deg, #22c977, #4de8a1);
}

.pitch-output-value {
  min-width: 45px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  font-family: monospace;
}
