:root {
  --bg: #f2f3f5;
  --card: #fff;
  --text: #1f2329;
  --muted: #8a9099;
  --blue: #2f6bff;
  --blue-soft: #eef3ff;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body.modal-open { overflow: hidden; }

.wrap {
  max-width: 540px;
  margin: 0 auto;
  padding: 16px 14px 40px;
}

/* ---------- 头部与搜索 ---------- */

.head h1 {
  margin: 0 0 3px;
  font-size: 20px;
  font-weight: 700;
}

.head .sub {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.search {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 8px 0 10px;
  background: var(--bg);
}

.search input {
  width: 100%;
  height: 40px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  -webkit-appearance: none;
}

.search input:focus { border-color: var(--blue); }

.search input::-webkit-search-cancel-button { display: none; }

.search button {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- 资源列表 ---------- */

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.item-btn:active { background: #fafbfc; }

.item-body {
  flex: 1;
  min-width: 0;
}

.title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.meta .drives {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  flex: none;
  color: #c9ced6;
  font-size: 18px;
  line-height: 1;
}

.empty {
  padding: 30px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ---------- 弹窗 ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal[hidden] { display: none; }

.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 22, .45);
}

.dialog {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: 92vh;
  overflow: auto;
  padding: 18px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}

.d-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}

.tab {
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: #f2f3f5;
  color: #5b616b;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.tab.active {
  background: var(--blue);
  color: #fff;
}

.qr-box {
  display: flex;
  justify-content: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.qr-box img {
  display: block;
  width: 100%;
  max-width: 230px;
  height: auto;
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 100;
  max-width: 86vw;
  padding: 12px 18px;
  border-radius: 10px;
  background: rgba(31, 35, 41, .92);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  transform: translate(-50%, -50%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}

.toast[hidden] { display: none; }

.hint {
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.link {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 1px dashed #7aa2ff;
  border-radius: 8px;
  background: var(--blue-soft);
  color: #2f5fd0;
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  word-break: break-all;
  cursor: pointer;
  -webkit-user-select: text;
  user-select: text;
}

.btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: #333;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.btn.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.btn:active { opacity: .8; }
