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

:root {
    --bg: #0a0a0f;
    --surface: #12121a;
    --surface-hover: #1a1a26;
    --border: #1e1e2e;
    --border-hover: #2e2e44;
    --accent: #00d4aa;
    --accent-hover: #00e8bb;
    --accent-glow: rgba(0, 212, 170, 0.15);
    --accent-glow-strong: rgba(0, 212, 170, 0.25);
    --text: #eaeaf0;
    --text-secondary: #7a7a96;
    --success: #00d4aa;
    --error: #ff6b6b;
    --warning: #f0a030;
    --radius: 16px;
    --radius-sm: 10px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

/* Background glow effect */
.bg-glow {
    position: fixed;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 212, 170, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    padding: 2rem 1.25rem;
    text-align: center;
}

/* ─── Header ─── */
header {
    margin-bottom: 2rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 10px;
    color: var(--bg);
}

.logo-icon svg {
    width: 20px;
    height: 20px;
}

.tagline {
    color: var(--text-secondary);
    margin-top: 0.35rem;
    font-size: 0.9rem;
    font-weight: 400;
}

/* ─── Cards ─── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    backdrop-filter: blur(8px);
}

/* ─── Drop zone ─── */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.drop-zone.has-file {
    border-color: var(--accent);
    border-style: solid;
    background: var(--accent-glow);
    padding: 1.5rem 1rem;
}

.drop-zone.has-file .drop-icon-wrap {
    width: 40px;
    height: 40px;
    margin-bottom: 0.4rem;
}

.drop-zone.has-file .drop-icon {
    width: 20px;
    height: 20px;
}

.drop-zone.has-file .drop-text {
    font-size: 0.85rem;
}

.drop-zone.has-file .drop-subtext {
    font-size: 0.75rem;
}

/* Screen-reader only (hidden file input) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.drop-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-glow);
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}

.drop-icon {
    width: 28px;
    height: 28px;
    color: var(--accent);
    transition: all 0.2s;
}

.drop-text {
    font-size: 1rem;
    font-weight: 600;
    transition: font-size 0.2s;
}

.drop-subtext {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 0.2rem;
    transition: font-size 0.2s;
}

/* ─── File list ─── */
.file-list {
    margin-top: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

.file-item + .file-item {
    border-top: 1px solid var(--border);
}

.file-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.file-item-size {
    color: var(--text-secondary);
    flex-shrink: 0;
    font-size: 0.75rem;
}

.file-item-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 0.15rem;
    border-radius: 4px;
    transition: all 0.15s;
}

.file-item-remove:hover {
    color: var(--error);
    background: rgba(255, 107, 107, 0.1);
}

.file-item-total {
    background: var(--accent-glow);
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--accent);
}

/* ─── Options grid ─── */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* ─── Form groups ─── */
.form-group {
    margin-top: 1rem;
    text-align: left;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.label-icon {
    width: 13px;
    height: 13px;
}

/* ─── Toggles row ─── */
.toggles-row {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Toggle switch */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 32px;
    height: 18px;
    background: var(--border);
    border-radius: 9px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 12px;
    height: 12px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.2s;
}

.toggle-label input:checked + .toggle-switch {
    background: var(--accent);
}

.toggle-label input:checked + .toggle-switch::after {
    left: 17px;
    background: var(--bg);
}

/* ─── Alias input ─── */
.alias-input {
    display: flex;
    align-items: stretch;
}

.alias-prefix {
    display: flex;
    align-items: center;
    padding: 0 0.6rem;
    background: var(--border);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.alias-input input {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
}

/* ─── Inputs ─── */
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* ─── Select ─── */
select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a7a96' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    padding-right: 2rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ─── Transfer progress ─── */
.transfer-progress {
    margin-top: 1rem;
}

.transfer-progress .progress-bar {
    margin-bottom: 0.4rem;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.progress-stats span:last-child {
    color: var(--accent);
    font-weight: 600;
}

#progress-speed,
#dl-speed {
    color: var(--accent);
    font-weight: 500;
}

/* ─── Progress bar ─── */
.progress-wrap {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), #00e8bb);
    border-radius: 3px;
    transition: width 0.15s ease;
}

#progress-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    min-width: 2.5rem;
    text-align: right;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn svg {
    width: 17px;
    height: 17px;
}

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

.btn-primary {
    background: var(--accent);
    color: var(--bg);
    width: 100%;
    margin-top: 1.25rem;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 20px var(--accent-glow-strong);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    margin-top: 0.75rem;
    font-size: 0.85rem;
    width: 100%;
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-copy:hover {
    background: var(--accent-hover);
}

.btn-copy.copied {
    background: var(--success);
}

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

/* ─── Spinner ─── */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(10, 10, 15, 0.3);
    border-top-color: var(--bg);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Error pages ─── */
.error-card {
    text-align: center;
}

.error-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 107, 107, 0.1);
    margin-bottom: 1rem;
}

.error-badge span {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--error);
}

.error-badge.gone {
    background: rgba(240, 160, 48, 0.1);
}

.error-badge.gone span {
    color: var(--warning);
}

.error-card h2 {
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.error-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* ─── Success page ─── */
.success-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-glow);
    margin-bottom: 1rem;
}

.success-badge svg {
    width: 28px;
    height: 28px;
    color: var(--accent);
}

.success-card h2 {
    margin-bottom: 1.25rem;
    font-weight: 700;
}

/* ─── File details ─── */
.file-details {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0;
    margin-bottom: 1.25rem;
    text-align: left;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
}

.detail-row + .detail-row {
    border-top: 1px solid var(--border);
}

.detail-label {
    color: var(--text-secondary);
}

.detail-value {
    color: var(--text);
    text-align: right;
}

.detail-value strong {
    font-weight: 600;
}

.badge-protected {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    background: rgba(255, 107, 107, 0.1);
    color: var(--error);
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-onetime {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    background: rgba(240, 160, 48, 0.1);
    color: var(--warning);
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* ─── Files list (success/download) ─── */
.files-list-small {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.files-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.files-list-item + .files-list-item {
    border-top: 1px solid var(--border);
}

.files-list-note {
    justify-content: center;
    background: var(--accent-glow);
    font-size: 0.7rem;
}

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

/* ─── Share link ─── */
.share-link {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.share-link input {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
}

/* ─── Download page ─── */
.download-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent-glow);
    margin-bottom: 1rem;
}

.download-badge svg {
    width: 32px;
    height: 32px;
    color: var(--accent);
}

.download-card h2 {
    word-break: break-all;
    margin-bottom: 0.75rem;
    font-weight: 700;
    font-size: 1.15rem;
}

/* ─── Error ─── */
.error {
    color: var(--error);
    background: rgba(255, 107, 107, 0.08);
    border: 1px solid rgba(255, 107, 107, 0.15);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    text-align: left;
}

/* ─── Utility ─── */
.hidden {
    display: none !important;
}

/* ─── Footer ─── */
footer {
    margin-top: 2rem;
}

.footer-info {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.footer-bottom a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.footer-bottom a:hover {
    text-decoration: underline;
}

.version {
    opacity: 0.5;
    font-size: 0.7rem;
}

.separator {
    opacity: 0.3;
}

/* ─── Matrix Easter Egg ─── */
#matrix-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.matrix-card {
    position: relative;
    z-index: 1;
    background: rgba(0, 8, 0, 0.85) !important;
    border-color: #00ff41 !important;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.1), inset 0 0 30px rgba(0, 255, 65, 0.03);
}

.matrix-card .file-details {
    background: rgba(0, 15, 0, 0.6);
    border-color: rgba(0, 255, 65, 0.15);
}

.matrix-card .detail-label {
    color: #00aa30;
}

.matrix-card .detail-value {
    color: #00ff41;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.matrix-card .detail-row + .detail-row {
    border-color: rgba(0, 255, 65, 0.1);
}

.matrix-card h2 {
    color: #00ff41;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.matrix-card .files-list-small {
    background: rgba(0, 15, 0, 0.6);
    border-color: rgba(0, 255, 65, 0.15);
}

.matrix-card .files-list-item {
    color: #00cc38;
}

.matrix-card .files-list-item + .files-list-item {
    border-color: rgba(0, 255, 65, 0.1);
}

.matrix-card .files-list-note {
    background: rgba(0, 255, 65, 0.05);
}

.matrix-badge {
    background: rgba(0, 255, 65, 0.1) !important;
    width: 72px !important;
    height: 72px !important;
}

.matrix-pill {
    font-size: 2rem;
}

.matrix-quote {
    color: #00aa30;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.8rem;
    font-style: italic;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.matrix-btn {
    background: #00ff41 !important;
    color: #000 !important;
    text-shadow: none;
}

.matrix-btn:hover {
    background: #33ff66 !important;
    box-shadow: 0 0 25px rgba(0, 255, 65, 0.4) !important;
}

.matrix-progress {
    background: linear-gradient(90deg, #00ff41, #33ff66) !important;
}

.matrix-card .progress-stats span {
    color: #00aa30;
}

.matrix-card .progress-stats span:last-child {
    color: #00ff41;
}

.matrix-card #dl-speed {
    color: #00ff41;
}

.matrix-card .progress-bar {
    background: rgba(0, 255, 65, 0.1);
}

.matrix-card .form-label {
    color: #00aa30;
}

.matrix-card input[type="password"] {
    background: rgba(0, 10, 0, 0.8);
    border-color: rgba(0, 255, 65, 0.25);
    color: #00ff41;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.matrix-card input[type="password"]:focus {
    border-color: #00ff41;
    box-shadow: 0 0 0 3px rgba(0, 255, 65, 0.15);
}

.matrix-card input[type="password"]::placeholder {
    color: #00aa30;
    opacity: 0.4;
}

.matrix-card .error {
    background: rgba(255, 0, 0, 0.1);
    border-color: rgba(255, 0, 0, 0.2);
    color: #ff3333;
}

.matrix-card .badge-onetime {
    background: rgba(0, 255, 65, 0.1);
    color: #00ff41;
}

.matrix-card .spinner {
    border-color: rgba(0, 0, 0, 0.2);
    border-top-color: #000;
}

.matrix-footer-text {
    color: #00aa30;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.7rem;
    margin-top: 1rem;
    opacity: 0.5;
}

.matrix-glitch {
    position: relative;
    animation: glitch 3s infinite;
}

@keyframes glitch {
    0%, 93%, 100% { opacity: 1; transform: none; }
    94% { opacity: 0.8; transform: translateX(-2px); }
    95% { opacity: 0.8; transform: translateX(2px); }
    96% { opacity: 1; transform: none; }
}

/* ─── Responsive ─── */
@media (max-width: 520px) {
    .container {
        padding: 1.5rem 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .toggles-row {
        flex-direction: column;
        gap: 0.75rem;
    }
}
