/* overlay.css — OBS 浏览器源专用
 *
 * 三条硬性约束：
 * 1. 背景必须完全透明（OBS 叠加在画面上）；
 * 2. 不能有任何滚动条或白边（body margin 0、overflow hidden）；
 * 3. 字号用 rem 时根字号不能跟随页面缩放 —— 这里直接用 px。
 */

@layer page {
  /* overlay 页不加载 base.css（它带导航/排版等用不上的东西），
     所以这里必须自己声明 [hidden]，否则 JS 设了 hidden 也藏不住。 */
  [hidden] { display: none !important; }

  html.is-overlay, html.is-overlay body {
    margin: 0;
    padding: 0;
    background: transparent !important;
    background-image: none !important;
    overflow: hidden;
    height: 100%;
    color: #fff;
    font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  }

  /* 预览模式：仅用于在普通浏览器里检查效果，OBS 里不要加 ?preview=1 */
  html.is-preview, html.is-preview body {
    background: linear-gradient(135deg, #171130 0%, #2a2350 55%, #100b22 100%) !important;
    background-image: linear-gradient(135deg, #171130 0%, #2a2350 55%, #100b22 100%) !important;
  }

  .overlay-body { position: relative; }

  /* ── 弹幕 ─────────────────────────────────────────── */
  .danmaku-stage {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
  }
  .danmaku-item {
    position: absolute;
    left: 100%;
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    white-space: nowrap;
    font-weight: 700;
    text-shadow:
      0 0 2px rgba(0, 0, 0, 0.9),
      0 0 6px rgba(0, 0, 0, 0.55),
      0 2px 2px rgba(0, 0, 0, 0.6);
    will-change: transform;
  }
  .danmaku-item__user { color: #ffd76e; }
  .danmaku-item__user::after { content: "："; color: #fff; }
  .danmaku-item__text { color: #fff; }

  .overlay-hint {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%);
    padding: 0.3rem 0.8rem;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
    background: rgba(0, 0, 0, 0.45);
    border-radius: 99px;
    transition: opacity 400ms ease;
  }
  .overlay-hint.is-hidden { opacity: 0; }

  /* ── 点歌面板 ─────────────────────────────────────── */
  .sq-panel {
    --sq-accent: #f0c96a;
    position: relative;
    width: 420px;
    padding: 16px 18px 15px;
    overflow: hidden;
    color: #fff;
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
    /* 兜底：不依赖 color-mix，OBS 旧版 CEF 也能画出底色（否则会整块透明） */
    background: linear-gradient(160deg, rgba(24, 20, 44, 0.96), rgba(18, 14, 38, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 20px;
    box-shadow:
      0 26px 60px -34px rgba(0, 0, 0, 0.9),
      inset 0 1px 0 rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(14px) saturate(1.15);
  }
  /* 支持 color-mix 的浏览器（现代 Chrome / OBS 30+）再叠一层强调色光晕 */
  @supports (background: color-mix(in srgb, red 10%, blue)) {
    .sq-panel {
      background:
        radial-gradient(120% 85% at 0% 0%, color-mix(in srgb, var(--sq-accent) 18%, transparent), transparent 58%),
        linear-gradient(160deg, rgba(24, 20, 44, 0.96), rgba(18, 14, 38, 0.92));
      border-color: color-mix(in srgb, var(--sq-accent) 34%, rgba(255, 255, 255, 0.12));
    }
  }
  /* 上屏标题/正文在浅色画面上也要能读 */
  .sq-panel .sq-title,
  .sq-panel .sq-head__titles b {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  }

  .sq-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.045), transparent 70%);
  }

  .sq-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  .sq-head__brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .sq-head__icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 17px;
    color: #1b1430;
    background: linear-gradient(145deg, var(--sq-accent), color-mix(in srgb, var(--sq-accent) 62%, #fff));
    box-shadow: 0 4px 14px -6px color-mix(in srgb, var(--sq-accent) 75%, transparent);
  }
  .sq-head__titles { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
  .sq-head__titles b {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.08em;
    white-space: nowrap;
  }
  .sq-head__titles small {
    font-size: 9px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
  }
  .sq-head__count {
    flex: 0 0 auto;
    padding: 4px 9px;
    font-size: 10.5px;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
  }
  .sq-head__count strong {
    margin-right: 2px;
    font-size: 14px;
    color: var(--sq-accent);
  }

  .sq-current {
    margin-top: 12px;
    padding: 11px 13px 12px;
    border-radius: 14px;
    background: linear-gradient(
      135deg,
      color-mix(in srgb, var(--sq-accent) 24%, transparent),
      rgba(255, 255, 255, 0.03)
    );
    border: 1px solid color-mix(in srgb, var(--sq-accent) 30%, transparent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    animation: sq-in 240ms ease-out both;
  }
  .sq-current__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .sq-current__label {
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.16em;
    color: #1b1430;
    background: var(--sq-accent);
    border-radius: 999px;
  }
  .sq-current__wave {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
  }
  .sq-current__wave i {
    width: 2px;
    height: 5px;
    background: var(--sq-accent);
    border-radius: 2px;
    animation: sq-wave 900ms ease-in-out infinite;
  }
  .sq-current__wave i:nth-child(2) { animation-delay: 120ms; }
  .sq-current__wave i:nth-child(3) { animation-delay: 240ms; }
  .sq-current__wave i:nth-child(4) { animation-delay: 360ms; }
  .sq-current__title {
    margin: 8px 0 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0.01em;
  }
  .sq-current__requester {
    margin: 3px 0 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.52);
  }
  .sq-current__requester::before { content: "点歌 · "; opacity: 0.65; }

  .sq-list {
    display: grid;
    gap: 6px;
    margin-top: 11px;
    padding: 0;
    list-style: none;
  }
  .sq-list__item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 10px;
    animation: sq-in 220ms ease-out both;
  }
  .sq-list__item:first-child {
    background: rgba(255, 255, 255, 0.075);
    border-color: color-mix(in srgb, var(--sq-accent) 22%, transparent);
  }
  .sq-list__pos {
    flex: 0 0 22px;
    font-size: 11px;
    font-weight: 800;
    color: var(--sq-accent);
    letter-spacing: 0.04em;
    opacity: 0.9;
  }
  .sq-list__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
  }
  .sq-list__title {
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sq-list__artist {
    overflow: hidden;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.46);
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sq-list__requester {
    flex: 0 0 auto;
    max-width: 96px;
    overflow: hidden;
    padding: 3px 7px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.58);
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.055);
    border-radius: 999px;
  }
  .sq-list__requester::before { content: "@"; opacity: 0.55; }

  .sq-empty {
    margin: 14px 0 2px;
    padding: 15px 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    background: rgba(255, 255, 255, 0.025);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 12px;
  }
  .sq-empty span {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-right: 6px;
    color: var(--sq-accent);
    background: color-mix(in srgb, var(--sq-accent) 14%, transparent);
    border-radius: 50%;
    vertical-align: -6px;
  }

  @keyframes sq-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
  }
  @keyframes sq-wave {
    0%, 100% { height: 4px; opacity: 0.65; }
    50% { height: 12px; opacity: 1; }
  }
}

/* ---------------------------------------------------------------------------
 * 点歌板 v0.5：滚动视口 + 标签 + 简洁样式（截图那版）
 *
 * 视口固定高 = rows 行，里面 .sq-list 靠 transform 平移；
 * 这样条目再多也只在视口里滚，不会把 OBS 的版式撑开。
 * ------------------------------------------------------------------------- */

.sq-viewport {
  overflow: hidden;
  margin-top: 10px;
}

.sq-list {
  margin-top: 0;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.sq-list__tags { display: flex; flex: 0 0 auto; gap: 4px; }

.sq-tag {
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.sq-tag--top { color: #fff; background: #e2483c; }
.sq-tag--parked { color: #ffd9a8; background: rgba(255, 176, 74, 0.22); }
.sq-tag--guard { color: #ffe9b0; background: rgba(240, 201, 106, 0.24); }

.sq-medal {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  color: #1a1430;
  font-size: 11px;
  font-weight: 800;
  background: linear-gradient(160deg, #ffe6a8, #e7b455);
  border-radius: 5px;
}

.sq-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}
.sq-foot__done b { color: var(--sq-accent); font-weight: 800; }
.sq-foot__closed {
  margin-left: auto;
  padding: 2px 8px;
  color: #ffcdc4;
  font-weight: 700;
  background: rgba(226, 72, 60, 0.2);
  border-radius: 6px;
}

/* ---- 简洁样式：没有卡片、没有圆角底色，只有细线分隔的列表 ---- */
.sq-panel[data-style="compact"] {
  padding: 12px 14px 10px;
  background: linear-gradient(180deg, rgba(20, 16, 32, 0.82), rgba(16, 12, 28, 0.68));
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  backdrop-filter: blur(8px) saturate(1.05);
}
.sq-panel[data-style="compact"] .sq-head {
  padding-bottom: 8px;
  border-bottom-color: rgba(255, 255, 255, 0.14);
}
.sq-panel[data-style="compact"] .sq-head__icon {
  width: 26px;
  height: 26px;
  font-size: 13px;
}
.sq-panel[data-style="compact"] .sq-head__titles b { font-size: 14px; }
.sq-panel[data-style="compact"] .sq-head__titles small { display: none; }
.sq-panel[data-style="compact"] .sq-current {
  padding: 8px 0 2px;
  background: none;
  border: none;
}

.sq-panel[data-style="compact"] .sq-list { gap: 0; }
/* 简洁样式的行是 .sq-row，卡片样式的行是 .sq-list__item；两者互斥渲染，无需隐藏 */
.sq-panel[data-style="compact"] .sq-list__item:not(.sq-row) { display: none; }

.sq-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 14px;
  line-height: 1.35;
}
.sq-row:last-child { border-bottom: none; }
.sq-row[data-pinned="1"] .sq-row__title { color: #ffe6a8; }

.sq-row__pos {
  flex: 0 0 20px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.sq-row__tags { display: flex; flex: 0 0 auto; gap: 4px; }
.sq-row__title {
  /* 截图那版是「歌名 → 点歌人 → 舰长标 → 粉丝牌」从左往右排，不右对齐 */
  flex: 0 1 auto;
  max-width: 56%;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sq-row__who {
  flex: 0 0 auto;
  max-width: 32%;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 新来的一条闪一下，让观众知道"我点上了" */
.sq-row.is-new,
.sq-list__item.is-new {
  animation: sq-flash 1.1s ease-out;
}
@keyframes sq-flash {
  0% { background: color-mix(in srgb, var(--sq-accent) 42%, transparent); }
  100% { background: transparent; }
}

/* ---------------------------------------------------------------------------
 * 简洁样式 v2 —— 照直播间截图里「点歌板」的样子重做
 *
 *   点歌板
 *   ──────────────────────────────
 *   2. 莉莉安   ♢ 小岁小夕  舰长  粉丝牌 16
 *   ──────────────────────────────
 *   已点 6               点歌已开启
 *
 * 和 v1 的差别：序号不补零、点歌人金色带 ♢、舰长/粉丝牌是浅色小字而不是彩色胶囊、
 * 头部标题居中、底部一条状态栏。
 * ------------------------------------------------------------------------- */
.sq-panel[data-style="compact"] {
  padding: 10px 12px 8px;
  background: linear-gradient(180deg, rgba(16, 13, 28, 0.86), rgba(12, 10, 22, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: 0 18px 40px -28px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}
.sq-panel[data-style="compact"] .sq-head {
  justify-content: center;
  padding: 2px 0 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}
.sq-panel[data-style="compact"] .sq-head__brand { gap: 0; justify-content: center; }
.sq-panel[data-style="compact"] .sq-head__icon { display: none; }
.sq-panel[data-style="compact"] .sq-head__titles { align-items: center; }
.sq-panel[data-style="compact"] .sq-head__titles b {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.sq-panel[data-style="compact"] .sq-head__titles small { display: none; }
.sq-panel[data-style="compact"] .sq-head__count {
  position: absolute;
  right: 12px;
  top: 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
}

/* 行 */
.sq-panel[data-style="compact"] .sq-list { gap: 0; }
.sq-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 5px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13.5px;
  line-height: 1.3;
}
.sq-row:last-child { border-bottom: none; }
.sq-row__pos {
  flex: 0 0 auto;
  min-width: 16px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.sq-row__pin {
  flex: 0 0 auto;
  padding: 0 4px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  background: #d9453a;
  border-radius: 3px;
}
.sq-row__title {
  flex: 0 1 auto;
  max-width: 42%;
  overflow: hidden;
  color: #fff;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sq-row__who {
  flex: 0 1 auto;
  max-width: 30%;
  overflow: hidden;
  color: #f5c96a;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sq-row__guard,
.sq-row__medal {
  flex: 0 0 auto;
  padding: 0 4px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 3px;
  white-space: nowrap;
}
.sq-row__medal { color: rgba(255, 233, 176, 0.8); }
.sq-row[data-pinned="1"] .sq-row__title { color: #ffe6a8; }

/* 底部状态栏 */
.sq-panel[data-style="compact"] .sq-foot {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.5);
}
.sq-panel[data-style="compact"] .sq-foot__done b { color: #f5c96a; }
.sq-panel[data-style="compact"] .sq-empty { font-size: 12px; padding: 8px 0; }

/* ---------------------------------------------------------------------------
 * 简洁样式 v3 —— 对齐直播截图的「密度 + 色彩」
 *
 * 参考图特征：小标题、很密的行、舰长紫色小框、粉丝牌青色标签、
 * 点歌人白字、底部一排功能小胶囊。v2 只借了行的顺序，这版才把观感拉齐。
 * ------------------------------------------------------------------------- */
.sq-panel[data-style="compact"] {
  padding: 8px 10px 7px;
  border-radius: 8px;
}
.sq-panel[data-style="compact"] .sq-head {
  padding: 1px 0 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.sq-panel[data-style="compact"] .sq-head__titles b {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.sq-panel[data-style="compact"] .sq-head__count {
  top: 8px;
  right: 9px;
  padding: 1px 6px;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

/* 行：更密 */
.sq-row {
  gap: 5px;
  padding: 3.5px 1px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12.5px;
  line-height: 1.25;
}
.sq-row__pos {
  min-width: 14px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 11.5px;
  font-weight: 600;
}
.sq-row__title {
  max-width: 40%;
  color: #fff;
  font-weight: 500;
}
/* 点歌人：白字（身份交给徽章，别用金色抢歌名） */
.sq-row__who {
  max-width: 30%;
  color: rgba(255, 255, 255, 0.82);
  font-size: 11.5px;
}
/* 舰长/提督：紫色小框 */
.sq-row__guard {
  padding: 0 4px;
  color: #c9b8ff;
  font-size: 10.5px;
  background: rgba(124, 92, 255, 0.22);
  border: 1px solid rgba(150, 122, 255, 0.45);
  border-radius: 3px;
}
/* 粉丝牌：青色标签 */
.sq-row__medal {
  padding: 0 4px;
  color: #7ee4d0;
  font-size: 10.5px;
  background: rgba(38, 190, 165, 0.18);
  border: 1px solid rgba(78, 210, 186, 0.42);
  border-radius: 3px;
}
.sq-row__pin {
  padding: 0 3px;
  font-size: 9.5px;
  border-radius: 2px;
}

/* 底部：一行小胶囊（对应截图那排功能标） */
.sq-panel[data-style="compact"] .sq-foot {
  gap: 5px;
  margin-top: 5px;
  padding-top: 5px;
  font-size: 11px;
}
.sq-foot__hint {
  display: none;
  gap: 4px;
  margin-left: auto;
}
.sq-panel[data-style="compact"] .sq-foot__hint { display: flex; }
.sq-foot__hint span {
  padding: 0 5px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  line-height: 16px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 3px;
  white-space: nowrap;
}
.sq-foot__hint span.is-accent { color: #ffe6a8; background: rgba(245, 201, 106, 0.16); }

/* 空队列：一行浅字，不要大虚线框 */
.sq-panel[data-style="compact"] .sq-empty {
  margin: 8px 0;
  padding: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.42);
  background: none;
  border: none;
}
.sq-panel[data-style="compact"] .sq-empty span { opacity: 0.5; }
