/* roggio.cn/copy —— 中转站样式
 *
 * 原则：白底、细边框、不加阴影堆叠，只靠留白和字重分层次。
 * 移动端几条硬规矩（都是以前踩过坑总结的）：
 *   · 可点区域至少 44px，否则手机上很难点中
 *   · 输入框字号不小于 16px，否则 iOS 聚焦时会强制放大页面
 *   · 次级文字用 #636d7e（白底 5.1:1），不要用 #8a93a3（只有 2.9:1，看不清）
 *   · hover 样式一律写成 .x:hover:not(.on)，避免触屏点完后 hover 粘住不散
 */

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --line: #e3e6eb;
  --line-2: #d3d8e0;
  --text: #1a1d21;
  --sub: #636d7e;
  --pri: #2563eb;
  --pri-d: #1d4ed8;
  --pri-bg: #eff4ff;
  --danger: #d92d20;
  --danger-bg: #fef3f2;
  --warn: #b45309;
  --ok: #067647;
  --radius: 14px;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 16px 60px;
}

/* ---------- 头部 ---------- */

.hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.hd h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.hd-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--sub);
}

.hd-sub b {
  color: var(--text);
  font-weight: 600;
}

.hd-r {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.lnk {
  appearance: none;
  background: none;
  border: 0;
  padding: 8px 8px;
  font: inherit;
  font-size: 13px;
  color: var(--sub);
  cursor: pointer;
  border-radius: 8px;
}

.lnk:hover:not(.on) {
  background: #eceef2;
  color: var(--text);
}

/* ---------- 卡片 ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

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

.gate {
  padding: 26px 22px 22px;
  max-width: 380px;
  margin: 8vh auto 0;
}

.gate-tip {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--sub);
  text-align: center;
}

.gate-err {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--danger);
  text-align: center;
}

/* ---------- 输入控件 ---------- */

.inp {
  display: block;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 16px;      /* 移动端低于 16px 会触发 iOS 自动放大 */
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.inp:focus {
  border-color: var(--pri);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.ta {
  display: block;
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  resize: vertical;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.ta:focus {
  border-color: var(--pri);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.ta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.ta-count {
  font-size: 12.5px;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}

.ta-count.over { color: var(--danger); }

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

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background .13s, border-color .13s, color .13s, opacity .13s;
}

.btn:hover:not(:disabled):not(.on) {
  background: #f2f4f7;
  border-color: var(--line-2);
}

.btn:disabled {
  opacity: .45;
  cursor: default;
}

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

.btn.primary:hover:not(:disabled):not(.on) {
  background: var(--pri-d);
  border-color: var(--pri-d);
}

.btn.block {
  display: flex;
  width: 100%;
  margin-top: 12px;
}

.btn.sm {
  height: 36px;
  padding: 0 14px;
  font-size: 13.5px;
}

.btn.danger {
  color: var(--danger);
  border-color: #f3c6c1;
  background: #fff;
}

.btn.danger:hover:not(:disabled):not(.on) {
  background: var(--danger-bg);
  border-color: #e9a9a2;
}

.btn.ghost {
  color: var(--sub);
}

/* ---------- 上传区 ---------- */

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 30px 16px;
  border: 2px dashed var(--line-2);
  border-radius: 12px;
  background: #fbfcfd;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.drop:hover:not(.on) {
  border-color: #9fb6e8;
  background: #f8fbff;
}

.drop.hot {
  border-color: var(--pri);
  background: var(--pri-bg);
}

.drop-ic {
  color: var(--pri);
  margin-bottom: 2px;
}

.drop-main {
  font-size: 14.5px;
  font-weight: 500;
}

.drop-sub {
  font-size: 12.5px;
  color: var(--sub);
}

.up-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.up-list:empty {
  display: none;
}

.up {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fafbfc;
}

.up-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.up-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.up-pct {
  flex-shrink: 0;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}

.up-bar {
  height: 4px;
  margin-top: 8px;
  border-radius: 999px;
  background: #e8ebef;
  overflow: hidden;
}

.up-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--pri);
  transition: width .12s linear;
}

.up.done .up-fill { background: var(--ok); }
.up.err .up-fill { background: var(--danger); }
.up.err .up-pct { color: var(--danger); }

/* ---------- 工具栏 ---------- */

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.chk-all {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--sub);
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.bar-info {
  font-size: 13px;
  color: var(--sub);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-btns {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------- 列表 ---------- */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
}

.item:last-child {
  border-bottom: 0;
}

.item-chk {
  width: 19px;
  height: 19px;
  margin: 2px 0 0;
  cursor: pointer;
  accent-color: var(--pri);
  flex-shrink: 0;
}

.item-main {
  min-width: 0;
}

.item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tag {
  flex-shrink: 0;
  display: inline-block;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 11.5px;
  line-height: 1.7;
  font-weight: 500;
}

.tag-file {
  background: var(--pri-bg);
  color: #1e40af;
}

.tag-text {
  background: #f1f3f6;
  color: #414b5a;
}

.item-name {
  font-size: 14.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.item-content {
  margin-top: 7px;
  padding: 9px 11px;
  border-radius: 9px;
  background: #f7f8fa;
  border: 1px solid #edeff3;
  font-size: 13.5px;
  line-height: 1.72;
  color: #33383f;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  position: relative;
}

.item-content.clip {
  max-height: 112px;
}

.item-content.clip::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40px;
  background: linear-gradient(to bottom, rgba(247, 248, 250, 0), #f7f8fa);
  pointer-events: none;
}

.more {
  appearance: none;
  background: none;
  border: 0;
  padding: 4px 0 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--pri);
  cursor: pointer;
}

.item-meta {
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}

.item-meta .left.warn {
  color: var(--warn);
  font-weight: 600;
}

.item-act {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

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

.empty {
  padding: 40px 10px;
  text-align: center;
}

.empty p {
  margin: 0;
  font-size: 14px;
  color: var(--sub);
}

.empty-sub {
  margin-top: 6px !important;
  font-size: 12.5px !important;
  color: #8b93a1 !important;
}

/* ---------- 页脚 ---------- */

.ft {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--sub);
}

/* ---------- 轻提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(8px);
  max-width: calc(100vw - 40px);
  padding: 11px 18px;
  border-radius: 10px;
  background: #1f2530;
  color: #fff;
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: 0 6px 22px rgba(16, 24, 40, .22);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 99;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- 窄屏 ---------- */

@media (max-width: 640px) {
  .wrap {
    padding: 20px 12px 48px;
  }

  .card {
    padding: 14px;
    border-radius: 12px;
  }

  .hd h1 {
    font-size: 19px;
  }

  /* 工具栏换行：按钮整体下移一行，别和"全选"挤在一起 */
  .bar {
    flex-wrap: wrap;
    gap: 10px;
  }

  .bar-info {
    order: 3;
    flex-basis: 100%;
    font-size: 12.5px;
  }

  .bar-btns {
    margin-left: auto;
  }

  /* 条目：操作按钮落到内容下方，右对齐 */
  .item {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 13px 2px;
  }

  .item-act {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .drop {
    padding: 24px 12px;
  }

  /* 窄屏基本就是手机，可点区域直接给到 44px。
     不把这件事只挂在 @media (pointer:coarse) 上 —— 那个查询在某些环境
     （包括无头浏览器、部分安卓 WebView）并不会按预期触发，一旦漏掉
     按钮就只有 36px，手机上很难点中。两条路都写上更保险。 */
  .btn {
    height: 44px;
  }

  .btn.sm {
    height: 44px;
    padding: 0 16px;
  }
}

/* 触屏：把可点区域抬到 44px 以上 */
@media (pointer: coarse) {
  .btn {
    height: 44px;
  }

  /* 列表里的按钮也要 44 —— 手机上 36px 的按钮经常点不中，
     而且条目里两个按钮挨得近，点错就要重新确认一次 */
  .btn.sm {
    height: 44px;
    padding: 0 16px;
  }

  .item-chk {
    width: 22px;
    height: 22px;
  }

  .chk-all {
    padding: 8px 0;
  }

  .lnk {
    padding: 10px 8px;
  }

  .more {
    padding: 8px 0;
  }
}
