
:root {
    --bg: #0a0a0a;
    --surface: #111111;
    --surface-hover: #161616;
    --border: #1a1a1a;
    --border-hover: #2a2a2a;
    --text: #e8e8e8;
    --text-muted: #6b6b6b;
    --accent: #00e87b;
    --accent-dim: #00e87b22;
    --accent-glow: #00e87b15;
    --error: #ff5c5c;
    --error-bg: #ff5c5c15;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
body { padding: 32px 20px; position: relative; overflow-x: hidden; }
body::before, body::after {
    content: ''; position: fixed; width: 500px; height: 500px;
    background: radial-gradient(circle, var(--accent-glow), transparent 70%);
    pointer-events: none; z-index: 0;
}
body::before { top: -200px; left: -200px; }
body::after { bottom: -200px; right: -200px; }
.container { max-width: 1100px; margin: 0 auto; position: relative; z-index: 1; }

.header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; margin-bottom: 8px; flex-wrap: wrap;
}
.site-title {
    font-weight: 700; font-size: 36px; letter-spacing: -0.02em;
    display: flex; align-items: center; gap: 12px;
}
.site-title .accent { color: var(--accent); }
.site-title img { width: 46px; height: 46px; object-fit: contain; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.current-path {
    text-align: left; color: var(--text-muted); font-size: 13px;
    margin-bottom: 24px; margin-top: 8px; word-break: break-all;
}
.current-path .label { color: var(--accent); }

.controls {
    display: flex; gap: 8px; margin-bottom: 18px;
    flex-wrap: wrap; align-items: center;
}
.btn {
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); padding: 9px 16px;
    border-radius: 8px; cursor: pointer; font-size: 13px;
    font-family: 'JetBrains Mono', monospace; text-decoration: none;
    display: inline-flex; align-items: center; gap: 8px;
    transition: all 0.15s ease; white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-hover); color: var(--accent); }
.btn.active, .btn.btn-accent {
    background: var(--accent-dim); border-color: var(--accent); color: var(--accent);
}
.btn.btn-accent:hover { background: var(--accent); color: var(--bg); }

.file-list {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden; position: relative;
}
.file-list::before {
    content: ''; position: absolute; top: 0; left: 24px; right: 24px;
    height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.4;
}
.file-item {
    display: grid;
    grid-template-columns: 40px 1fr auto auto;
    gap: 18px; align-items: center; padding: 13px 22px;
    border-bottom: 1px solid var(--border); transition: opacity 0.25s ease, transform 0.25s ease, background 0.15s ease;
}
body.has-actions .file-item {
    grid-template-columns: 40px 1fr auto auto 76px;
}
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--surface-hover); }
.file-item.removing { opacity: 0; transform: translateX(20px); }

.icon {
    font-size: 20px; display: flex; align-items: center;
    justify-content: center; color: var(--text-muted);
}
.file-item:hover .icon { color: var(--accent); }
.parent-dir .icon { color: var(--accent); }
.icon .fa-folder, .icon .fa-box-archive { color: var(--accent); }

.file-name {
    color: var(--text); text-decoration: none; font-size: 13.5px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    transition: color 0.15s ease;
}
.file-name:hover { color: var(--accent); }
.file-size, .file-date {
    color: var(--text-muted); font-size: 12.5px; white-space: nowrap;
}
.file-size { text-align: right; }

.file-actions { display: flex; justify-content: flex-end; gap: 4px; }
.action-btn {
    background: transparent; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 13px; padding: 6px 8px;
    border-radius: 6px; transition: all 0.15s ease;
    display: inline-flex; align-items: center; justify-content: center;
}
.archive-btn:hover { color: #ff9a3c; background: rgba(255, 154, 60, 0.12); }
.delete-btn:hover { color: var(--error); background: var(--error-bg); }
.action-btn:disabled { opacity: 0.4; cursor: wait; }

.footer {
    text-align: center; color: var(--text-muted); font-size: 12px;
    margin-top: 32px; letter-spacing: 0.05em;
}
.footer .accent { color: var(--accent); }

/* ---------- card (login / upload) ---------- */
.card {
    max-width: 460px; margin: 40px auto; background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px;
    padding: 36px 32px 28px; position: relative;
}
.card::before {
    content: ''; position: absolute; top: 0; left: 24px; right: 24px;
    height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.4;
}
.card.card-upload { padding-top: 20px; }
.card-top-bar {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 8px; gap: 10px;
}
.card-top-bar a {
    color: var(--text-muted); text-decoration: none; font-size: 12px;
    display: inline-flex; align-items: center; gap: 6px;
    transition: color 0.15s ease;
}
.card-top-bar a:hover { color: var(--accent); }

/* Logout is a POST form now (CSRF-safe vs. GET); make it render like the old links */
.inline-form { display: inline-flex; margin: 0; }
.linklike {
    background: none; border: none; padding: 0; cursor: pointer;
    font-family: inherit; color: var(--text-muted); font-size: 12px;
    display: inline-flex; align-items: center; gap: 6px;
    transition: color 0.15s ease;
}
.linklike:hover { color: var(--accent); }

.card h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.card .subtitle { color: var(--text-muted); font-size: 12.5px; margin-bottom: 24px; }
.card.center h2 { text-align: center; }
.card.center .subtitle { text-align: center; }
.card .subtitle-line { display: block; }
.card .subtitle-line + .subtitle-line { margin-top: 3px; }

.field { margin-bottom: 14px; }
.field label {
    display: block; color: var(--text-muted);
    font-size: 12px; margin-bottom: 6px;
}
.field input[type=text], .field input[type=password] {
    width: 100%; background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 11px 14px; color: var(--text);
    font-family: 'JetBrains Mono', monospace; font-size: 13px;
    transition: border 0.15s ease;
}
.field input:focus { outline: none; border-color: var(--accent); }

/* One-time-code input — big, centered, monospace */
.otp-input {
    text-align: center !important;
    font-size: 28px !important;
    letter-spacing: 0.4em;
    padding: 16px 14px !important;
    font-weight: 700;
    /* Make placeholder readable but muted */
}
.otp-input::placeholder { color: var(--text-muted); opacity: 0.4; letter-spacing: 0.4em; }

/* Trust-this-device checkbox */
.field-checkbox { margin-bottom: 8px; }
.trust-toggle {
    display: inline-flex !important; align-items: center; gap: 10px;
    cursor: pointer; color: var(--text-muted); font-size: 12.5px;
    user-select: none; padding: 6px 4px;
}
.trust-toggle input[type=checkbox] {
    width: 16px; height: 16px;
    appearance: none; -webkit-appearance: none;
    background: var(--bg); border: 1.5px solid var(--border-hover);
    border-radius: 4px; cursor: pointer; position: relative;
    transition: all 0.15s ease;
    margin: 0;
}
.trust-toggle input[type=checkbox]:checked {
    background: var(--accent); border-color: var(--accent);
}
.trust-toggle input[type=checkbox]:checked::after {
    content: '\2713'; position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -52%);
    color: var(--bg); font-size: 13px; font-weight: 900;
}
.trust-toggle:hover { color: var(--text); }

/* 2FA success screen — big pulsing green check */
.success-mark {
    display: flex; justify-content: center; align-items: center;
    margin: 6px auto 18px;
    width: 72px; height: 72px;
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 38px;
    animation: success-pulse 1.2s ease-in-out infinite;
}
@keyframes success-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 232, 123, 0.35); }
    50%      { box-shadow: 0 0 0 12px rgba(0, 232, 123, 0); }
}
/* Animated trailing dots: . .. ... . .. ... */
.dots { display: inline-block; }
.dots span {
    opacity: 0;
    animation: dot-blink 1.4s infinite;
}
.dots span:nth-child(1) { animation-delay: 0s; }
.dots span:nth-child(2) { animation-delay: 0.25s; }
.dots span:nth-child(3) { animation-delay: 0.5s; }
@keyframes dot-blink {
    0%, 80%, 100% { opacity: 0; }
    40%           { opacity: 1; }
}

/* Custom file drop zone */
.file-drop {
    position: relative; display: block;
    border: 1.5px dashed var(--border-hover); border-radius: 10px;
    padding: 28px 20px; text-align: center; cursor: pointer;
    transition: all 0.15s ease; background: var(--bg);
}
.file-drop:hover, .file-drop.dragover {
    border-color: var(--accent); background: var(--accent-glow);
}
.file-drop input[type=file] {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
}
.file-drop-icon {
    font-size: 32px; color: var(--text-muted); margin-bottom: 10px;
    transition: color 0.15s ease;
}
.file-drop:hover .file-drop-icon, .file-drop.dragover .file-drop-icon {
    color: var(--accent);
}
.file-drop-text {
    color: var(--text); font-size: 13px; margin-bottom: 4px; font-weight: 500;
}
.file-drop-hint { color: var(--text-muted); font-size: 11.5px; }
.file-drop-name { color: var(--accent); font-size: 12.5px; word-break: break-all; }

/* Upload progress — dual-layer text, dark on filled side, light on empty side */
.progress {
    display: none; margin-top: 16px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; overflow: hidden; position: relative; height: 28px;
}
.progress.active { display: block; }
.progress-bar {
    position: absolute; top: 0; left: 0; height: 100%; width: 0%;
    background: var(--accent); transition: width 0.2s ease;
}
.progress-text {
    position: absolute; inset: 0; display: flex;
    align-items: center; justify-content: center;
    font-size: 11.5px; font-weight: 500; pointer-events: none;
}
.progress-text-bg { color: var(--text); z-index: 1; }
.progress-text-fg {
    color: var(--bg); z-index: 2;
    clip-path: inset(0 calc(100% - var(--pct, 0%)) 0 0);
}

/* ---------- multi-file upload queue ---------- */
.upload-queue {
    margin-top: 16px;
    display: flex; flex-direction: column; gap: 8px;
}
.queue-item {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 10px 14px;
    text-align: left;
}
.queue-head {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 6px; font-size: 13px;
}
.queue-icon { color: var(--text-muted); font-size: 14px; }
.queue-name {
    flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--text);
}
.queue-status {
    font-size: 11px; padding: 2px 8px; border-radius: 4px;
    background: var(--surface-hover); color: var(--text-muted);
    text-transform: lowercase; letter-spacing: 0.03em;
    font-weight: 500; flex-shrink: 0;
}
.queue-status[data-status="uploading"] { color: var(--accent); }
.queue-status[data-status="done"]      { color: var(--accent); background: var(--accent-dim); }
.queue-status[data-status="failed"]    { color: var(--error);  background: var(--error-bg); }
.queue-progress {
    height: 4px; background: var(--surface-hover);
    border-radius: 3px; overflow: hidden;
}
.queue-bar {
    height: 100%; width: 0%; background: var(--accent);
    transition: width 0.2s ease;
}
.queue-meta {
    font-size: 11px; color: var(--text-muted); margin-top: 5px;
    font-family: 'JetBrains Mono', monospace;
}
.queue-item[data-failed="true"] .queue-bar { background: var(--error); }

.submit-btn {
    width: 100%; background: var(--accent); color: var(--bg);
    border: none; padding: 13px; border-radius: 8px;
    font-family: 'JetBrains Mono', monospace; font-size: 13px;
    font-weight: 700; cursor: pointer; transition: all 0.15s ease;
    margin-top: 16px; display: inline-flex; align-items: center;
    justify-content: center; gap: 8px;
}
.submit-btn:hover:not(:disabled) { background: #00ff88; transform: translateY(-1px); }
.submit-btn:active { transform: translateY(0); }
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.error, .success {
    padding: 10px 14px; border-radius: 8px; font-size: 12.5px;
    margin-bottom: 16px; transition: opacity 0.6s ease, transform 0.6s ease;
}
.error {
    background: var(--error-bg); color: var(--error); border: 1px solid var(--error);
}
.success {
    background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent);
}
.fade-out { opacity: 0; transform: translateY(-8px); }

.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-muted); text-decoration: none; font-size: 12px;
    transition: color 0.15s ease;
}
.back-link:hover { color: var(--accent); }

/* ---------- mobile ---------- */
@media (max-width: 768px) {
    body { padding: 20px 14px; }
    .header {
        flex-direction: column; align-items: center; gap: 16px; text-align: center;
    }
    .site-title { font-size: 30px; justify-content: center; }
    .site-title img { width: 38px; height: 38px; }
    .header-actions { justify-content: center; width: 100%; }
    .current-path { text-align: center; font-size: 13px; }
    .controls {
        display: grid; grid-template-columns: 52px 1fr 1fr 1fr 1fr;
        gap: 6px; width: 100%;
    }
    .controls .btn { padding: 10px 8px; font-size: 12px; justify-content: center; }
    .file-item { grid-template-columns: 32px 1fr; gap: 14px; padding: 14px 16px; }
    body.has-actions .file-item { grid-template-columns: 32px 1fr 86px; }
    body.has-actions.single-action .file-item { grid-template-columns: 32px 1fr 44px; }
    .file-size, .file-date { display: none; }
    .icon { font-size: 20px; width: 28px; }
    .apk-icon { width: 22px; height: 22px; border-radius: 5px; }   /* <- tune mobile size here */
    .file-name { font-size: 14px; }

    /* On mobile, give archive button a visible orange tint so it's
       distinguishable from the trash icon without needing to hover. */
    .archive-btn {
        color: #ff9a3c;
        background: rgba(255, 154, 60, 0.08);
    }
    .delete-btn {
        color: #d98080;
    }
    .action-btn { padding: 8px 10px; font-size: 15px; }

    .card { padding: 28px 22px 22px; margin: 20px auto; }
    .card h2 { font-size: 20px; }
    .file-drop { padding: 24px 16px; }
    .file-drop-icon { font-size: 28px; }
}

@media (max-width: 560px) {
    .controls {
        grid-template-columns: 48px 1fr 1fr;
        align-items: stretch;
    }
    .controls .btn[href="/"] { grid-column: 1; grid-row: 1 / 3; }
    .controls .btn[data-sort="name"] { grid-column: 2; grid-row: 1; }
    .controls .btn[data-sort="date"] { grid-column: 3; grid-row: 1; }
    .controls .btn[data-sort="size"] { grid-column: 2; grid-row: 2; }
    .controls .btn[data-sort="type"] { grid-column: 3; grid-row: 2; }
}

/* ---------- README rendering ---------- */
.readme {
    margin-top: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 32px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.65;
    position: relative;
    overflow: hidden;
}
.readme::before {
    content: ''; position: absolute; top: 0; left: 24px; right: 24px;
    height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.4;
}
.readme h1, .readme h2, .readme h3, .readme h4, .readme h5, .readme h6 {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-top: 1.6em;
    margin-bottom: 0.6em;
    color: var(--text);
}
.readme h1:first-child, .readme h2:first-child, .readme h3:first-child { margin-top: 0; }
.readme h1 { font-size: 26px; color: var(--accent); }
.readme h2 { font-size: 20px; }
.readme h3 { font-size: 17px; }
.readme h4 { font-size: 15px; color: var(--text-muted); }
.readme p { margin: 0.85em 0; }
.readme a {
    color: var(--accent); text-decoration: none;
    border-bottom: 1px dashed transparent;
    transition: border-color 0.15s ease;
}
.readme a:hover { border-bottom-color: var(--accent); }
.readme strong { color: var(--text); font-weight: 700; }
.readme em { color: var(--text); }
.readme ul, .readme ol { margin: 0.7em 0; padding-left: 1.8em; }
.readme li { margin: 0.3em 0; }
.readme li::marker { color: var(--accent); }
.readme code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 2px 6px;
    font-size: 0.92em;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
}
.readme pre {
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    overflow-x: auto;
    margin: 1em 0;
    font-size: 12.5px;
    line-height: 1.55;
    position: relative;
}
.readme pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: #e8e8e8;
    font-family: 'JetBrains Mono', monospace;
    font-size: inherit;
    display: block;
}
/* Tweak github-dark to lean a bit greener for keyword highlights */
.readme .hljs-keyword,
.readme .hljs-built_in,
.readme .hljs-title.function_ { color: #00e87b !important; }
.readme .hljs-string { color: #b5e3a8 !important; }
.readme .hljs-comment { color: #6b6b6b !important; font-style: italic; }
.readme .hljs-number,
.readme .hljs-literal { color: #ff9a3c !important; }
.readme blockquote {
    border-left: 3px solid var(--accent);
    background: var(--accent-glow);
    margin: 1em 0;
    padding: 8px 14px;
    color: var(--text-muted);
    border-radius: 0 6px 6px 0;
}
.readme hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-hover), transparent);
    margin: 1.6em 0;
}
.readme table {
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 13px;
}
.readme th, .readme td {
    border: 1px solid var(--border);
    padding: 7px 12px;
    text-align: left;
}
.readme th { background: var(--surface-hover); color: var(--accent); font-weight: 700; }
.readme img { max-width: 100%; border-radius: 8px; }

/* Admonitions */
.admonition {
    margin: 1.2em 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    overflow: hidden;
}
.admonition-title {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px;
    font-weight: 700;
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}
.admonition-body { padding: 4px 18px 14px; }
.admonition-body > :first-child { margin-top: 0.6em; }
.admonition-body > :last-child { margin-bottom: 0; }
.admonition-note    { border-left: 3px solid var(--text-muted); }
.admonition-note    .admonition-title { color: var(--text); }
.admonition-info    { border-left: 3px solid #4aa3ff; }
.admonition-info    .admonition-title { color: #4aa3ff; }
.admonition-warn    { border-left: 3px solid #ff9a3c; }
.admonition-warn    .admonition-title { color: #ff9a3c; }
.admonition-important { border-left: 3px solid #d96cf2; }
.admonition-important .admonition-title { color: #d96cf2; }
.admonition-success { border-left: 3px solid var(--accent); }
.admonition-success .admonition-title { color: var(--accent); }
.admonition-tip     { border-left: 3px solid #ffd84a; }
.admonition-tip     .admonition-title { color: #ffd84a; }

@media (max-width: 768px) {
    .readme { padding: 22px 20px; font-size: 13.5px; }
    .readme h1 { font-size: 22px; }
    .readme h2 { font-size: 17px; }
    .admonition-body { padding: 4px 14px 12px; }
}

/* Footer link row on login/2FA cards (was an inline style attribute;
   strict CSP forbids those now) */
.card-foot { text-align: center; margin-top: 18px; }

/* Destination picker on the upload page */
.dest-field { text-align: left; margin-bottom: 14px; }
.dest-select {
    width: 100%; background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
    padding: 10px 12px; font-family: 'JetBrains Mono', monospace;
    font-size: 13px; cursor: pointer;
}
.dest-select:focus { outline: none; border-color: var(--accent); }

/* "Logout everywhere" control on the upload page */
.danger-zone { margin-top: 26px; text-align: center; }
.linklike.danger:hover { color: #ff5566; }

/* Copy-to-clipboard button on README code blocks (injected by app.js) */
.code-copy-btn {
    position: absolute; top: 8px; right: 8px;
    background: var(--surface); color: var(--text-muted);
    border: 1px solid var(--border); border-radius: 6px;
    padding: 5px 8px; font-size: 12px; line-height: 1;
    font-family: 'JetBrains Mono', monospace; cursor: pointer;
    opacity: 0; transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.readme pre:hover .code-copy-btn,
.code-copy-btn:focus-visible { opacity: 1; }
.code-copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.code-copy-btn.copied { color: var(--accent); border-color: var(--accent); opacity: 1; }

/* Real launcher icons for .apk files (extracted server-side).
   Launcher artwork ships with built-in transparent padding, so these are
   sized close to the full icon column to read at the same visual weight
   as the Font Awesome glyphs. */
.apk-icon {
    width: 24px; height: 24px;   /* <- tune desktop size here */
    border-radius: 5px;
    object-fit: contain;
    display: block;
}

@media (max-width: 768px) {
    /* zip lives in the desktop toolbar only — pointless on a phone */
    .zip-btn { display: none; }
    /* no hover on touch screens — keep the copy button visible */
    .code-copy-btn { opacity: 1; }
}
