/* 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, #1c1811 0%, #2f2a20 55%, #14110c 100%) !important;
    background-image: linear-gradient(135deg, #1c1811 0%, #2f2a20 55%, #14110c 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;
    background:
      radial-gradient(120% 85% at 0% 0%, color-mix(in srgb, var(--sq-accent) 18%, transparent), transparent 58%),
      linear-gradient(160deg, rgba(27, 27, 21, 0.94), rgba(19, 17, 12, 0.82));
    border: 1px solid color-mix(in srgb, var(--sq-accent) 34%, rgba(255, 255, 255, 0.12));
    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);
  }
  .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: #221a0d;
    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: #221a0d;
    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; }
  }
}