:root {
  --bg: #0f172a;
  --card: #1e293b;
  --line: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --ok: #34d399;
  --bad: #f87171;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  line-height: 1.5;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

header { padding: 24px 16px 8px; max-width: 720px; margin: 0 auto; }
h1 { font-size: 1.4rem; display: flex; align-items: baseline; gap: 8px; }
.app-version {
  font-size: .7rem; font-weight: 400; color: var(--muted);
  white-space: nowrap; user-select: none; vertical-align: middle;
}
.sub { color: var(--muted); font-size: .85rem; margin-top: 4px; }

main { max-width: 720px; margin: 0 auto; padding: 8px 16px 40px; display: grid; gap: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.card h2 { font-size: 1rem; margin-bottom: 12px; }
.count { color: var(--muted); font-size: .8rem; font-weight: 400; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input[type="file"] { flex: 1; min-width: 200px; color: var(--text); font-size: .85rem; }
button {
  background: var(--accent); color: #0c4a6e; border: 0; border-radius: 8px;
  padding: 8px 18px; font-size: .9rem; font-weight: 600; cursor: pointer;
}
button:disabled { opacity: .5; cursor: not-allowed; }
button.danger { background: var(--bad); color: #7f1d1d; }

.msg { margin-top: 8px; font-size: .85rem; min-height: 1.2em; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--bad); }
.hidden { display: none; }
.hint { color: var(--muted); font-size: .8rem; margin-bottom: 8px; }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.tab.active { background: var(--accent); color: #0c4a6e; border-color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.item {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer;
  background: var(--bg); position: relative;
}
.item img, .item video { width: 100%; height: 120px; object-fit: cover; display: block; background: #000; }
.item .meta { padding: 6px 8px; font-size: .7rem; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.item .del { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 6px; padding: 2px 8px; font-size: .7rem; cursor: pointer; }

.compare-row {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: .85rem;
}
.compare-row .label { color: var(--muted); }
.compare-row .val { font-weight: 600; }
.compare-row .fast { color: var(--ok); }
.compare-row .slow { color: var(--bad); }
