/* ===== CSS Variables & Reset ===== */
:root {
    --bg-primary: #FDB139;
    --bg-secondary: #e9a033;
    --element: #408080;
    --element-dark: #2d5a5a;
    --element-light: #5a9e9e;
    --accent: #FFF2DF;
    --accent-warm: #ffe8c7;
    --text-dark: #1a1a1a;
    --text-light: #ffffff;
    --success: #4ade80;
    --success-dark: #22c55e;
    --error: #f87171;
    --error-dark: #ef4444;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.15);
    --shadow-strong: 0 12px 40px rgba(0, 0, 0, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    min-height: 100vh;
    color: var(--text-dark);
    overflow-x: hidden;
}

/* ===== App Container ===== */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--element);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-medium);
    margin-bottom: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    background: var(--accent);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--element);
    box-shadow: var(--shadow-soft);
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.progress-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.progress-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    opacity: 0.8;
}

.progress-count {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent);
}

/* ===== Menu Button ===== */
.menu-wrapper {
    position: relative;
}

.menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: rgba(255, 242, 223, 0.15);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 10px;
}

.menu-btn:hover {
    background: rgba(255, 242, 223, 0.25);
}

.menu-btn.open {
    background: rgba(255, 242, 223, 0.3);
}

.menu-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    transition: all var(--transition-normal);
}

.menu-btn.open .menu-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-btn.open .menu-bar:nth-child(2) {
    opacity: 0;
}

.menu-btn.open .menu-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ===== Menu Dropdown ===== */
.menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--accent);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-strong);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.95);
    transition: all var(--transition-normal);
    z-index: 100;
}

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

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--element-dark);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.menu-item:hover {
    background: rgba(64, 128, 128, 0.1);
}

.menu-item.active {
    background: var(--element);
    color: var(--accent);
    font-weight: 600;
}

.menu-item-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.menu-divider {
    height: 1px;
    background: rgba(64, 128, 128, 0.15);
    margin: 4px 8px;
}

/* ===== Exercise Panels ===== */
.exercise-panel {
    display: none;
    flex-direction: column;
    gap: 20px;
}

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

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== Practice Card ===== */
.practice-card {
    background: var(--accent);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--shadow-strong);
    position: relative;
    overflow: hidden;
}

.practice-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(253, 177, 57, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

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

.practice-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--element);
    font-weight: 600;
    background: rgba(64, 128, 128, 0.1);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}

.streak-badge {
    font-size: 16px;
    font-weight: 600;
    color: var(--element);
    background: rgba(64, 128, 128, 0.1);
    padding: 6px 14px;
    border-radius: var(--radius-md);
    transition: var(--transition-normal);
}

.streak-badge.active {
    background: var(--bg-primary);
    transform: scale(1.1);
}

/* ===== Mistakes Badge ===== */
.dumbbell-icon {
    transform: rotate(-22.5deg);
    vertical-align: middle;
    margin-right: 3px;
    flex-shrink: 0;
}

.mistakes-badge {
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--element-light);
    background: rgba(64, 128, 128, 0.06);
    padding: 5px 12px;
    border-radius: var(--radius-md);
    border: 1.5px dashed rgba(64, 128, 128, 0.25);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    opacity: 0.5;
    box-shadow: 0 2px 0 rgba(64, 128, 128, 0.75);
}

.mistakes-badge:hover {
    opacity: 1;
    background: rgba(64, 128, 128, 0.12);
    border-color: var(--element);
}

.mistakes-badge.has-mistakes {
    opacity: 1;
    color: var(--element);
    border-color: var(--element);
    border-style: solid;
    background: rgba(64, 128, 128, 0.1);
}

.mistakes-badge.active-strengthen {
    background: var(--bg-primary);
    border-color: var(--bg-primary);
    color: var(--text-dark);
    border-style: solid;
    opacity: 1;
    box-shadow: 0 2px 0 #ab762294;
}

/* ===== Strengthen Mode ===== */
.practice-label.strengthen-active {
    background: var(--bg-primary);
    color: var(--text-dark);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 0 #ab762294;
}

.practice-label.strengthen-active:hover {
    background: #ffc04d;
}

/* ===== Danger Button ===== */
.settings-action-btn.danger {
    background: #a84040;
    border-color: #a84040;
    color: #fff;
    margin-top: 4px;
}

.settings-action-btn.danger:hover {
    background: #c04848;
    border-color: #c04848;
}

/* ===== Question Section ===== */
.question-section {
    text-align: center;
    margin-bottom: 32px;
}

.question-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--element-dark);
    margin-bottom: 28px;
    line-height: 1.4;
}

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

.scale-key {
    font-size: 72px;
    font-weight: 800;
    color: var(--element);
    line-height: 1;
    letter-spacing: -2px;
    text-shadow: 2px 2px 0 rgba(64, 128, 128, 0.1);
    animation: scaleIn 0.4s ease;
}

.scale-mode {
    font-size: 28px;
    font-weight: 600;
    color: var(--element-light);
    text-transform: uppercase;
    letter-spacing: 4px;
    animation: slideUp 0.4s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

/* ===== Answer Section (Accidentals) ===== */
.answer-section {
    margin-bottom: 20px;
}

.answer-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.answer-btn {
    background: var(--element);
    color: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    padding: 18px 0;
    font-size: 22px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 0 var(--element-dark), var(--shadow-soft);
    position: relative;
    top: 0;
}

.answer-btn:hover {
    background: var(--element-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--element-dark), var(--shadow-medium);
}

.answer-btn:active {
    top: 4px;
    box-shadow: 0 0 0 var(--element-dark), var(--shadow-soft);
}

.answer-btn.correct {
    background: var(--success);
    box-shadow: 0 4px 0 var(--success-dark), var(--shadow-soft);
    animation: correctPulse 0.5s ease;
}

.answer-btn.incorrect {
    background: var(--error);
    box-shadow: 0 4px 0 var(--error-dark), var(--shadow-soft);
    animation: shake 0.4s ease;
}

.answer-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

@keyframes correctPulse {

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

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

@keyframes shake {

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

    20%,
    60% {
        transform: translateX(-8px);
    }

    40%,
    80% {
        transform: translateX(8px);
    }
}

/* ===== Feedback Section ===== */
.feedback-section {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.feedback-message {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
}

.feedback-message.show {
    opacity: 1;
    transform: translateY(0);
}

.feedback-message.success {
    color: var(--success-dark);
}

.feedback-message.error {
    color: var(--error-dark);
}

/* ===== Scale Reveal ===== */
.scale-reveal {
    background: rgba(64, 128, 128, 0.08);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition-normal);
}

.scale-reveal.show {
    opacity: 1;
    transform: translateY(0);
}

.reveal-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--element);
    display: block;
    margin-bottom: 6px;
}

.reveal-notes {
    font-size: 16px;
    font-weight: 600;
    color: var(--element-dark);
    letter-spacing: 2px;
}

/* ===== Next Button ===== */
.next-btn {
    display: none;
    width: 100%;
    padding: 16px;
    margin-top: 16px;
    background: var(--bg-primary);
    color: var(--text-dark);
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 0 var(--bg-secondary), var(--shadow-soft);
    position: relative;
    top: 0;
}

.next-btn.show {
    display: block;
    animation: slideUp 0.3s ease;
}

.next-btn:hover {
    background: #ffc04d;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--bg-secondary), var(--shadow-medium);
}

.next-btn:active {
    top: 4px;
    box-shadow: 0 0 0 var(--bg-secondary), var(--shadow-soft);
}

/* ===== Builder: Input Slots ===== */
.builder-inputs {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.chord-inputs {
    margin-left: auto;
    margin-right: auto;
}

.builder-slot {
    background: rgba(64, 128, 128, 0.08);
    border: 2px dashed rgba(64, 128, 128, 0.3);
    border-radius: var(--radius-sm);
    padding: 14px 4px;
    text-align: center;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--element);
    transition: all var(--transition-fast);
}

.builder-slot .slot-number {
    color: rgba(64, 128, 128, 0.25);
    font-size: 14px;
    font-weight: 600;
}

.builder-slot.filled {
    background: var(--element);
    border: 2px solid var(--element-dark);
    color: var(--accent);
    animation: slotFill 0.25s ease;
}

.builder-slot.filled .slot-number {
    display: none;
}

.builder-slot.active-slot {
    border-color: var(--bg-primary);
    background: rgba(253, 177, 57, 0.15);
    animation: pulseSlot 1.5s ease-in-out infinite;
}

.builder-slot.correct-slot {
    background: var(--success);
    border-color: var(--success-dark);
    color: var(--text-dark);
}

.builder-slot.incorrect-slot {
    animation: shake 0.4s ease;
    border-color: var(--error);
    background: rgba(248, 113, 113, 0.15);
}

@keyframes slotFill {
    from {
        transform: scale(0.85);
        opacity: 0.5;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulseSlot {

    0%,
    100% {
        border-color: var(--bg-primary);
        box-shadow: 0 0 0 0 rgba(253, 177, 57, 0);
    }

    50% {
        border-color: var(--bg-secondary);
        box-shadow: 0 0 0 4px rgba(253, 177, 57, 0.2);
    }
}


/* ===== Extra Notes Row (double accidentals) ===== */
.extra-notes-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.extra-notes-row:empty {
    display: none;
}

.extra-note-btn {
    border-color: var(--bg-primary) !important;
    box-shadow: 0 3px 0 var(--bg-secondary), 0 0 12px rgba(255, 176, 0, 0.15) !important;
}

/* ===== Builder: Note Buttons Grid ===== */
.note-buttons-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.note-btn {
    background: var(--element);
    color: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 2px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 3px 0 var(--element-dark);
    position: relative;
    top: 0;
    white-space: nowrap;
}

.note-btn:hover {
    background: var(--element-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 0 var(--element-dark);
}

.note-btn:active {
    top: 3px;
    box-shadow: 0 0 0 var(--element-dark);
}

.note-btn.used {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

.note-btn.flash-wrong {
    background: var(--error);
    box-shadow: 0 3px 0 var(--error-dark);
    animation: shake 0.4s ease;
}

.note-btn.flash-correct {
    background: var(--success);
    box-shadow: 0 3px 0 var(--success-dark);
}

/* ===== No Combos Warning ===== */
.no-combos-warning {
    animation: slideUp 0.4s ease;
}

.warning-content {
    text-align: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.warning-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.warning-content h3 {
    font-size: 20px;
    color: var(--element-dark);
    margin-bottom: 12px;
}

.warning-content p {
    font-size: 14px;
    color: var(--element);
    line-height: 1.6;
}

/* ===== Stats Bar ===== */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    background: var(--element);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-medium);
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    opacity: 0.7;
}

/* ===== Settings Overlay ===== */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    backdrop-filter: blur(4px);
}

.settings-overlay.open {
    opacity: 1;
    visibility: visible;
}

.settings-panel {
    background: var(--accent);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-strong);
    transform: translateY(20px) scale(0.95);
    transition: all var(--transition-normal);
}

.settings-overlay.open .settings-panel {
    transform: translateY(0) scale(1);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 16px;
    flex-shrink: 0;
}

.settings-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--element-dark);
}

.settings-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(64, 128, 128, 0.1);
    border-radius: var(--radius-sm);
    font-size: 18px;
    color: var(--element);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-close:hover {
    background: rgba(64, 128, 128, 0.2);
}

.settings-body {
    padding: 8px 28px 20px;
    overflow-y: auto;
    flex: 1;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--element);
    margin-bottom: 4px;
}

.settings-section-desc {
    font-size: 12px;
    color: var(--element-light);
    margin-bottom: 12px;
}

/* ===== Toggle Grid (Settings) ===== */
.toggle-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.toggle-btn {
    padding: 10px 16px;
    border: 2px solid var(--element);
    border-radius: var(--radius-sm);
    background: var(--element);
    color: var(--accent);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 0 var(--element-dark);
    position: relative;
    top: 0;
}

.toggle-btn:hover {
    background: var(--element-light);
    border-color: var(--element-light);
}

.toggle-btn:active {
    top: 2px;
    box-shadow: 0 0 0 var(--element-dark);
}

.toggle-btn.disabled {
    background: transparent;
    color: var(--element);
    opacity: 0.45;
    box-shadow: none;
    border-style: dashed;
}

.toggle-btn.disabled:hover {
    opacity: 0.7;
    background: rgba(64, 128, 128, 0.08);
}

/* Language button active state */
.lang-btn.active {
    background: var(--bg-primary);
    border-color: var(--bg-primary);
    color: var(--text-dark);
    box-shadow: 0 2px 0 var(--bg-secondary);
}

.lang-btn.active:hover {
    background: #ffc04d;
    border-color: #ffc04d;
}

/* Keys grid: 7 columns to match note layout */
.keys-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.keys-grid .toggle-btn {
    padding: 10px 4px;
    text-align: center;
}

/* ===== Settings Footer ===== */
.settings-footer {
    padding: 16px 28px 24px;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    border-top: 1px solid rgba(64, 128, 128, 0.1);
}

.settings-action-btn {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--element);
    border-radius: var(--radius-sm);
    background: var(--element);
    color: var(--accent);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.settings-action-btn:hover {
    background: var(--element-light);
    border-color: var(--element-light);
}

.settings-action-btn.outlined {
    background: transparent;
    color: var(--element);
}

.settings-action-btn.outlined:hover {
    background: rgba(64, 128, 128, 0.08);
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--element-dark);
    font-size: 14px;
    opacity: 0.8;
}

.copyright {
    font-size: 11px;
    margin-top: 8px;
    opacity: 0.7;
}

.copyright a {
    color: var(--element-dark);
    text-decoration: none;
    font-weight: 600;
}

.copyright a:hover {
    text-decoration: underline;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .app-container {
        padding: 12px;
    }

    .header {
        padding: 12px 16px;
    }

    .logo-text {
        font-size: 16px;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }

    .practice-card {
        padding: 20px;
    }

    .scale-key {
        font-size: 56px;
    }

    .scale-mode {
        font-size: 22px;
        letter-spacing: 2px;
    }

    .answer-buttons {
        gap: 8px;
    }

    .answer-btn {
        padding: 14px 0;
        font-size: 18px;
    }

    .builder-inputs {
        gap: 4px;
    }

    .builder-slot {
        padding: 10px 2px;
        min-height: 48px;
        font-size: 14px;
    }

    .note-buttons-grid {
        gap: 4px;
    }

    .note-btn {
        padding: 10px 1px;
        font-size: 13px;
    }

    .settings-panel {
        max-height: 90vh;
    }

    .settings-body {
        padding: 8px 20px 16px;
    }

    .settings-header {
        padding: 20px 20px 12px;
    }

    .settings-footer {
        padding: 12px 20px 20px;
    }

    .toggle-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .header-right {
        gap: 10px;
    }

    .progress-count {
        font-size: 14px;
    }

    .stat-value {
        font-size: 24px;
    }
}

/* ===== Celebration Animation ===== */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--bg-primary);
    animation: confettiFall 1s ease-out forwards;
}

/* ===== Builder Inputs Grid ===== */
.builder-inputs {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

/* ===== Reverse Toggle ===== */
.reverse-toggle {
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: var(--element);
    background: rgba(64, 128, 128, 0.06);
    border: 1.5px solid rgba(64, 128, 128, 0.2);
    border-radius: 20px;
    padding: 4px 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-left: 10px;
    white-space: nowrap;
    opacity: 0.6;
}

.reverse-toggle:hover {
    opacity: 0.85;
    border-color: var(--element);
}

.reverse-toggle.active {
    color: var(--text-on-element);
    background: var(--element);
    border-color: var(--element);
    opacity: 1;
    box-shadow: 0 2px 8px rgba(64, 128, 128, 0.3);
}

/* ===== Extra Notes Row ===== */
.extra-notes-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
    flex-wrap: wrap;
}

.extra-note-btn {
    padding-left: 16px !important;
    padding-right: 16px !important;
}

/* ===== Theory Overview ===== */
.theory-explanation {
    font-size: 14px;
    color: var(--element-dark);
    line-height: 1.6;
    margin: 0 0 8px 0;
}

.theory-example {
    font-size: 13px;
    color: var(--element);
    line-height: 1.5;
    margin: 0 0 20px 0;
    font-style: italic;
}

.theory-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.theory-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.theory-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    color: var(--element-dark);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 4px;
    text-align: center;
    border-bottom: 2px solid var(--element);
    hyphens: auto;
    word-break: break-word;
    overflow-wrap: break-word;
}

.theory-table tbody td {
    padding: 9px 8px;
    text-align: center;
    color: var(--element-dark);
    font-weight: 500;
    border-bottom: 1px solid var(--element);
    border-left: none;
    border-right: none;
    transition: background var(--transition-fast);
}

.theory-table tbody tr:last-child td {
    border-bottom: none;
}

.theory-table tbody tr:hover td {
    background: rgba(64, 128, 128, 0.06);
}

/* ===== Circle of Fifths ===== */
.theory-section {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.theory-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--element-dark);
    margin: 0 0 8px 0;
}

.cof-container {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.cof-svg {
    width: 100%;
    max-width: 380px;
    height: auto;
    font-family: inherit;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* ===== Scales Dictionary ===== */
#theoryDictionaryPanel .practice-card {
    padding-bottom: 30px;
}

.dict-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.dict-control-group {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dict-control-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dict-select {
    padding: 12px;
    border-radius: var(--radius-md);
    border: 2px solid rgba(64, 128, 128, 0.1);
    background: white;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dict-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(64, 128, 128, 0.1);
}

.dict-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dict-result-card {
    background: rgba(64, 128, 128, 0.04);
    border-radius: var(--radius-md);
    padding: 20px;
    border-left: 4px solid var(--accent);
}

.dict-result-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--element-dark);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.info-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(64, 128, 128, 0.5);
    border: none;
    color: var(--element-dark);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.info-btn:hover {
    background: var(--element-dark);
    color: white;
}

.info-popup {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    z-index: 100;
    background: var(--accent);
    color: var(--element-dark);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0.3px;
    width: 220px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all var(--transition-normal);
    pointer-events: none;
}

.info-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.info-popup::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 30px;
    border: 6px solid transparent;
    border-bottom-color: var(--accent);
}

.dict-result-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    word-break: break-all;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.dict-result-value.compact {
    gap: 1px;
    align-items: flex-end;
}

.dict-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 28px;
    padding: 0 4px;
}

.solfege-syllable {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: lowercase;
}

.dict-sep {
    width: 1px;
    height: 18px;
    background: rgba(64, 128, 128, 0.15);
    margin: 0 4px;
}

.dict-sep-tall {
    width: 1px;
    height: 36px;
    background: rgba(64, 128, 128, 0.15);
    margin: 4px 2px 0 2px;
}

/* Visualization Styles */
.visualization-container {
    width: 100%;
    margin-top: 10px;
    overflow-x: auto;
    display: flex;
    justify-content: center;
    padding-bottom: 5px;
}

/* Staff */
.staff-svg {
    background: white;
    border-radius: 4px;
    padding: 10px;
    min-width: 300px;
}

.staff-line {
    stroke: #333;
    stroke-width: 1;
}

.staff-note {
    fill: black;
    stroke: black;
}

.staff-stem {
    stroke: black;
    stroke-width: 1.5;
}

.staff-accidental {
    font-family: "Noto Music", sans-serif;
    font-size: 20px;
}

.staff-clef {
    font-family: "Noto Music", sans-serif;
    font-size: 40px;
}

/* Piano */
.piano-container {
    display: flex;
    position: relative;
    height: 80px;
    background: #333;
    padding: 4px;
    border-radius: 4px;
}

.piano-key-white {
    width: 24px;
    height: 100%;
    background: white;
    border: 1px solid #ccc;
    border-radius: 0 0 3px 3px;
    margin-right: 1px;
    position: relative;
    z-index: 1;
}

.piano-key-black {
    width: 16px;
    height: 60%;
    background: black;
    position: absolute;
    z-index: 2;
    border-radius: 0 0 2px 2px;
}

.piano-marker {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 18px;
    background: rgba(255, 0, 0, 0.6);
    border-radius: 50%;
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.piano-key-black .piano-marker {
    bottom: 8px;
    background: rgba(255, 0, 0, 0.8);
}

/* Guitar */
.guitar-container {
    display: flex;
    flex-direction: column;
    background: #5e4033;
    /* Fretboard dark scaling wood */
    padding: 10px 10px 10px 25px;
    /* Increased left padding for labels */
    border-radius: 6px;
    position: relative;
    width: 320px;
    /* Increased total width slightly */
}

.guitar-string {
    height: 20px;
    /* Ensure sufficient height for markers */
    position: relative;
    display: flex;
    align-items: center;
}

.guitar-string::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    background: #b0b0b0;
    /* String color */
    transform: translateY(-50%);
    z-index: 1;
}

.guitar-fret-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: silver;
}

.guitar-nut {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 15px;
    /* Move nut right to make space for open notes */
    width: 6px;
    background: #ddd;
    z-index: 5;
}

.guitar-marker {
    position: absolute;
    top: 50%;
    /* On the string */
    transform: translate(-50%, -50%);
    width: 22px;
    height: 22px;
    background: #d4a017;
    /* Gold/Orange for better visibility */
    border: 1px solid #fff;
    border-radius: 50%;
    color: black;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.guitar-fret-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
}

@media (max-width: 480px) {
    .dict-result-value {
        font-size: 18px;
    }
}