* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #0097A7;
    --secondary: #FF5722;
    --dark: #006978;
    --light: #B2EBF2;
    --text: #212121;
    --background: #f5f5f5;
    --success: #4CAF50;
    --warning: #FFC107;
    --danger: #F44336;
    
    /* Enhanced font sizes for better readability */
    --font-xs: 0.8rem;
    --font-sm: 0.95rem;
    --font-base: 1.1rem;
    --font-lg: 1.3rem;
    --font-xl: 1.5rem;
    --font-2xl: 1.8rem;
    --font-3xl: 2.2rem;
    --font-4xl: 2.8rem;
    
    /* Spacing variables */
    --space-xs: 0.75rem;
    --space-sm: 1.25rem;
    --space-md: 1.75rem;
    --space-lg: 2.5rem;
    --space-xl: 3.5rem;
    --space-2xl: 5rem;
}

/* Enhanced Device Indicator */
.device-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: var(--font-xs);
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}

body {
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    font-size: var(--font-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ==================== */
/* ENHANCED HEADER STYLES */
/* ==================== */

header {
    background: linear-gradient(135deg, var(--primary), var(--dark));
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.header-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
    z-index: 2;
}

/* Enhanced Logo Header */
.logo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-img {
    width: 70px;
    height: 70px;
    border-radius: 12px;
    object-fit: contain;
    background: linear-gradient(135deg, var(--primary), var(--dark));
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    animation: logoPulse 4s ease-in-out infinite;
}

.logo:hover .logo-img {
    transform: scale(1.1) rotate(5deg);
}

@keyframes logoPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    text-align: left;
}

.logo-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.logo-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    margin-top: 0.2rem;
}

/* Enhanced Header Tagline */
.header-tagline {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.header-tagline:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.header-tagline i {
    color: #FFD54F;
    font-size: 1.1rem;
}

.header-tagline span {
    color: white;
    font-weight: 500;
}

/* Enhanced Main Title */
h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Enhanced Intro Text */
.intro {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    line-height: 1.6;
    opacity: 0.95;
    font-weight: 300;
}

/* ==================== */
/* CONTENT SECTIONS */
/* ==================== */

/* Section Header with TTS Button */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.tts-section-btn {
    background: linear-gradient(135deg, var(--primary), var(--dark));
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: var(--font-sm);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.tts-section-btn:hover {
    background: linear-gradient(135deg, var(--dark), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tts-section-btn.playing {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    animation: pulse 2s infinite;
}

.tts-section-btn.stop-btn {
    background: linear-gradient(135deg, #F44336, #D32F2F);
}

.tts-section-btn.stop-btn:hover {
    background: linear-gradient(135deg, #D32F2F, #C62828);
}

/* TTS Controls */
.tts-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ==================== */
/* PROJECT OVERVIEW WITH PROPER JUSTIFICATION */
/* ==================== */

.project-overview {
    background-color: white;
    padding: var(--space-lg);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.overview-content {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
}

.overview-text {
    flex: 1;
    min-width: 300px;
}

.overview-text p {
    text-align: justify;
    text-justify: inter-word;
    line-height: 1.6;
    margin-bottom: var(--space-sm);
    font-size: var(--font-base);
    word-spacing: -0.05em;
    letter-spacing: 0.01em;
    hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    -ms-hyphens: auto;
}

.overview-image {
    flex: 1;
    min-width: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm);
}

.overview-image img {
    max-width: 100%;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 4px solid var(--light);
    transition: all 0.4s ease;
}

.overview-image img:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    border-color: var(--primary);
}

/* Components Section */
.components {
    background-color: white;
    padding: var(--space-lg);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.component-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.component-card {
    background-color: var(--light);
    padding: var(--space-md);
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.component-card:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.component-card i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: var(--space-sm);
    transition: transform 0.2s ease, color 0.2s ease;
}

.component-card:hover i {
    transform: scale(1.2);
    color: var(--dark);
}

/* Specifications Table */
.specifications {
    background-color: white;
    padding: var(--space-lg);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.specs-table-container {
    overflow-x: auto;
    margin-top: var(--space-md);
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    font-size: var(--font-base);
}

th, td {
    padding: var(--space-sm);
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

tr:hover {
    background-color: var(--light);
    transition: background-color 0.3s ease;
}

/* Gallery */
.gallery {
    background-color: white;
    padding: var(--space-lg);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.gallery-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.gallery-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover .gallery-img {
    transform: scale(1.1);
}

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    padding: var(--space-sm);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    transform: translateY(0);
}

/* How It Works */
.how-it-works {
    background-color: white;
    padding: var(--space-lg);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

h2 {
    font-size: 1.75rem;
    margin-bottom: 1.25rem;
    color: var(--primary);
    border-bottom: 2px solid var(--light);
    padding-bottom: var(--space-xs);
    letter-spacing: -0.01em;
}

h3 {
    font-size: var(--font-2xl);
    margin: var(--space-md) 0 var(--space-sm);
    color: var(--dark);
}

h4 {
    font-size: var(--font-lg);
    margin: var(--space-sm) 0 var(--space-xs);
    color: var(--dark);
}

p {
    margin-bottom: var(--space-sm);
    font-size: var(--font-base);
    line-height: 1.6;
}

.steps {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.step {
    flex: 1;
    min-width: 250px;
    background-color: white;
    padding: var(--space-md);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.step:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.step-number {
    display: inline-block;
    width: 40px;
    height: 40px;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    line-height: 40px;
    margin-bottom: var(--space-sm);
    font-weight: bold;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.step:hover .step-number {
    transform: scale(1.2);
    background-color: var(--dark);
}

/* Simulation Section */
.simulation {
    background-color: white;
    padding: var(--space-lg);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    text-align: center;
}

.calibration-status {
    background-color: var(--light);
    padding: var(--space-md);
    border-radius: 8px;
    margin-bottom: var(--space-lg);
    text-align: left;
}

.status-indicator, .baseline-readings {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.baseline-item {
    display: flex;
    justify-content: space-between;
    flex: 1;
    min-width: 200px;
}

.noise-meter-container {
    max-width: 600px;
    margin: 0 auto var(--space-lg);
}

.noise-meter {
    width: 100%;
    height: 50px;
    background: linear-gradient(to right, var(--success), var(--warning), var(--danger));
    border-radius: 25px;
    margin: var(--space-lg) auto;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255,255,255,0.1);
}

.noise-level {
    position: absolute;
    height: 100%;
    width: 30%;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 25px;
    transition: width 0.5s ease, background-color 0.5s ease;
    border: 2px solid rgba(255, 255, 255, 0.6);
    will-change: transform;
}

.threshold-marker {
    position: absolute;
    height: 100%;
    width: 3px;
    background-color: rgba(0, 0, 0, 0.8);
    border-radius: 2px;
    transition: left 0.5s ease;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    will-change: transform;
}

.noise-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: var(--font-sm);
    color: var(--text);
    font-weight: 600;
}

.simulation-controls {
    margin-top: var(--space-md);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.sim-btn {
    background: linear-gradient(135deg, var(--primary), var(--dark));
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: var(--font-base);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex: 1;
    min-width: 160px;
    max-width: 220px;
    justify-content: center;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.sim-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.sim-btn:hover::before {
    left: 100%;
}

.sim-btn:hover {
    background: linear-gradient(135deg, var(--dark), var(--primary));
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.sim-btn:active {
    transform: translateY(0);
}

.sim-btn.secondary {
    background-color: #6c757d;
}

.sim-btn.secondary:hover {
    background-color: #5a6268;
}

.btn-text {
    font-size: var(--font-base);
}

.simulation-feedback {
    margin-top: var(--space-lg);
}

.lcd-display {
    background-color: #2E7D32;
    color: #E8F5E9;
    padding: 1.5rem;
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    margin: var(--space-sm) auto;
    max-width: 350px;
    text-align: left;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.6);
    border: 3px solid #1B5E20;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    line-height: 1.4;
}

.lcd-line-1, .lcd-line-2 {
    margin: var(--space-xs) 0;
}

.alert-message {
    margin-top: var(--space-md);
    padding: var(--space-sm);
    border-radius: 5px;
    background-color: #FFEBEE;
    color: #C62828;
    display: none;
    animation: pulse 2s infinite;
    border-left: 4px solid var(--danger);
    font-size: var(--font-base);
}

.alert-message.playing {
    background: linear-gradient(135deg, #FFF3E0, #FFECB3);
    color: #E65100;
    border-left-color: #FF9800;
    animation: pulse 1.5s infinite, glow 2s infinite alternate;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px rgba(255, 152, 0, 0.3);
    }
    to {
        box-shadow: 0 0 15px rgba(255, 152, 0, 0.6);
    }
}

/* Audio Status Indicator */
.audio-status {
    background-color: #E8F5E9;
    color: #2E7D32;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    border-left: 4px solid #4CAF50;
    font-weight: 600;
    transition: all 0.3s ease;
}

.audio-status.playing {
    background-color: #FFF3E0;
    color: #EF6C00;
    border-left-color: #FF9800;
    animation: pulse 1.5s infinite;
}

.audio-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.audio-status.loading {
    background-color: #E3F2FD;
    color: #1976D2;
    border-left-color: #2196F3;
}

.audio-status.ready {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Enhanced Audio Help Message */
.audio-help-message {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    color: #856404;
    font-size: 1rem;
    animation: slideDown 0.4s ease-out;
    border-left: 6px solid #ffc107;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    line-height: 1.5;
}

.audio-help-message strong {
    color: #664d03;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== */
/* FIXED TROUBLESHOOTING CARDS */
/* ==================== */

.troubleshooting {
    background-color: white;
    padding: var(--space-lg);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.troubleshooting-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.issue-card {
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.issue-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.issue-header {
    background-color: var(--primary);
    color: white;
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: 80px;
}

.issue-header i {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.issue-header h3 {
    color: white;
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.3;
}

.issue-content {
    padding: var(--space-md);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.issue-content h4 {
    font-size: var(--font-lg);
    margin: var(--space-sm) 0 var(--space-xs);
    color: var(--dark);
    font-weight: 600;
}

.issue-content ul, .issue-content ol {
    margin-left: var(--space-md);
    margin-bottom: var(--space-sm);
    flex-grow: 1;
}

.issue-content li {
    margin-bottom: var(--space-xs);
    font-size: var(--font-base);
    line-height: 1.4;
}

/* Ensure all issue cards have consistent header height */
.issue-card:nth-child(1) .issue-header {
    background-color: var(--primary);
}

.issue-card:nth-child(2) .issue-header {
    background-color: var(--primary);
}

.issue-card:nth-child(3) .issue-header {
    background-color: var(--primary);
}

.issue-card:nth-child(4) .issue-header {
    background-color: var(--primary);
}

/* Code Snippet */
.code-snippet {
    background-color: #263238;
    color: #EEFFFF;
    padding: var(--space-lg);
    border-radius: 8px;
    margin: var(--space-md) 0;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.code-container {
    overflow-x: auto;
}

.code-snippet pre {
    margin: 0;
    font-size: var(--font-sm);
    line-height: 1.4;
}

.code-snippet code {
    font-family: 'Courier New', monospace;
}

/* Active section highlighting */
.section-highlight {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 165, 0, 0.1)) !important;
    border: 2px solid #FFD700 !important;
    transform: scale(1.02);
}

/* ==================== */
/* UPDATED FOOTER STYLES */
/* ==================== */

footer {
    background-color: var(--dark);
    color: white;
    padding: 2rem 0 1rem;
    margin-top: 3rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.footer-logo {
    flex: 0 0 auto;
}

.footer-logo .logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-logo .logo-img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
}

.footer-logo .logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.footer-logo .logo-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
}

.footer-logo .logo-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.footer-info-right {
    flex: 1;
    min-width: 300px;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
}

.footer-text {
    text-align: right;
}

.footer-text p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.footer-links a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.footer-links i {
    font-size: 1rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    margin: 0;
}

/* ==================== */
/* ENHANCED RESPONSIVE BREAKPOINTS */
/* ==================== */

/* Tablets */
@media (max-width: 768px) {
    header {
        padding: 1.5rem 0;
    }
    
    .logo-header {
        margin-bottom: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .logo {
        justify-content: center;
    }
    
    .header-tagline {
        margin-top: 0.5rem;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    h1 {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .intro {
        font-size: 1.1rem;
        line-height: 1.5;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    .tts-section-btn {
        align-self: flex-start;
    }
    
    .overview-content {
        flex-direction: column;
    }
    
    .footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1.5rem;
    }
    
    .footer-info-right {
        text-align: center;
        min-width: 100%;
        align-items: center;
    }
    
    .footer-text {
        text-align: center;
    }
    
    .footer-logo .logo {
        justify-content: center;
    }
    
    .footer-links {
        justify-content: center;
        gap: 1rem;
    }
    
    .footer-links a {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .logo-title {
        font-size: 1.5rem;
    }
    
    .logo-img {
        width: 60px;
        height: 60px;
    }
    
    .audio-controls {
        flex-direction: row;
    }
    
    .audio-controls .sim-btn {
        width: auto;
    }
    
    .sim-btn {
        min-height: 50px;
    }

    /* Troubleshooting responsive */
    .troubleshooting-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    
    .issue-header {
        min-height: 70px;
        padding: var(--space-sm);
    }
    
    .issue-header h3 {
        font-size: 1.1rem;
    }
    
    .issue-content {
        padding: var(--space-sm);
    }
}

/* Mobile Phones */
@media (max-width: 480px) {
    header {
        padding: 1.25rem 0;
    }
    
    .logo-header {
        margin-bottom: 0.75rem;
        gap: 0.75rem;
    }
    
    .logo {
        flex-direction: row;
        gap: 0.8rem;
        padding: 0.4rem;
    }
    
    .logo-img {
        width: 55px;
        height: 55px;
    }
    
    .logo-text {
        line-height: 1.1;
    }
    
    .logo-title {
        font-size: 1.4rem;
    }
    
    .logo-subtitle {
        font-size: 0.9rem;
        margin-top: 0.1rem;
    }
    
    .header-tagline {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
        gap: 0.4rem;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }
    
    .intro {
        font-size: 1rem;
        line-height: 1.4;
    }
    
    .container {
        padding: 1rem;
    }
    
    .tts-section-btn {
        padding: 0.4rem 0.8rem;
        font-size: var(--font-xs);
    }
    
    .audio-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .audio-controls .sim-btn {
        width: 200px;
    }
    
    .simulation-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sim-btn {
        min-width: auto;
        max-width: none;
        justify-content: center;
        padding: 1rem 1.5rem;
    }
    
    .btn-text {
        font-size: var(--font-base);
        display: inline !important;
    }

    /* Project Overview mobile fixes */
    .overview-text p {
        text-align: justify !important;
        text-align-last: left;
        text-justify: inter-word;
        line-height: 1.5;
        font-size: var(--font-sm);
        word-spacing: -0.03em;
        letter-spacing: 0.005em;
    }
    
    .overview-content {
        flex-direction: column;
        gap: var(--space-md);
    }
    
    .overview-text, .overview-image {
        min-width: 100%;
    }
    
    .overview-image img {
        width: 100%;
        max-width: 100%;
        border-radius: 10px;
    }

    /* Footer mobile */
    footer {
        padding: 1.5rem 0 0.5rem;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .footer-links a {
        justify-content: center;
        width: 200px;
        margin: 0 auto;
    }
    
    .footer-logo .logo-img {
        width: 45px;
        height: 45px;
    }
    
    .footer-logo .logo-title {
        font-size: 1.2rem;
    }
    
    .footer-logo .logo-subtitle {
        font-size: 0.8rem;
    }

    /* Troubleshooting mobile */
    .issue-header {
        min-height: 60px;
        padding: 0.75rem;
    }
    
    .issue-header h3 {
        font-size: 1rem;
    }
    
    .issue-header i {
        font-size: 1.3rem;
    }
    
    .issue-content {
        padding: 0.75rem;
    }
    
    .issue-content h4 {
        font-size: var(--font-base);
    }
    
    .issue-content li {
        font-size: var(--font-sm);
    }
}

/* Very Small Phones (360px and below) */
@media (max-width: 360px) {
    .logo {
        flex-direction: row;
        gap: 0.6rem;
    }
    
    .logo-img {
        width: 50px;
        height: 50px;
    }
    
    .logo-title {
        font-size: 1.3rem;
    }
    
    .logo-subtitle {
        font-size: 0.8rem;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    .intro {
        font-size: 0.95rem;
    }
    
    .sim-btn .btn-text {
        font-size: var(--font-sm);
    }
    
    .device-indicator {
        font-size: 0.7rem;
        padding: 6px 10px;
    }
    
    .component-card {
        min-height: 180px;
        padding: var(--space-sm);
    }

    /* Project Overview for very small phones with proper justification */
    .overview-text p {
        text-align: justify !important;
        text-align-last: left;
        text-justify: inter-word;
        line-height: 1.4;
        font-size: 0.9rem;
        word-spacing: -0.02em;
        letter-spacing: 0.002em;
        hyphens: auto;
        -webkit-hyphens: auto;
        -moz-hyphens: auto;
        -ms-hyphens: auto;
        margin-bottom: 1rem;
    }
    
    .project-overview {
        padding: var(--space-md);
    }
    
    .overview-content {
        gap: var(--space-sm);
    }
    
    .overview-text {
        padding: 0;
    }
    
    /* Improve word breaking for better justification */
    .overview-text {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Section header for small screens */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    .tts-controls {
        align-self: stretch;
    }
    
    .tts-section-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Additional optimization for better text rendering */
.overview-text {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Enhanced button states for better feedback */
.sim-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.sim-btn.loading {
    background-color: #6c757d;
    cursor: wait;
}

.sim-btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced performance with will-change */
.component-card, .logo-img, .noise-level, .threshold-marker {
    will-change: transform;
}

/* Enhanced noise meter animations */
.noise-meter.alert {
    animation: meterPulse 1s infinite;
}

@keyframes meterPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Enhanced focus styles for accessibility */
.sim-btn:focus, .component-card:focus {
    outline: 3px solid var(--secondary);
    outline-offset: 2px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Animation for TTS */
@keyframes ttsPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
}

.tts-section-btn.playing {
    animation: ttsPulse 2s infinite;
}

/* Additional responsive breakpoints for other screen sizes */
@media (min-width: 992px) and (max-width: 1199px) {
    :root {
        --font-base: 1.05rem;
        --font-lg: 1.2rem;
        --font-xl: 1.4rem;
        --font-2xl: 1.6rem;
        --font-3xl: 2rem;
        --font-4xl: 2.4rem;
    }
    
    .component-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    :root {
        --font-base: 1rem;
        --font-lg: 1.1rem;
        --font-xl: 1.3rem;
        --font-2xl: 1.5rem;
        --font-3xl: 1.8rem;
        --font-4xl: 2.1rem;
    }
    
    h1 {
        font-size: var(--font-3xl);
    }
    
    .project-overview {
        flex-direction: column;
    }
    
    .component-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .steps {
        flex-direction: column;
    }
    
    .simulation-controls {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .sim-btn {
        min-width: 140px;
    }
    
    .btn-text {
        font-size: var(--font-sm);
    }
}

@media (min-width: 576px) and (max-width: 767px) {
    :root {
        --font-base: 0.95rem;
        --font-sm: 0.9rem;
        --font-lg: 1.05rem;
        --font-xl: 1.1rem;
        --font-2xl: 1.3rem;
        --font-3xl: 1.5rem;
        --font-4xl: 1.7rem;
    }
    
    .container {
        padding: var(--space-sm);
    }
    
    h1 {
        font-size: var(--font-3xl);
    }
    
    h2 {
        font-size: var(--font-2xl);
    }
    
    .project-overview, .steps {
        flex-direction: column;
    }
    
    .component-grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .simulation-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .sim-btn {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }
    
    .btn-text {
        font-size: var(--font-base);
    }
    
    .specs-table {
        font-size: var(--font-sm);
    }
    
    th, td {
        padding: var(--space-xs);
    }
}

@media (max-width: 575px) {
    :root {
        --font-base: 0.9rem;
        --font-sm: 0.85rem;
        --font-lg: 1rem;
        --font-xl: 1.05rem;
        --font-2xl: 1.2rem;
        --font-3xl: 1.4rem;
        --font-4xl: 1.6rem;
    }
    
    .container {
        padding: var(--space-xs);
    }
    
    .component-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    
    .component-card {
        padding: var(--space-sm);
        min-height: 170px;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .simulation-controls {
        flex-direction: column;
        gap: var(--space-xs);
    }
    
    .sim-btn {
        width: 100%;
        padding: var(--space-sm);
        font-size: var(--font-sm);
        min-height: 45px;
    }
    
    .btn-text {
        font-size: var(--font-sm);
    }
    
    .specs-table {
        font-size: var(--font-xs);
    }
    
    th, td {
        padding: var(--space-xs);
        font-size: var(--font-xs);
    }
    
    .calibration-status, .baseline-readings {
        flex-direction: column;
        gap: var(--space-xs);
    }
    
    .lcd-display {
        font-size: var(--font-sm);
        padding: var(--space-sm);
    }
    
    .code-snippet {
        padding: var(--space-sm);
    }
    
    .code-snippet pre {
        font-size: var(--font-xs);
    }
    
    .audio-controls {
        flex-direction: column;
        gap: var(--space-xs);
    }
    
    .audio-controls .sim-btn {
        width: 100%;
        max-width: 250px;
    }
}
