/* edu_stream · 直播课堂样式
   沿用 edu.css 的设计令牌（--edu-*），只补充本插件专属组件，
   保证与课程中心 / 公开课等页面观感一致。
*/

/* ---------------- 列表页 ---------------- */

.stm-hero {
    background: linear-gradient(135deg, #1f2a55 0%, #2f3f7d 60%, #3b4fa0 100%);
    color: #fff;
    padding: 56px 0 48px;
}

.stm-hero__badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    font-size: 12.5px;
    letter-spacing: .04em;
}

.stm-hero__title {
    margin: 16px 0 8px;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -.5px;
    line-height: 1.35;
}

.stm-hero__title em {
    font-style: normal;
    color: #ffd8bf;
}

.stm-hero__sub {
    font-size: 14px;
    color: rgba(255, 255, 255, .84);
    line-height: 1.8;
    max-width: 640px;
}

.stm-hero__stats {
    margin-top: 26px;
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

.stm-hero__stat-num {
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.stm-hero__stat-lab {
    margin-top: 2px;
    font-size: 12px;
    color: rgba(255, 255, 255, .72);
}

.stm-list {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.stm-card {
    background: #fff;
    border: 1px solid var(--edu-line, #e5e6eb);
    border-radius: var(--edu-radius, 14px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.stm-card__cover {
    height: 132px;
    position: relative;
    background: linear-gradient(135deg, #5c7cfa 0%, #2f3f8f 100%);
    background-size: cover;
    background-position: center;
}

.stm-card__badge {
    position: absolute;
    left: 12px;
    top: 12px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: rgba(0, 0, 0, .45);
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.stm-card__badge--live { background: rgba(245, 63, 63, .85); }

.stm-card__dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #fff; display: inline-block;
}

.stm-card__body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.stm-card__title { font-size: 15.5px; font-weight: 700; line-height: 1.5; }
.stm-card__summary { font-size: 13px; color: var(--edu-ink-3, #86909c); line-height: 1.7; }
.stm-card__meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--edu-ink-3, #86909c); }
/* 独立公开课（未关联课程）：一次性开播的房间，卡片上给个轻标记 */
.stm-card__tag {
    padding: 0 6px;
    border-radius: 4px;
    background: rgba(22, 93, 255, .08);
    color: var(--edu-brand, #165dff);
    font-weight: 600;
}
.stm-card__foot { margin-top: auto; padding-top: 6px; }

/* ---------------- 直播间 ---------------- */

.stm-room {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
}

@media (max-width: 980px) {
    .stm-room { grid-template-columns: minmax(0, 1fr); }
}

.stm-stage {
    background: #0e1220;
    border-radius: var(--edu-radius, 14px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.stm-stage__video {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #05070f;
    object-fit: cover;
    display: block;
}

/* 外部推流（OBS）尚未开播 / 播放失败时的画面提示 */
.stm-stage__tip {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    max-width: 82%;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.7;
    text-align: center;
    color: #e9ecef;
    background: rgba(10, 14, 25, .78);
    border: 1px solid rgba(255, 255, 255, .12);
    pointer-events: none;
}

.stm-stage { position: relative; }

.stm-stage__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, .88);
    font-size: 13px;
}

.stm-stage__status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* 画质切换（登录观众可见；游客固定标清，只显示徽标不给控件） */
.stm-quality {
    margin-left: 6px; padding: 3px 8px; font-size: 12px; font-family: inherit;
    color: rgba(255, 255, 255, .88); background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; cursor: pointer;
}
.stm-quality option { color: #1d2129; }

/* 游客留资门槛（公开直播课）：进入直播间前的表单卡 */
.stm-gate { max-width: 460px; margin: 0 auto; }
.stm-gate .edu-form { display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }
.stm-gate .edu-field { margin: 0; }

/* 试看倒计时最后 60 秒变红提醒 */
.stm-trial--ending { background: rgba(224, 49, 49, .15); border-color: #e03131; color: #ffc9c9; }

/* 讲师端设备与画面条：深色玻璃感，和播放器区连成一体 */
.stm-devbar {
    display: grid; gap: 6px;
    padding: 10px 16px 4px;
}
.stm-devbar__row {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.stm-devbar__label { font-size: 12.5px; color: rgba(255, 255, 255, .65); white-space: nowrap; }
.stm-devbar__select {
    max-width: 180px; padding: 5px 8px; border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .08); color: #fff; font-size: 12.5px;
}
.stm-devbar__select option { color: #1d2129; }
.stm-devbar__hint {
    margin: 0; font-size: 12px; color: rgba(255, 255, 255, .5);
}

.stm-stage__ctrl {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 16px 14px;
    color: rgba(255, 255, 255, .7);
}
.stm-stage__ctrl .edu-field__hint { color: rgba(255, 255, 255, .6); }

.stm-side { display: grid; gap: 16px; align-content: start; }

.stm-panel {
    background: #fff;
    border: 1px solid var(--edu-line, #e5e6eb);
    border-radius: var(--edu-radius, 14px);
    overflow: hidden;
}

.stm-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--edu-line, #e5e6eb);
    font-weight: 700;
    font-size: 14px;
}

.stm-panel__body { padding: 12px 16px 14px; }

/* 互动区 tab：公共互动 / 私聊提问 */
.stm-tabs { justify-content: flex-start; gap: 4px; padding: 6px 10px 0; }
.stm-tab {
    border: none; background: none; cursor: pointer;
    padding: 8px 12px 10px; font-family: inherit;
    font-size: 14px; font-weight: 600; color: var(--edu-ink-3, #86909c);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    display: inline-flex; align-items: center; gap: 6px;
}
.stm-tab:hover { color: var(--edu-ink-1, #1d2129); }
.stm-tab.active { color: var(--edu-brand, #FF6B18); border-bottom-color: var(--edu-brand, #FF6B18); }
.stm-pane { display: none; }
.stm-pane.active { display: block; }
.stm-pane .stm-chat { max-height: 380px; }

/* 互动区消息流 */
.stm-chat {
    max-height: 320px;
    overflow-y: auto;
    display: grid;
    gap: 10px;
}

.stm-msg { display: grid; gap: 2px; }
.stm-msg__head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--edu-ink-3, #86909c); }
.stm-msg__name { font-weight: 600; color: var(--edu-ink-1, #1d2129); }
.stm-msg__text { font-size: 13.5px; line-height: 1.7; color: var(--edu-ink-2, #4e5969); }
.stm-msg--private { background: rgba(255, 107, 24, .05); border-left: 2px solid var(--edu-brand, #FF6B18); padding: 8px 10px; border-radius: 8px; }
.stm-msg--mine .stm-msg__name { color: var(--edu-brand, #FF6B18); }

.stm-compose { display: flex; gap: 8px; margin-top: 10px; }
.stm-compose .stm-input { flex: 1 1 auto; min-width: 0; }
.stm-compose--reply { margin-top: 6px; }
.stm-compose--reply .stm-input { font-size: 12.5px; padding: 6px 10px; }

/* 观众席 */
.stm-seats { display: flex; flex-wrap: wrap; gap: 8px; }
.stm-seat {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px;
    background: var(--edu-bg-soft, #f5f7fa);
    font-size: 12.5px; color: var(--edu-ink-2, #4e5969);
}
.stm-seat--teacher { background: rgba(255, 107, 24, .12); color: var(--edu-brand, #FF6B18); font-weight: 600; }

/* 录制回放列表 */
.stm-replay { display: grid; gap: 8px; }
.stm-replay__item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 12px; border-radius: 10px;
    background: var(--edu-bg-soft, #f5f7fa); font-size: 13px;
}

/* ---------------- 手机端布局重排（≤720px） ---------------- */
@media (max-width: 720px) {
    .stm-hero { padding: 30px 0 22px; }
    .stm-hero__title { font-size: 26px; }
    .stm-hero__sub { font-size: 14.5px; }
    /* 统计条：横滑单行，避免折成两行挤压标题 */
    .stm-hero__stats {
        display: flex; flex-wrap: nowrap; gap: 18px;
        overflow-x: auto; scrollbar-width: none; padding-bottom: 4px;
    }
    .stm-hero__stats::-webkit-scrollbar { display: none; }
    .stm-hero__stat { flex: none; }
    .stm-hero__stat-num { font-size: 19px; }
    .stm-list { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .stm-card__cover { height: 140px; }
    /* 直播间：播放器在上、侧栏在下；工具条换行不溢出 */
    .stm-stage__bar { flex-wrap: wrap; gap: 6px; font-size: 12px; }
    .stm-stage__ctrl { padding: 8px 12px 12px; }
    .stm-tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
    .stm-tabs::-webkit-scrollbar { display: none; }
    .stm-compose { flex-wrap: nowrap; }
    .stm-chat, .stm-pane .stm-chat { max-height: 300px; }
    .stm-replay__item { flex-wrap: wrap; }
    .stm-gate { max-width: 100%; }
}

/* ================= 弹幕（2026-11-05） ================= */
/* 视频上方的飘屏层：绝对定位盖住画面区（不含底部信息条），
   pointer-events 关掉点击穿透，观众操作仍落在播放器控件上 */
.stm-danmaku {
    position: absolute;
    left: 0; right: 0; top: 0;
    height: min(72%, 340px);
    overflow: hidden;
    pointer-events: none;
    z-index: 6;
}
.stm-danmaku--off { display: none; }

.stm-danmaku__item {
    position: absolute;
    left: 100%;
    white-space: nowrap;
    max-width: 92%;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 14.5px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .85), 0 0 6px rgba(0, 0, 0, .5);
    background: rgba(12, 16, 28, .42);
    animation: stm-danmaku-fly linear forwards;
}
.stm-danmaku__item--teacher {
    color: #ffd66e;
    border: 1px solid rgba(255, 214, 110, .45);
}
.stm-danmaku__item--mine {
    outline: 1px solid rgba(255, 255, 255, .55);
}

@keyframes stm-danmaku-fly {
    from { transform: translateX(0); }
    to   { transform: translateX(calc(-100vw - 100%)); }
}

/* 弹幕发送条：贴在画面信息条下方，深色底与舞台一体。
   2026-11-07 下午需求：送礼按钮与消息发送同行 —— 弹幕表单占满剩余宽度，
   送礼按钮固定在右端（弹幕关掉/不能发弹幕时独占整行也自然）。 */
.stm-danmaku-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 12px;
    background: rgba(10, 14, 25, .55);
    border-top: 1px solid rgba(255, 255, 255, .08);
}
.stm-danmaku-bar__form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.stm-danmaku-bar__toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12.5px;
    color: rgba(255, 255, 255, .85);
    cursor: pointer;
    flex: none;
}
.stm-danmaku-bar__form .stm-input { flex: 1; min-width: 0; }
.stm-danmaku-bar__hint {
    margin: 0;
    font-size: 12.5px;
    color: rgba(255, 255, 255, .65);
    flex: 1;
    min-width: 0;
}

@media (max-width: 980px) {
    .stm-danmaku { height: 62%; }
    .stm-danmaku__item { font-size: 12.5px; }
    .stm-danmaku-bar__form { flex-wrap: nowrap; }
}

/* 无限滚动哨兵（2026-11-05）：列表页滚动到底按页取数 */
.stm-feed__sentinel {
    padding: 18px 0 26px;
    text-align: center;
}
.stm-feed__hint {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .06);
    color: var(--edu-ink-3, #8a8f99);
    font-size: 12.5px;
}

/* 直播已开始 · 刷新画面按钮（观看页状态翻转提示） */
#stm-live-reload {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 7;
}
/* .edu-btn 自带 display，会压过 hidden 属性的 UA 样式——不补这条，
   「刷新画面」按钮在未开播/已结束的页面上也会一直亮着（截图核验发现） */
#stm-live-reload[hidden] { display: none !important; }

/* ---------------- 送礼（2026-11-07 需求） ----------------
   按钮在底部操作条（弹幕输入行）右端，点开是 4 列礼品面板，
   面板向上弹出盖在画面上。礼物消息在互动区单独配色，和普通聊天区分开。 */

.stm-gift {
    position: relative;        /* 面板的定位锚点 */
    flex: none;
    z-index: 8;
}

.stm-gift__btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border: none; border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    color: #fff; font-family: inherit; font-size: 13px; font-weight: 600;
    cursor: pointer;
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    transition: background .16s, transform .16s;
}
.stm-gift__btn:hover { background: rgba(255, 255, 255, .24); transform: translateY(-1px); }
.stm-gift__btn-icon { font-size: 15px; line-height: 1; }

.stm-gift__panel {
    position: absolute; right: 0; bottom: calc(100% + 10px);
    width: 300px; max-width: calc(100vw - 40px);
    padding: 12px;
    background: #fff; color: var(--edu-ink-1, #1d2129);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .28);
    display: grid; gap: 10px;
}
/* .stm-gift__panel 自带 display:grid，会压过 hidden 的 UA 样式 */
.stm-gift__panel[hidden] { display: none !important; }

.stm-gift__head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.stm-gift__points { color: var(--edu-ink-3, #86909c); font-size: 12px; }
.stm-gift__points b { color: var(--edu-brand, #FF6B18); font-size: 14px; margin-left: 2px; }

.stm-gift__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stm-gift__item {
    display: grid; gap: 2px; justify-items: center;
    padding: 8px 4px; border: 1px solid var(--edu-line, #e5e6eb); border-radius: 10px;
    background: #fff; cursor: pointer; font-family: inherit;
    transition: border-color .15s, background .15s, transform .15s;
}
.stm-gift__item:hover {
    border-color: var(--edu-brand, #FF6B18);
    background: rgba(255, 107, 24, .05);
    transform: translateY(-1px);
}
.stm-gift__item:disabled { opacity: .5; cursor: wait; transform: none; }
.stm-gift__icon { font-size: 20px; line-height: 1.1; }
.stm-gift__name { font-size: 12px; color: var(--edu-ink-1, #1d2129); }
.stm-gift__cost { font-size: 11px; color: var(--edu-ink-3, #86909c); }
.stm-gift__tip { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--edu-ink-3, #86909c); }

/* 互动区里的礼物消息 */
.stm-msg--gift {
    background: linear-gradient(90deg, rgba(255, 125, 0, .10), rgba(255, 107, 24, .06));
    border-radius: 10px;
    padding: 8px 10px;
}
.stm-msg__text--gift {
    display: flex; align-items: center; gap: 6px;
    font-weight: 600; color: #b25000;
}
.stm-msg__gift-icon { font-size: 18px; line-height: 1; }
.stm-msg__gift-cost {
    margin-left: auto; font-size: 11.5px; font-weight: 500;
    color: var(--edu-ink-3, #86909c);
}
