/* ============================================================
   云中转 · 样式
   ------------------------------------------------------------
   与 learn / todo 一致：零构建、纯 CSS、不依赖主题变量
   （独立应用页，套主题的 CSS 变量反而会被博客全局样式干扰）。
   深色模式跟系统，不另设开关。
   ============================================================ */

:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --line: #e3e8ef;
  --line-strong: #cdd5e0;
  --text: #171b22;
  --muted: #667085;
  --faint: #98a2b3;
  --accent: #2563eb;
  --accent-soft: #e8f0fe;
  --ok: #10a05a;
  --ok-soft: #e6f7ee;
  --warn: #b45309;
  --warn-soft: #fef4e6;
  --danger: #d64545;
  --danger-soft: #fdecec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #13161b;
    --panel: #1c2027;
    --panel-2: #22272f;
    --line: #2b313a;
    --line-strong: #3a424e;
    --text: #e6e9ee;
    --muted: #98a2b3;
    --faint: #6b7480;
    --accent: #4d8bff;
    --accent-soft: #1b2b47;
    --ok: #35c07a;
    --ok-soft: #14301f;
    --warn: #f0a94a;
    --warn-soft: #33260f;
    --danger: #f26a6a;
    --danger-soft: #351818;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

/* ---------------- 登录壳 ---------------- */

.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px 24px 26px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-logo {
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  border-radius: 13px;
  background: var(--accent);
  display: grid;
  place-items: center;
}

.login-card h1 {
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: .3px;
}

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

.login-card input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: 0;
  margin-bottom: 10px;
  transition: border-color .15s;
}

.login-card input:focus { border-color: var(--accent); }

.login-card .btn { width: 100%; justify-content: center; padding: 11px; }

.login-err {
  min-height: 18px;
  font-size: 12.5px;
  color: var(--danger);
  margin: 10px 0 0;
}

/* ---------------- 顶栏 ---------------- */

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 14px 70px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 0 11px;
  background: linear-gradient(var(--bg) 72%, transparent);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .3px;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--accent);
}

.conn {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  transition: background .25s;
}

.dot.on { background: var(--ok); }
.dot.off { background: var(--danger); }
.dot.busy { background: var(--accent); }

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}

.icon-btn:hover { background: var(--panel-2); color: var(--text); }

/* ---- 回博客的入口（顶栏箭头 + 登录卡链接）----
   两个都要有：登录态失效时只显示登录壳，壳里没有顶栏，
   只做一个的话，用户会卡在一个「回不去」的独立页面里。 */
.back-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  padding: 6px;
  border-radius: 8px;
  color: var(--muted);
  line-height: 0;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.back-home:hover { background: var(--panel-2); color: var(--text); }

.login-back {
  display: inline-block;
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--faint);
  text-decoration: none;
  transition: color .15s;
}

.login-back:hover { color: var(--accent); }

/* ---- 在线设备 ---- */
.dev-btn {
  position: relative;
  flex: none;
}

.dev-count {
  position: absolute;
  top: -2px;
  right: -3px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--ok);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 15px;
  text-align: center;
}

.dev-pop {
  position: absolute;
  top: calc(100% - 4px);
  right: 0;
  z-index: 40;
  min-width: 190px;
  max-width: 260px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(16, 24, 40, .14);
}

.dev-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 7px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
}

.dev-row + .dev-row { margin-top: 1px; }

.dev-row .dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

.dev-row .nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dev-row .you {
  margin-left: auto;
  flex: none;
  font-size: 11px;
  color: var(--faint);
}

/* ---------------- 标签 ---------------- */

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  padding: 6px 13px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.tab:hover { background: var(--panel-2); }

.tab.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

/* ---------------- 输入区 ---------------- */

.composer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color .18s;
}

.composer:focus-within { border-color: var(--line-strong); }

.composer textarea {
  display: block;
  width: 100%;
  min-height: 74px;
  max-height: 42vh;
  padding: 13px 15px 4px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1.6;
}

.composer textarea::placeholder { color: var(--faint); }

.bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px 9px;
  flex-wrap: wrap;          /* 三个按钮 + 提示，窄屏允许换行，别把「发送」挤出去 */
}

/* 视觉隐藏但仍可被 <label for> 激活。
   ⚠️ 不能用 display:none —— 移动端对 display:none 的 file input
   程序化激活/部分浏览器的 label 激活会失效，表现就是「点了没反应」。 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.hint {
  font-size: 12px;
  color: var(--faint);
  margin-right: auto;
  min-width: 0;             /* 允许被压缩，否则长提示会把按钮顶出去 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------- 按钮 ---------------- */

.btn {
  font: inherit;
  font-size: 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 7px 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}

.btn:hover { border-color: var(--line-strong); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .45; cursor: default; }

/* 文件选择按钮：input 铺满整个按钮，只把透明度压到 0。
   ★ 不要改回 .sr-only / clip / 1px —— PWA standalone 下那种「不可见」
   的 input 会被判定为无法响应用户手势，点击后什么都弹不出来。
   这里 input 有真实尺寸、在视口内、点击目标是它自己，才 100% 可靠。 */
.btn.file-pick {
  position: relative;
  overflow: hidden;
}
.btn.file-pick > input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  /* iOS 上字号 <16px 会让点按区域异常，给足 */
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}

.btn.primary:hover { filter: brightness(1.06); }

.btn.small { font-size: 13px; padding: 5px 10px; }

.btn.danger { color: var(--danger); border-color: var(--line); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }

/* ---------------- 卡片容器 ---------------- */

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stack:empty { display: none; }

.stream {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

/* ---------------- 待接收 offer ---------------- */

.offer {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 15px;
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: slideIn .22s ease-out;
}

.offer.dead { border-color: var(--line); box-shadow: none; opacity: .6; }

/* 云端中转用另一种颜色：两种卡片摆在一起，颜色一样就等于没说清楚
   这条是「另一条路」，不是「另一条消息」。 */
.offer-cloud { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

.offer-meta {
  margin-top: 9px;
  font-size: 12px;
  color: var(--faint);
}

.cloud-links {
  margin-top: 9px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cloud-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}

.cloud-link:hover { border-color: var(--line-strong); }

.cloud-link .n {
  margin-left: auto;
  flex: none;
  font-size: 12px;
  color: var(--faint);
}

.offer-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 9px;
}

.offer-head .who { color: var(--text); font-weight: 500; }

.offer-files {
  font-size: 14px;
  margin-bottom: 11px;
  word-break: break-word;
}

.offer-files .n { color: var(--faint); font-size: 12.5px; }

.offer-actions { display: flex; gap: 8px; }
.offer-actions .btn { flex: 1; justify-content: center; }

/* ---------------- 传输进度 ---------------- */

.transfer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
  box-shadow: var(--shadow);
  animation: slideIn .22s ease-out;
}

.transfer.err { border-color: var(--danger); }

.transfer-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13.5px;
  margin-bottom: 9px;
}

.transfer-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.transfer-pct { color: var(--accent); font-variant-numeric: tabular-nums; }

.track {
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width .18s linear;
}

.transfer-sub {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--faint);
  margin-top: 7px;
}

/* ---------------- 流条目 ---------------- */

.sep {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--faint);
  margin: 8px 0 1px;
  user-select: none;
}

.sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.item {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 11px 13px 10px;
  animation: slideIn .2s ease-out;
  transition: border-color .18s, background .18s;
}

.item.flash { border-color: var(--ok); background: var(--ok-soft); }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: none; }
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--faint);
  margin-bottom: 6px;
}

.tag {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.tag.file { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }

.item-meta .grow { flex: 1; }

.item-text {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: pointer;
  max-height: 360px;
  overflow: auto;
  padding-right: 3px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.file-badge {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .3px;
  text-transform: uppercase;
}

.file-main { min-width: 0; flex: 1; }

.file-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-sub { font-size: 12px; color: var(--faint); }

.actions {
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity .15s;
}

.item:hover .actions { opacity: 1; }
@media (hover: none) { .actions { opacity: 1; } }

/* ---------------- 搜索 / 筛选 ---------------- */

.searchbar {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  box-shadow: var(--shadow);
  color: var(--faint);
}

.searchbar input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  min-width: 0;
}

.chips {
  display: flex;
  gap: 6px;
  margin: 11px 0 0;
}

.chip {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  padding: 4px 11px;
  border-radius: 20px;
  cursor: pointer;
  transition: all .15s;
}

.chip.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------------- 空态 ---------------- */

.empty {
  text-align: center;
  color: var(--faint);
  font-size: 13.5px;
  padding: 46px 20px;
  line-height: 1.9;
}

.empty b {
  display: block;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 5px;
}

/* ---------------- 设置面板 ---------------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(12, 15, 20, .45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.sheet-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .22);
}

.sheet-card h2 { font-size: 16px; margin: 0 0 16px; font-weight: 600; }

.field { margin-bottom: 12px; }

.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}

.field input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: 0;
}

.field input:focus { border-color: var(--accent); }
.field input[readonly] { color: var(--faint); }

.sheet-note {
  font-size: 12px;
  color: var(--faint);
  line-height: 1.7;
  margin: 4px 0 0;
}

.sheet-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.sheet-actions .btn { flex: 1; justify-content: center; }

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 14px);
  background: #1f2430;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  padding: 9px 16px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 90;
  max-width: 86vw;
  text-align: center;
}

.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 拖拽提示 ---------------- */

.drop-hint {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, .09);
  border: 2px dashed var(--accent);
  color: var(--accent);
  font-size: 16px;
  font-weight: 500;
  pointer-events: none;
}

.drop-hint.on { display: flex; }

/* ---------------- 移动端 ---------------- */

@media (max-width: 560px) {
  .app { padding: 0 10px 60px; }
  .brand { font-size: 15px; }
  .hint { display: none; }
  .bar { justify-content: flex-end; }
  .item-text { font-size: 13px; }
}
