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

:root {
  --primary: #2a5298;
  --primary-deep: #1e3c72;
  --danger: #e74c3c;
  --ok: #2ecc71;
  --warn: #f39c12;
  --line: #e6ebf5;
  --ink: #2b3445;
  --sub: #7a8499;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(255,255,255,.16), transparent 55%),
    radial-gradient(800px 500px at 105% 15%, rgba(255,255,255,.10), transparent 50%),
    linear-gradient(135deg, #14264e, #1e3c72 45%, #2a5298);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.app { max-width: 580px; margin: 0 auto; padding: 18px 16px 48px; }

/* ---------- 头部 ---------- */
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 4px 18px;
}
h1 {
  color: #fff; font-size: 21px; font-weight: bold;
  display: flex; align-items: center; gap: 10px;
  text-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.logo {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; font-size: 20px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 12px;
  backdrop-filter: blur(4px);
}
.status {
  font-size: 13px; padding: 6px 14px; border-radius: 20px; color: #fff;
  display: inline-flex; align-items: center; gap: 7px;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  white-space: nowrap;
}
.status .dot {
  width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.9);
  animation: pulse 1.6s ease-in-out infinite;
}
.status.online  { background: linear-gradient(135deg, #27ae60, #1e8449); }
.status.offline { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.status.checking{ background: linear-gradient(135deg, #f39c12, #d68910); }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: .45; transform: scale(.8);} }

/* ---------- 卡片 ---------- */
.card {
  background: rgba(255,255,255,.97);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 10px 30px rgba(10, 25, 60, .25), 0 2px 6px rgba(10, 25, 60, .12);
  transition: transform .18s, box-shadow .18s;
}
.card:hover { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(10,25,60,.28), 0 2px 6px rgba(10,25,60,.12); }
.label { display: block; font-size: 13.5px; font-weight: bold; color: #5a6478; margin-bottom: 10px; letter-spacing: .3px; }
.row { display: flex; gap: 8px; margin-bottom: 8px; }
.row:last-child { margin-bottom: 0; }
.row input { flex: 1; }
.row .btn { flex-shrink: 0; }

/* ---------- 输入 ---------- */
input[type=text], input[type=password], input[type=datetime-local], textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 15px;
  outline: none;
  transition: border .2s, box-shadow .2s;
  font-family: inherit;
  background: #fbfcfe;
  color: var(--ink);
}
input:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(42, 82, 152, .14);
  background: #fff;
}
input::placeholder, textarea::placeholder { color: #aab3c5; }
textarea { resize: vertical; min-height: 88px; line-height: 1.55; }

/* ---------- 按钮 ---------- */
.btn {
  border: none; border-radius: 10px; cursor: pointer;
  font-size: 14px; padding: 10px 16px; font-family: inherit;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn.ghost { background: #eef2f9; color: var(--primary); font-weight: bold; }
.btn.ghost:hover { background: #dfe8f5; }
.btn.primary { background: linear-gradient(135deg, #2a5298, #1e3c72); color: #fff; font-weight: bold; }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(30, 60, 114, .35); }
.btn.primary:disabled { background: #93a7c8; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.big {
  width: 100%; padding: 16px; font-size: 17.5px; letter-spacing: 6px;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(30, 60, 114, .35);
}
#send { margin-top: 12px; }
.btn.mini { padding: 5px 12px; font-size: 12px; border-radius: 8px; }

/* ---------- 类型页签 ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab {
  flex: 1; padding: 11px; border: 1.5px solid var(--line); background: #f7f9fd;
  border-radius: 10px; cursor: pointer; font-size: 14.5px; font-family: inherit;
  color: var(--sub); font-weight: bold;
  transition: all .18s;
}
.tab:hover { border-color: #c6d4ec; color: var(--primary); }
.tab.active {
  background: linear-gradient(135deg, #2a5298, #1e3c72);
  color: #fff; border-color: transparent;
  box-shadow: 0 6px 16px rgba(30, 60, 114, .3);
}

/* ---------- 显示颜色 ---------- */
.colors { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.9);
  background: var(--c);
  cursor: pointer; padding: 0;
  box-shadow: 0 2px 6px rgba(10, 25, 60, .25);
  transition: transform .15s, box-shadow .15s;
  position: relative;
}
.swatch:hover { transform: scale(1.12); }
.swatch.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4.5px var(--c), 0 2px 6px rgba(10,25,60,.25);
  transform: scale(1.05);
}
.swatch.custom {
  display: grid; place-items: center;
  background: conic-gradient(#e74c3c, #f39c12, #2ecc71, #16a085, #2a5298, #6c3483, #e74c3c);
  overflow: hidden;
}
.swatch.custom input {
  position: absolute; inset: 5px; opacity: 0; cursor: pointer; border: none;
  border-radius: 50%; width: auto; height: auto;
}
.swatch-plus {
  pointer-events: none; color: #fff; font-size: 15px; font-weight: bold;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.color-preview {
  border-radius: 10px;
  transition: background .2s;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
/* 跑马灯预览：真实滚动动画 */
.mq-preview { position: relative; height: 44px; overflow: hidden; margin-top: 14px; }
.mq-track {
  position: absolute; top: 50%; transform: translateY(-50%);
  white-space: nowrap; font-weight: bold; font-size: 15px;
  animation: mqScroll 15s linear infinite;
}
@keyframes mqScroll {
  from { transform: translate(620px, -50%); }
  to   { transform: translate(-100%, -50%); }
}
.mq-indicator {
  position: absolute; top: 4px; right: 30px;
  font-size: 10px; font-weight: bold; color: #fff;
  background: rgba(0,0,0,.45); border-radius: 7px; padding: 1px 7px;
}
.win-hint {
  position: absolute; bottom: 4px; right: 7px;
  font-size: 10px; color: #fff;
  background: rgba(0,0,0,.45); border-radius: 7px; padding: 1px 7px;
  opacity: .85;
}
/* 全屏预览：居中大字 + 底部提示行 */
.fs-preview {
  position: relative; height: 88px;
  display: flex; align-items: center; justify-content: center;
  margin-top: 14px;
}
.fs-text {
  font-weight: bold; font-size: 30px; line-height: 1.25;
  text-align: center; padding: 0 14px; overflow: hidden;
  max-height: 100%;
}
.fs-hintline {
  position: absolute; bottom: 4px; left: 0; right: 0;
  text-align: center; font-size: 10px; opacity: .75;
}
/* 滚动次数 / 字号 / 文字颜色 */
.plabel { display: block; font-size: 13px; font-weight: bold; color: var(--primary); margin: 4px 0 8px; }
.params-grid { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.params-grid .param { flex: 1; min-width: 100px; }
.params-grid .param label {
  display: block; font-size: 12px; color: var(--sub); margin-bottom: 4px; font-weight: bold;
}
.params-grid .param input[type=number] {
  width: 100%; padding: 8px 10px; font-size: 14px;
}
.tc-row { display: flex; gap: 6px; align-items: center; }
.tc-row input[type=color] {
  width: 40px; height: 34px; padding: 2px; border: 1.5px solid var(--line);
  border-radius: 8px; background: #fbfcfe; cursor: pointer;
}
.tc-row .btn.mini.active { background: var(--primary); color: #fff; }

/* ---------- 图片拖放 ---------- */
.drop {
  border: 2px dashed #c3cfe4; border-radius: 12px; padding: 26px;
  text-align: center; color: #8b96ad; cursor: pointer; transition: .2s;
  background: #f8fafd;
}
.drop:hover, .drop.over { border-color: var(--primary); background: #f0f5ff; color: var(--primary); }
.preview { max-width: 100%; max-height: 260px; border-radius: 10px; margin-top: 10px; box-shadow: 0 4px 14px rgba(10,25,60,.15); }
.hint { font-size: 12px; color: #98a2b6; margin-top: 8px; }

/* ---------- 显示方式 / 开关 ---------- */
.modes { display: flex; gap: 10px; margin-bottom: 14px; }
.mode {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1.5px solid var(--line); border-radius: 11px; padding: 13px 8px;
  cursor: pointer; font-size: 14px; background: #f7f9fd; color: var(--sub);
  transition: all .18s; font-weight: bold;
}
.mode:hover { border-color: #c6d4ec; }
.mode:has(input:checked) {
  border-color: var(--primary); background: #eef4ff; color: var(--primary);
  box-shadow: 0 4px 12px rgba(42, 82, 152, .14);
}
.mode input { display: none; }

.switch {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 2px; cursor: pointer; font-size: 15px; user-select: none;
}
.switch input { display: none; }
.toggle {
  width: 40px; height: 22px; border-radius: 11px; flex-shrink: 0;
  background: #ccd4e4; position: relative; transition: background .2s;
}
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  transition: left .2s;
}
.switch input:checked + .toggle { background: var(--ok); }
.switch input:checked + .toggle::after { left: 20px; }

/* ---------- 接收端列表 ---------- */
.count-badge {
  display: inline-block; min-width: 22px; padding: 1px 8px;
  background: var(--ok); color: #fff; border-radius: 12px;
  font-size: 12px; text-align: center; vertical-align: middle;
}
.client-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 6px; border-bottom: 1px solid #eef1f8;
  cursor: pointer; user-select: none; border-radius: 8px;
  transition: background .15s;
}
.client-item:last-child { border-bottom: none; }
.client-item:hover { background: #f4f7fd; }
.client-item label {
  display: flex; align-items: center; gap: 9px;
  width: 100%; cursor: pointer; padding: 2px 0;
}
.client-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--ok); flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(46, 204, 113, .18);
}
.client-dot.soft { background: var(--warn); box-shadow: 0 0 0 3px rgba(243, 156, 18, .18); }
.client-dot.warn { background: var(--danger); box-shadow: 0 0 0 3px rgba(231, 76, 60, .18); }
.client-dot.dead { background: #b0b6bf; box-shadow: none; }
.client-name {
  flex: 1; font-size: 14px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.client-meta {
  font-size: 12px; color: var(--primary); white-space: nowrap;
  font-variant-numeric: tabular-nums; min-width: 52px; text-align: right;
}
.client-meta.off { color: var(--danger); }
.client-check { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; cursor: pointer; }
.client-item.selected { background: #eef4ff; box-shadow: inset 3px 0 0 var(--primary); }
/* 备注改名 */
.client-edit {
  border: none; background: transparent; cursor: pointer;
  font-size: 13px; padding: 2px 5px; border-radius: 6px; flex-shrink: 0;
  opacity: .55; transition: opacity .15s, background .15s; font-family: inherit;
}
.client-item:hover .client-edit { opacity: 1; }
.client-edit:hover { background: #e4ecfa; }
.client-item.renaming { background: #f2f7ff; }
.rename-input {
  flex: 1; min-width: 0; width: auto !important;
  padding: 6px 10px !important; font-size: 13.5px !important;
  border: 1.5px solid var(--primary) !important; border-radius: 8px;
}
.client-item.renaming .btn.mini { flex-shrink: 0; }
/* 离线设备：灰色展示，不可勾选 */
.client-item.offline { opacity: .55; }
.client-item.offline:hover { background: transparent; }
.client-item.offline label { cursor: default; }

.client-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.selected-info { font-size: 12px; color: var(--sub); margin-left: auto; }

/* ---------- 定时列表 ---------- */
.sched-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 0; border-bottom: 1px solid #eef1f8;
}
.sched-item:last-child { border-bottom: none; }
.sched-time { font-size: 13px; color: var(--primary); font-weight: bold; white-space: nowrap; }
.sched-preview { flex: 1; font-size: 14px; color: #555f73; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-target {
  font-size: 12px; color: var(--primary); background: #eef4ff;
  padding: 2px 7px; border-radius: 5px; white-space: nowrap;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis;
}
.sched-cancel {
  border: none; background: #fdecea; color: var(--danger);
  border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 13px; font-family: inherit;
  transition: background .15s;
}
.sched-cancel:hover { background: #f5c6c2; }
.sched-empty { font-size: 13px; color: #999; }

/* ---------- 发送记录 ---------- */
.hist-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.hist-head .label { margin: 0; }
.hist-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 2px; border-bottom: 1px solid #eef1f8; font-size: 13px;
}
.hist-item:last-child { border-bottom: none; }
.hist-time {
  color: var(--sub); font-variant-numeric: tabular-nums;
  white-space: nowrap; font-size: 12px;
}
.hist-dot {
  width: 10px; height: 10px; border-radius: 3px; background: var(--c);
  flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.hist-kind { flex-shrink: 0; }
.hist-content {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--ink);
}
.hist-target {
  font-size: 11px; color: var(--primary); background: #eef4ff;
  padding: 1px 6px; border-radius: 5px; white-space: nowrap;
}
.hist-sched { font-size: 11px; color: var(--warn); white-space: nowrap; }
.hist-ok { font-size: 12px; color: var(--ok); font-weight: bold; white-space: nowrap; }
.hist-fail {
  font-size: 12px; color: var(--danger); font-weight: bold;
  white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 提示浮层 ---------- */
.toast {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%);
  background: rgba(28, 40, 66, .92); color: #fff; padding: 12px 26px;
  border-radius: 12px; font-size: 14.5px; z-index: 99;
  box-shadow: 0 8px 28px rgba(0,0,0,.3);
  backdrop-filter: blur(6px);
  animation: toastIn .25s ease-out;
  max-width: 90vw;
}
.toast.error { background: rgba(192, 57, 43, .95); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -12px);} to { opacity: 1; transform: translate(-50%, 0);} }

.hidden { display: none !important; }

input:focus, textarea:focus { border-color: var(--primary); }
