:root {
  --bg: #0a0b10;
  --panel: #12141c;
  --panel2: #171a24;
  --line: #232838;
  --text: #e8eaf2;
  --dim: #8b93a8;
  --accent: #ff5a3c;
  --accent2: #ff8a3c;
  --ok: #35d07f;
  --warn: #ffb020;
  --err: #ff4d6a;
  --live: #ff2d55;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 90, 60, .10), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(70, 120, 255, .08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent2); text-decoration: none; }
button { font-family: inherit; }

/* ---------- 通用 ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #3a4159; background: #1c2030; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border: none; color: #fff; font-weight: 600; box-shadow: 0 6px 20px rgba(255, 90, 60, .28); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff8098; border-color: #48202c; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px;
  background: #1c2030; color: var(--dim); border: 1px solid var(--line);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.dot.ok { background: var(--ok); box-shadow: 0 0 10px rgba(53, 208, 127, .7); }
.dot.warn { background: var(--warn); }
.dot.err { background: var(--err); }
.dot.live { background: var(--live); animation: blink 1.2s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

input, textarea, select {
  background: #0e1017; border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 8px 11px; font-size: 14px; font-family: inherit;
  outline: none; width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #262b3b; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #333a4e; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 控制台布局 ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: rgba(12, 14, 20, .82); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.logo .mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid; place-items: center; font-size: 14px; color: #fff;
}
.spacer { flex: 1; }

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 330px;
  gap: 16px; padding: 16px 20px 40px;
  align-items: start;
  max-width: 1720px; margin: 0 auto;
}
@media (max-width: 1280px) {
  .layout { grid-template-columns: 260px minmax(0, 1fr); }
  .col-right { grid-column: 1 / -1; }
}

.card {
  background: linear-gradient(180deg, var(--panel), #0f1118);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-h {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px; border-bottom: 1px solid var(--line);
  font-weight: 600; font-size: 14px;
}
.card-b { padding: 14px 15px; }

/* 队列 */
.queue { max-height: 62vh; overflow-y: auto; }
.q-item {
  display: flex; gap: 10px; padding: 10px 12px;
  border-bottom: 1px solid #1a1e2b; cursor: pointer; transition: .14s;
  align-items: flex-start;
}
.q-item:hover { background: #151823; }
.q-item.active { background: linear-gradient(90deg, rgba(255, 90, 60, .16), transparent); border-left: 3px solid var(--accent); padding-left: 9px; }
.q-item.done { opacity: .5; }
.q-item .no {
  width: 22px; height: 22px; border-radius: 6px; background: #1c2030;
  display: grid; place-items: center; font-size: 11px; color: var(--dim); flex: none; margin-top: 1px;
}
.q-item.active .no { background: var(--accent); color: #fff; }
.q-t { font-size: 13.5px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.q-m { font-size: 12px; color: var(--dim); margin-top: 3px; display: flex; gap: 8px; }
.q-price { color: var(--accent2); font-weight: 600; }

/* 当前款 */
.now-card { position: relative; }
.now-head { display: flex; gap: 16px; padding: 18px; border-bottom: 1px solid var(--line); }
.now-thumb {
  width: 92px; height: 92px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, #232838, #161a26);
  display: grid; place-items: center; font-size: 28px; color: #3a4258;
  overflow: hidden;
}
.now-thumb img { width: 100%; height: 100%; object-fit: cover; }
.now-title { font-size: 19px; font-weight: 700; line-height: 1.35; margin-bottom: 8px; }
.now-meta { display: flex; gap: 8px; flex-wrap: wrap; }

.timer-row { display: flex; align-items: center; gap: 14px; padding: 12px 18px; background: #0e1017; border-bottom: 1px solid var(--line); }
.big-timer { font-variant-numeric: tabular-nums; font-size: 30px; font-weight: 700; letter-spacing: 1px; min-width: 74px; }
.big-timer.hurry { color: var(--warn); }
.big-timer.critical { color: var(--err); animation: blink 1s infinite; }
.progress { flex: 1; height: 8px; background: #1a1e2b; border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 99px; transition: width .9s linear; }
.seg-pos { font-size: 12.5px; color: var(--dim); white-space: nowrap; }

.segs { padding: 6px 0 10px; max-height: 46vh; overflow-y: auto; }
.seg {
  display: flex; gap: 12px; padding: 11px 18px; border-left: 3px solid transparent;
  transition: .15s; cursor: pointer;
}
.seg:hover { background: #151823; }
.seg.cur { background: linear-gradient(90deg, rgba(255, 90, 60, .13), transparent); border-left-color: var(--accent); }
.seg.past { opacity: .42; }
.seg-label {
  font-size: 11.5px; color: var(--dim); width: 74px; flex: none; padding-top: 3px;
  display: flex; flex-direction: column; gap: 3px;
}
.seg.cur .seg-label { color: var(--accent2); }
.seg-text { font-size: 15px; line-height: 1.72; }
.seg.cur .seg-text { font-size: 16.5px; }

/* 日志 */
.logs { max-height: 34vh; overflow-y: auto; font-size: 12.5px; line-height: 1.6; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.log-line { padding: 4px 0; border-bottom: 1px dashed #1a1e2b; display: flex; gap: 8px; }
.log-time { color: #4b5468; flex: none; }
.log-line.ok .log-t { color: #7fe0ac; }
.log-line.warn .log-t { color: var(--warn); }
.log-line.err .log-t { color: #ff8fa3; }
.log-line.seg .log-t { color: #8fb8ff; }
.log-line.auto .log-t { color: #d2a4ff; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; color: var(--dim); margin-bottom: 6px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #1a1e2b; }
.switch:last-child { border-bottom: none; }
.switch .sw-t { font-size: 13.5px; }
.switch .sw-d { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.tgl { width: 44px; height: 24px; border-radius: 99px; background: #262b3b; position: relative; cursor: pointer; flex: none; transition: .18s; border: none; }
.tgl::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #8b93a8; transition: .18s; }
.tgl.on { background: rgba(255, 90, 60, .3); }
.tgl.on::after { left: 23px; background: var(--accent); }

.toast-wrap { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast { background: #1b1f2c; border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 10px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); animation: slideIn .22s ease; max-width: 360px; }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .62); backdrop-filter: blur(4px); display: none; place-items: center; z-index: 100; padding: 20px; }
.modal-mask.show { display: grid; }
.modal { width: min(720px, 100%); max-height: 86vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.modal-h { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-b { padding: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12.5px; color: var(--dim); line-height: 1.65; }
.kbd { display: inline-block; padding: 1px 6px; border: 1px solid #333a4e; border-bottom-width: 2px; border-radius: 5px; font-size: 11.5px; color: var(--dim); background: #0e1017; }

/* ---------- 提词器 ---------- */
body.prompter {
  background: #05060a;
  overflow: hidden;
  user-select: none;
}
.p-top {
  display: flex; align-items: center; gap: 18px; padding: 18px 32px;
  border-bottom: 1px solid #14161f;
}
.p-badge { font-size: 15px; padding: 5px 14px; border-radius: 99px; background: #14161f; color: var(--dim); display: flex; align-items: center; gap: 8px; }
.p-badge.live { background: rgba(255, 45, 85, .13); color: #ff6b8a; }
.p-title { font-size: 24px; font-weight: 700; }
.p-price { font-size: 22px; color: var(--accent2); font-weight: 700; margin-left: auto; }
.p-clock { font-variant-numeric: tabular-nums; font-size: 22px; color: var(--dim); }

.p-opbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 32px; background: rgba(255, 90, 60, .08);
  border-bottom: 1px solid #1f1620;
}
.op-kw {
  font-size: 17px; font-weight: 700; color: var(--accent2);
  background: rgba(255, 138, 60, .14); border: 1px solid #4a2f22;
  padding: 5px 14px; border-radius: 9px; user-select: all;
}
.op-tip { font-size: 15px; color: #c9a99a; }

.p-main {
  height: calc(100vh - 86px - 96px);
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 8vw; position: relative;
}
.p-main.with-bar { height: calc(100vh - 86px - 96px - 52px); }
.p-label { font-size: 17px; color: var(--accent2); letter-spacing: 2px; margin-bottom: 26px; display: flex; align-items: center; gap: 12px; }
.p-label .n { background: rgba(255, 90, 60, .15); color: var(--accent2); padding: 3px 12px; border-radius: 8px; font-size: 14px; letter-spacing: 0; }
.p-prev { font-size: 26px; line-height: 1.6; color: #2f3547; margin-bottom: 30px; max-height: 3.2em; overflow: hidden; }
.p-cur {
  font-size: clamp(34px, 3.6vw, 62px); line-height: 1.52; font-weight: 700;
  letter-spacing: .5px; text-shadow: 0 4px 40px rgba(255, 90, 60, .14);
  max-height: 62vh; overflow: hidden;
}
.p-cur .sent { transition: color .3s; color: #4a5268; }
.p-cur .sent.now { color: #ffffff; }
.p-next { font-size: 26px; line-height: 1.6; color: #2f3547; margin-top: 32px; }

.p-bar { position: fixed; left: 0; right: 0; bottom: 0; height: 96px; display: flex; align-items: center; gap: 22px; padding: 0 32px; border-top: 1px solid #14161f; background: rgba(5, 6, 10, .9); backdrop-filter: blur(10px); }
.p-prog { flex: 1; height: 10px; background: #14161f; border-radius: 99px; overflow: hidden; }
.p-prog > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .9s linear; border-radius: 99px; }
.p-rem { font-size: 26px; font-variant-numeric: tabular-nums; font-weight: 700; min-width: 62px; text-align: right; }
.p-hint { font-size: 13px; color: #3a4159; position: absolute; right: 32px; top: -30px; }

.rescue {
  position: fixed; left: 50%; bottom: 120px; transform: translate(-50%, 20px);
  background: #1b1f2c; border: 1px solid var(--accent); border-radius: 14px;
  padding: 18px 28px; font-size: 24px; max-width: 70vw; opacity: 0; pointer-events: none; transition: .25s;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.rescue.show { opacity: 1; transform: translate(-50%, 0); }

.p-paused { position: fixed; inset: 0; background: rgba(5, 6, 10, .82); display: none; place-items: center; font-size: 54px; letter-spacing: 10px; color: var(--dim); }
.p-paused.show { display: grid; }

/* ---------- 手机竖屏适配 ---------- */
@media (max-width: 820px), (orientation: portrait) {
  body.prompter { overflow-y: auto; }
  .p-top {
    flex-wrap: wrap; gap: 8px; padding: 10px 14px;
  }
  .p-badge { font-size: 12px; padding: 3px 10px; }
  .p-title { font-size: 15px; width: 100%; order: 3; }
  .p-price { font-size: 15px; margin-left: 0; order: 4; }
  .p-clock { font-size: 15px; margin-left: auto; }

  .p-opbar { padding: 8px 14px; gap: 8px; flex-wrap: wrap; }
  .op-kw { font-size: 13px; padding: 3px 9px; }
  .op-tip { font-size: 12px; }

  .p-main {
    height: auto; min-height: calc(100vh - 150px);
    padding: 16px 18px 120px; justify-content: flex-start;
  }
  .p-main.with-bar { height: auto; }
  .p-label { font-size: 13px; margin-bottom: 12px; }
  .p-label .n { font-size: 12px; padding: 2px 8px; }
  .p-prev { font-size: 14px; margin-bottom: 12px; max-height: 2.4em; }
  .p-cur { font-size: 24px; line-height: 1.6; max-height: none; }
  .p-next { font-size: 14px; margin-top: 14px; }

  .p-bar { height: 70px; padding: 0 14px; gap: 10px; }
  .p-prog { height: 8px; }
  .p-rem { font-size: 18px; min-width: 44px; }
  .p-hint { display: none; }
  .rescue { font-size: 16px; padding: 12px 18px; max-width: 88vw; bottom: 90px; }
}
