/**
 * INDEX.CSS - KrushFlow Main Styles
 * ==================================
 * Plain ASCII only. No emojis. No Unicode.
 * 
 * SECTIONS:
 * 1. CSS Variables (Light/Dark themes)
 * 2. Reset and Base Styles
 * 3. Layout and Container
 * 4. Screen System
 * 5. Header and Navigation
 * 6. Glass Cards (Home tiles)
 * 7. Form Elements
 * 8. Buttons
 * 9. Item Lists
 * 10. Upload Zone
 * 11. Status Bar
 * 12. Voice Mapping Screen
 * 13. Edit Aliases Screen
 * 14. Edit Master List Screen
 * 15. Modals and Overlays
 * 16. Utility Classes
 * 17. Responsive
 */

/* =================================================================
   1. CSS VARIABLES
   ================================================================= */

:root {
    /* Brand */
    --brand: #f97316;
    --brand-light: #fb923c;
    --brand-dark: #ea580c;
    
    /* Backgrounds - Light Mode */
    --bg-page: #fafafa;
    --bg-main: #ffffff;
    --bg-card: #ffffff;
    --bg-elevated: #f5f5f5;
    --bg-input: #ffffff;
    
    /* Borders */
    --border: #e5e7eb;
    --border-focus: #f97316;
    
    /* Glass effect */
    --glass: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(249, 115, 22, 0.2);
    
    /* Text */
    --text-main: #18181b;
    --text-secondary: #3f3f46;
    --text-muted: #71717a;
    --text-inverse: #fafafa;
    
    /* Status Colors */
    --success: #22c55e;
    --success-light: rgba(34, 197, 94, 0.1);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    --info: #3b82f6;
    --info-light: rgba(59, 130, 246, 0.1);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.2);
    --shadow-brand: 0 8px 24px rgba(249, 115, 22, 0.25);
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, monospace;
    
    /* Transitions */
    --transition-fast: 0.1s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-page: #0a0a0a;
    --bg-main: #0f0f0f;
    --bg-card: #171717;
    --bg-elevated: #262626;
    --bg-input: #1a1a1a;
    
    --border: #2a2a2a;
    --border-focus: #fb923c;
    
    --glass: rgba(23, 23, 23, 0.95);
    --glass-border: rgba(251, 146, 60, 0.25);
    
    --text-main: #fafafa;
    --text-secondary: #d4d4d4;
    --text-muted: #a1a1aa;
    --text-inverse: #18181b;
    
    --success: #4ade80;
    --success-light: rgba(74, 222, 128, 0.15);
    --danger: #f87171;
    --danger-light: rgba(248, 113, 113, 0.15);
    --warning: #fbbf24;
    --warning-light: rgba(251, 191, 36, 0.15);
    --info: #60a5fa;
    --info-light: rgba(96, 165, 250, 0.15);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-brand: 0 8px 24px rgba(251, 146, 60, 0.25);
}

/* =================================================================
   2. RESET AND BASE STYLES
   ================================================================= */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* =================================================================
   3. LAYOUT AND CONTAINER
   ================================================================= */

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: var(--space-md);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
    background: var(--bg-main);
    border: 2px solid var(--brand);
    border-radius: var(--radius-lg);
    box-shadow:
        var(--shadow-lg),
        0 4px 0 0 var(--brand-dark),
        0 0 0 4px rgba(249, 115, 22, 0.1);
}

@media (min-width: 768px) {
    .container {
        margin-top: var(--space-lg);
        margin-bottom: var(--space-lg);
    }
}

@media (max-width: 520px) {
    .container {
        /* Full border frame on mobile with rounded corners and 3D tile effect */
        margin: 8px;
        padding: var(--space-sm);
        border: 3px solid var(--brand);
        height: calc(100vh - 16px);
        height: calc(100dvh - 16px);
        border-radius: var(--radius-lg);
        box-shadow:
            0 4px 0 0 var(--brand-dark),
            0 6px 12px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }
}

/* Landing screen main element fills available space */
#screen-landing main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Compact header for landing screen */
#screen-landing header {
    padding: 2px 8px;
    flex-shrink: 0;
}

#screen-landing .logo-wrapper {
    margin-bottom: 0;
}

#screen-landing .logo-wrapper img {
    max-width: 160px;
}

#screen-landing .tagline {
    margin-bottom: 0;
    font-size: 0.7rem;
}

/* =================================================================
   4. SCREEN SYSTEM
   ================================================================= */

.screen {
    display: none;
    min-height: auto;
    padding-bottom: var(--space-lg);
    position: relative;
}

.screen.active {
    display: block;
}

/* Landing screen specific - fills viewport, no scroll */
#screen-landing {
    padding-bottom: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
}

/* =================================================================
   5. HEADER AND NAVIGATION
   ================================================================= */

header {
    text-align: center;
    padding: 4px var(--space-md) 4px;
    position: relative;
}

.logo-wrapper {
    margin-bottom: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-wrapper img {
    width: 100%;
    max-width: none;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-brand);
}

/* Logo spans full width of tile grid */
#screen-landing .logo-wrapper img {
    width: calc(100% - 16px);
    max-width: none;
}

.tagline {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: var(--space-sm);
}

.theme-toggle {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: 2px solid var(--brand);
    background: var(--bg-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    padding: 0;
}

.theme-toggle:hover {
    background: var(--bg-elevated);
    box-shadow: var(--shadow-md);
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* SVG Theme Icon */
.theme-icon-svg {
    width: 24px;
    height: 24px;
}

/* Light mode: show sun, dim moon */
.theme-icon-svg .sun-center,
.theme-icon-svg .sun-rays {
    color: var(--brand);
    opacity: 1;
    transition: opacity var(--transition-normal);
}

.theme-icon-svg .moon-shape {
    color: var(--text-muted);
    opacity: 0.3;
    transition: opacity var(--transition-normal);
}

/* Dark mode: dim sun, show moon */
[data-theme="dark"] .theme-icon-svg .sun-center,
[data-theme="dark"] .theme-icon-svg .sun-rays {
    opacity: 0.3;
}

[data-theme="dark"] .theme-icon-svg .moon-shape {
    color: var(--brand-light);
    opacity: 1;
}

/* New SVG-based theme toggle (smaller, narrower) */
#theme-toggle {
    position: absolute;
    top: 4px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    z-index: 10;
    transform: scale(0.85);
    transform-origin: left top;
}

#theme-toggle .theme-icon {
    width: 20px;
    height: 20px;
}

#theme-toggle svg:last-child {
    width: 36px;
    height: 20px;
}

.phase-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--bg-main);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.phase-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    flex: 1;
    text-align: center;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.back-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--brand);
}

/* =================================================================
   6. GLASS CARDS (Home Tiles)
   ================================================================= */

/* Tile entrance animation */
@keyframes tileEnter {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Shimmer effect on border */
@keyframes borderShimmer {
    0% {
        border-color: var(--border);
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
    }
    50% {
        border-color: var(--brand-light);
        box-shadow: 0 0 20px 2px rgba(249, 115, 22, 0.3);
    }
    100% {
        border-color: var(--border);
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
    }
}

/* Icon pulse on hover */
@keyframes iconPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Subtle glow pulse */
@keyframes glowPulse {
    0%, 100% {
        box-shadow:
            var(--shadow-sm),
            0 4px 0 0 var(--bg-elevated),
            0 4px 8px rgba(0, 0, 0, 0.1),
            inset 0 0 0 0 rgba(249, 115, 22, 0);
    }
    50% {
        box-shadow:
            var(--shadow-sm),
            0 4px 0 0 var(--bg-elevated),
            0 4px 8px rgba(0, 0, 0, 0.1),
            inset 0 0 30px 5px rgba(249, 115, 22, 0.05);
    }
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 4px 8px;
    flex: 1;
    align-content: stretch;
    height: 100%;
}

.glass-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, background-color 150ms ease;
    box-shadow:
        var(--shadow-sm),
        0 4px 0 0 var(--bg-elevated),
        0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
    animation: tileEnter 0.5s ease-out backwards;
}

/* Staggered entrance delays for each tile */
.glass-card:nth-child(1) { animation-delay: 0ms; }
.glass-card:nth-child(2) { animation-delay: 100ms; }
.glass-card:nth-child(3) { animation-delay: 200ms; }
.glass-card:nth-child(4) { animation-delay: 300ms; }

/* Subtle continuous glow */
.glass-card {
    animation: tileEnter 0.5s ease-out backwards, glowPulse 4s ease-in-out infinite;
}

.glass-card:hover {
    transform: translateY(-3px);
    box-shadow:
        var(--shadow-brand),
        0 6px 0 0 var(--brand-dark),
        0 8px 16px rgba(249, 115, 22, 0.2),
        0 0 30px 5px rgba(249, 115, 22, 0.15);
    border-color: var(--brand);
    background: var(--bg-elevated);
    animation: borderShimmer 0.6s ease;
}

/* Icon animation on hover */
.glass-card:hover .icon-container img {
    animation: iconPulse 0.4s ease;
}

.glass-card:focus-visible {
    outline: none;
    transform: translateY(-3px);
    box-shadow:
        var(--shadow-brand),
        0 6px 0 0 var(--brand-dark),
        0 8px 16px rgba(249, 115, 22, 0.2);
    border-color: var(--brand);
}

.glass-card:active {
    transform: translateY(1px);
    box-shadow:
        var(--shadow-sm),
        0 1px 0 0 var(--bg-elevated),
        0 2px 4px rgba(0, 0, 0, 0.1);
    background: var(--bg-elevated);
}

/* Touch device optimization - prevent sticky hover */
@media (hover: none) {
    .glass-card:hover {
        transform: none;
        box-shadow:
            var(--shadow-sm),
            0 4px 0 0 var(--bg-elevated),
            0 4px 8px rgba(0, 0, 0, 0.1);
        border-color: var(--border);
        background: var(--bg-card);
    }

    .glass-card:active {
        transform: scale(0.97);
        background: var(--bg-elevated);
        border-color: var(--brand);
    }
}

.glass-card .icon-container {
    width: 48px;
    height: 48px;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.glass-card .icon-container img {
    width: 48px;
    height: 48px;
}

.glass-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-main);
}

.glass-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* =================================================================
   7. FORM ELEMENTS
   ================================================================= */

input[type="text"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    font-family: var(--font-family);
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    transition: all var(--transition-fast);
}

input[type="text"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

.input-section-highlight {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.08), rgba(249, 115, 22, 0.02));
    border: 2px solid var(--brand);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.input-label-prominent {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: var(--space-sm);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--brand);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
}

.input-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-sm);
}

.project-name-input {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 14px 16px;
}

.project-selector {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    cursor: pointer;
    margin-bottom: var(--space-md);
}

.project-selector-search {
    margin-bottom: 0;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border-bottom: none;
}

.project-selector-search + .project-selector {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* =================================================================
   8. BUTTONS
   ================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-family);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    text-decoration: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--brand-light), var(--brand));
    color: white;
    box-shadow: var(--shadow-brand);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 32px rgba(249, 115, 22, 0.3);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-elevated);
    border-color: var(--brand);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #16a34a);
    color: white;
}

.btn-full {
    width: 100%;
}

.footer-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-md);
    background: var(--bg-main);
    border-top: 1px solid var(--border);
    max-width: 500px;
    margin: 0 auto;
    z-index: 50;
}

.bottom-home-btn {
    display: block;
    width: 100%;
    padding: 14px;
    margin-top: var(--space-md);
    font-size: 1rem;
    font-weight: 600;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    cursor: pointer;
}

/* =================================================================
   9. ITEM LISTS
   ================================================================= */

.item-list {
    list-style: none;
    margin-bottom: var(--space-md);
}

.item-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    transition: all var(--transition-fast);
}

.item-list li:hover {
    background: var(--bg-elevated);
    border-color: var(--brand);
}

.item-list .item-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: var(--space-sm);
}

.item-list .item-actions {
    display: flex;
    gap: var(--space-sm);
}

.item-list .item-actions button {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.item-list .item-actions button:hover {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
}

.empty-state {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
    font-style: italic;
}

.count,
.count-badge {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--brand);
}

/* =================================================================
   10. UPLOAD ZONE
   ================================================================= */

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    margin-bottom: var(--space-md);
    background: var(--bg-card);
}

.upload-zone:hover {
    border-color: var(--brand);
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.05), transparent);
}

.upload-zone.drag-over {
    border-color: var(--brand);
    background: rgba(249, 115, 22, 0.1);
    transform: scale(1.02);
}

.upload-zone .icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.upload-zone p {
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.upload-zone p:last-child {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* =================================================================
   11. STATUS BAR
   ================================================================= */

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    font-size: 0.9rem;
}

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

/* =================================================================
   12. VOICE MAPPING SCREEN
   ================================================================= */

#screen-voice-mapping .vm-item-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    text-align: center;
}

#screen-voice-mapping .vm-item-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: var(--space-sm);
}

#screen-voice-mapping .vm-item-index {
    font-size: 0.9rem;
    color: var(--text-muted);
}

#screen-voice-mapping .vm-alias-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    justify-content: center;
}

#screen-voice-mapping .vm-alias-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 6px 12px;
    background: var(--info-light);
    border: 1px solid var(--info);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--info);
}

#screen-voice-mapping .vm-alias-tag button {
    background: none;
    border: none;
    color: var(--info);
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}

.voice-control-center {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    margin-bottom: var(--space-md);
}

.mic-button {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    border: 3px solid var(--brand);
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(249, 115, 22, 0.05));
    color: var(--brand);
    font-size: 2rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    margin: var(--space-md) auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mic-button:hover {
    background: rgba(249, 115, 22, 0.15);
    transform: scale(1.05);
}

.mic-button.recording {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
    border-color: var(--danger);
    color: var(--danger);
    animation: pulse-recording 1s infinite;
}

@keyframes pulse-recording {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
}

.voice-status {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.voice-transcript {
    font-size: 0.9rem;
    color: var(--info);
    font-style: italic;
}

/* =================================================================
   13. EDIT ALIASES SCREEN
   ================================================================= */

#screen-edit-aliases .alias-item-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
}

#screen-edit-aliases .alias-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

#screen-edit-aliases .alias-item-name {
    font-weight: 600;
    color: var(--text-main);
}

#screen-edit-aliases .alias-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

#screen-edit-aliases .alias-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

#screen-edit-aliases .alias-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

#screen-edit-aliases .alias-tag .remove-alias {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1;
}

/* =================================================================
   14. EDIT MASTER LIST SCREEN
   ================================================================= */

#screen-edit-master-list .master-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

#screen-edit-master-list .master-item .item-text {
    flex: 1;
    font-weight: 500;
}

#screen-edit-master-list .master-item .delete-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#screen-edit-master-list .master-item .delete-btn:hover {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
}

/* =================================================================
   15. MODALS AND OVERLAYS
   ================================================================= */

.modal-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 10, 0.95);
    z-index: 10000;
    padding: var(--space-md);
    overflow-y: auto;
    border-radius: var(--radius-lg);
}

.modal-overlay.active {
    display: block;
}

.modal-content {
    max-width: 400px;
    margin: 10vh auto;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 2px solid var(--brand);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    padding: var(--space-lg);
    color: white;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-body {
    padding: var(--space-lg);
}

.modal-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

/* =================================================================
   16. UTILITY CLASSES
   ================================================================= */

.hidden {
    display: none !important;
}

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

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-muted); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* =================================================================
   17. RESPONSIVE
   ================================================================= */

@media (max-width: 360px) {
    .mode-grid {
        grid-template-columns: 1fr;
    }
    
    .glass-card {
        padding: var(--space-md);
    }
}

@media (min-width: 768px) {
    .container {
        padding: var(--space-lg);
    }
    
    .mode-grid {
        gap: var(--space-lg);
    }
}
