:root {
  --bg: #0f172a;
  --bg2: #1e293b;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --border: #e2e8f0;
  --ok: #16a34a;
  --warn: #f59e0b;
  --err: #dc2626;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #c7d2fe 0%, transparent 60%),
    radial-gradient(1000px 500px at 110% 10%, #bae6fd 0%, transparent 60%),
    linear-gradient(180deg, #f8fafc, #eef2ff);
  min-height: 100vh;
}

.topbar {
  text-align: center;
  padding: 36px 16px 8px;
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: 1px;
}

.topbar .sub {
  margin: 0;
  color: var(--muted);
}

.container {
  max-width: 720px;
  margin: 24px auto 80px;
  padding: 0 16px;
}

.tabs {
  display: flex;
  gap: 8px;
  background: rgba(255,255,255,0.7);
  padding: 6px;
  border-radius: 999px;
  width: fit-content;
  margin: 0 auto 20px;
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.tab {
  border: 0;
  background: transparent;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  transition: all .2s;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.panel {
  display: none;
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.panel.active { display: block; }

/* dropzone */
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius);
  padding: 40px 16px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #f8fafc;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--primary);
  background: #eff6ff;
}
.dz-icon { font-size: 36px; margin-bottom: 6px; }
.dz-title { font-weight: 600; margin-bottom: 4px; }
.dz-hint { color: var(--muted); font-size: 13px; }

.opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}
.opts label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.opts input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  outline: none;
  font-size: 14px;
  background: #f8fafc;
  transition: all .2s;
}
.opts input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

/* buttons */
.primary, .ghost, .as-button {
  display: inline-block;
  border: 0;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
  text-decoration: none;
}
.primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
  box-shadow: 0 6px 16px rgba(37,99,235,.3);
}
.primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}
.primary:not(:disabled):hover { background: var(--primary-hover); }
.as-button { width: 100%; margin-top: 8px; }
.ghost {
  background: #f1f5f9;
  color: var(--text);
  border: 1px solid var(--border);
}
.ghost:hover { background: #e2e8f0; }

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.row .ghost { flex: 1; min-width: 100px; }

/* progress */
.progress { margin-top: 16px; }
.bar {
  height: 8px;
  border-radius: 4px;
  background: #e2e8f0;
  overflow: hidden;
}
.fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  transition: width .2s;
}
.progress-text {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}

/* result */
.result {
  margin-top: 20px;
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ecfeff, #f0f9ff);
  border: 1px solid #bae6fd;
}
.result-title {
  font-weight: 600;
  margin-bottom: 10px;
}
.result-meta {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.7;
}

.code-display {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 40px;
  letter-spacing: 12px;
  font-weight: 700;
  text-align: center;
  color: var(--primary);
  padding: 12px 0;
  background: #fff;
  border-radius: 10px;
  border: 1px dashed #93c5fd;
  user-select: all;
}

/* recv */
.recv-form { text-align: center; padding: 16px 8px; }
.recv-label {
  display: block;
  color: var(--muted);
  margin-bottom: 12px;
}
.code-input {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.code-input input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: #f8fafc;
  transition: all .2s;
  -moz-appearance: textfield;
}
.code-input input::-webkit-outer-spin-button,
.code-input input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.code-input input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: rgba(15,23,42,.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 999;
  animation: pop .2s ease-out;
}
@keyframes pop {
  from { transform: translateX(-50%) translateY(8px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ============== 文字直传相关 ============== */
.send-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 4px;
}
.send-tab {
  flex: 1;
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s ease;
  font-size: 14px;
}
.send-tab.active {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.send-tab:hover:not(.active) {
  color: var(--text);
}
.send-pane { display: none; }
.send-pane.active { display: block; }

.text-input {
  width: 100%;
  min-height: 160px;
  max-height: 360px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.55;
  background: #fafafa;
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, background .15s ease;
  box-sizing: border-box;
}
.text-input:focus {
  border-color: #6366f1;
  background: #ffffff;
}
.text-input[readonly] {
  background: #f8fafc;
  cursor: text;
}
.text-meta {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  margin: 6px 0 12px;
}
.text-meta.over {
  color: #dc2626;
  font-weight: 600;
}

.recv-text-wrap {
  margin-top: 14px;
}
.recv-text-wrap .text-input {
  min-height: 180px;
}
.recv-text-wrap .row {
  margin-top: 10px;
  justify-content: flex-end;
}

.hidden { display: none !important; }

/* ============== 共享空间（Room） ============== */
.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 12px;
  gap: 8px;
  flex-wrap: wrap;
}
.room-title {
  font-weight: 700;
  color: var(--text);
}
.room-title code {
  background: #eef2ff;
  border: 1px dashed #93c5fd;
  color: var(--primary);
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 16px;
  letter-spacing: 4px;
  font-weight: 700;
  user-select: all;
}
.room-expires {
  margin-left: 10px;
  font-size: 12px;
  color: var(--muted);
  font-weight: normal;
}
.room-tools { display: flex; gap: 6px; }
.room-tools .ghost.small {
  padding: 6px 12px;
  font-size: 13px;
}

.room-msg-list {
  max-height: 460px;
  overflow-y: auto;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.room-empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 30px 0;
}

.room-msg {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  position: relative;
  transition: box-shadow .15s ease;
}
.room-msg:hover {
  box-shadow: 0 2px 8px rgba(15,23,42,.08);
}
.room-msg.mine {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.room-msg-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
}
.room-msg-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.room-msg-actions {
  display: flex;
  gap: 6px;
}
.room-msg-actions button {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  transition: all .15s ease;
}
.room-msg-actions button:hover {
  background: #e2e8f0;
  color: var(--text);
}
.room-msg-actions .danger:hover {
  background: #fee2e2;
  color: var(--err);
}

.room-composer {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}
.room-composer .text-input {
  min-height: 70px;
  background: #ffffff;
}
.room-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 10px;
}
.room-composer-bar .primary {
  width: auto;
  padding: 8px 22px;
  font-size: 14px;
}
.text-meta-inline {
  font-size: 12px;
  color: var(--muted);
}
.text-meta-inline.over { color: var(--err); font-weight: 600; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 24px;
}

@media (max-width: 480px) {
  .opts { grid-template-columns: 1fr; }
  .code-input input { width: 40px; height: 48px; font-size: 20px; }
  .code-display { font-size: 30px; letter-spacing: 8px; }
}

/* ===== 房间内文件消息卡片 ===== */
.room-msg-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.room-msg.mine .room-msg-file {
  background: #f1f5ff;
  border-color: #cdd9f7;
}
.room-msg-file-icon {
  font-size: 28px;
  line-height: 1;
  flex: 0 0 auto;
}
.room-msg-file-info {
  flex: 1 1 auto;
  min-width: 0;
}
.room-msg-file-name {
  font-weight: 600;
  word-break: break-all;
  color: var(--text);
}
.room-msg-file-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.room-msg-file a.dl-btn {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 8px;
  background: #2563eb;
  color: #fff !important;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .25);
  transition: background-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.room-msg-file a.dl-btn:hover {
  background: #1d4ed8;
  box-shadow: 0 2px 6px rgba(37, 99, 235, .35);
}
.room-msg-file a.dl-btn:active {
  transform: translateY(1px);
}
.ghost.small { padding: 6px 12px; font-size: 13px; }

