/* ============================================
   VoiceLink — Design System
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Color Palette — Deep space with vibrant accents */
    --bg-primary: #0a0a1a;
    --bg-secondary: #111128;
    --bg-card: #16163a;
    --bg-card-hover: #1c1c4a;
    --bg-glass: rgba(22, 22, 58, 0.7);
    --bg-modal: rgba(10, 10, 26, 0.92);

    --text-primary: #e8e8f0;
    --text-secondary: #9090b0;
    --text-muted: #5a5a80;
    --text-accent: #a78bfa;

    --accent-primary: #7c3aed;
    --accent-primary-glow: rgba(124, 58, 237, 0.4);
    --accent-secondary: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #7c3aed, #a78bfa, #c084fc);
    --accent-gradient-vibrant: linear-gradient(135deg, #6d28d9, #7c3aed, #8b5cf6);

    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.3);
    --success: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.3);
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.3);
    --info: #3b82f6;

    --border-subtle: rgba(124, 58, 237, 0.15);
    --border-accent: rgba(124, 58, 237, 0.3);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-xs: 0.7rem;
    --font-sm: 0.8rem;
    --font-base: 0.95rem;
    --font-md: 1.1rem;
    --font-lg: 1.35rem;
    --font-xl: 1.75rem;
    --font-2xl: 2.5rem;

    /* Borders */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--accent-primary-glow);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --header-height: 56px;
    --tab-height: 56px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-base);
    color: var(--text-primary);
    background: var(--bg-primary);
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

/* --- Splash Screen --- */
.splash {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 1000;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.splash.fade-out {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

.splash-content {
    text-align: center;
}

.splash-logo {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    opacity: 0;
    animation: pulse-ring 2.5s ease-out infinite;
}

.pulse-ring.delay-1 { animation-delay: 0.8s; }
.pulse-ring.delay-2 { animation-delay: 1.6s; }

@keyframes pulse-ring {
    0% { transform: scale(0.5); opacity: 0.8; }
    100% { transform: scale(1.8); opacity: 0; }
}

.mic-icon-splash {
    width: 40px;
    height: 40px;
    color: var(--accent-secondary);
    filter: drop-shadow(0 0 12px var(--accent-primary-glow));
}

.splash-title {
    font-size: var(--font-2xl);
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.splash-subtitle {
    font-size: var(--font-sm);
    color: var(--text-muted);
    margin-top: var(--space-xs);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* --- App Shell --- */
.app {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    background: var(--bg-primary);
}

/* --- Header --- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 var(--space-md);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-logo {
    width: 22px;
    height: 22px;
    color: var(--accent-secondary);
}

.header-title {
    font-size: var(--font-md);
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

.icon-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.icon-btn:active {
    transform: scale(0.92);
}

.connection-indicator {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: background var(--transition-base);
}

.dot.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success-glow);
}

.dot.offline {
    background: var(--text-muted);
}

/* --- Tab Navigation --- */
.tab-nav {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    height: var(--tab-height);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-family);
    font-size: var(--font-sm);
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: color var(--transition-base);
}

.tab-btn svg {
    width: 18px;
    height: 18px;
}

.tab-btn.active {
    color: var(--accent-secondary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 2px 2px 0 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
}

/* --- Views --- */
.view {
    display: none;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.view.active {
    display: flex;
    flex-direction: column;
}

/* --- Record View --- */
.record-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl) var(--space-md);
    gap: var(--space-lg);
}

.visualizer-wrapper {
    position: relative;
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.visualizer {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    opacity: 0.7;
}

.record-timer {
    position: absolute;
    font-size: var(--font-xl);
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.record-timer.visible {
    opacity: 1;
}

/* Record Button */
.record-btn-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.record-btn-glow {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--accent-primary-glow);
    filter: blur(20px);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.record-btn-glow.active {
    opacity: 1;
    animation: glow-pulse 1.5s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 1; }
}

.record-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--accent-primary);
    background: var(--bg-card);
    color: var(--accent-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: all var(--transition-spring);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.05);
}

.record-btn svg {
    width: 32px;
    height: 32px;
    transition: all var(--transition-base);
}

.record-btn:hover {
    transform: scale(1.05);
    border-color: var(--accent-secondary);
    box-shadow: var(--shadow-glow);
}

.record-btn:active {
    transform: scale(0.95);
}

.record-btn.recording {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
    animation: recording-pulse 1.5s ease-in-out infinite;
}

.record-btn.recording .mic-icon { display: none; }
.record-btn.recording .stop-icon { display: block !important; }

@keyframes recording-pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--danger-glow); }
    50% { box-shadow: 0 0 0 16px transparent; }
}

.record-hint {
    font-size: var(--font-sm);
    color: var(--text-muted);
    text-align: center;
    transition: opacity var(--transition-base);
}

/* --- Post Record Preview --- */
.post-record {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    animation: slide-up 0.4s ease;
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.audio-preview {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.play-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    border: none;
    background: var(--accent-gradient-vibrant);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.play-btn svg {
    width: 16px;
    height: 16px;
    margin-left: 2px;
}

.play-btn:active {
    transform: scale(0.92);
}

.waveform-mini {
    flex: 1;
    height: 32px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.waveform-mini .bar {
    width: 3px;
    border-radius: 2px;
    background: var(--accent-gradient);
    transition: height var(--transition-fast);
}

.duration {
    font-size: var(--font-sm);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    text-align: right;
}

/* Action Buttons */
.post-actions {
    display: flex;
    gap: var(--space-sm);
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

.action-btn.discard {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.action-btn.discard:hover {
    background: rgba(239, 68, 68, 0.2);
}

.action-btn.send {
    background: var(--accent-gradient-vibrant);
    color: white;
    border: none;
    box-shadow: 0 4px 12px var(--accent-primary-glow);
}

.action-btn.send:hover {
    box-shadow: 0 6px 20px var(--accent-primary-glow);
    transform: translateY(-1px);
}

.action-btn.send:active {
    transform: translateY(0) scale(0.98);
}

.action-btn.send.small {
    flex: 0;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-xs);
}

.action-btn.full-width {
    width: 100%;
    margin-top: var(--space-md);
}

.action-btn:active {
    transform: scale(0.97);
}

/* --- Notes View --- */
.notes-container {
    flex: 1;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
}

.notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.notes-header h2 {
    font-size: var(--font-lg);
    font-weight: 700;
}

.notes-filter {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    padding: 3px;
    border-radius: var(--radius-sm);
}

.filter-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-family);
    font-size: var(--font-xs);
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn.active {
    background: var(--accent-primary);
    color: white;
}

/* Notes List */
.notes-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    overflow-y: auto;
    padding-bottom: calc(var(--space-xl) + var(--safe-bottom));
}

.note-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all var(--transition-fast);
    animation: slide-up 0.3s ease;
}

.note-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.note-card:active {
    transform: translateY(0);
}

.note-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    opacity: 0.4;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    min-width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

.note-delete-btn:hover {
    opacity: 1;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.note-delete-btn:active {
    transform: scale(0.9);
}

.note-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.note-icon svg {
    width: 18px;
    height: 18px;
}

.note-icon.pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.note-icon.processing {
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent-secondary);
}

.note-icon.completed {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.note-icon.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.note-content {
    flex: 1;
    min-width: 0;
}

.note-title {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-preview {
    font-size: var(--font-xs);
    color: var(--text-secondary);
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-xs);
    font-size: var(--font-xs);
    color: var(--text-muted);
}

.note-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.note-status.pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.note-status.processing {
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent-secondary);
}

.note-status.completed {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.note-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* Spinner inside processing notes */
.note-icon.processing svg {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    text-align: center;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    opacity: 0.3;
    margin-bottom: var(--space-md);
}

.empty-state p {
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--text-secondary);
}

.empty-state span {
    font-size: var(--font-sm);
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* --- Modals --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
    animation: fade-in 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    display: flex;
    flex-direction: column;
    animation: slide-up-modal 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--border-subtle);
    border-bottom: none;
}

@keyframes slide-up-modal {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-lg) var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: var(--font-lg);
    font-weight: 700;
}

.modal-title-area {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.modal-status {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent-secondary);
}

.modal-close {
    color: var(--text-muted);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

.modal-section {
    margin-bottom: var(--space-lg);
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section h4 {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-sm);
}

.transcript-box, .response-box {
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    font-size: var(--font-sm);
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.response-box {
    min-height: 120px;
}

.placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* Thinking Indicator */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: var(--font-sm);
}

.thinking-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-secondary);
    border-radius: 50%;
    animation: thinking 1.4s ease-in-out infinite;
}

.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinking {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
    padding-bottom: calc(var(--space-md) + var(--safe-bottom));
}

.modal-timestamp {
    font-size: var(--font-xs);
    color: var(--text-muted);
}

/* --- Settings Modal --- */
.settings-modal .modal-body {
    padding-bottom: calc(var(--space-lg) + var(--safe-bottom));
}

.settings-group {
    margin-bottom: var(--space-lg);
}

.settings-group h4 {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-md);
}

.input-field {
    margin-bottom: var(--space-md);
}

.input-field label {
    display: block;
    font-size: var(--font-xs);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.input-field input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-sm);
    outline: none;
    transition: border-color var(--transition-fast);
}

.input-field input::placeholder {
    color: var(--text-muted);
}

.input-field input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: calc(var(--tab-height) + var(--space-lg) + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: var(--space-sm) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-full);
    font-size: var(--font-sm);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    opacity: 0;
    transition: all var(--transition-base);
    white-space: nowrap;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Uploading Overlay --- */
.upload-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 150;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.upload-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: var(--space-md);
}

.upload-text {
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--text-primary);
}

.upload-subtext {
    font-size: var(--font-sm);
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* --- Utility Animations --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Scrollbar (WebKit) --- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-accent);
}

/* --- Media Queries --- */
@media (min-width: 481px) {
    .modal {
        border-radius: var(--radius-xl);
        border-bottom: 1px solid var(--border-subtle);
        margin: auto;
        max-height: 80vh;
        align-self: center;
    }

    @keyframes slide-up-modal {
        from { transform: translateY(40px); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }

    .modal-overlay {
        align-items: center;
    }
}
