:root {
  --bg: #f4f5f9;
  --card: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #4f46e5;
  --accent-weak: #eef2ff;
  --ok: #059669;
  --warn: #b45309;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

/* 作者样式里的 display 会覆盖 UA 的 [hidden]，这里强制生效 */
[hidden] { display: none !important; }

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

body {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 16px calc(40px + env(safe-area-inset-bottom));
}

/* ---------- 顶栏 ---------- */
.topbar {
  padding: 20px 0 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(140deg, #6366f1, #4338ca);
  position: relative;
  flex: none;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .28);
}

.logo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: no-repeat center/18px 18px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 3l6 6h-3.5v6h-5V9H6z'/%3E%3Crect x='6' y='18' width='12' height='2' rx='1'/%3E%3C/svg%3E");
}

h1 {
  font-size: 19px;
  margin: 0;
  letter-spacing: -.01em;
}

.brand p {
  margin: 1px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- 标签页 ---------- */
.tabs {
  display: flex;
  gap: 4px;
  background: #e9ebf2;
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 9px 0;
  border-radius: 9px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
}

.tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 15px;
  margin: 0 0 10px;
}

.card.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- 表单 ---------- */
.lbl {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: .02em;
}

input[type="text"],
input[type="password"],
input:not([type]),
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfbfd;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

textarea { resize: vertical; min-height: 92px; }

input:focus, textarea:focus, select:focus {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .14);
}

select {
  width: auto;
  min-width: 132px;
  padding-right: 30px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 8l3-3.5' stroke='%236b7280' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* ---------- 密钥方式 ---------- */
.segmented {
  display: flex;
  gap: 4px;
  background: #f1f2f7;
  padding: 4px;
  border-radius: 11px;
  margin-bottom: 10px;
}

.segmented label {
  flex: 1;
  text-align: center;
  cursor: pointer;
}

.segmented input { position: absolute; opacity: 0; pointer-events: none; }

.segmented span {
  display: block;
  padding: 8px 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: background .15s, color .15s;
}

.segmented input:checked + span {
  background: #fff;
  color: var(--accent);
  box-shadow: var(--shadow);
}

.segmented.three span { font-size: 13px; letter-spacing: -.01em; }

/* ---------- 取件码 ---------- */
.code-display {
  margin: 6px 0 12px;
  padding: 16px 10px;
  background: #f7f8fb;
  border: 1.5px dashed #c7cbe0;
  border-radius: 12px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--accent);
  user-select: all;
  -webkit-user-select: all;
  word-break: break-all;
  line-height: 1.3;
}

/* ---------- 文件投放 ---------- */
.drop {
  margin-top: 12px;
  border: 1.5px dashed #cfd3e0;
  border-radius: 12px;
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.drop:hover, .drop.hover {
  border-color: var(--accent);
  background: var(--accent-weak);
}

.drop strong { font-size: 14.5px; color: var(--accent); }

.picked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 9px 12px;
  background: var(--accent-weak);
  border-radius: 10px;
  font-size: 13.5px;
}

.picked span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 按钮 ---------- */
.primary, .ghost {
  width: 100%;
  border-radius: 11px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform .08s, opacity .15s, background .15s;
}

.primary {
  border: 0;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, .28);
}

.primary:active { transform: translateY(1px); }
.primary[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }

#btn-send { margin-bottom: 12px; }

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  box-shadow: none;
}

.ghost:hover { background: #fafafc; }

.block { display: block; margin-top: 10px; text-decoration: none; }

.linkbtn {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 0;
}

/* ---------- 进度 ---------- */
.progress .bar {
  height: 6px;
  background: #eceef5;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress .bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #4338ca);
  border-radius: 99px;
  transition: width .18s ease;
}

.progress p { margin: 0; font-size: 13px; }

/* ---------- 状态文字 ---------- */
.status {
  font-size: 13.5px;
  margin: 0 2px 12px;
  min-height: 0;
}

.status:empty { display: none; }
.status.err { color: var(--danger); }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }

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

.tip {
  font-size: 12.5px;
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.5;
}

code {
  background: #f1f2f7;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- 结果区 ---------- */
.result { text-align: left; }

.qr-wrap {
  display: flex;
  justify-content: center;
  padding: 6px 0 10px;
}

#qr {
  width: 190px;
  height: 190px;
  image-rendering: pixelated;
  border-radius: 8px;
}

.linkbox {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.linkbox input {
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  background: #f7f8fb;
}

.linkbox .ghost {
  width: auto;
  flex: none;
  padding: 10px 16px;
  font-size: 13.5px;
}

.countdown {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--warn);
  font-variant-numeric: tabular-nums;
}

/* ---------- 历史 ---------- */
.history {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}

.history li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}

.history li:first-child { border-top: 0; }

.history .h-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history .h-sub {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 400;
}

.history .h-empty {
  color: var(--muted);
  font-size: 13px;
  border-top: 0;
  justify-content: center;
}

/* ---------- 接收 ---------- */
#recv-name {
  font-size: 17px;
  margin: 0 0 4px;
  word-break: break-all;
}

#recv-text {
  margin: 12px 0 0;
  padding: 12px;
  background: #f7f8fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 46vh;
  overflow: auto;
}

#pass-prompt { margin-top: 14px; }
#pass-prompt .primary { margin-top: 10px; }

/* ---------- 页脚 ---------- */
footer {
  margin-top: 18px;
  padding: 0 4px;
}

footer p {
  font-size: 11.5px;
  color: #9aa1ae;
  line-height: 1.6;
  margin: 0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #171a21;
    --text: #e8eaef;
    --muted: #9aa1ae;
    --line: #262b35;
    --accent-weak: #1e2233;
  }
  .tabs { background: #1b1f28; }
  .segmented { background: #1b1f28; }
  .segmented input:checked + span { background: #262b35; }
  .tab.active { background: #262b35; }
  .code-display { background: #1b1f28; border-color: #333a47; }
  input, textarea, select { background: #1b1f28; color: var(--text); }
  .drop { border-color: #333a47; }
  .linkbox input, #recv-text { background: #1b1f28; }
  .ghost { background: #1b1f28; }
  .ghost:hover { background: #222733; }
  .logo { box-shadow: none; }
}
