/*
 * STYLE GUIDE: Terminal Audio
 * Shared design system for Audio Tools Network
 * Theme: Dark mode, electric green accent, clean and functional
 */

:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-light: #d1fae5;
    --accent: #10b981;
    --bg: #0a0a0a;
    --surface: #111111;
    --surface-raised: #1a1a1a;
    --text: #f0f0f0;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border: #262626;
    --border-focus: #404040;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2rem;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    border-radius: 16px;
    overflow: hidden;
}

/* Header */
.page-header {
    padding: 3rem 3rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    text-align: center;
    position: relative;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
}

.header-content h1,
.header-content .site-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.03em;
}

.tagline {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.header-badges {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
    justify-content: center;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 2rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.header-badge i {
    color: var(--primary);
}

/* Mini Navigation */
.mini-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--surface-raised);
    border-bottom: 1px solid var(--border);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.75rem;
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-right: 1px solid var(--border);
    position: relative;
}

.nav-link:last-child {
    border-right: none;
}

.nav-link:hover {
    background: var(--surface);
    color: var(--primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 80%;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
    transition: transform 0.2s ease;
}

.nav-link:hover::after {
    transform: translateX(-50%) scaleX(1);
}

/* Main Controls */
.main-controls {
    padding: 2rem 3rem;
}

/* Frequency Display */
.frequency-display {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.freq-main {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
}

.freq-value {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.freq-unit {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.freq-note {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Frequency Input Group */
.freq-input-group {
    margin-bottom: 1.5rem;
}

.freq-numeric {
    margin-bottom: 1rem;
}

.freq-numeric label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input-with-buttons {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    justify-content: center;
}

.freq-adjust-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.freq-adjust-btn.small {
    padding: 0.5rem;
    font-size: 0.75rem;
}

.freq-adjust-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--surface);
}

.freq-adjust-btn i {
    font-size: 0.75rem;
}

#frequencyInput {
    width: 120px;
    padding: 0.625rem 1rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
    outline: none;
    transition: border-color 0.2s ease;
}

#frequencyInput:focus {
    border-color: var(--primary);
}

#frequencyInput::-webkit-inner-spin-button,
#frequencyInput::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#frequencyInput[type=number] {
    -moz-appearance: textfield;
}

/* Frequency Slider */
.freq-slider-container {
    padding: 0 1rem;
}

.freq-slider-container input[type="range"] {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    margin: 0.75rem 0;
}

.freq-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.freq-slider-container input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.freq-slider-container input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.status-badge.ready {
    background: var(--surface-raised);
    border-color: var(--border);
    color: var(--text-secondary);
}

.status-badge.ready .status-icon {
    color: var(--text-muted);
}

.status-badge.ready .status-icon::before {
    content: '\2022';
}

.status-badge.playing {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.status-badge.playing .status-icon {
    color: var(--primary);
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.status-badge.playing .status-icon::before {
    content: '\2022';
}

.status-badge.sweeping {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
    color: #3b82f6;
}

.status-badge.sweeping .status-icon {
    color: #3b82f6;
    animation: pulse-dot 0.75s ease-in-out infinite;
}

.status-badge.sweeping .status-icon::before {
    content: '\2022';
}

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

/* Action Buttons */
.action-buttons {
    margin-bottom: 1.5rem;
}

.primary-btn {
    width: 100%;
    background: var(--primary);
    color: #000;
    border: none;
    padding: 1.125rem 2rem;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.primary-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.primary-btn.playing {
    background: #ef4444;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 4px 20px rgba(239, 68, 68, 0.6); }
}

.primary-btn.playing:hover {
    background: #dc2626;
}

/* Visualization Container */
.visualization-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.viz-panel {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

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

.viz-title {
    font-size: 0.6875rem;
    color: #a3a3a3;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#waveformCanvas,
#fftCanvas {
    width: 100%;
    height: 100px;
    display: block;
    background: #000;
    border-radius: 4px;
}

/* Controls */
.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 0 3rem 2rem;
}

.control-group {
    background: var(--surface);
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.control-group.full-width {
    grid-column: 1 / -1;
}

.control-group h3 {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--surface-raised);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group h3::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--primary);
    border-radius: 2px;
}

.control-group label {
    display: block;
    font-weight: 500;
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
    color: var(--text-secondary);
}

.control-group label:first-of-type {
    margin-top: 0;
}

.control-group input[type="range"] {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    margin: 0.5rem 0;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.control-group .value {
    display: block;
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

/* Waveform Buttons */
.waveform-buttons,
.channel-buttons,
.duration-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.waveform-btn,
.channel-btn,
.duration-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.waveform-btn:hover,
.channel-btn:hover,
.duration-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.waveform-btn.active,
.channel-btn.active,
.duration-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
}

/* Sweep Controls */
.sweep-controls {
    padding: 0 3rem 2rem;
}

.sweep-inputs {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
}

.sweep-field {
    flex: 1;
}

.sweep-field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.sweep-field input {
    width: 100%;
    padding: 0.625rem 1rem;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s ease;
}

.sweep-field input:focus {
    border-color: var(--primary);
}

.sweep-arrow {
    padding: 0.625rem;
    color: var(--text-muted);
}

.sweep-arrow i {
    font-size: 1.25rem;
}

.sweep-type-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.sweep-type-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sweep-type-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.sweep-type-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
}

.sweep-actions {
    margin-top: 1.5rem;
}

.sweep-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #3b82f6;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sweep-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.sweep-btn.sweeping {
    background: #ef4444;
}

.sweep-btn.sweeping:hover {
    background: #dc2626;
}

.sweep-progress {
    margin-top: 1rem;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.sweep-progress-bar {
    height: 100%;
    width: 0%;
    background: #3b82f6;
    border-radius: 4px;
    transition: width 0.1s linear;
}

/* Presets Section */
.presets-section {
    padding: 0 3rem 2rem;
}

.preset-category {
    margin-bottom: 1.5rem;
}

.preset-category:last-child {
    margin-bottom: 0;
}

.preset-category h4 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.preset-buttons.notes {
    gap: 0.375rem;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
    padding: 0.75rem 1rem;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.preset-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.preset-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
}

.preset-btn.small {
    padding: 0.5rem 0.75rem;
    flex-direction: row;
    font-size: 0.8125rem;
    font-weight: 600;
}

.preset-freq {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}

.preset-btn:hover .preset-freq,
.preset-btn.active .preset-freq {
    color: inherit;
}

.preset-name {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.preset-btn:hover .preset-name,
.preset-btn.active .preset-name {
    color: inherit;
    opacity: 0.8;
}

/* Content Section */
.content-section {
    padding: 3rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.content-article h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.content-article h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.content-article p {
    font-size: 0.9375rem;
    line-height: 1.75;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.intro-text {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 2rem;
    padding: 1.25rem;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.info-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.info-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-card h4 i {
    font-size: 1.125rem;
}

.info-card p {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.info-card p:last-child {
    margin-bottom: 0;
}

.noise-specs {
    font-size: 0.8125rem !important;
    color: var(--text-muted) !important;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 0.75rem !important;
}

/* Math Block */
.math-block {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1.5rem 0;
    text-align: center;
}

.math-block code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 1.25rem;
    color: var(--primary);
    display: block;
    margin-bottom: 0.5rem;
}

.math-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
}

/* Feature List */
.feature-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.feature-list li {
    padding: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.6;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}

.feature-list li:last-child {
    border-bottom: none;
}

.feature-list li::before {
    content: ">";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.feature-list li strong {
    color: var(--text);
    font-weight: 600;
}

/* Ad Section - Tasteful, minimal ad placement */
.ad-section {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.ad-container {
    text-align: center;
    max-width: 400px;
}

.ad-container [data-ea-publisher] {
    margin: 0 auto;
}

.ad-label {
    font-size: 0.625rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.5rem;
    opacity: 0.6;
}

/* Affiliate disclosure styling */
.affiliate-disclosure {
    font-size: 0.6875rem;
    color: #475569;
    margin-top: 0.5rem;
}

.disclosure-link {
    color: #64748b;
    text-decoration: underline;
}

.disclosure-link:hover {
    color: var(--primary);
}

/* Recommended Gear - Affiliate Links */
.recommended-gear {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin: 2rem 0;
}

.recommended-gear h4 {
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recommended-gear > p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.recommended-gear ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recommended-gear li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.recommended-gear li:last-child {
    border-bottom: none;
}

.recommended-gear a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

.recommended-gear a:hover {
    color: var(--primary);
}

.recommended-gear .gear-note {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    font-style: italic;
}

/* Footer */
.site-footer {
    background: #0f172a;
    color: #e2e8f0;
    padding: 0;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2.5rem;
    padding: 2.5rem 3rem;
    border-bottom: 1px solid #334155;
}

.footer-brand {
    max-width: 320px;
}

.footer-logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    display: block;
    margin-bottom: 0.5rem;
}

.footer-brand p {
    font-size: 0.8125rem;
    color: #94a3b8;
    line-height: 1.6;
}

.footer-links h4,
.footer-related h4 {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #f1f5f9;
    margin-bottom: 0.875rem;
}

.footer-links a,
.footer-related a {
    display: block;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.8125rem;
    padding: 0.375rem 0;
    transition: all 0.2s ease;
}

.footer-links a:hover,
.footer-related a:hover {
    color: var(--primary);
    transform: translateX(4px);
}

.footer-bottom {
    padding: 1.25rem 3rem;
    text-align: center;
}

.footer-bottom p {
    font-size: 0.75rem;
    color: #64748b;
}

.footer-legal {
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    color: #64748b;
}

.footer-legal a {
    color: #94a3b8;
    text-decoration: none;
    margin: 0 0.15rem;
}

.footer-legal a:hover {
    color: #e2e8f0;
    text-decoration: underline;
}

/* ============================================
   SPEAKER TEST SECTION
   ============================================ */

.speaker-test-section,
.hearing-test-section {
    padding: 0 3rem 2rem;
}

.section-intro {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
}

.test-cards,
.hearing-test-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.test-card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.test-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.test-card-header i {
    font-size: 1.5rem;
    color: var(--primary);
}

.test-card-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.test-card > p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.test-tip {
    font-size: 0.8125rem !important;
    color: var(--text-muted) !important;
    background: var(--surface);
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 1rem !important;
    margin-bottom: 0 !important;
}

/* Stereo Test Controls */
.stereo-test-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stereo-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.stereo-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.stereo-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
}

.stereo-indicator {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.channel-indicator {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--surface);
    border: 2px solid var(--border);
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.channel-indicator.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

/* Polarity Test Controls */
.polarity-test-controls {
    display: flex;
    gap: 0.5rem;
}

.polarity-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.polarity-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.polarity-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
}

/* Noise Buttons */
.noise-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.noise-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.noise-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.noise-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
}

.noise-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.noise-icon.pink {
    background: #ec4899;
}

.noise-icon.white {
    background: #fff;
}

.noise-icon.brown {
    background: #92400e;
}

.noise-info {
    padding: 0.75rem;
    background: var(--surface);
    border-radius: 6px;
}

.noise-info p {
    margin: 0 !important;
    font-size: 0.8125rem !important;
}

/* Bass Test Buttons */
.bass-test-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bass-btn {
    padding: 0.625rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bass-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.bass-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
}

/* ============================================
   HEARING TEST SECTION
   ============================================ */

.hearing-disclaimer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.hearing-disclaimer i {
    font-size: 1.25rem;
    color: #fbbf24;
    flex-shrink: 0;
}

.hearing-disclaimer p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.hearing-card {
    background: var(--surface-raised);
}

.tinnitus-card {
    grid-column: 1 / -1;
}

.hearing-age-guide {
    margin-bottom: 1rem;
}

.age-range {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.age-range:last-child {
    border-bottom: none;
}

.age-range span:first-child {
    font-weight: 600;
    color: var(--text);
}

.hearing-test-controls {
    display: flex;
    gap: 0.5rem;
}

.hearing-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: #000;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hearing-btn:hover {
    background: var(--primary-dark);
}

.hearing-btn.secondary {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.hearing-btn.secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.hearing-result {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 8px;
    text-align: center;
}

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

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

.result-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

/* Ear Selector */
.ear-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ear-btn {
    flex: 1;
    padding: 0.625rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ear-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.ear-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
}

/* Audiometric Buttons */
.audiometric-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.audio-freq-btn {
    padding: 0.625rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.audio-freq-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.audio-freq-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
}

/* Tinnitus Controls */
.tinnitus-disclaimer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    margin-bottom: 1rem;
}

.tinnitus-disclaimer i {
    color: #3b82f6;
    flex-shrink: 0;
}

.tinnitus-disclaimer p {
    margin: 0 !important;
    font-size: 0.8125rem !important;
    color: var(--text-secondary);
}

.tinnitus-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.tinnitus-range {
    grid-column: 1 / -1;
}

.tinnitus-range label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.tinnitus-range input[type="range"] {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    margin: 0.5rem 0;
}

.tinnitus-range input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

.tinnitus-freq-display {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 0.5rem;
}

.tinnitus-actions {
    display: flex;
    gap: 0.5rem;
    grid-column: 1 / -1;
}

.tinnitus-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: #000;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tinnitus-btn:hover {
    background: var(--primary-dark);
}

.tinnitus-btn.secondary {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.tinnitus-btn.secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================
   EDUCATIONAL CONTENT ENHANCEMENTS
   ============================================ */

.note-frequency-table {
    margin: 1.5rem 0;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
}

.note-frequency-table h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
}

.note-table {
    display: grid;
    gap: 0.25rem;
}

.note-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.note-row:last-child {
    border-bottom: none;
}

.note-row.header {
    font-weight: 600;
    color: var(--text);
    background: var(--surface);
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
}

.note-row span {
    color: var(--text-secondary);
}

.note-row span:nth-child(odd) {
    font-weight: 600;
    color: var(--primary);
}

.warning-box {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    margin: 1.5rem 0;
}

.warning-box i {
    font-size: 1.5rem;
    color: #ef4444;
    flex-shrink: 0;
}

.warning-box strong {
    display: block;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.warning-box p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.testing-guide {
    display: grid;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.test-guide-item {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
}

.test-guide-item h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.test-guide-item h4 i {
    font-size: 1.125rem;
}

.test-guide-item p {
    margin-bottom: 0.75rem;
}

.test-guide-item ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.test-guide-item ul li {
    padding: 0.375rem 0;
    padding-left: 1.25rem;
    position: relative;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.test-guide-item ul li::before {
    content: ">";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.test-guide-item ul li strong {
    color: var(--text);
}

/* Info cards in educational content */
.info-card ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
}

.info-card ul li {
    padding: 0.25rem 0;
    padding-left: 1rem;
    position: relative;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.info-card ul li::before {
    content: ">";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-size: 0.75rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
        box-shadow: none;
    }

    .page-header {
        padding: 2rem 1.5rem 1.5rem;
    }

    .header-content h1,
.header-content .site-title {
        font-size: 1.75rem;
    }

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

    .nav-link {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0.875rem 1.5rem;
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    .main-controls {
        padding: 1.5rem;
    }

    .freq-value {
        font-size: 2.5rem;
    }

    .input-with-buttons {
        flex-wrap: wrap;
    }

    .visualization-container {
        grid-template-columns: 1fr;
    }

    .controls {
        grid-template-columns: 1fr;
        padding: 0 1.5rem 1.5rem;
    }

    .sweep-controls,
    .presets-section {
        padding: 0 1.5rem 1.5rem;
    }

    .sweep-inputs {
        flex-direction: column;
        align-items: stretch;
    }

    .sweep-arrow {
        display: none;
    }

    .content-section {
        padding: 2rem 1.5rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 2rem 1.5rem;
    }

    .footer-bottom {
        padding: 1rem 1.5rem;
    }

    /* Speaker and Hearing Test responsive */
    .speaker-test-section,
    .hearing-test-section {
        padding: 0 1.5rem 1.5rem;
    }

    .test-cards,
    .hearing-test-cards {
        grid-template-columns: 1fr;
    }

    .tinnitus-card {
        grid-column: 1;
    }

    .stereo-test-controls,
    .polarity-test-controls,
    .noise-buttons {
        flex-direction: column;
    }

    .tinnitus-controls {
        grid-template-columns: 1fr;
    }

    .tinnitus-actions {
        flex-direction: column;
    }

    .note-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .warning-box {
        flex-direction: column;
    }
}

/* ============================================
   NAV DROPDOWN STYLES
   ============================================ */

.nav-dropdown {
    position: relative;
}

.nav-dropdown .dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-dropdown .dropdown-trigger::after {
    display: none;
}

.nav-dropdown .dropdown-arrow {
    font-size: 0.875rem;
    transition: transform 0.2s ease;
}

.nav-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 100;
    overflow: hidden;
}

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

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    border-bottom: 1px solid var(--border);
}

.dropdown-menu a:last-child {
    border-bottom: none;
}

.dropdown-menu a:hover {
    background: var(--surface-raised);
    color: var(--primary);
}

.dropdown-menu a.active {
    color: var(--primary);
    background: var(--surface-raised);
}

.dropdown-menu a i {
    font-size: 1.125rem;
    color: var(--primary);
    opacity: 0.7;
}

.dropdown-menu a:hover i,
.dropdown-menu a.active i {
    opacity: 1;
}

/* ============================================
   RESEARCH/CONTENT PAGE STYLES
   ============================================ */

.research-hero {
    padding: 3rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.research-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
}

.research-hero .subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.7;
}

.research-content {
    padding: 3rem;
}

.research-section {
    margin-bottom: 4rem;
}

.research-section h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary);
    display: inline-block;
}

.research-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.research-section p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.research-section strong {
    color: var(--text);
    font-weight: 600;
}

/* Research Table */
.research-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.research-table th,
.research-table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.research-table th {
    background: var(--surface-raised);
    font-weight: 600;
    color: var(--primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.research-table td {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
}

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

.research-table tr:hover td {
    background: var(--surface-raised);
}

/* Key Findings Box */
.key-findings {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.key-findings h4 {
    color: var(--primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.key-findings ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.key-findings li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.6;
}

.key-findings li::before {
    content: ">";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* Disclaimer Box */
.disclaimer-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin: 2rem 0;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.disclaimer-box i {
    color: #ef4444;
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.disclaimer-box p {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Application Cards Grid */
.application-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.application-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.application-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.application-card h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.application-card h4 i {
    color: var(--primary);
    font-size: 1.25rem;
}

.application-card p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.application-card ul {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0 0;
}

.application-card li {
    padding: 0.375rem 0;
    padding-left: 1.25rem;
    position: relative;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.application-card li::before {
    content: "-";
    position: absolute;
    left: 0;
    color: var(--primary);
}

/* Tradition Card */
.tradition-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    margin: 1.5rem 0;
    transition: all 0.2s ease;
}

.tradition-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.tradition-card h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tradition-card h4 .tradition-icon {
    font-size: 1.5rem;
}

.tradition-card p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.tradition-card p:last-child {
    margin-bottom: 0;
}

/* References */
.references {
    margin-top: 2.5rem;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
}

.reference-list {
    list-style: none;
    counter-reset: reference-counter;
    padding: 0;
    margin: 0;
}

.reference-list li {
    counter-increment: reference-counter;
    position: relative;
    padding-left: 2.5rem;
    margin-bottom: 1rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.reference-list li:last-child {
    margin-bottom: 0;
}

.reference-list li::before {
    content: "[" counter(reference-counter) "]";
    position: absolute;
    left: 0;
    font-weight: 600;
    color: var(--primary);
}

.reference-list li em {
    font-style: italic;
}

/* Cross-links */
.cross-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.cross-link-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.cross-link-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.cross-link-card i {
    font-size: 1.5rem;
    color: var(--primary);
}

.cross-link-card .link-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.25rem 0;
}

.cross-link-card .link-content p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
}

/* ============================================
   FAQ PAGE STYLES
   ============================================ */

.faq-container {
    padding: 3rem;
}

.faq-hero {
    text-align: center;
    margin-bottom: 3rem;
}

.faq-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
}

.faq-hero p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.faq-section {
    margin-bottom: 3rem;
}

.faq-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.2s ease;
}

.faq-item:hover {
    border-color: var(--border-focus);
}

.faq-question {
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: var(--text);
    background: var(--surface-raised);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.faq-question:hover {
    color: var(--primary);
}

.faq-question i {
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

.faq-item.open .faq-question i {
    transform: rotate(180deg);
    color: var(--primary);
}

.faq-answer {
    padding: 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item.open .faq-answer {
    padding: 1.25rem 1.5rem;
    max-height: 1000px;
}

.faq-answer p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

.faq-answer p + p {
    margin-top: 1rem;
}

.faq-answer code {
    background: var(--surface-raised);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.9em;
    color: var(--primary);
}

/* Responsive for Research/FAQ Pages */
@media (max-width: 768px) {
    .research-hero,
    .research-content,
    .faq-container {
        padding: 1.5rem;
    }

    .research-hero h1,
    .faq-hero h1 {
        font-size: 1.75rem;
    }

    .research-table {
        font-size: 0.875rem;
    }

    .research-table th,
    .research-table td {
        padding: 0.75rem;
    }

    .application-grid {
        grid-template-columns: 1fr;
    }

    .cross-links {
        grid-template-columns: 1fr;
    }

    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown .dropdown-trigger {
        width: 100%;
        justify-content: center;
        border-bottom: 1px solid var(--border);
    }

    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border-radius: 0;
        border: none;
        border-top: 1px solid var(--border);
        display: none;
    }

    .nav-dropdown:hover .dropdown-menu,
    .nav-dropdown.active .dropdown-menu {
        display: block;
    }

    .dropdown-menu a {
        justify-content: center;
        background: var(--surface-raised);
    }

    .disclaimer-box {
        flex-direction: column;
    }
}

/* =====================================================
   USE CASE PAGE STYLES (for-speaker-testing, etc.)
   Ported from noise-generator for the Audio Tools Network
   ===================================================== */

.use-case-container {
    padding: 0;
}

.use-case-hero {
    text-align: center;
    padding: 3rem;
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-raised) 100%);
    border-bottom: 1px solid var(--border);
}

.use-case-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.cta-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.cta-button i {
    font-size: 1.25rem;
}

.use-case-section {
    padding: 3rem;
    border-bottom: 1px solid var(--border);
}

.use-case-section:last-of-type {
    border-bottom: none;
}

.use-case-section h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.5rem;
}

.use-case-section p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.use-case-section p strong {
    color: var(--text);
    font-weight: 600;
}

/* Benefit Grid */
.benefit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.benefit-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s ease;
}

.benefit-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.benefit-card i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
    display: block;
}

.benefit-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.benefit-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Tips List */
.tips-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0 0;
}

.tips-list li {
    padding: 0.875rem 0;
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.7;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.tips-list li:last-child {
    border-bottom: none;
}

.tips-list li::before {
    content: ">";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.tips-list li strong {
    color: var(--text);
    font-weight: 600;
}

/* CTA Section */
.cta-section {
    text-align: center;
    padding: 3rem;
    background: var(--surface-raised);
    border-top: 1px solid var(--border);
}

.cta-section h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.cta-section p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Responsive for use-case pages */
@media (max-width: 768px) {
    .use-case-hero {
        padding: 2rem 1.5rem;
    }

    .use-case-hero h1 {
        font-size: 1.75rem;
    }

    .use-case-section {
        padding: 2rem 1.5rem;
    }

    .benefit-grid {
        grid-template-columns: 1fr;
    }

    .cta-section {
        padding: 2rem 1.5rem;
    }
}

/* ============================================
   ENGAGEMENT: Share bar + Network tools grid
   ============================================ */
.share-bar{display:flex;align-items:center;flex-wrap:wrap;gap:.5rem;margin:1.5rem 0;}
.share-label{font-size:.8125rem;font-weight:600;color:var(--text-secondary);margin-right:.25rem;}
.share-btn{display:inline-flex;align-items:center;gap:.4rem;padding:.45rem .8rem;font-size:.8125rem;font-weight:600;
  color:var(--text-secondary);background:var(--surface-raised,#1a1a1a);border:1px solid var(--border,#262626);
  border-radius:8px;text-decoration:none;cursor:pointer;transition:all .15s ease;}
.share-btn:hover{color:var(--primary);border-color:var(--primary);}
.network-tools{margin:3rem 0 1rem;}
.network-tools h2{font-size:1.25rem;margin-bottom:1rem;}
.network-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:1rem;}
.network-card{display:flex;flex-direction:column;gap:.25rem;padding:1rem;background:var(--surface-raised,#1a1a1a);
  border:1px solid var(--border,#262626);border-radius:12px;text-decoration:none;transition:all .15s ease;}
.network-card:hover{border-color:var(--primary);transform:translateY(-2px);}
.network-card i{color:var(--primary);font-size:1.4rem;}
.nt-name{font-weight:700;color:var(--text);}
.nt-blurb{font-size:.8125rem;color:var(--text-secondary);}


/* === DESIGN SYSTEM V2 === */
/* ============================================================
   Audio Tools Network — Design System v2
   SITE: TestTones — "The Signal Bench"
   Mood: precise, trustworthy, instrument-grade, calm.
   Aesthetic: dark scope-graticule bench, electric-cyan phosphor
   trace on deep steel-navy, amber as the warning/precision accent.
   Strategy: (1) per-site PALETTE via token overrides = identity;
   (2) shared ELEVATION layer = world-class bar.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=JetBrains+Mono:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

/* ---- TestTones palette: electric cyan signal on steel-navy ---- */
:root {
  --primary: #22D3EE;
  --primary-dark: #0E9BB8;
  --primary-light: #CDF7FF;
  --accent: #FFB020;
  --bg: #0A0F1A;
  --surface: #121A2A;
  --surface-raised: #16213450;
  --text: #ECF4FB;
  --text-secondary: #9DB0C7;
  --text-muted: #66798F;
  --border: #1E2B40;
  --border-focus: #2C405E;
  --grad: linear-gradient(120deg, #22D3EE 0%, #5BE8F2 45%, #7DF0C8 110%);
  --grad-amber: linear-gradient(120deg, #FFB020 0%, #FFCB5C 100%);
  --glow: 0 0 0 1px rgba(34,211,238,.16), 0 18px 50px -14px rgba(34,211,238,.40);
  --shadow-lg: 0 26px 64px -20px rgba(0,0,0,.85), 0 8px 24px -12px rgba(0,0,0,.7);
}

/* ---- Ambient background: scope-bench depth, not flat black ---- */
body {
  background:
    radial-gradient(1100px 640px at 16% -10%, rgba(34,211,238,.16), transparent 60%),
    radial-gradient(940px 560px at 94% 4%, rgba(20,48,70,.55), transparent 58%),
    radial-gradient(820px 600px at 50% 122%, rgba(255,176,32,.07), transparent 60%),
    linear-gradient(135deg, #0A0F1A 0%, #0E1726 55%, #143046 100%) !important;
  background-attachment: fixed;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

/* faint graticule grid overlay — the bench reads as an instrument */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(34,211,238,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,211,238,.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(1200px 800px at 50% 30%, #000 0%, transparent 80%);
  -webkit-mask-image: radial-gradient(1200px 800px at 50% 30%, #000 0%, transparent 80%);
}
.container { position: relative; z-index: 1; }

/* ---- Container: glassy hairline panel with cyan lift ---- */
.container {
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 22px;
  box-shadow: var(--shadow-lg), var(--glow);
  background:
    linear-gradient(180deg, rgba(34,211,238,.035), rgba(255,255,255,0) 260px),
    var(--surface);
}

/* ---- Hero: display wordmark + scope-readout tagline ---- */
.page-header {
  padding: 3.5rem 3rem 2.25rem;
  background:
    radial-gradient(700px 220px at 50% -40%, rgba(34,211,238,.10), transparent 70%),
    var(--surface);
}
.header-content h1,
.header-content .site-title {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: clamp(2.6rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.02;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline {
  font-size: 1.075rem;
  color: var(--text-secondary);
  max-width: 56ch; margin: 0.85rem auto 0; line-height: 1.55;
}
.page-header::after { height: 3px; background: var(--grad); opacity: .9; }

/* ---- Badges: refined glass pills ---- */
.header-badge {
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 2rem; backdrop-filter: blur(6px);
  color: var(--text-secondary);
  transition: transform .2s ease, border-color .2s ease;
}
.header-badge:hover { transform: translateY(-1px); border-color: rgba(34,211,238,.45); }
.header-badge i { color: var(--accent); }

/* ---- Nav: animated active underline ---- */
.mini-nav { background: rgba(8,13,22,.5); }
.nav-link { transition: color .2s ease, background .2s ease; }
.nav-link::after {
  content: ''; position: absolute; left: 1.25rem; right: 1.25rem; bottom: 0;
  height: 2px; background: var(--grad); transform: scaleX(0); transform-origin: left;
  transition: transform .22s ease;
}
.nav-link:hover { color: var(--text); background: rgba(34,211,238,.07); }
.nav-link:hover::after { transform: scaleX(1); }

/* ---- The Hz readout: JetBrains Mono, phosphor-glow numerals ---- */
input[type="number"],
.frequency-display, .freq-display, .freq-value, .frequency-value,
.value-display, output, .readout {
  font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.frequency-display, .freq-display, .freq-value, .frequency-value {
  color: var(--primary-light) !important;
  text-shadow: 0 0 16px rgba(34,211,238,.40), 0 0 2px rgba(34,211,238,.55);
}

/* scope / waveform canvases read as instrument screens, not dead black */
canvas {
  border-radius: 12px !important;
  background:
    linear-gradient(180deg, rgba(34,211,238,.05), rgba(8,13,22,0)) ,
    rgba(8,13,22,.6) !important;
  box-shadow: inset 0 0 0 1px rgba(34,211,238,.12), inset 0 0 40px rgba(34,211,238,.04) !important;
}

/* ---- Primary actions: gradient pill with glow + lift ---- */
button.btn-primary, .btn-primary, .play-btn, .play-button, button[class*="play"],
.generate-btn, .primary-btn, .btn--primary {
  background: var(--grad) !important;
  border: none !important; color: #04222A !important; font-weight: 700 !important;
  border-radius: 999px !important;
  box-shadow: 0 10px 30px -8px rgba(34,211,238,.55), inset 0 1px 0 rgba(255,255,255,.4) !important;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease !important;
}
button.btn-primary:hover, .btn-primary:hover, .play-btn:hover, .play-button:hover,
button[class*="play"]:hover, .generate-btn:hover, .primary-btn:hover, .btn--primary:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 16px 42px -8px rgba(34,211,238,.7), inset 0 1px 0 rgba(255,255,255,.5) !important;
  filter: saturate(1.08) !important;
}

/* stop / panic actions carry the amber warning language */
.stop-btn, .stop-button, button[class*="stop"], .panic, .panic-stop {
  border-radius: 999px !important;
  border: 1px solid rgba(255,176,32,.4) !important;
  color: var(--accent) !important;
}

/* ---- Inputs / sliders / cards: tighten to the system ---- */
input, select, textarea {
  border-radius: 12px !important;
  border: 1px solid var(--border) !important;
  background: rgba(8,13,22,.55) !important;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(34,211,238,.5) !important;
  box-shadow: 0 0 0 3px rgba(34,211,238,.14) !important;
  outline: none !important;
}
input[type="range"] { accent-color: var(--primary); }
.preset-btn, .card, .panel, .tool-card, .feature-card, .network-card {
  border-radius: 16px !important;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.preset-btn:hover {
  border-color: rgba(34,211,238,.45) !important;
  color: var(--primary-light) !important;
}
.network-card:hover, .tool-card:hover, .card:hover, .feature-card:hover {
  transform: translateY(-3px);
  border-color: rgba(34,211,238,.4);
  box-shadow: 0 16px 36px -16px rgba(34,211,238,.5);
}

/* ---- Section accents ---- */
h2 { letter-spacing: -0.02em; }
a { color: var(--primary-light); }
::selection { background: rgba(34,211,238,.4); color: #04222A; }


/* === FOLD FIX + FLOATING PLAY === */
/* ============================================================
   FOLD FIX — bring the tool's primary control above the fold.
   Compacts the hero + collapses the mini-nav into one scroll row.
   Appended after DESIGN SYSTEM V2. CSS-only, fleet-wide.
   ============================================================ */

/* --- Desktop: gently tighten the top so the tool sits higher --- */
body { padding-top: 1rem; padding-bottom: 1rem; }
.page-header { padding: 2rem 3rem 1.5rem !important; }
.header-content h1,
.header-content .site-title { font-size: clamp(2.1rem, 4vw, 2.9rem) !important; }
.tagline { font-size: 1rem !important; margin-top: 0.6rem !important; }
.header-badges { margin-top: 0.85rem !important; }

/* mini-nav: never let it grow tall; keep it one tidy row */
.mini-nav { flex-wrap: nowrap !important; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.mini-nav::-webkit-scrollbar { display: none; }
.nav-link { padding-top: 0.8rem !important; padding-bottom: 0.8rem !important; white-space: nowrap; }

/* --- Mobile: aggressive compaction (the real problem) --- */
@media (max-width: 640px) {
  body { padding: 0.5rem !important; }
  .page-header { padding: 1.25rem 1rem 1rem !important; }
  .header-content h1,
  .header-content .site-title { font-size: clamp(1.9rem, 8vw, 2.3rem) !important; line-height: 1.05 !important; }
  .tagline {
    font-size: 0.9rem !important; line-height: 1.4 !important; margin-top: 0.5rem !important;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  /* badges are decorative — drop them above the fold on phones */
  .header-badges { display: none !important; }

  /* mini-nav: the big win — collapse the 6-row vertical stack into ONE horizontal scroll strip */
  .mini-nav {
    flex-direction: row !important; flex-wrap: nowrap !important;
    justify-content: flex-start !important; align-items: stretch !important;
  }
  .nav-link {
    flex: 0 0 auto !important; width: auto !important;
    padding: 0.7rem 1rem !important; font-size: 0.8125rem !important;
    border-right: 1px solid var(--border) !important; border-bottom: none !important;
  }
  .nav-dropdown { flex: 0 0 auto !important; }
  .nav-dropdown .dropdown-trigger { width: auto !important; }

  /* lift the tool: trim the first section's top padding so Play rises */
  .page-header::after { height: 2px !important; }
  main > section:first-of-type,
  .tool, .tool-section, .generator, .generator-section,
  #generator, #tool, .controls-section { padding-top: 1rem !important; margin-top: 0 !important; }
}

/* === FLOATING PLAY (always-available primary control) === */
#floating-play{
  position:fixed; left:50%; bottom:20px; transform:translateX(-50%) translateY(140%);
  z-index:9999; display:inline-flex; align-items:center; gap:.55rem;
  padding:.85rem 1.7rem; border:none; border-radius:999px; cursor:pointer;
  font:700 1rem/1 'Inter',-apple-system,sans-serif; color:#140a1e;
  background:var(--grad, var(--primary));
  box-shadow:0 14px 34px -8px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.4);
  opacity:0; pointer-events:none;
  transition:transform .3s cubic-bezier(.2,.8,.2,1), opacity .3s, filter .15s;
}
#floating-play.visible{ transform:translateX(-50%) translateY(0); opacity:1; pointer-events:auto; }
#floating-play:hover{ filter:saturate(1.1) brightness(1.06); }
#floating-play:active{ transform:translateX(-50%) translateY(1px); }
#floating-play .fp-icon{ font-size:1.05em; line-height:1; }
#floating-play.is-playing{ background:#23232b; color:#fff; box-shadow:0 14px 34px -8px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.14); }
@media (max-width:640px){ #floating-play{ bottom:16px; padding:.8rem 1.5rem; } }
@media (prefers-reduced-motion: reduce){ #floating-play{ transition:opacity .2s; } }
