/* General Styles */
* {
    box-sizing: border-box;
    /* FIX 1: Removes "Ghost" gray/blue highlight rectangles on tap */
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Arial', sans-serif;
    background: #ffffff;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* FIX: Class to freeze background scrolling */
body.no-scroll {
    overflow: hidden !important;
    position: fixed !important;
    width: 100%;
    height: 100%;
}

/* Remove min-height on home page */
#home {
    min-height: auto;
    margin-bottom: 0;
}

/* Navigation Styles */
.nav-container {
    background: #ffffff;
    width: 100%;
    position: fixed;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid #6a0dad;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    box-sizing: border-box;
    height: 5vh;
    min-height: 50px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav-header {
    max-width: none;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 100%;
    width: 100%;
}

.nav-brand {
    font-size: 20px;
    font-weight: bold;
    color: #6a0dad;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    flex-shrink: 0;
}

.nav-brand span {
    color: inherit;
}

.nav-menu {
    display: flex;
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-btn {
    background: none;
    border: none;
    color: #6a0dad;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    position: relative;
    border-radius: 5px;
}

.nav-btn:after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #6a0dad, #8a2be2);
    transition: width 0.3s ease;
}

.nav-btn:hover {
    color: #4b0082;
    background: none;
    transform: translateY(-2px);
}

.nav-btn:hover:after,
.nav-btn.active:after {
    width: 100%;
}

.nav-btn.active {
    color: #4b0082;
    background: none !important;
}

/* Mobile Navigation */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #6a0dad;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
}

.nav-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: #6a0dad;
    margin: 5px 0;
    transition: all 0.3s ease;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Menu Overlay */
.mobile-menu {
    display: none; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; 
}

.mobile-menu.active {
    display: block; 
    opacity: 1;
    pointer-events: auto; 
}

.mobile-menu-content {
    position: absolute;
    right: 0;
    top: 80px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.mobile-menu .nav-btn {
    font-size: 20px;
    text-align: right;
}

/* Page Container */
.container {
    max-width: 900px;
    width: calc(100% - 60px);
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 5vh;
}

/* Hide container on home page */
#home .container {
    display: none;
}

/* Page Management */
.page {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s ease-in-out;
    margin-bottom: 20px;
}

.page.active {
    display: block;
}

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

h1 {
    text-align: center;
    margin-bottom: 40px;
    margin-top: 60px;
    font-size: 2.8em;
    color: #6a0dad;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    text-transform: uppercase;
    letter-spacing: 3px;
}

/* Hide h1 on home page only */
#home h1 {
    display: none;
}

.hero-section {
    width: 100vw;
    height: 95vh;
    min-height: 400px;
    background-image: url('../images/hero-background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    margin-top: 0;
    padding-top: 0;
    box-sizing: border-box;
}

/* Background with blur effect */
.hero-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/hero-background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    filter: blur(3px);
    z-index: 0;
}

/* Background Overlay */
.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(106, 13, 173, 0.15);
    z-index: 1;
    transition: background 0.3s ease;
}

.hero-content {
    text-align: center;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
}

.hero-logo {
    max-width: 270px;
    width: 70%;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
    margin: 0;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.scroll-indicator:hover {
    opacity: 1;
}

.scroll-arrow {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 16px solid #6a0dad;
    margin: 0 auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    transition: border-top-color 0.3s ease;
}

/* Contact Form Styles */
.contact-form {
    background: linear-gradient(135deg, #fff 0%, #f8f8f8 100%);
    border: 3px solid #6a0dad;
    border-radius: 20px;
    padding: 30px;
    margin-top: 25px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
}

.contact-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
        rgba(106, 13, 173, 0.05) 0%, 
        transparent 25%, 
        transparent 75%, 
        rgba(106, 13, 173, 0.05) 100%);
    pointer-events: none;
}

.form-group {
    margin-bottom: 25px;
    position: relative;
    z-index: 1;
}

/* Form Status Messages */
#form-status {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 10px;
    text-align: center;
    font-weight: bold;
    display: none;
}
#form-status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}
#form-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.form-label {
    display: block;
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border: 3px solid #6a0dad;
    color: #333;
    padding: 14px 18px;
    border-radius: 15px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    box-sizing: border-box;
    font-family: inherit;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    background: linear-gradient(135deg, #fff 0%, #f8f8f8 100%);
    border-color: #4b0082;
    box-shadow: 0 0 15px rgba(106, 13, 173, 0.4), inset 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #999;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.submit-btn {
    background: linear-gradient(135deg, #6a0dad 0%, #4b0082 100%);
    border: 3px solid #6a0dad;
    color: white;
    padding: 16px 40px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    min-width: 180px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2), inset 0 1px 2px rgba(255,255,255,0.1);
    font-family: inherit;
}

.submit-btn:hover {
    background: linear-gradient(135deg, #8a2be2 0%, #6a0dad 100%);
    border-color: #8a2be2;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3), inset 0 1px 2px rgba(255,255,255,0.1);
}

.submit-btn:active {
    transform: translateY(-1px);
}

.form-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    position: relative;
    z-index: 1;
}

.form-footer p {
    color: #666;
    font-size: 0.9em;
    margin: 0;
    line-height: 1.5;
}

/* Info Section */
.info-section {
    width: 100vw;
    min-height: 95vh;
    background: #f8f8f8;
    color: #333;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    text-align: center;
    border-top: 2px solid #6a0dad;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    margin-bottom: 0;
    position: relative;
    padding: 50px 0;
}

.info-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 40px;
    width: 100%;
}

.info-title {
    color: #6a0dad;
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    margin-top: 0;
}

.info-text {
    font-size: 1.3em;
    line-height: 1.6;
    margin-bottom: 40px;
    color: #333;
}

.tool-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.tool-btn {
    background: linear-gradient(135deg, #6a0dad 0%, #4b0082 100%);
    border: 3px solid #6a0dad;
    color: white;
    padding: 18px 36px;
    border-radius: 35px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    min-width: 200px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2), inset 0 1px 2px rgba(255,255,255,0.1);
    font-family: inherit;
}
.tool-btn:hover {
    background: linear-gradient(135deg, #8a2be2 0%, #6a0dad 100%);
    border-color: #8a2be2;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3), inset 0 1px 2px rgba(255,255,255,0.1);
}

/* Box Styles */
.tone-generator,
.settings-box {
    background: linear-gradient(135deg, #fff 0%, #f8f8f8 100%);
    border: 3px solid #6a0dad;
    border-radius: 20px;
    padding: 0;
    margin-bottom: 25px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
}

.tone-generator::before,
.settings-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
        rgba(106, 13, 173, 0.05) 0%, 
        transparent 25%, 
        transparent 75%, 
        rgba(106, 13, 173, 0.05) 100%);
    pointer-events: none;
}

/* Collapsible Styles */
.collapsible-header {
    padding: 20px 30px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    user-select: none;
    gap: 15px;
}

.collapsible-title {
    font-size: 1.4em;
    font-weight: bold;
    color: #333;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    margin: 0;
    flex-grow: 1;
}

.chevron {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border: 3px solid #6a0dad;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2), inset 0 1px 2px rgba(255,255,255,0.3);
    flex-shrink: 0;
}

.chevron:hover {
    background: linear-gradient(135deg, #6a0dad 0%, #4b0082 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3), inset 0 1px 2px rgba(255,255,255,0.3);
}

.chevron svg {
    width: 16px;
    height: 16px;
    stroke: #333;
    stroke-width: 3;
    transition: stroke 0.3s ease, transform 0.4s ease-out;
    transform: rotate(-180deg);
}

.chevron:hover svg {
    stroke: white;
}

.chevron.expanded svg {
    transform: rotate(0deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    position: relative;
    z-index: 1;
}

.collapsible-content.expanded {
    max-height: 1000px;
}

.content-inner {
    padding: 0 30px 30px;
    border-top: 1px solid #e0e0e0;
    margin-top: -1px;
}

/* Generator Controls */
.generator-header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding-top: 20px;
    width: 100%;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-title {
    font-size: 1.4em;
    font-weight: bold;
    color: #333;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.frequency-display-container {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.frequency-display {
    font-size: 1.1em;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border: 2px solid #6a0dad;
    padding: 10px 18px;
    border-radius: 25px;
    min-width: 90px;
    text-align: center;
    transition: all 0.4s ease;
    color: #333;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    font-weight: 600;
    flex-grow: 1;
}

#drone-tuning-content .frequency-display {
     background: linear-gradient(135deg, #ccc 0%, #bbb 100%);
}
#drone-tuning-content .frequency-display.indicator-enabled {
     background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
}

.frequency-display.correct {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%) !important;
    color: white;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.6), inset 0 2px 4px rgba(255,255,255,0.2);
    transform: scale(1.05);
}

.frequency-display.close {
    background: linear-gradient(135deg, #FF9800 0%, #e68900 100%) !important;
    color: white;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.6), inset 0 2px 4px rgba(255,255,255,0.2);
    transform: scale(1.02);
}

.frequency-display.far {
    background: linear-gradient(135deg, #F44336 0%, #da190b 100%) !important;
    color: white;
    box-shadow: 0 0 15px rgba(244, 67, 54, 0.6), inset 0 2px 4px rgba(255,255,255,0.2);
}

.frequency-display.hz-hidden {
    background: linear-gradient(135deg, #ccc 0%, #bbb 100%);
    color: transparent !important;
    user-select: none;
}

#score-display-drone, #streak-display-drone, #fc-score-display, #fc-streak-display {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%) !important;
}


.controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
    padding-top: 20px;
}

.slider-container {
    flex: 1;
    position: relative;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-wrapper {
    flex: 1;
    position: relative;
}
.text-input-container {
    flex: 1;
    display: flex;
    align-items: center;
}

.freq-input {
    width: 100%;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border: 3px solid #6a0dad;
    color: #333;
    padding: 12px 18px;
    border-radius: 30px;
    font-size: 16px;
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.freq-input:focus {
    background: linear-gradient(135deg, #fff 0%, #f8f8f8 100%);
    border-color: #4b0082;
    box-shadow: 0 0 15px rgba(106, 13, 173, 0.4), inset 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.freq-input::placeholder {
    color: #999;
}

.slider {
    width: 100%;
    height: 10px;
    background: linear-gradient(135deg, #ddd 0%, #ccc 100%);
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.slider:hover {
    background: linear-gradient(135deg, #e0e0e0 0%, #d0d0d0 100%);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #6a0dad 0%, #4b0082 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3), inset 0 1px 2px rgba(255,255,255,0.3);
    transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    background: linear-gradient(135deg, #8a2be2 0%, #6a0dad 100%);
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 1px 2px rgba(255,255,255,0.3);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #6a0dad 0%, #4b0082 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

.fine-tune-btn {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border: 3px solid #6a0dad;
    color: #333;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2), inset 0 1px 2px rgba(255,255,255,0.3);
}

.fine-tune-btn:hover {
    background: linear-gradient(135deg, #6a0dad 0%, #4b0082 100%);
    color: white;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3), inset 0 1px 2px rgba(255,255,255,0.3);
}
.fine-tune-btn:active {
    transform: translateY(0) scale(0.95);
}

.play-btn {
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    border: 3px solid #e0e0e0;
    color: #333;
    padding: 14px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    min-width: 90px;
    min-height: 52px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2), inset 0 1px 2px rgba(0,0,0,0.1);
}

.play-btn:hover {
    background: linear-gradient(135deg, #e0e0e0 0%, #d0d0d0 100%);
    border-color: #d0d0d0;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3), inset 0 1px 2px rgba(0,0,0,0.1);
}

.play-btn.playing {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff5252 100%);
    border-color: #ff5252;
    color: white;
    animation: pulse 2s infinite;
}

.btn-gold {
    background: linear-gradient(135deg, #6a0dad 0%, #4b0082 100%);
    border-color: #6a0dad;
    color: white;
}
.btn-gold:hover {
    background: linear-gradient(135deg, #4b0082 0%, #3a0066 100%);
    border-color: #4b0082;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(255, 107, 107, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); }
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 55px;
    height: 28px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #ccc 0%, #bbb 100%);
    transition: .4s;
    border-radius: 28px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: linear-gradient(135deg, white 0%, #f8f8f8 100%);
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #6a0dad 0%, #4b0082 100%);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(27px);
}

.toggle-label {
    font-size: 0.9em;
    color: #666;
    font-weight: 600;
}

/* Segmented Control for Difficulty */
.segmented-control {
    display: flex;
    width: 100%;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border: 2px solid #6a0dad;
    border-radius: 30px;
    padding: 5px;
    box-sizing: border-box;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 25px;
}

.segmented-control input[type="radio"] {
    display: none;
}

.segmented-control label {
    flex: 1;
    text-align: center;
    padding: 12px 18px;
    cursor: pointer;
    color: #666;
    font-weight: bold;
    font-size: 16px;
    border-radius: 25px;
    transition: all 0.4s ease;
    user-select: none;
    position: relative;
}

.segmented-control label:hover {
    color: #333;
    background: rgba(106, 13, 173, 0.1);
}

.segmented-control input[type="radio"]:checked + label {
    background: linear-gradient(135deg, #6a0dad 0%, #4b0082 100%);
    color: white;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2), inset 0 1px 2px rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

.tester-content-panel {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s ease-in-out;
}
.tester-content-panel.active {
    display: block;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
    width: 100%;
}
.action-btn {
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    border: 3px solid #e0e0e0;
    color: #333;
    padding: 14px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    min-width: 130px;
    min-height: 52px;
    text-align: center;
    box-sizing: border-box;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2), inset 0 1px 2px rgba(0,0,0,0.1);
}

.action-btn:hover {
    background: linear-gradient(135deg, #e0e0e0 0%, #d0d0d0 100%);
    border-color: #d0d0d0;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3), inset 0 1px 2px rgba(0,0,0,0.1);
}

.action-btn.randomise {
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    border-color: #e0e0e0;
}
.action-btn.randomise:hover {
    background: linear-gradient(135deg, #e0e0e0 0%, #d0d0d0 100%);
    border-color: #d0d0d0;
}
.action-btn.indicator {
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    border-color: #e0e0e0;
}
.action-btn.indicator:hover {
    background: linear-gradient(135deg, #e0e0e0 0%, #d0d0d0 100%);
    border-color: #d0d0d0;
}
.action-btn.indicator.hidden {
    background: linear-gradient(135deg, #FF9800 0%, #e68900 100%);
    border-color: #FF9800;
}
.action-btn.indicator.hidden:hover {
    background: linear-gradient(135deg, #e68900 0%, #d68400 100%);
    border-color: #e68900;
}

.action-btn:disabled, button:disabled {
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

.action-btn.submit-correct:disabled,
.action-btn.submit-close:disabled,
.action-btn.submit-incorrect:disabled,
.test-btn.correct:disabled,
.test-btn.incorrect:disabled {
    opacity: 1 !important;
}

/* Submit button color states */
.action-btn.submit-correct {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-color: #4CAF50;
}
.action-btn.submit-close {
    background: linear-gradient(135deg, #FF9800 0%, #e68900 100%);
    border-color: #FF9800;
}
.action-btn.submit-incorrect {
    background: linear-gradient(135deg, #F44336 0%, #da190b 100%);
    border-color: #F44336;
}

/* Settings Box Styles */
.settings-controls {
    display: flex;
    flex-direction: column;
    gap: 25px;
    align-items: stretch;
    width: 100%;
    position: relative;
    z-index: 1;
    padding-top: 20px;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}
.settings-row.button-row { display: flex; width: 100%; }
.settings-row.toggle-row {
    display: flex;
    flex-direction: row;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
}

.difficulty-display {
    font-size: 1.1em;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border: 2px solid #6a0dad;
    padding: 14px 22px;
    border-radius: 30px;
    flex: 1;
    text-align: center;
    transition: all 0.3s ease;
    box-sizing: border-box;
    color: #333;
    font-weight: 600;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

/* Test Buttons */
.test-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 18px;
    width: 100%;
}
.test-btn {
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    border: 3px solid #e0e0e0;
    color: #333;
    padding: 14px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 52px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2), inset 0 1px 2px rgba(0,0,0,0.1);
}

.test-btn:hover {
    background: linear-gradient(135deg, #e0e0e0 0%, #d0d0d0 100%);
    border-color: #d0d0d0;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3), inset 0 1px 2px rgba(0,0,0,0.1);
}

.test-btn.correct {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-color: #4CAF50;
    color: white;
    animation: correctPulse 0.8s ease;
}

.test-btn.incorrect {
    background: linear-gradient(135deg, #F44336 0%, #da190b 100%);
    border-color: #F44336;
    color: white;
    animation: incorrectShake 0.6s ease;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* Vertical Controls Layout */
.controls-vertical {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    position: relative;
    z-index: 1;
    padding-top: 20px;
}
.controls-vertical button {
    width: 100%;
    min-height: 52px;
    padding: 14px 24px;
}
.controls-vertical .action-btn { width: 100%; }

/* NEW STYLES FOR CHANTER TUNER */
.carousel-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.carousel-viewport {
    flex-grow: 1;
    width: 100%;
    overflow: hidden;
    position: relative;
    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
}

.carousel-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    padding: 20px 0;
    cursor: grab;
}
.carousel-track:active { cursor: grabbing; }

.note-card {
    flex: 0 0 120px;
    height: 80px;
    margin: 0 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    background: linear-gradient(135deg, #f9f9f9 0%, #e9e9e9 100%);
    border: 3px solid #ccc;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.5s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transform: scale(0.8);
    opacity: 0.6;
    user-select: none;
}

.note-card.active {
    transform: scale(1.1);
    opacity: 1;
    border-color: #8a2be2;
    box-shadow: 0 0 15px rgba(106, 13, 173, 0.4);
}

.note-card.correct { background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%); border-color: #4CAF50; color: white; }
.note-card.close { background: linear-gradient(135deg, #FF9800 0%, #e68900 100%);
    border-color: #FF9800; color: white; }
.note-card.far { background: linear-gradient(135deg, #F44336 0%, #da190b 100%); border-color: #F44336; color: white;
}

.carousel-arrow {
    flex-shrink: 0;
    background-color: rgba(106, 13, 173, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    margin: 0 15px;
}
.carousel-arrow:hover { background-color: #6a0dad;
}

.tuning-dial-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.wheel-container {
    width: 200px;
    height: 200px;
    position: relative;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0e0e0, #cccccc);
    position: relative;
    cursor: grab;
    transform: rotate(var(--angle, 0deg));
    box-shadow: 0 8px 25px rgba(0,0,0,0.3), inset 0 0 15px rgba(0,0,0,0.2);
}
.wheel:active { cursor: grabbing;
}

.wheel-pointer {
    width: 8px;
    height: 25px;
    background-color: #6a0dad;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* Tool Hub Styles */
#tool-selection-container { text-align: center; width: 100%;
}
#tool-selection-container h2 { font-size: 2.2em; color: #6a0dad; text-shadow: 1px 1px 2px rgba(0,0,0,0.2); margin-bottom: 10px; }
#tool-selection-container p { font-size: 1.1em;
    color: #555; margin-bottom: 40px; }

.tool-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    width: 100%;
}

.tool-card {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border: 3px solid #ddd;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    transition: all 0.3s ease-in-out;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    text-align: center;
}
.tool-card:hover { transform: translateY(-8px); box-shadow: 0 15px 40px rgba(0,0,0,0.2); border-color: #6a0dad; }
.tool-card[data-target="chanter-tuning-content"] { border-color: #FFBF00; }
.tool-card[data-target="chanter-tuning-content"]:hover { border-color: #FFBF00;
    box-shadow: 0 15px 40px rgba(255, 191, 0, 0.3); }

.tool-card h3 { font-size: 1.6em; color: #6a0dad; margin-top: 0; margin-bottom: 8px;
}
.tool-card .difficulty-tag { display: none; }
.tool-card .description { font-size: 1em; color: #555; line-height: 1.5; flex-grow: 1; margin-bottom: 20px;
}

.tool-card .action-button {
    background: linear-gradient(135deg, #6a0dad 0%, #4b0082 100%);
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    align-self: center;
}
.tool-card .action-button:hover {
    background: linear-gradient(135deg, #8a2be2 0%, #6a0dad 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.back-btn {
    background: #6a0dad;
    border: 2px solid #6a0dad;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-bottom: 25px;
    align-self: flex-start;
}
.back-btn:hover { background: #4b0082; color: white; }

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 30px 40px;
    border: 3px solid #6a0dad;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: left;
}

.modal-content .close-btn {
    background: linear-gradient(135deg, #6a0dad 0%, #4b0082 100%);
    border: none;
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s ease;
    display: block;
    width: fit-content;
    margin: 30px auto 0;
    text-decoration: none;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.modal-content .close-btn:hover {
     background: linear-gradient(135deg, #8a2be2 0%, #6a0dad 100%);
    transform: translateY(-2px);
     box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.modal-content h3 { color: #6a0dad; margin-top: 0; font-size: 1.8em; text-align: center; margin-bottom: 20px;
}
.modal-content h4 { font-size: 1.3em; color: #4b0082; margin-top: 25px; margin-bottom: 10px; border-bottom: 2px solid #eee; padding-bottom: 5px;
}
.modal-content p, .modal-content li { font-size: 1em; line-height: 1.6; color: #555; }
.modal-content strong { color: #333;
}
.modal-content code { background-color: #eee; padding: 2px 6px; border-radius: 4px; font-family: monospace; color: #6a0dad;
}
.modal-content ol, .modal-content ul { padding-left: 20px; }
.modal-content ol li { margin-bottom: 12px; }
.modal-content ul li { margin-bottom: 8px;
}

.tool-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 25px;
}
.tool-header-controls .back-btn { margin-bottom: 0;
}
.tool-header-controls .instructions-btn {
    background: none;
    border: 2px solid #6a0dad;
    color: #6a0dad;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s ease;
}
.tool-header-controls .instructions-btn:hover { background: #6a0dad; color: white;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    body { padding: 0; width: 100%;
    }
    .hero-section, .hero-section::after { background-attachment: scroll; }
    .info-section { min-height: auto; padding: 80px 0;
    }
    .nav-header { padding: 0 15px; }
    .nav-brand { font-size: 18px; letter-spacing: 1px;
    }
    .nav-menu { gap: 15px; display: none; }
    .nav-container { height: 5vh; min-height: 40px;
    }
    .nav-toggle { display: block; }
    
    /* FIX FOR INVISIBLE WALL: Do NOT force display:block here */
    .mobile-menu { 
        /* The default style handles display:none */
    }
    .mobile-menu.active {
        display: block; 
    }
    
    .container { margin: 100px 20px 0; padding: 0; width: calc(100% - 40px); max-width: 900px;
    }
    .hero-section { height: 95vh; min-height: 300px; }
    #home .hero-section:first-child { margin-top: -100px;
    padding-top: 100px; }
    .hero-logo { max-width: 250px; width: 70%; margin: 40px 0;
    }
    .info-content { padding: 0 30px; }
    .info-text { font-size: 1.1em; margin-bottom: 30px;
    }
    .tool-buttons { flex-direction: column; align-items: center; gap: 20px;
    }
    .tool-btn { padding: 16px 32px; font-size: 16px; min-width: 180px;
    }
    .collapsible-header { padding: 15px 20px; }
    .content-inner { padding: 0 20px 20px;
    }
    .collapsible-title { font-size: 1.2em; }
    .controls { flex-direction: column; gap: 15px; align-items: stretch;
    }
    .slider-container { min-width: auto; width: 100%; order: 1; }
    .slider-wrapper { flex: 1;
    }
    .fine-tune-btn { width: 45px; height: 45px; font-size: 20px;
    }
    .play-btn, .play-btn.solve-individual { order: 2; min-width: auto; width: 100%; padding: 16px; font-size: 16px;
    }
    .text-input-container { width: 100%; order: 1; }
    .freq-input { font-size: 16px;
    padding: 14px 18px; }
    .action-buttons { grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; max-width: none;
    }
    .action-btn { padding: 14px 18px; font-size: 16px; min-width: auto;
    }
    .frequency-display { padding: 8px 15px; font-size: 1em; min-width: 80px;
    }
    .toggle-label { font-size: 0.8em; }
    .toggle-switch { width: 50px; height: 25px;
    }
    .toggle-slider:before { height: 19px; width: 19px; left: 3px; bottom: 3px;
    }
    .toggle-switch input:checked + .toggle-slider:before { transform: translateX(25px); }
    .settings-title { text-align: center;
    }
    .settings-controls { gap: 18px; padding-top: 20px; }
    .settings-row { gap: 12px;
    }
    .settings-row.button-row { width: 100%; }
    .settings-row.toggle-row { gap: 12px;
    }
    .difficulty-display { padding: 12px 18px; font-size: 1em;
    }
    .segmented-control label { padding: 10px 14px; font-size: 16px; }
    .test-buttons { gap: 12px;
    margin-top: 12px; }
    .test-btn { padding: 12px 18px; font-size: 16px;
    }
    .scroll-indicator { bottom: 20px; }
    .scroll-arrow { border-left-width: 10px; border-right-width: 10px; border-top: 14px;
    }
    .score-displays { flex-direction: row !important; gap: 10px !important; }
    .carousel-arrow { display: none;
    } 
    .carousel-viewport {
         -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    }
}

@media (max-width: 480px) {
    .generator-header-controls { flex-direction: row;
    align-items: center; }
    .action-btn { font-size: 16px; padding: 12px 15px;
    }
    .nav-brand { font-size: 24px; }
    .hero-section { height: 95vh; min-height: 250px;
    }
    .hero-logo { max-width: 200px; width: 60%; margin: 30px 0;
    }
    .info-content { padding: 0 20px; }
    .info-text { font-size: 1em;
    }
    .tool-btn { padding: 14px 28px; font-size: 16px; min-width: 160px;
    }
}


/* ========================================= */
/* METRONOME THEME / DARK MODE GLOBALS       */
/* ========================================= */

/* Variables and Global Defaults */
body.dark-mode {
    --bg: #0f1012;
    --surface: #1a1b1e;
    --surface-hover: #25262b;
    --primary: #00f2ff;
    --primary-dim: rgba(0, 242, 255, 0.1);
    --accent: #ff0055;
    --warn: #ffd900;
    --text: #ffffff;
    --text-muted: #868e96;
    --border: #2c2e33;
    --radius: 12px;

    /* Override body background */
    background: var(--bg);
    color: var(--text);
}

/* 1. Global Navigation Re-skin */
body.dark-mode .nav-container {
    background: var(--surface);
    border-bottom: 3px solid var(--primary);
    box-shadow: 0 4px 20px rgba(0, 242, 255, 0.15);
}

body.dark-mode .nav-brand {
    color: var(--text);
    text-shadow: none;
}
body.dark-mode .nav-brand span {
    color: var(--primary);
}

body.dark-mode .nav-btn {
    color: var(--text-muted);
}
body.dark-mode .nav-btn:hover, 
body.dark-mode .nav-btn.active {
    color: var(--primary);
    background: none;
    text-shadow: 0 0 8px var(--primary-dim);
}
body.dark-mode .nav-btn::after {
    background: var(--primary);
    box-shadow: 0 0 5px var(--primary);
}

body.dark-mode .nav-toggle span {
    background: var(--primary);
    box-shadow: 0 0 5px var(--primary-dim);
}

/* Mobile Menu Dark Mode */
body.dark-mode .mobile-menu {
    background: rgba(15, 16, 18, 0.98);
}

/* 2. Global Section Overrides */

/* Hero Section */
body.dark-mode .hero-section::before {
    background: rgba(15, 16, 18, 0.4);
    /* Darker overlay for hero image */
}
body.dark-mode .scroll-arrow {
    border-top-color: var(--primary);
    filter: drop-shadow(0 0 5px var(--primary));
}

/* Info Section */
body.dark-mode .info-section {
    background: var(--surface);
    border-top: 2px solid var(--primary);
    color: var(--text);
}
body.dark-mode .info-title {
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-dim);
}
body.dark-mode .info-text {
    color: var(--text-muted);
}

/* Contact Form & General Cards */
body.dark-mode .contact-form,
body.dark-mode .tone-generator,
body.dark-mode .settings-box,
body.dark-mode .tool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border-radius: var(--radius);
}

/* Remove gradients overlays */
body.dark-mode .contact-form::before,
body.dark-mode .tone-generator::before,
body.dark-mode .settings-box::before {
    display: none;
}

/* 3. Inputs & Form Elements */
body.dark-mode .form-label,
body.dark-mode label {
    color: var(--text-muted);
    text-shadow: none;
}

body.dark-mode .form-input,
body.dark-mode .form-textarea,
body.dark-mode .form-select,
body.dark-mode .freq-input {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

body.dark-mode .form-input:focus,
body.dark-mode .form-textarea:focus,
body.dark-mode .form-select:focus,
body.dark-mode .freq-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-dim);
    background: var(--surface-hover);
}

body.dark-mode .form-input::placeholder,
body.dark-mode .form-textarea::placeholder {
    color: #555;
}

body.dark-mode .form-footer {
    border-top: 1px solid var(--border);
}
body.dark-mode .form-footer p {
    color: var(--text-muted);
}

/* 4. Headlines & Text */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
    color: var(--text);
    text-shadow: none;
}
body.dark-mode h1 {
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
}
body.dark-mode p {
    color: var(--text-muted);
}
/* Fix for Tool Selection Text in Dark Mode */
body.dark-mode #tool-selection-container p {
    color: var(--text-muted);
}
/* Instruction Text Override */
body.dark-mode .instruction-text {
    text-align: left !important;
    padding-left: 10px;
    margin-bottom: 10px;
}

/* 5. Tool Cards Specifics */
body.dark-mode .tool-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-dim);
    transform: translateY(-5px);
}
body.dark-mode .tool-card h3 {
    color: var(--text);
}
body.dark-mode .tool-card .description {
    color: var(--text-muted);
}
body.dark-mode .tool-card .action-button,
body.dark-mode .tool-btn {
    background: var(--surface-hover);
    border: 1px solid var(--primary);
    color: var(--primary);
    box-shadow: none;
}
body.dark-mode .tool-card .action-button:hover,
body.dark-mode .tool-btn:hover {
    background: var(--primary);
    color: var(--bg);
    box-shadow: 0 0 15px var(--primary);
    border-color: var(--primary);
}

/* 6. Collapsible Headers */
body.dark-mode .collapsible-header {
    border-bottom: 1px solid var(--border);
}
body.dark-mode .collapsible-title {
    color: var(--text);
}
body.dark-mode .chevron {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    box-shadow: none;
}
body.dark-mode .chevron:hover {
    border-color: var(--primary);
}
body.dark-mode .chevron svg {
    stroke: var(--text-muted);
}
body.dark-mode .chevron:hover svg {
    stroke: var(--primary);
}
body.dark-mode .content-inner {
    border-top: none;
    background: var(--bg);
}

/* 7. Buttons (General Override) */
body.dark-mode .play-btn, 
body.dark-mode .action-btn, 
body.dark-mode .test-btn, 
body.dark-mode .fine-tune-btn,
body.dark-mode .back-btn,
body.dark-mode .instructions-btn,
body.dark-mode .submit-btn {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    border-radius: 8px;
}

body.dark-mode .play-btn:hover, 
body.dark-mode .action-btn:hover,
body.dark-mode .test-btn:hover,
body.dark-mode .fine-tune-btn:hover,
body.dark-mode .submit-btn:hover {
    background: #333;
    border-color: var(--text-muted);
    color: white;
    transform: none;
}

/* Primary Cyan Buttons */
body.dark-mode .btn-gold,
body.dark-mode .action-btn.solve,
body.dark-mode .submit-btn {
    color: var(--primary);
    border-color: var(--primary-dim);
}
body.dark-mode .btn-gold:hover,
body.dark-mode .submit-btn:hover {
    background: var(--primary-dim);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-dim);
    color: var(--primary);
}

/* Active/Playing State */
body.dark-mode .play-btn.playing {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.4);
    animation: none;
}

/* Secondary Buttons */
body.dark-mode .back-btn, 
body.dark-mode .instructions-btn {
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    background: transparent;
}
body.dark-mode .back-btn:hover, 
body.dark-mode .instructions-btn:hover {
    border-color: var(--text);
    color: var(--text);
    background: var(--surface-hover);
}

/* Fine Tune Buttons */
body.dark-mode .fine-tune-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
body.dark-mode .fine-tune-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--surface-hover);
}

/* 8. Sliders & Toggles */
body.dark-mode input[type=range]::-webkit-slider-runnable-track {
    background: var(--surface-hover);
}
body.dark-mode input[type=range]::-webkit-slider-thumb {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

body.dark-mode .toggle-slider {
    background: var(--surface-hover);
    border: 1px solid var(--border);
}
body.dark-mode .toggle-slider:before {
    background: var(--text-muted);
}
body.dark-mode .toggle-switch input:checked + .toggle-slider {
    background: var(--primary-dim);
    border-color: var(--primary);
}
body.dark-mode .toggle-switch input:checked + .toggle-slider:before {
    background: var(--primary);
}
body.dark-mode .difficulty-display {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}

/* Segmented Control */
body.dark-mode .segmented-control {
    background: var(--bg);
    border: 1px solid var(--border);
}
body.dark-mode .segmented-control label {
    color: var(--text-muted);
}
body.dark-mode .segmented-control label:hover {
    color: var(--text);
    background: transparent;
}
body.dark-mode .segmented-control input[type="radio"]:checked + label {
    background: var(--surface-hover);
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    font-weight: 700;
}

/* 9. Results & Indicators */
body.dark-mode .frequency-display,
body.dark-mode #score-display-drone, 
body.dark-mode #streak-display-drone, 
body.dark-mode #fc-score-display, 
body.dark-mode #fc-streak-display,
body.dark-mode #score-display,
body.dark-mode #streak-display {
    background: var(--bg) !important;
    border: 1px solid var(--border);
    color: var(--primary);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

/* Color States */
body.dark-mode .test-btn.correct,
body.dark-mode .frequency-display.correct {
    border-color: #4CAF50;
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.1) !important;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.2);
}
body.dark-mode .test-btn.incorrect,
body.dark-mode .frequency-display.far {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(255, 0, 85, 0.1) !important;
    box-shadow: 0 0 10px rgba(255, 0, 85, 0.2);
}
body.dark-mode .frequency-display.close {
    border-color: var(--warn);
    color: var(--warn);
    background: rgba(255, 217, 0, 0.1) !important;
}

/* 10. Chanter Tuner */
body.dark-mode .note-card {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text-muted);
}
body.dark-mode .note-card.active {
    border-color: var(--primary);
    color: var(--text);
    box-shadow: 0 0 15px var(--primary-dim);
    background: var(--bg);
}
body.dark-mode .wheel {
    background: radial-gradient(circle, var(--surface-hover) 30%, var(--bg) 100%);
    border: 2px solid var(--border);
    box-shadow: 0 0 20px rgba(0,0,0,0.5), inset 0 0 10px rgba(0,0,0,0.5);
}
body.dark-mode .wheel-pointer {
    background-color: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

/* ========================================= */
/* CALENDAR & BOOKING SYSTEM STYLES    */
/* ========================================= */

#calendar-container {
    width: 100%;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    min-height: 600px;
    overflow: hidden; 
    margin-bottom: 50px; /* Added Buffer at bottom */
}

/* Booking Modal Form */
.booking-modal-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.booking-info {
    font-size: 0.9em;
    color: var(--text-muted);
    background: var(--bg);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 10px;
}
.booking-info strong {
    color: var(--primary);
}

/* FullCalendar Overrides for Dark Mode - MODERN REDESIGN */
body.dark-mode .fc {
    font-family: 'Arial', sans-serif;
    color: var(--text);
}

/* Header & Admin Controls */
.calendar-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
    gap: 10px; /* Added Buffer */
}

.calendar-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}
.calendar-title {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}
.admin-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.admin-icon-btn:hover {
    background: var(--surface-hover);
    color: var(--primary);
    box-shadow: 0 0 10px var(--primary-dim);
}
.admin-icon-btn.active {
    color: var(--primary);
    box-shadow: 0 0 15px var(--primary-dim);
}

/* Toolbar Buttons (Prev, Next, Today) */
body.dark-mode .fc-button {
    background: var(--surface-hover) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: none !important;
    border-radius: 20px !important; /* Pill shape */
    padding: 8px 16px !important;
    transition: all 0.3s ease;
    margin: 0 2px; /* Buffer between buttons */
}
body.dark-mode .fc-button:hover {
    background: var(--primary) !important;
    color: var(--bg) !important;
    border-color: var(--primary) !important;
    transform: translateY(-2px);
}
body.dark-mode .fc-button-active {
    background: var(--primary-dim) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}
body.dark-mode .fc-icon {
    vertical-align: middle;
    font-size: 1em;
}

/* Restored Grid Lines */
body.dark-mode .fc-theme-standard td, 
body.dark-mode .fc-theme-standard th {
    border-color: var(--border); /* Restored grid lines */
}
body.dark-mode .fc-scrollgrid {
    border-color: transparent; 
}
body.dark-mode .fc-theme-standard .fc-scrollgrid {
    border: none;
}
body.dark-mode .fc-col-header-cell {
    border-bottom: 1px solid var(--border); 
}

/* Header Text */
body.dark-mode .fc-col-header-cell-cushion {
    color: var(--text-muted);
    text-decoration: none;
    padding: 10px 0;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}
body.dark-mode .fc-col-header-cell-cushion:hover {
    color: var(--primary);
}

/* Time Axis */
body.dark-mode .fc-timegrid-slot-label-cushion {
    color: var(--text-muted);
    font-size: 0.85em;
}

/* Events (The Slots) - GLASS EFFECT */
body.dark-mode .fc-event {
    border: none;
    border-radius: 8px; /* Rounded corners */
    padding: 4px 6px;
    font-size: 0.85em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin: 1px 4px; /* Space between events */
    backdrop-filter: blur(5px); /* The Glass Blur */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    
    /* FIX 2: Mobile Touch Improvements */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto !important; 
    
    /* FIX 3: Removed position: relative to fix 1h display bug */
    z-index: 50 !important; 
    /* position: relative;  <-- REMOVED THIS LINE */
}
body.dark-mode .fc-event:hover {
    transform: translateY(-2px) scale(1.01);
    z-index: 55 !important;
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

/* AVAILABLE Slots (Cyan Glass) */
body.dark-mode .event-available {
    background-color: rgba(0, 242, 255, 0.15) !important;
    border-left: 4px solid var(--primary) !important;
    color: var(--primary) !important;
    border: 1px solid rgba(0, 242, 255, 0.2);
}
body.dark-mode .event-available:hover {
    background-color: rgba(0, 242, 255, 0.25) !important;
    border-color: var(--primary);
}

/* PENDING Slots (Gold Glass) */
body.dark-mode .event-pending {
    background-color: rgba(255, 217, 0, 0.15) !important;
    border-left: 4px solid var(--warn) !important;
    color: var(--warn) !important;
    border: 1px solid rgba(255, 217, 0, 0.2);
}

/* BOOKED Slots (Red/Pink Glass) */
body.dark-mode .event-booked {
    background-color: rgba(255, 0, 85, 0.15) !important;
    border-left: 4px solid var(--accent) !important;
    color: var(--accent) !important;
    border: 1px solid rgba(255, 0, 85, 0.2);
    cursor: default;
}

/* "Today" Highlight */
body.dark-mode .fc-day-today {
    background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 100%) !important;
}

/* Mobile Tweaks */
@media (max-width: 768px) {
    #calendar-container {
        padding: 10px;
        min-height: 500px;
    }
    .calendar-header-controls {
        flex-direction: row; 
        margin-bottom: 15px;
        gap: 15px; /* Ensure gap between title and icon */
    }
    .calendar-title {
        font-size: 1.2em;
    }
    
    /* Fix FullCalendar Toolbar on Mobile */
    body.dark-mode .fc-header-toolbar {
        flex-direction: column;
        gap: 10px;
    }
    body.dark-mode .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
        gap: 5px;
    }
    
    /* Make events easier to tap */
    body.dark-mode .fc-event {
        min-height: 40px; /* Enforce min-height for tap target */
        margin: 2px 0;
        padding: 8px 6px;
        pointer-events: auto !important; /* Force clickable */
    }
    
    /* Adjust grid for mobile */
    body.dark-mode .fc-timegrid-slot {
        height: 3em !important; /* Taller slots */
    }
}

/* ========================================= */
/* NEW AMENDMENTS (LESSONS FIX)        */
/* ========================================= */

/* 1. Modal Theme Overrides for Dark Mode (Cyan instead of Purple) */
body.dark-mode .modal-content {
    background-color: var(--surface);
    border: 3px solid var(--primary); /* Cyan Border */
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.15); /* Cyan Glow */
    color: var(--text);
}

body.dark-mode .modal-content h3 {
    color: var(--primary); /* Cyan Title */
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
}

body.dark-mode .booking-info {
    background-color: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
}
body.dark-mode .booking-info strong {
    color: var(--primary);
}

/* 2. Fix Bright Calendar Date Headers */
body.dark-mode .fc-theme-standard th {
    background: var(--surface); /* Dark background for headers */
    border-color: var(--border);
}

body.dark-mode .fc-col-header-cell-cushion {
    color: var(--primary); /* Cyan text for Day Names */
    opacity: 0.9;
    text-shadow: none; 
}

/* 3. Button Styling Matches (Metronome Style) */
/* Ensure the "Cancel" / "Close" buttons look like the generic action buttons */
body.dark-mode .action-btn {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: all 0.3s ease;
}
body.dark-mode .action-btn:hover {
    border-color: var(--text);
    color: var(--text);
    background: #333;
}

/* "Submit" or "Approve" buttons get the Primary Cyan Glow */
body.dark-mode .submit-btn,
body.dark-mode .submit-correct {
    background: rgba(0, 242, 255, 0.1);
    border: 1px solid var(--primary);
    color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.1);
}
body.dark-mode .submit-btn:hover,
body.dark-mode .submit-correct:hover {
    background: var(--primary);
    color: #000; /* Black text on Cyan background for high contrast */
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.4);
}

/* "Delete" or "Reject" buttons (Red/Pink) */
body.dark-mode .submit-incorrect {
    background: rgba(255, 0, 85, 0.1);
    border: 1px solid var(--accent);
    color: var(--accent);
}
body.dark-mode .submit-incorrect:hover {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.4);
}