:root {
  --paper: #eef1eb;
  --surface: #f8faf6;
  --ink: #1b2520;
  --muted: #5a665f;
  --line: #d2d9d1;
  --accent: #1d5c4c;
  --accent-hover: #174a3d;
  --on-accent: #f8faf6;
  --tag: #edc748;
  --tag-ink: #2a2410;
  --danger: #a33a2c;
  --font: "Avenir Next", Avenir, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC",
    "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131915;
    --surface: #1a221d;
    --ink: #e4eae5;
    --muted: #97a39b;
    --line: #2b3530;
    --accent: #7cc4ac;
    --accent-hover: #95d3be;
    --on-accent: #0e1411;
    --tag: #d8b53e;
    --tag-ink: #1e1a08;
    --danger: #e08a7c;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

.wrap { max-width: 760px; margin: 0 auto; padding: 56px 20px 96px; }

h1 {
  font-size: clamp(30px, 6vw, 46px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 10px;
}
h2 { font-size: 20px; font-weight: 700; margin: 48px 0 0; }
.sub { color: var(--muted); margin: 0; }
.muted { color: var(--muted); font-size: 14px; }

/* 输入框 */
input[type="search"], input[type="email"], input[type="password"] {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 12px 14px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.search { display: block; margin-top: 28px; }

/* 按钮 */
.btn, .ghost {
  appearance: none;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  display: inline-block;
}
.btn { border: 0; background: var(--accent); color: var(--on-accent); }
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: 0.6; cursor: default; }
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); padding: 7px 14px; font-size: 14px; }
.ghost:hover { border-color: var(--muted); }
.ghost.danger { color: var(--danger); }
.ghost:disabled { opacity: 0.6; cursor: default; }

:is(.btn, .ghost, input):focus-visible { outline: 3px solid var(--tag); outline-offset: 2px; }

/* 文件列表 */
.list { list-style: none; margin: 24px 0 0; padding: 0; border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.row-main { flex: 1; min-width: 0; }
.row-name { font-weight: 600; overflow-wrap: anywhere; }
.row-meta { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* 页面上唯一的"亮点"：包裹吊牌样式的扩展名标签 */
.tag {
  position: relative;
  flex: none;
  width: 62px;
  height: 34px;
  display: grid;
  place-items: center;
  padding-left: 12px;
  background: var(--tag);
  color: var(--tag-ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  clip-path: polygon(12px 0, 100% 0, 100% 100%, 12px 100%, 0 50%);
}
.tag::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--paper);
}

.empty { color: var(--muted); padding: 32px 0; margin: 0; }

/* 管理页 */
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.login { max-width: 380px; margin-top: 28px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > span { font-size: 14px; color: var(--muted); }
.msg { min-height: 1.5em; color: var(--danger); font-size: 14px; margin: 10px 0 0; }

.meter { margin-top: 28px; }
.meter-top { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.meter-bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.3s ease; }
.meter-fill.warn { background: var(--danger); }

.drop {
  margin-top: 24px;
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 160px;
  padding: 24px;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
}
.drop.over { border-color: var(--accent); }
.drop:focus-within { outline: 3px solid var(--tag); outline-offset: 2px; }

.queue { list-style: none; margin: 8px 0 0; padding: 0; }
.q { padding: 10px 0; border-bottom: 1px solid var(--line); }
.q-top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.q-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-status { flex: none; max-width: 55%; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.q-bar { height: 4px; margin-top: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.q-fill { height: 100%; width: 0; background: var(--accent); }
.q.ok .q-status { color: var(--accent); }
.q.err .q-status { color: var(--danger); }
.q.err .q-fill { background: var(--danger); }

.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;
}

@media (max-width: 520px) {
  .wrap { padding-top: 36px; }
  .row { align-items: flex-start; flex-wrap: wrap; }
  .row .actions { width: 100%; justify-content: flex-start; padding-left: 78px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
