:root {
  --bg: #f5f6f8;
  --fg: #1f2329;
  --muted: #8a919e;
  --accent: #ff7a1a;
  --line: #e6e8eb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, "Microsoft YaHei", sans-serif;
}
.card {
  width: fit-content;
  min-width: 300px;
  max-width: calc(100vw - 24px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}
h1 { font-size: 20px; margin: 0 0 6px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.primary {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.primary:hover { filter: brightness(0.96); }
.qr-box {
  position: relative;
  width: fit-content;
  margin: 0 auto 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: #fff;
}
/* 关键：按图片原始像素 1:1 显示，不做 CSS 缩放，模块边界不会被平滑成灰。
   白边已由后端烘焙进图片。pixelated 只在高 DPI 整数放大时保持硬边。 */
#qr-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  image-rendering: pixelated;
}
.qr-mask {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--fg);
}
/* hidden 属性必须真正隐藏遮罩，否则这层 90% 白色会盖在二维码上使其发灰 */
.qr-mask[hidden] {
  display: none;
}
.status { font-size: 14px; color: var(--muted); margin: 0; }
.status.ok { color: #18a058; }
.status.err { color: #d03050; }
.link {
  margin-top: 10px;
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
}

/* ---- 文件页 ---- */
.files {
  width: 560px;
  max-width: calc(100vw - 24px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}
.files-head { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 8px; }
.files-title { font-size: 18px; font-weight: 600; }
.crumbs { margin-top: 8px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.crumb { cursor: pointer; color: var(--accent); }
.crumb.current { color: var(--muted); cursor: default; }
.crumb-sep { color: var(--line); margin: 0 2px; }
.file-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; }
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.file-row.is-dir { cursor: pointer; }
.file-row.is-dir:hover, .file-row.is-file:hover { background: #fafbfc; }
.file-icon { flex: 0 0 auto; }
.file-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.file-dl {
  flex: 0 0 auto;
  padding: 5px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
}
.file-dl:hover { filter: brightness(0.96); }
.files-status { color: var(--muted); font-size: 13px; text-align: center; margin: 14px 0 2px; }

/* ---- 卡密 ---- */
.boot { margin: 0; }
.card-form { display: flex; flex-direction: column; gap: 12px; width: 300px; max-width: 100%; margin: 0 auto 10px; }
.code-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 17px;
  letter-spacing: 1px;
  text-align: center;
  font-family: ui-monospace, Consolas, monospace;
  text-transform: uppercase;
}
.code-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 122, 26, 0.15); }
.primary:disabled { opacity: 0.6; cursor: wait; }
.card-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  margin: 0 auto 20px;
  padding: 10px 14px;
  width: fit-content;
  max-width: 100%;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  text-align: left;
}
.card-summary dt { color: var(--muted); }
.card-summary dd { margin: 0; }
.card-summary:empty { display: none; }
#login-error:empty, #card-error:empty { display: none; }
#login-error { margin-top: 10px; }
.files-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.files-actions { display: flex; gap: 4px; }
.files-actions .link { margin-top: 0; }
.card-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 12px; color: var(--muted); background: #f5f6f8; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.files-notice { margin: 6px 0; padding: 8px 12px; border-radius: 8px; font-size: 13px; background: #f5f6f8; color: var(--fg); }
.files-notice.ok { background: #eaf7ef; color: #18a058; }
.files-notice.err { background: #fdeeee; color: #d03050; }
