:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-tertiary: #1a1a24;
    --accent: #00d9ff;
    --accent-glow: rgba(0, 217, 255, 0.12);
    --text-primary: #e8e8ed;
    --text-secondary: #8888a0;
    --text-muted: #55556a;
    --border: #252532;
    --success: #00ff88;
    --folder-color: #ffaa00;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

.bg-pattern {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: 
        radial-gradient(ellipse at 15% 10%, rgba(0, 217, 255, 0.04) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 90%, rgba(0, 217, 255, 0.025) 0%, transparent 45%);
    will-change: transform;
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    padding: calc(1.5rem + var(--safe-top)) calc(1rem + var(--safe-right)) calc(1.5rem + var(--safe-bottom)) calc(1rem + var(--safe-left));
}

@media (min-width: 640px) {
    .container {
        padding: 3rem 2rem;
    }
}

header {
    margin-bottom: 1.5rem;
    animation: fadeIn 0.4s ease-out;
}

@media (min-width: 640px) {
    header {
        margin-bottom: 2rem;
    }
}

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

h1 {
    font-size: clamp(1.5rem, 5vw, 2.25rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-container {
    position: relative;
    margin-bottom: 1.75rem;
    animation: fadeIn 0.4s ease-out 0.1s backwards;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.search-input {
    width: 100%;
    height: 48px;
    padding: 0 3rem 0 3rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.search-input:focus {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.clear-search {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.15s ease;
    touch-action: manipulation;
}

.clear-search svg {
    width: 16px;
    height: 16px;
}

.clear-search:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.clear-search:active {
    transform: translateY(-50%) scale(0.95);
}

.icon {
    width: clamp(38px, 8vw, 46px);
    height: clamp(38px, 8vw, 46px);
    background: linear-gradient(135deg, var(--accent), #0088ff);
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: clamp(1.1rem, 3vw, 1.35rem);
    box-shadow: 0 4px 16px var(--accent-glow);
    flex-shrink: 0;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
    padding-left: calc(clamp(38px, 8vw, 46px) + 0.75rem);
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.folder-section {
    animation: fadeIn 0.4s ease-out backwards;
}

.folder-section:nth-child(1) { animation-delay: 0.05s; }
.folder-section:nth-child(2) { animation-delay: 0.1s; }
.folder-section:nth-child(3) { animation-delay: 0.15s; }
.folder-section:nth-child(4) { animation-delay: 0.2s; }
.folder-section:nth-child(5) { animation-delay: 0.25s; }

.folder-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.25rem;
    color: var(--folder-color);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

.folder-header svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.folder-files {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.file-item {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: background 0.15s ease, border-color 0.15s ease;
    will-change: transform;
}

@media (min-width: 540px) {
    .file-item {
        grid-template-columns: 1fr auto;
        align-items: center;
        padding: 0.875rem 1.125rem;
    }
}

@media (hover: hover) {
    .file-item:hover {
        background: var(--bg-tertiary);
        border-color: rgba(0, 217, 255, 0.3);
    }
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.file-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.file-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-ext {
    color: var(--accent);
}

.file-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

@media (min-width: 540px) {
    .file-actions {
        display: flex;
        gap: 0.5rem;
    }
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    user-select: none;
    touch-action: manipulation;
}

@media (min-width: 540px) {
    .btn {
        min-height: 38px;
        padding: 0 0.875rem;
    }
}

.btn:active {
    transform: scale(0.97);
}

@media (hover: hover) {
    .btn:hover {
        border-color: var(--accent);
        color: var(--accent);
        background: var(--accent-glow);
    }
}

.btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.btn.copied {
    border-color: var(--success);
    color: var(--success);
    background: rgba(0, 255, 136, 0.1);
}

.btn-download {
    background: var(--accent-glow);
    border-color: rgba(0, 217, 255, 0.4);
    color: var(--accent);
}

@media (hover: hover) {
    .btn-download:hover {
        background: var(--accent);
        color: var(--bg-primary);
        border-color: var(--accent);
    }
}

.btn-download:active {
    background: var(--accent);
    color: var(--bg-primary);
}

.toast {
    position: fixed;
    bottom: calc(1.25rem + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(calc(100% + 2rem));
    background: var(--bg-tertiary);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    z-index: 1000;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    animation: fadeIn 0.4s ease-out 0.3s backwards;
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

@media (hover: hover) {
    footer a:hover {
        text-decoration: underline;
    }
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

