:root {
  color-scheme: light;
  --bg: #f5f4f0;
  --surface: #fff;
  --surface-soft: #f2f2ed;
  --border: #e7e6df;
  --border-strong: #dedfd7;
  --divider: #efeee9;
  --text: #20231f;
  --muted: #71756d;
  --faint: #92958c;
  --accent: #d9f36a;
  --accent-ink: #526329;
  --accent-soft: #e8edda;
  --accent-strong: #a2bd36;
  --focus: #899c40;
  --button: #20231f;
  --button-hover: #41463a;
  --button-text: #fff;
  --quiet: #f0f1eb;
  --quiet-hover: #e2e5d7;
  --quiet-text: #41463a;
  --danger-bg: #f7e9e6;
  --danger-bg-hover: #f0d9d4;
  --danger: #963b31;
  --ok: #4f7a1e;
  --track: #eceee7;
  --shadow: 0 12px 40px #252a1510;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-synthesis: none;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #161815;
    --surface: #1f221e;
    --surface-soft: #2a2e28;
    --border: #2f332d;
    --border-strong: #3a3f37;
    --divider: #2a2e28;
    --text: #eceee6;
    --muted: #a3a79c;
    --faint: #868a80;
    --accent-ink: #d9f36a;
    --accent-soft: #31391c;
    --accent-strong: #b7d64a;
    --focus: #b7d64a;
    --button: #d9f36a;
    --button-hover: #c6e252;
    --button-text: #1b1e14;
    --quiet: #2a2e28;
    --quiet-hover: #353a32;
    --quiet-text: #dfe2d8;
    --danger-bg: #3a2320;
    --danger-bg-hover: #4a2b27;
    --danger: #f0a79c;
    --ok: #b7d64a;
    --track: #2f332d;
    --shadow: 0 12px 40px #00000040;
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  padding: max(40px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: var(--bg);
  color: var(--text);
}
main { max-width: 760px; margin: 0 auto; }
[hidden] { display: none !important; }

header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 30px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 750; letter-spacing: -.04em; }
.logo { width: 38px; height: 38px; border-radius: 12px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.status { color: var(--ok); font-size: 13px; white-space: nowrap; }
.status.offline { color: var(--danger); }

h1 { max-width: 540px; margin: 0; font-size: clamp(36px, 8vw, 60px); line-height: 1; letter-spacing: -.06em; }
h2 { margin: 0; font-size: 17px; letter-spacing: -.03em; }
.intro { margin: 16px 0 24px; color: var(--muted); font-size: 16px; line-height: 1.6; }
.hint { margin: -8px 0 22px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--text); font-size: 13px; line-height: 1.5; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 41px; padding: 0 16px; border: 0; border-radius: 10px;
  background: var(--button); color: var(--button-text);
  font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; text-decoration: none;
}
button:hover, .button:hover { background: var(--button-hover); }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, .button:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.install { min-height: 34px; padding: 0 12px; }
.link { min-height: 0; padding: 0; background: none; color: var(--muted); font-weight: 500; text-decoration: underline; }
.link:hover { background: none; color: var(--text); }

.panel { display: grid; max-width: 440px; gap: 12px; padding: 24px; margin: 50px auto 0; border: 1px solid var(--border); border-radius: 19px; background: var(--surface); box-shadow: var(--shadow); }
.panel h1 { font-size: 29px; letter-spacing: -.05em; }
.panel p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.panel b { color: var(--text); }
.form { display: grid; gap: 6px; margin-top: 4px; }
.form label { margin-top: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.form input, .search-input {
  width: 100%; min-height: 42px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 15px;
}
.form input:focus, .search-input:focus { border-color: var(--focus); outline: 2px solid var(--accent); }
.form button { margin-top: 12px; }
.panel .message { min-height: 18px; color: var(--danger); font-size: 13px; }

.card { overflow: hidden; border: 1px solid var(--border); border-radius: 19px; background: var(--surface); box-shadow: var(--shadow); }
.drop { display: grid; min-height: 220px; padding: 28px; margin: 14px; place-content: center; justify-items: center; border: 2px dashed var(--border-strong); border-radius: 15px; text-align: center; transition: background .15s, border-color .15s; }
.drop.dragging { border-color: var(--accent-strong); background: var(--accent-soft); }
.upload-icon { display: grid; width: 48px; height: 48px; place-items: center; margin-bottom: 14px; border-radius: 15px; background: var(--accent-soft); color: var(--accent-ink); font-size: 23px; }
.drop strong { font-size: 16px; }
.drop p { margin: 7px 0 16px; color: var(--faint); font-size: 14px; }
.drop .upload-note { margin: 11px 0 0; font-size: 12px; }
.drop-text-touch { display: none; }
@media (pointer: coarse) { .drop-text { display: none; } .drop-text-touch { display: block; } }
.file-input { display: none; }

.uploads { padding: 0 20px 18px; }
.uploads-summary { color: var(--muted); font-size: 13px; }
.upload-list { display: grid; gap: 10px; margin: 10px 0 0; padding: 0; list-style: none; }
.upload-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13px; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-state { color: var(--faint); font-variant-numeric: tabular-nums; }
.upload-row .progress { grid-column: 1 / -1; margin: 0; }
.upload-row.failed .upload-state { color: var(--danger); }
.upload-row.failed .upload-reason { grid-column: 1 / -1; color: var(--danger); font-size: 12px; line-height: 1.45; }
.upload-row.failed .progress { display: none; }

.progress { height: 5px; overflow: hidden; border-radius: 5px; background: var(--track); }
.progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent-strong); transition: width .15s; }

.usage { margin: 22px 2px 0; }
.usage-text { margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.usage.full .usage-text { color: var(--danger); }
.usage.full .progress span { background: var(--danger); }

.files { margin-top: 26px; }
.files-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.files-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
.count { margin-left: 5px; color: var(--faint); font-size: 13px; font-weight: 450; }
.refresh { min-height: 34px; padding: 0 11px; background: transparent; color: var(--muted); }
.refresh:hover { background: var(--quiet); color: var(--text); }
.select-all { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; cursor: pointer; white-space: nowrap; }
.file-select { width: 18px; height: 18px; flex: 0 0 18px; margin: 0; accent-color: #819b2c; cursor: pointer; }
.delete-selected { min-height: 34px; padding: 0 11px; background: var(--danger-bg); color: var(--danger); }
.delete-selected:hover { background: var(--danger-bg-hover); }
.search-input { margin-bottom: 12px; font-size: 14px; }
.files-message { margin: 0 2px 12px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.file-list { overflow: hidden; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); }
.file-row { display: flex; align-items: center; gap: 13px; min-height: 68px; padding: 12px 16px; }
.file-row + .file-row { border-top: 1px solid var(--divider); }
.file-icon { display: grid; flex: 0 0 40px; height: 40px; place-items: center; border-radius: 11px; background: var(--surface-soft); color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .02em; }
.file-info { min-width: 0; flex: 1; }
.file-name { display: block; overflow: hidden; color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
a.file-name:hover { text-decoration: underline; }
.file-meta { margin-top: 4px; color: var(--faint); font-size: 12px; }
.download { min-height: 34px; padding: 0 11px; background: var(--quiet); color: var(--quiet-text); }
.download:hover { background: var(--quiet-hover); }
.empty { padding: 25px 16px; color: var(--muted); font-size: 14px; line-height: 1.5; text-align: center; }

.account { margin: 26px 2px 0; color: var(--faint); font-size: 12px; line-height: 1.6; }
.account b { color: var(--muted); font-weight: 600; overflow-wrap: anywhere; }

.drop-overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px; background: color-mix(in srgb, var(--bg) 82%, transparent); pointer-events: none; }
.drop-overlay span { padding: 18px 26px; border: 2px dashed var(--accent-strong); border-radius: 16px; background: var(--surface); font-size: 18px; font-weight: 700; }

@media (max-width: 560px) {
  body { padding-top: max(26px, env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  header { margin-bottom: 24px; }
  .drop { min-height: 190px; padding: 20px; margin: 10px; }
  .files-toolbar { align-items: flex-start; flex-direction: column; }
  .files-actions { justify-content: flex-start; }
  .file-row { gap: 10px; padding: 10px 12px; }
  .file-icon { flex-basis: 36px; height: 36px; }
  .download { padding: 0 10px; }
}
