/* ═══════════════════════════════════════════
   AirDrop — Dark Glassmorphism Design System
   ═══════════════════════════════════════════ */

:root {
    /* — Color Palette: ColorHunt Warm Dark — 
       #FAF3E1 (cream)  #F5E7C6 (beige)  #FA8112 (orange)  #222222 (charcoal) */
    --bg-primary: #1a1a1a;
    --bg-secondary: #222222;
    --bg-card: rgba(250, 243, 225, 0.04);
    --bg-card-hover: rgba(250, 243, 225, 0.07);
    --bg-glass: rgba(250, 243, 225, 0.045);
    --bg-glass-strong: rgba(250, 243, 225, 0.08);
    --border-glass: rgba(245, 231, 198, 0.1);
    --border-hover: rgba(250, 129, 18, 0.4);
    --border-active: rgba(250, 129, 18, 0.65);

    --text-primary: #FAF3E1;
    --text-secondary: rgba(245, 231, 198, 0.7);
    --text-muted: rgba(245, 231, 198, 0.38);

    --accent-orange: #FA8112;
    --accent-orange-light: #FFA54C;
    --accent-cream: #FAF3E1;
    --accent-beige: #F5E7C6;
    --accent-green: #5CB85C;
    --accent-red: #E74C3C;
    --accent-amber: #F5E7C6;

    --gradient-primary: linear-gradient(135deg, #FA8112, #FFA54C);
    --gradient-warm: linear-gradient(135deg, #FA8112, #E06B00);
    --gradient-glow: linear-gradient(135deg, rgba(250,129,18,0.25), rgba(255,165,76,0.2));
    --gradient-subtle: linear-gradient(135deg, rgba(250,129,18,0.07), rgba(245,231,198,0.04));

    /* — Typography — */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-xs: 0.7rem;
    --font-sm: 0.8125rem;
    --font-base: 0.9375rem;
    --font-lg: 1.0625rem;
    --font-xl: 1.375rem;
    --font-2xl: 1.75rem;
    --font-3xl: 2.5rem;
    --font-4xl: 3.5rem;

    /* — Spacing — */
    --space-2xs: 0.125rem;
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* — Borders — */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    /* — Transitions — */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-fast: 120ms var(--ease-out);
    --transition-base: 250ms var(--ease-out);
    --transition-slow: 500ms var(--ease-out);

    /* — Shadows — */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 40px rgba(250,129,18,0.12);
    --shadow-glow-strong: 0 0 60px rgba(250,129,18,0.18);
}

/* ═══ Reset & Base ═══ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* ═══ Animated Background Mesh ═══ */
.bg-mesh {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-mesh::before,
.bg-mesh::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
    animation: meshFloat 20s ease-in-out infinite;
}

.bg-mesh::before {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(250,129,18,0.4) 0%, transparent 70%);
    top: -15%;
    right: -10%;
    animation-delay: 0s;
}

.bg-mesh::after {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(245,231,198,0.18) 0%, transparent 70%);
    bottom: -10%;
    left: -10%;
    animation-delay: -10s;
}

.bg-mesh-extra {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(250,129,18,0.15) 0%, transparent 70%);
    filter: blur(100px);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: meshFloat 25s ease-in-out infinite reverse;
    opacity: 0.3;
}

@keyframes meshFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -40px) scale(1.1); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(15px, 35px) scale(1.05); }
}

/* Noise texture */
.noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    mix-blend-mode: overlay;
}

/* ═══ Header ═══ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-xl);
    position: relative;
    z-index: 10;
    animation: fadeSlideDown 0.6s var(--ease-out) both;
}

@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo-icon {
    width: 28px;
    height: 28px;
}

.logo-text {
    font-size: var(--font-lg);
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    font-size: var(--font-xs);
    color: var(--text-secondary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all var(--transition-base);
}

.status-badge.connected .status-dot {
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(34,197,94,0.6);
}

.status-badge.transferring .status-dot {
    background: var(--accent-orange);
    box-shadow: 0 0 8px rgba(250,129,18,0.6);
    animation: pulseGlow 1s ease-in-out infinite;
}

.status-badge.error .status-dot {
    background: var(--accent-red);
    box-shadow: 0 0 8px rgba(239,68,68,0.6);
}

@keyframes pulseGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

/* ═══ Main Content ═══ */
.main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-xl);
    position: relative;
    z-index: 2;
}

.view {
    display: none;
    width: 100%;
    max-width: 680px;
}

.view.active {
    display: block;
    animation: fadeSlideUp 0.5s var(--ease-out) both;
}

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

/* ═══ Hero Section ═══ */
.hero {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.hero-title {
    font-size: clamp(var(--font-2xl), 5vw, var(--font-4xl));
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.04em;
    margin-bottom: var(--space-md);
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: var(--font-base);
    color: var(--text-secondary);
    max-width: 440px;
    margin: 0 auto;
    line-height: 1.65;
    font-weight: 400;
}

/* ═══ Mode Cards ═══ */
.mode-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

.mode-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    color: var(--text-primary);
    font-family: var(--font-family);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.mode-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-subtle);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.mode-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow), 0 0 0 1px rgba(250,129,18,0.1);
}

.mode-card:hover::before {
    opacity: 1;
}

.mode-card:active {
    transform: translateY(-1px);
}

.mode-card.small {
    padding: var(--space-sm) var(--space-lg);
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-sm);
    margin-top: var(--space-lg);
    border-radius: var(--radius-md);
}

.mode-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto var(--space-md);
    color: var(--accent-orange);
    position: relative;
    z-index: 1;
    transition: color var(--transition-base);
}

.mode-card:hover .mode-icon {
    color: var(--accent-beige);
}

.mode-card h2 {
    font-size: var(--font-base);
    font-weight: 650;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
    letter-spacing: -0.01em;
}

.mode-card p {
    font-size: var(--font-xs);
    color: var(--text-muted);
    line-height: 1.5;
    position: relative;
    z-index: 1;
}

/* ═══ Glass Card ═══ */
.glass-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.card-header h2 {
    font-size: var(--font-lg);
    font-weight: 650;
    letter-spacing: -0.02em;
}

.back-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.back-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.back-btn svg {
    width: 16px;
    height: 16px;
}

/* ═══ Room Code ═══ */
.room-section {
    text-align: center;
}

.room-label {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.room-code-display {
    display: inline-flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-lg);
    margin-bottom: var(--space-lg);
}

.room-code {
    font-size: var(--font-xl);
    font-weight: 700;
    letter-spacing: 0.18em;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.copy-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.copy-btn:hover {
    border-color: var(--accent-beige);
    color: var(--accent-beige);
    background: rgba(250,129,18,0.08);
}

.copy-btn svg {
    width: 14px;
    height: 14px;
}

/* Waiting Indicator */
.waiting-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: var(--font-xs);
}

.pulse-ring {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-orange);
    position: relative;
    flex-shrink: 0;
}

.pulse-ring::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1.5px solid var(--accent-orange);
    animation: pulseRingAnim 1.5s ease-out infinite;
}

@keyframes pulseRingAnim {
    from { transform: scale(0.8); opacity: 1; }
    to   { transform: scale(2.2); opacity: 0; }
}

/* ═══ Drop Zone ═══ */
.dropzone {
    border: 1.5px dashed rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl) var(--space-lg);
    text-align: center;
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
}

.dropzone:hover {
    border-color: rgba(250,129,18,0.3);
    background: rgba(250,129,18,0.03);
}

.dropzone.drag-over {
    border-color: var(--accent-orange);
    background: rgba(250,129,18,0.06);
    transform: scale(1.01);
    box-shadow: inset 0 0 40px rgba(250,129,18,0.05);
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin: 0 auto var(--space-md);
    transition: color var(--transition-base);
}

.dropzone.drag-over .dropzone-icon {
    color: var(--accent-orange);
}

.dropzone-text {
    font-size: var(--font-base);
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.dropzone-subtext {
    color: var(--text-muted);
    font-size: var(--font-xs);
    margin-bottom: var(--space-md);
}

.file-picker-btn {
    display: inline-block;
    padding: 6px 20px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    font-size: var(--font-xs);
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all var(--transition-base);
}

.file-picker-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(250,129,18,0.35);
}

/* ═══ File Info ═══ */
.file-info, .incoming-file {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.file-icon-wrap {
    width: 36px;
    height: 36px;
    color: var(--accent-beige);
    flex-shrink: 0;
}

.file-icon-wrap svg {
    width: 100%;
    height: 100%;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    display: block;
    font-weight: 600;
    font-size: var(--font-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    display: block;
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-top: 1px;
}

.send-btn, .accept-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-family: var(--font-family);
    font-size: var(--font-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.send-btn:hover, .accept-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(250,129,18,0.35);
}

.send-btn:disabled, .accept-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.send-btn svg, .accept-btn svg {
    width: 14px;
    height: 14px;
}

/* ═══ Progress Bar ═══ */
.transfer-progress {
    margin-top: var(--space-md);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.progress-label {
    font-size: var(--font-xs);
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-percent {
    font-size: var(--font-xs);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.progress-bar-track {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 80ms linear;
    position: relative;
    box-shadow: 0 0 16px rgba(250,129,18,0.5);
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: var(--font-xs);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}

.streaming-label {
    margin-top: 6px;
    font-size: var(--font-xs);
    color: var(--accent-orange);
    text-align: center;
    letter-spacing: 0.02em;
    opacity: 0.8;
    animation: pulseGlow 2s ease-in-out infinite;
}

/* ═══ Transfer Complete ═══ */
.transfer-done {
    text-align: center;
    padding: var(--space-lg) 0;
}

.done-icon {
    width: 56px;
    height: 56px;
    color: var(--accent-green);
    margin: 0 auto var(--space-md);
    animation: scaleIn 0.5s var(--ease-spring);
}

@keyframes scaleIn {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.transfer-done h3 {
    font-size: var(--font-lg);
    font-weight: 650;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.done-hash {
    font-size: var(--font-xs);
    color: var(--text-muted);
    font-family: var(--font-mono);
    word-break: break-all;
    margin-bottom: 4px;
}

.integrity-check {
    font-size: var(--font-sm);
    font-weight: 600;
    margin-bottom: var(--space-md);
}

.integrity-check.pass {
    color: var(--accent-green);
}

.integrity-check.fail {
    color: var(--accent-red);
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 28px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-family: var(--font-family);
    font-size: var(--font-sm);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-base);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(250,129,18,0.35);
}

.download-btn svg {
    width: 16px;
    height: 16px;
}

/* ═══ Receiver Room Input ═══ */
.room-input-section {
    text-align: center;
}

.room-code-input-wrap {
    display: flex;
    gap: var(--space-sm);
    max-width: 340px;
    margin: 0 auto;
}

.room-input {
    flex: 1;
    padding: 10px var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--font-lg);
    font-weight: 600;
    letter-spacing: 0.18em;
    text-align: center;
    text-transform: uppercase;
    transition: all var(--transition-fast);
    outline: none;
}

.room-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.1em;
}

.room-input:focus {
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(250,129,18,0.12);
}

.join-btn {
    padding: 10px 24px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: var(--font-family);
    font-size: var(--font-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.join-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(250,129,18,0.35);
}

/* Waiting section */
.waiting-section {
    text-align: center;
    padding: var(--space-xl) 0;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    font-size: var(--font-sm);
}

/* ═══ Folder Tree View ═══ */
.folder-tree-section {
    margin-top: var(--space-md);
}

.folder-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.folder-header-icon {
    width: 36px;
    height: 36px;
    color: var(--accent-amber);
    flex-shrink: 0;
}

.folder-header-icon svg {
    width: 100%;
    height: 100%;
}

.folder-header-info {
    flex: 1;
    min-width: 0;
}

.folder-header-name {
    font-weight: 650;
    font-size: var(--font-base);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-header-meta {
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-top: 1px;
}

.tree-container {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    max-height: 280px;
    overflow-y: auto;
    padding: var(--space-sm);
    margin-bottom: var(--space-md);
}

.tree-container::-webkit-scrollbar {
    width: 4px;
}

.tree-container::-webkit-scrollbar-track {
    background: transparent;
}

.tree-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: var(--radius-xs);
    font-size: var(--font-xs);
    transition: background var(--transition-fast);
    cursor: pointer;
}

.tree-item:hover {
    background: rgba(255,255,255,0.04);
}

.tree-item.dir {
    color: var(--accent-amber);
    font-weight: 500;
}

.tree-item.file {
    color: var(--text-secondary);
}

.tree-checkbox {
    width: 14px;
    height: 14px;
    accent-color: var(--accent-orange);
    cursor: pointer;
    flex-shrink: 0;
}

.tree-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.7;
}

.tree-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-size {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.tree-indent {
    display: inline-block;
    width: 16px;
    flex-shrink: 0;
}

.folder-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    flex-wrap: wrap;
}

.select-all-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: var(--font-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.select-all-toggle:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* ═══ Per-File Progress (Folder Mode) ═══ */
.file-progress-list {
    margin-top: var(--space-md);
}

.file-progress-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 6px var(--space-sm);
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: var(--font-xs);
}

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

.file-progress-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.file-progress-icon.pending { color: var(--text-muted); }
.file-progress-icon.active { color: var(--accent-orange); animation: pulseGlow 1s ease-in-out infinite; }
.file-progress-icon.done { color: var(--accent-green); }
.file-progress-icon.error { color: var(--accent-red); }

.file-progress-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

.file-progress-status {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ═══ Completed File List (Download Buttons) ═══ */
.completed-files {
    margin-top: var(--space-md);
    max-height: 240px;
    overflow-y: auto;
}

.completed-file-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 8px var(--space-sm);
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

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

.completed-file-name {
    flex: 1;
    min-width: 0;
    font-size: var(--font-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

.completed-file-hash {
    font-size: 10px;
    font-family: var(--font-mono);
    padding: 1px 6px;
    border-radius: var(--radius-xs);
}

.completed-file-hash.pass {
    color: var(--accent-green);
    background: rgba(34,197,94,0.1);
}

.completed-file-hash.fail {
    color: var(--accent-red);
    background: rgba(239,68,68,0.1);
}

.completed-file-dl {
    padding: 3px 10px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.completed-file-dl:hover {
    border-color: var(--accent-beige);
    color: var(--accent-beige);
}

.dl-all-zip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 22px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-family: var(--font-family);
    font-size: var(--font-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    margin-top: var(--space-md);
}

.dl-all-zip:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(250,129,18,0.35);
}

.dl-all-zip svg {
    width: 16px;
    height: 16px;
}

/* ═══ Footer ═══ */
.footer {
    text-align: center;
    padding: var(--space-md) var(--space-lg);
    color: var(--text-muted);
    font-size: var(--font-xs);
    position: relative;
    z-index: 2;
}

.footer-hint {
    margin-top: 2px;
    font-size: 10px;
    color: var(--accent-orange);
    opacity: 0.6;
}

/* ═══ Responsive ═══ */
@media (max-width: 640px) {
    .header {
        padding: var(--space-sm) var(--space-md);
    }

    .main {
        padding: var(--space-md);
        align-items: flex-start;
        padding-top: var(--space-lg);
    }

    .mode-cards {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .mode-card {
        padding: var(--space-lg) var(--space-md);
    }

    .glass-card {
        padding: var(--space-lg);
        border-radius: var(--radius-lg);
    }

    .hero-title {
        font-size: var(--font-2xl);
    }

    .hero-subtitle {
        font-size: var(--font-sm);
    }

    .file-info {
        flex-direction: column;
        text-align: center;
    }

    .room-code-input-wrap {
        flex-direction: column;
    }

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

@media (min-width: 641px) and (max-width: 900px) {
    .mode-cards {
        grid-template-columns: 1fr 1fr;
    }
    .mode-cards .mode-card:nth-child(3) {
        grid-column: 1 / -1;
    }
}

/* ═══ Reduced Motion ═══ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .bg-mesh::before,
    .bg-mesh::after,
    .bg-mesh-extra {
        animation: none;
    }
}
