:root {
  --bg: #f6f5f2; --card: #ffffff; --ink: #1d1d1b; --muted: #6a6a64; --line: #deddd6;
  --accent: #1f6feb; --accent-ink: #ffffff; --danger: #c0352b; --ok: #2a7d3f; --warn: #946200;
  --warn-bg: #fff4d6; --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211; --card: #1c1c1a; --ink: #efeee9; --muted: #a09f97; --line: #333330;
    --accent: #5b9bff; --accent-ink: #0b0b0a; --danger: #ff7b70; --ok: #6fd18a; --warn: #f2c35a; --warn-bg: #2b2412;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
main { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

button, .btn, input[type="text"], input[type="password"] {
  font: inherit; min-height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); padding: 8px 14px;
}
input[type="text"], input[type="password"] { width: 100%; }
button, .btn { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; color: var(--accent); padding: 8px 4px; min-height: 44px; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0; }
.album { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; min-height: 64px; border-radius: var(--radius); }
.album .name { font-weight: 600; overflow-wrap: anywhere; }
.badge { font-size: .8rem; border-radius: 999px; padding: 2px 10px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.banner { border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; border: 1px solid var(--line); background: var(--card); }
.banner.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.banner.ok { color: var(--ok); }
.banner .actions { margin-top: 8px; }

form.inline { display: flex; gap: 8px; }
form.stack { display: grid; gap: 12px; }
label { font-weight: 600; display: block; margin-bottom: 4px; }
.error { color: var(--danger); min-height: 1.4em; margin: 0; }

.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 18px; text-align: center; margin: 12px 0; }
.dropzone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.queue { list-style: none; padding: 0; margin: 8px 0; }
.queue li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.queue .fname { overflow-wrap: anywhere; font-size: .95rem; }
.queue .status { font-size: .85rem; color: var(--muted); }
.queue .status.fail { color: var(--danger); }
.queue .status.done { color: var(--ok); }
progress { width: 100%; height: 8px; margin-top: 4px; accent-color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 8px; }
.tile { position: relative; border-radius: 10px; overflow: hidden; background: var(--line); aspect-ratio: 1; }
.tile a { display: block; width: 100%; height: 100%; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .del {
  position: absolute; top: 4px; right: 4px; min-height: 36px; min-width: 36px; padding: 0;
  border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; border: 0; font-size: 20px; line-height: 1;
}
.tile .off { position: absolute; left: 4px; bottom: 4px; right: 4px; font-size: .7rem; background: rgba(148,98,0,.92); color: #fff; border-radius: 6px; padding: 2px 6px; text-align: center; }

.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: 696px; margin: 0 auto;
  background: var(--ink); color: var(--bg); border-radius: 12px; padding: 12px 16px; z-index: 10;
}
