:root {
  --paper: #f7f5f1;
  --card: #ffffff;
  --line: #e8e3d9;
  --ink: #241f1a;
  --muted: #7b7368;
  --accent: #c0562e;
  --teal: #177e6b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px 18px;
  max-width: 1320px;
  margin: 0 auto;
}

.title { display: flex; align-items: center; gap: 12px; }
.mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(140deg, #ffb27f, #c0562e);
  flex: none;
}
.title h1 { font-size: 17px; font-weight: 500; letter-spacing: 0.01em; }
.title p { font-size: 12px; color: var(--muted); margin-top: 3px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.chip {
  font-size: 12px;
  color: #5b5348;
  background: #f1eee7;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 5px 11px;
  white-space: nowrap;
}
.chip b { font-weight: 500; color: var(--ink); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 18px;
  padding: 0 28px 30px;
  max-width: 1320px;
  margin: 0 auto;
  align-items: start;
}

.column { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 18px; }

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

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-head h2 { font-size: 14px; font-weight: 500; }
.hint-key { font-size: 12px; color: #a29a8d; }

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 13px;
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: #fdfcfa;
  resize: vertical;
  min-height: 86px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
textarea:focus { border-color: #d9b39c; box-shadow: 0 0 0 3px rgba(192, 86, 46, 0.08); }

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

.btn {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 18px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.btn.primary { background: var(--accent); color: #fff; font-weight: 500; }
.btn.primary:hover { background: #a8481f; }
.btn.primary:disabled { background: #d9cfc4; cursor: not-allowed; }
.btn.ghost { background: #fff; border-color: var(--line); color: #4a443b; }
.btn.ghost:hover { border-color: #cbbfb0; background: #fbf9f6; }
.btn.ghost:disabled { color: #bdb5a8; cursor: not-allowed; }
.btn.small { padding: 6px 12px; font-size: 12px; }

.latency { margin-left: auto; font-size: 12px; color: var(--teal); }

.topics { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ---------------------------------------------------------------- 弹幕面板 */
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: #6a6257; cursor: pointer; }
.switch input { appearance: none; width: 32px; height: 18px; border-radius: 99px; background: #ddd6c9; position: relative; cursor: pointer; transition: background 160ms ease; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 160ms ease; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }

.dstats { font-size: 12px; color: #a29a8d; margin-left: auto; }

.dm-send { display: flex; gap: 8px; margin-top: 12px; }
.dm-send input {
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  background: #fdfcfa;
  color: var(--ink);
  outline: none;
  min-width: 0;
}
.dm-send input:first-child { width: 96px; flex: none; color: #6a6257; }
.dm-send input:nth-child(2) { flex: 1; }
.dm-send input:focus { border-color: #d9b39c; }

.dm-feed { margin-top: 12px; max-height: 210px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.dm-feed .empty { font-size: 12px; color: #a8a094; line-height: 1.7; }
.dm-item { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; line-height: 1.5; padding: 5px 8px; border-radius: 8px; background: #faf8f4; }
.dm-item .u { color: #7a6a5c; flex: none; max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-item .t { color: #3a342d; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-item .s { font-size: 11px; flex: none; border-radius: 99px; padding: 1px 7px; }
.dm-item .s.ok { color: #177e6b; background: #e8f6f2; }
.dm-item .s.no { color: #9a9285; background: #f0ece4; }
.dm-item .s.gift { color: #b1521f; background: #fdeee4; }
.dm-item .s.q { color: #8a5a1c; background: #fbf1de; }
.topic {
  font: inherit;
  font-size: 12px;
  color: #6a6257;
  background: #f8f6f2;
  border: 1px dashed #e2dbcf;
  border-radius: 99px;
  padding: 6px 12px;
  cursor: pointer;
}
.topic:hover { border-color: #cf9e83; color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.field label b { color: var(--ink); font-weight: 500; }
select {
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fdfcfa;
  color: var(--ink);
  outline: none;
}
input[type="range"] { width: 100%; accent-color: var(--accent); }

.card.grow { flex: 1; display: flex; flex-direction: column; min-height: 260px; }

.log { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; max-height: 46vh; padding-right: 4px; }
.log .empty { font-size: 13px; color: #a8a094; }

.entry { border-left: 2px solid #eee7dc; padding-left: 12px; }
.entry .q { font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.entry .a { font-size: 14px; line-height: 1.7; color: #2d2721; white-space: pre-wrap; }
.entry .meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 8px; }
.entry .meta span { font-size: 11px; color: #9a9285; }
.entry .meta span.src { color: var(--teal); }
.entry .meta span.warn { color: #b8752a; }
.entry.pending .a { color: #b3aa9d; }

.preview-card .phone {
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 16px;
  overflow: hidden;
  background: #14121c;
  border: 1px solid #e2dbcf;
  box-shadow: 0 12px 30px rgba(60, 45, 30, 0.12);
}
.phone iframe { width: 100%; height: 100%; border: 0; display: block; }

.note { font-size: 12px; line-height: 1.7; color: #8a8175; margin-bottom: 10px; }
.note.dim { color: #a8a094; margin: 10px 0 0; }

.copyline {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #faf8f4;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
}
.copyline code { font-size: 12px; color: #4a443b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

@media (max-width: 1040px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; order: -1; }
  .preview-card .phone { max-width: 300px; margin: 0 auto; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .chips { justify-content: flex-start; }
}
