:root {
    --bg: #0f172a;
    --card: #1e293b;
    --border: #334155;
    --text: #f8fafc;
    --text-light: #94a3b8;
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --primary-light: #312e81;
    --success: #10b981;
    --success-bg: #064e3b;
    --error: #f87171;
    --error-bg: #7f1d1d;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--primary);
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 1000;
    border-radius: 0 0 var(--radius-sm) 0;
    text-decoration: none;
    font-weight: 600;
}
.skip-link:focus { top: 0; }
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15,23,42,0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.logo-icon { font-size: 1.4rem; }
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}
.hamburger[aria-expanded=true] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger[aria-expanded=true] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded=true] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav { display: flex; gap: 0.25rem; }
.nav-link {
    color: var(--text-light);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
    min-height: 44px;
    display: flex;
    align-items: center;
}
.nav-link:hover, .nav-link:focus-visible { background: var(--primary-light); color: var(--primary); }
.main { flex: 1; padding: 1.5rem 1rem; }
.container { max-width: 640px; margin: 0 auto; }
.title {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--card);
    min-height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}
.upload-zone:hover, .upload-zone:focus-visible {
    border-color: var(--primary);
    background: var(--primary-light);
    outline: none;
}
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.01);
}
.upload-icon { font-size: 2.5rem; }
.upload-text { font-weight: 600; color: var(--text); }
.upload-subtext { color: var(--text-light); font-size: 0.875rem; }
.upload-limit { color: var(--text-light); font-size: 0.75rem; margin-top: 0.25rem; }

.file-list { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--card);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.file-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    background: #111827;
    flex-shrink: 0;
}
.file-info { flex: 1; min-width: 0; }
.file-name {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-size { font-size: 0.75rem; color: var(--text-light); }
.file-status { font-size: 0.75rem; font-weight: 500; }
.file-status.success { color: var(--success); }
.file-status.error { color: var(--error); }
.file-remove {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
}
.file-remove:hover, .file-remove:focus-visible { color: var(--error); }
.actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    justify-content: center;
}
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s, transform 0.1s;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #475569; }

.progress { margin-top: 1.25rem; text-align: center; }
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #c084fc);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}
.progress-text { margin-top: 0.5rem; font-size: 0.85rem; color: var(--text-light); }

.results { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--success-bg);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid #065f46;
}
.result-item .file-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
}
.result-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.result-download {
    background: var(--success);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    transition: background 0.15s;
    white-space: nowrap;
}
.result-download:hover { background: #059669; }

.batch-download { margin-top: 1rem; text-align: center; }

.footer {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--text-light);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}

.hidden { display: none !important; }

@media (max-width: 768px) {
    .hamburger { display: flex; }
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(15,23,42,0.98);
        flex-direction: column;
        padding: 0.5rem;
        border-bottom: 1px solid var(--border);
    }
    .nav.open { display: flex; }
    .nav-link { padding: 0.75rem 1rem; }
    .title { font-size: 1.5rem; }
    .upload-zone { padding: 2rem 1rem; }
}

@media (max-width: 480px) {
    .actions { flex-direction: column; }
    .actions .btn { width: 100%; justify-content: center; }
    .file-item { flex-wrap: wrap; }
    .result-item { flex-wrap: wrap; }
    .batch-download .btn { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
