:root {
    /* Dark Theme (default) */
    --background-dark: #2B2E3B;
    --background-darker: #252830;
    --card-background: #343845;
    --accent-blue: #688db1;
    --accent-green: #9cb68f;
    --accent-red: #e16162;
    --text-primary: #d1d5db;
    --text-secondary: #9ca3af;
    
    /* Shadow Variables */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    
    /* Spacing Variables */
    --spacing-1: 0.25rem;
    --spacing-2: 0.5rem;
    --spacing-3: 0.75rem;
    --spacing-4: 1rem;
    --spacing-6: 1.5rem;
    --spacing-8: 2rem;
    --spacing-12: 3rem;
    --spacing-16: 4rem;
    
    /* Radius Variables */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* Light Theme */
[data-theme="light"] {
    --background-dark: #f8fafc;
    --background-darker: #f1f5f9;
    --card-background: #ffffff;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    
    /* Light theme shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.15);
}

/* Light theme specific overrides */
[data-theme="light"] .action-btn,
[data-theme="light"] .viz-toggle {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .action-btn:hover,
[data-theme="light"] .viz-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .export-option,
[data-theme="light"] .history-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .export-option:hover,
[data-theme="light"] .history-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .transcript {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] #audioCanvas {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .volume-bar {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .container {
    border: 1px solid rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Theme transition */
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
                 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
                 sans-serif;
    background: var(--background-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-8);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    width: 100%;
    background: var(--card-background);
    border-radius: var(--radius-xl);
    padding: var(--spacing-12);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.container:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
}

@media (hover: none) {
    .container:hover {
        transform: none;
    }
}

h1 {
    text-align: center;
    margin-bottom: var(--spacing-8);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--accent-blue);
    border-radius: var(--radius-sm);
}

/* Settings Card */
.settings-card {
    background: var(--background-darker);
    border-radius: var(--radius-xl);
    padding: var(--spacing-4);
    margin-top: var(--spacing-8);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-4);
}

/* Control Section */
.control-section {
    display: flex;
    gap: var(--spacing-4);
    justify-content: center;
    margin-bottom: var(--spacing-8);
}

.primary-btn {
    background: var(--accent-blue);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--spacing-4) var(--spacing-8);
    border-radius: var(--radius-xl);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(104, 141, 177, 0.4);
    background: #7399bf;
}

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

.stop-btn {
    background: var(--accent-red);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--spacing-4) var(--spacing-6);
    border-radius: var(--radius-xl);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.stop-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(225, 97, 98, 0.4);
    background: #e87374;
}

.stop-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Status Section */
.status-section {
    margin-bottom: var(--spacing-8);
}

/* Transcript Section */
.transcript-section {
    background: var(--background-darker);
    border-radius: var(--radius-xl);
    padding: var(--spacing-6);
    margin-bottom: var(--spacing-8);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.transcript-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-4);
}

.transcript-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.transcript-actions {
    display: flex;
    gap: var(--spacing-2);
}

.action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-2) var(--spacing-3);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* Export Dropdown */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-background);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 120px;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.export-menu.show {
    display: flex;
}

.export-option {
    background: none;
    border: none;
    padding: var(--spacing-3) var(--spacing-4);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    min-width: auto;
    justify-content: flex-start;
}

.export-option:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: none;
}

.export-option .icon {
    font-size: 1rem;
}

/* History Section */
.history-section {
    background: var(--background-darker);
    border-radius: var(--radius-xl);
    padding: var(--spacing-4);
    margin-bottom: var(--spacing-8);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.history-actions {
    display: flex;
    gap: var(--spacing-2);
}

/* History Modal */
.history-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--spacing-4);
    box-sizing: border-box;
}

.history-modal {
    background: var(--card-background);
    border-radius: var(--radius-xl);
    padding: var(--spacing-8);
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-lg);
}

.history-modal .history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-6);
    padding-bottom: var(--spacing-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.history-modal .history-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.history-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--spacing-2);
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.history-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.history-content {
    flex: 1;
    overflow-y: auto;
    margin-bottom: var(--spacing-6);
}

.no-history {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: var(--spacing-8);
}

.history-item {
    background: var(--background-darker);
    border-radius: var(--radius-lg);
    padding: var(--spacing-4);
    margin-bottom: var(--spacing-4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.1);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-2);
    flex-wrap: wrap;
    gap: var(--spacing-2);
}

.history-date {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

.history-language {
    background: var(--accent-blue);
    color: white;
    padding: var(--spacing-1) var(--spacing-2);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.history-words {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.history-text {
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: var(--spacing-3);
    font-size: 0.9rem;
}

.history-item .history-actions {
    display: flex;
    gap: var(--spacing-2);
    justify-content: flex-end;
}

.history-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    padding: var(--spacing-2) var(--spacing-3);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.history-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.history-btn.delete-btn:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
}

.history-footer {
    display: flex;
    gap: var(--spacing-3);
    justify-content: flex-end;
    padding-top: var(--spacing-4);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.history-btn-action {
    padding: var(--spacing-3) var(--spacing-6);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.history-clear-all {
    background: var(--accent-red);
    color: white;
}

.history-clear-all:hover {
    background: #c53030;
    transform: translateY(-1px);
}

.history-cancel {
    background: var(--background-darker);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.history-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .history-modal {
        margin: var(--spacing-4);
        padding: var(--spacing-6);
        max-height: 85vh;
    }
    
    .history-footer {
        flex-direction: column;
    }
    
    .history-btn-action {
        width: 100%;
        padding: var(--spacing-4);
    }
    
    .history-item-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .history-item .history-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* Keyboard Shortcuts Modal */
.shortcuts-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--spacing-4);
    box-sizing: border-box;
}

.shortcuts-modal {
    background: var(--card-background);
    border-radius: var(--radius-xl);
    padding: var(--spacing-8);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-lg);
}

.shortcuts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-6);
    padding-bottom: var(--spacing-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.shortcuts-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.shortcuts-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--spacing-2);
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.shortcuts-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.shortcuts-content {
    flex: 1;
    overflow-y: auto;
    margin-bottom: var(--spacing-6);
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-3) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.shortcut-item:last-child {
    border-bottom: none;
}

.shortcut-key {
    background: var(--background-darker);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    padding: var(--spacing-1) var(--spacing-2);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.shortcut-action {
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
    margin-left: var(--spacing-4);
}

.shortcuts-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: var(--spacing-4);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.shortcuts-btn-action {
    padding: var(--spacing-3) var(--spacing-6);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.shortcuts-cancel {
    background: var(--background-darker);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.shortcuts-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Light theme overrides for shortcuts */
[data-theme="light"] .shortcut-key {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.2);
}

/* Light theme overrides for timestamps */
[data-theme="light"] .timestamp {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid var(--accent-green);
}

@media (max-width: 768px) {
    .shortcuts-modal {
        margin: var(--spacing-4);
        padding: var(--spacing-6);
        max-height: 85vh;
    }
    
    .shortcut-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-2);
    }
    
    .shortcut-action {
        margin-left: 0;
    }
    
    .shortcuts-footer {
        flex-direction: column;
    }
    
    .shortcuts-btn-action {
        width: 100%;
        padding: var(--spacing-4);
    }
}

/* Debug Section */
.debug-section {
    display: flex;
    gap: var(--spacing-2);
    justify-content: center;
    margin: var(--spacing-8) 0;
}

button {
    background: var(--accent-blue);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--spacing-3) var(--spacing-6);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    min-width: 140px;
    position: relative;
    overflow: hidden;
}

button::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.6s ease;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: #7399bf;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Touch feedback for mobile */
@media (hover: none) {
    button:hover {
        transform: none;
    }

    button:active {
        transform: scale(0.98);
        background: #5a7ca8;
    }
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: var(--background-darker);
    color: var(--text-secondary);
    border-color: rgba(255, 255, 255, 0.05);
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--shadow-sm);
}

.recording-btn {
    background: var(--accent-red);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.recording-btn:hover {
    background: #e87374;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-lg);
}

.recording-btn.active {
    background: #c53030;
    border-color: rgba(255, 255, 255, 0.2);
    animation: pulse 1.5s infinite;
}

@media (hover: none) {
    .recording-btn:hover {
        transform: none;
    }

    .recording-btn:active {
        transform: scale(0.98);
        background: #c53030;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 6px 20px rgba(255, 107, 107, 0.3);
    }
    50% {
        transform: scale(1.03);
        box-shadow: 0 8px 25px rgba(255, 107, 107, 0.5);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 6px 20px rgba(255, 107, 107, 0.3);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: 200px 0;
    }
}

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

@keyframes typewriter {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes glowingTypewriter {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
        text-shadow: 0 0 0 var(--accent-blue);
    }
    50% {
        opacity: 1;
        transform: translateY(0) scale(1);
        text-shadow: 0 0 20px var(--accent-blue),
                    0 0 40px var(--accent-blue),
                    0 0 60px rgba(104, 141, 177, 0.5);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        text-shadow: 0 0 5px rgba(104, 141, 177, 0.3);
    }
}

@keyframes glow {
    0% {
        text-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
    }
    50% {
        text-shadow: 0 0 20px rgba(102, 126, 234, 0.8);
    }
    100% {
        text-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
    }
}

.new-word {
    display: inline-block;
    animation: glowingTypewriter 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 2px;
}

.interim-text {
    opacity: 0.6;
    color: var(--accent-blue);
    font-style: italic;
    animation: glow 1.5s ease-in-out infinite;
}

/* Timestamp styles */
.timestamp {
    color: var(--accent-green);
    font-weight: 600;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    opacity: 0.9;
    background: rgba(156, 182, 143, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    border-left: 3px solid var(--accent-green);
    margin-right: 8px;
    display: inline-block;
    vertical-align: baseline;
}

/* Improve timestamp line formatting */
.transcript-line {
    display: block;
    margin-bottom: 8px;
    line-height: 1.6;
}

.transcript-line:last-child {
    margin-bottom: 0;
}

/* Audio Visualization */
.audio-viz-section {
    background: var(--background-darker);
    border-radius: var(--radius-xl);
    padding: var(--spacing-6);
    margin-bottom: var(--spacing-8);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.audio-viz-section.active {
    border-color: var(--accent-green);
    box-shadow: 0 0 20px rgba(156, 182, 143, 0.2);
}

.audio-viz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-4);
}

.audio-viz-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.viz-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-2) var(--spacing-3);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.viz-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.viz-toggle.active {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.audio-visualizer {
    display: none;
    flex-direction: column;
    gap: var(--spacing-4);
}

.audio-visualizer.show {
    display: flex;
}

#audioCanvas {
    width: 100%;
    height: 100px;
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.volume-meter {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    flex-wrap: wrap;
}

.volume-label {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    min-width: 80px;
}

.volume-bar {
    flex: 1;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    min-width: 200px;
    position: relative;
}

.volume-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue), var(--accent-red));
    width: 0%;
    transition: width 0.1s ease;
    border-radius: var(--radius-xl);
}

.volume-level {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    min-width: 40px;
    text-align: right;
}

@media (max-width: 768px) {
    .audio-viz-section {
        padding: var(--spacing-4);
    }
    
    #audioCanvas {
        height: 80px;
    }
    
    .volume-meter {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .volume-label, .volume-level {
        min-width: auto;
        text-align: center;
    }
    
    .volume-bar {
        min-width: auto;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.status.listening {
    animation: fadeIn 0.3s ease-out;
}

.status.error {
    animation: fadeIn 0.3s ease-out;
}

.status {
    text-align: center;
    margin-bottom: var(--spacing-4);
    padding: var(--spacing-6);
    border-radius: var(--radius-xl);
    background: var(--background-darker);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.status.listening {
    background: rgba(156, 182, 143, 0.2);
    border: 1px solid var(--accent-green);
    color: var(--text-primary);
    font-weight: 600;
    position: relative;
}

.status.listening::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.status.error {
    background: rgba(225, 97, 98, 0.2);
    border: 1px solid var(--accent-red);
    color: var(--text-primary);
    font-weight: 600;
    position: relative;
}

.status.error::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.transcript {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: var(--spacing-6);
    min-height: 200px;
    font-size: 1.1rem;
    line-height: 1.8;
    white-space: pre-wrap;
    overflow-y: auto;
    max-height: 350px;
    position: relative;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.transcript .placeholder {
    opacity: 0.4;
    font-style: italic;
}

.transcript:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(104, 141, 177, 0.1);
}

.transcript[data-placeholder]:empty::before {
    content: attr(data-placeholder);
    opacity: 0.7;
    font-style: italic;
    color: var(--text-secondary);
}

.settings {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
}

.setting-group label {
    display: flex;
    align-items: center;
    gap: var(--spacing-1);
    margin-bottom: var(--spacing-1);
}

label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

select {
    background: var(--background-darker);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-3) var(--spacing-4);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(104, 141, 177, 0.1);
}

select option {
    background: var(--card-background);
    color: var(--text-primary);
    font-weight: 500;
}

.mic-icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 18px;
    transition: transform 0.2s ease;
}

button:hover .mic-icon {
    transform: scale(1.1);
}

button:active .mic-icon {
    transform: scale(0.95);
}



.footer {
    margin-top: var(--spacing-8);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 400;
    padding: var(--spacing-6) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: var(--spacing-2);
        min-height: 100vh;
        min-height: 100dvh; /* Dynamic viewport height for mobile */
    }

    .container {
        padding: var(--spacing-4);
        border-radius: var(--radius-lg);
        margin: 0 auto;
        min-height: calc(100vh - var(--spacing-4));
        min-height: calc(100dvh - var(--spacing-4));
        display: flex;
        flex-direction: column;
    }

    h1 {
        font-size: 1.75rem;
        margin-bottom: var(--spacing-12);
        line-height: 1.2;
    }

    .control-section {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-3);
        margin-bottom: var(--spacing-6);
    }

    .primary-btn, .stop-btn {
        width: 100%;
        padding: var(--spacing-4) var(--spacing-6);
        font-size: 1.1rem;
        min-height: 56px;
        touch-action: manipulation;
        justify-content: center;
        border-radius: var(--radius-lg);
    }

    .status {
        padding: var(--spacing-4);
        font-size: 0.9rem;
        min-height: 50px;
        margin-bottom: var(--spacing-3);
        line-height: 1.4;
    }

    .status.listening::before,
    .status.error::before {
        left: 12px;
        width: 6px;
        height: 6px;
    }


    .transcript-section {
        flex: 1;
        padding: var(--spacing-4);
        margin-bottom: var(--spacing-6);
        display: flex;
        flex-direction: column;
    }

    .transcript {
        flex: 1;
        min-height: 150px;
        max-height: 40vh;
        font-size: 1rem;
        padding: var(--spacing-4);
        line-height: 1.6;
    }

    .transcript-header {
        margin-bottom: var(--spacing-3);
    }

    .transcript-header h3 {
        font-size: 1rem;
    }

    .action-btn {
        padding: var(--spacing-2);
        font-size: 1rem;
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .debug-section {
        margin-bottom: var(--spacing-6);
    }
    
    .debug-section .primary-btn {
        width: 100%;
    }


    .settings-card {
        margin-top: var(--spacing-6);
    }

    .settings {
        grid-template-columns: 1fr;
        gap: var(--spacing-4);
        margin-top: var(--spacing-2);
    }

    .setting-group label {
        font-size: 0.85rem;
        margin-bottom: var(--spacing-2);
    }

    select {
        padding: var(--spacing-3);
        font-size: 1rem;
        min-height: 48px;
        border-radius: var(--radius);
    }

    .footer {
        margin-top: var(--spacing-6);
        padding: var(--spacing-4) 0;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: var(--spacing-1);
    }

    .container {
        padding: var(--spacing-3);
        border-radius: var(--radius-lg);
        margin: 0;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: var(--spacing-8);
        line-height: 1.1;
    }

    .primary-btn, .stop-btn {
        font-size: 1rem;
        padding: var(--spacing-4);
        min-height: 52px;
    }

    .control-section {
        gap: var(--spacing-2);
        margin-bottom: var(--spacing-4);
    }

    .status {
        padding: var(--spacing-3);
        font-size: 0.85rem;
        min-height: 45px;
        margin-bottom: var(--spacing-2);
    }

    .transcript-section {
        padding: var(--spacing-3);
        margin-bottom: var(--spacing-4);
    }

    .transcript {
        min-height: 120px;
        font-size: 0.875rem;
        padding: var(--spacing-3);
        max-height: 35vh;
        line-height: 1.5;
    }

    .transcript-header h3 {
        font-size: 0.9rem;
    }

    .action-btn {
        padding: var(--spacing-2);
        font-size: 0.9rem;
        min-width: 36px;
        min-height: 36px;
    }



    .settings {
        gap: var(--spacing-3);
        margin-top: var(--spacing-2);
    }

    .setting-group label {
        font-size: 0.8rem;
    }

    select {
        padding: var(--spacing-2) var(--spacing-3);
        font-size: 0.9rem;
        min-height: 44px;
    }

    .footer {
        padding: var(--spacing-3) 0;
        font-size: 0.75rem;
        margin-top: var(--spacing-4);
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    button {
        min-height: 48px;
        padding: var(--spacing-4) var(--spacing-6);
    }

    select {
        min-height: 48px;
        padding: var(--spacing-3) var(--spacing-4);
    }

    .transcript {
        min-height: 200px;
    }
}

/* Mobile Layout Adjustments */
@media (max-width: 768px) {
    .settings {
        grid-template-columns: 1fr;
    }
    
    .control-section {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-3);
    }
    
    .primary-btn, .stop-btn {
        width: 100%;
        justify-content: center;
    }
    
    .transcript-section {
        padding: var(--spacing-4);
    }
    
    .debug-section {
        flex-direction: column;
        gap: var(--spacing-2);
    }
    
    .debug-button {
        width: 100%;
    }
}

/* Debug Dialog Styles */
.debug-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--spacing-4);
    box-sizing: border-box;
}

.debug-dialog {
    background: var(--card-background);
    border-radius: var(--radius-xl);
    padding: var(--spacing-8);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-lg);
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-6);
    padding-bottom: var(--spacing-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.debug-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.debug-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--spacing-2);
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.debug-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.debug-content {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    background: var(--background-darker);
    border-radius: var(--radius);
    padding: var(--spacing-4);
    margin-bottom: var(--spacing-6);
    white-space: pre-wrap;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    max-height: 300px;
    overflow-y: auto;
}

.debug-actions {
    display: flex;
    gap: var(--spacing-3);
    justify-content: flex-end;
}

.debug-button-action {
    padding: var(--spacing-3) var(--spacing-6);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.debug-copy {
    background: var(--accent-blue);
    color: white;
}

.debug-copy:hover {
    background: #5a7ba8;
    transform: translateY(-1px);
}

.debug-cancel {
    background: var(--background-darker);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.debug-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .debug-dialog {
        margin: var(--spacing-4);
        padding: var(--spacing-6);
        max-height: 85vh;
    }
    
    .debug-actions {
        flex-direction: column;
    }
    
    .debug-button-action {
        width: 100%;
        padding: var(--spacing-4);
    }
}

/* Landscape Orientation Optimizations */
@media (max-height: 600px) and (orientation: landscape) {
    body {
        padding: var(--spacing-1);
    }
    
    .container {
        padding: var(--spacing-3);
        min-height: auto;
    }
    
    h1 {
        font-size: 1.4rem;
        margin-bottom: var(--spacing-3);
    }
    
    .control-section {
        flex-direction: row;
        justify-content: center;
        gap: var(--spacing-3);
        margin-bottom: var(--spacing-4);
    }
    
    .primary-btn, .stop-btn {
        width: auto;
        min-width: 140px;
        padding: var(--spacing-3) var(--spacing-4);
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    .status {
        padding: var(--spacing-2);
        font-size: 0.8rem;
        min-height: 40px;
        margin-bottom: var(--spacing-2);
    }
    
    .transcript-section {
        padding: var(--spacing-3);
        margin-bottom: var(--spacing-3);
    }
    
    .transcript {
        min-height: 80px;
        max-height: 25vh;
        font-size: 0.8rem;
        padding: var(--spacing-3);
    }
    
    
    .settings {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-2);
    }
    
    
    .footer {
        margin-top: var(--spacing-3);
        padding: var(--spacing-2) 0;
        font-size: 0.7rem;
    }
}

/* Ultra-compact mobile screens */
@media (max-width: 360px) {
    .container {
        padding: var(--spacing-2);
    }
    
    h1 {
        font-size: 1.3rem;
        margin-bottom: var(--spacing-6);
    }
    
    .primary-btn, .stop-btn {
        font-size: 0.9rem;
        padding: var(--spacing-3);
        min-height: 48px;
    }
    
    .transcript {
        min-height: 100px;
        max-height: 30vh;
        font-size: 0.8rem;
    }
    
    .action-btn {
        min-width: 32px;
        min-height: 32px;
        padding: var(--spacing-1);
        font-size: 0.85rem;
    }
    
    select {
        font-size: 0.85rem;
        min-height: 40px;
    }
}