* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: "Microsoft Yahei", "Hiragino Sans GB", sans-serif;
    background: #F2F4F8;
    -webkit-text-size-adjust: none;
    display: flex;
    flex-direction: column;
}

/* 顶栏：延续站内蓝色风格 */
.topbar {
    background-image: url(../Images/bg.png);
    background-color: #407ADD;
    color: White;
    display: flex;
    align-items: center;
    line-height: 40px;
    height: 40px;
    flex: none;
}
.topbar-btn { width: 40px; text-align: center; line-height: 0; }
.topbar-btn img { vertical-align: middle; }
.topbar-title { flex: 1; text-align: center; font-size: 12pt; color: White; }

/* 登录层 */
.join-overlay {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.join-card {
    background: White;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    padding: 30px 26px;
    width: 100%;
    max-width: 360px;
    text-align: center;
}
.join-title { font-size: 15pt; font-weight: bold; margin-bottom: 18px; }
.join-notice {
    background: #FFF3E8;
    color: #C05621;
    border: 1px solid #F0C9A8;
    border-radius: 6px;
    font-size: 10pt;
    padding: 8px 10px;
    margin-bottom: 12px;
    text-align: left;
}
.join-card input {
    width: 100%;
    font-size: 12pt;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid #CCCCCC;
    border-radius: 6px;
    outline: none;
}
.join-card input:focus { border-color: #407ADD; }
.btn-primary {
    width: 100%;
    background: #F05A3C;
    color: White;
    border: none;
    border-radius: 6px;
    font-size: 13pt;
    font-family: inherit;
    padding: 10px 0;
    cursor: pointer;
}
.btn-primary:disabled { background: #E0A497; cursor: default; }
.join-teacher { margin-top: 14px; font-size: 10pt; }
.join-teacher a { color: #407ADD; text-decoration: none; }

/* 直播间主体 */
.room-main {
    flex: 1;
    display: flex;
    gap: 12px;
    padding: 12px;
    min-height: 0;
}
.stage-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.stage {
    position: relative;
    background: #111827;
    border-radius: 8px;
    overflow: hidden;
    flex: 1;
    min-height: 240px;
}
#mainVideo { width: 100%; height: 100%; object-fit: contain; display: block; }
#pipVideo {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 200px;
    max-width: 32%;
    border: 2px solid rgba(255,255,255,.6);
    border-radius: 6px;
    background: #000;
}
.stage-hint {
    position: absolute;
    top: 50%; left: 0; right: 0;
    transform: translateY(-50%);
    text-align: center;
    color: #9CA3AF;
    font-size: 13pt;
}
.stage-badges { position: absolute; top: 10px; left: 10px; }
.badge {
    display: inline-block;
    background: rgba(0,0,0,.55);
    color: White;
    font-size: 9pt;
    border-radius: 20px;
    padding: 3px 10px;
    margin-right: 6px;
}
.badge-live { background: #E02424; }

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 10px;
    flex: none;
}
.ctl-btn {
    background: White;
    border: 1px solid #CCCCCC;
    border-radius: 6px;
    font-size: 11pt;
    font-family: inherit;
    padding: 8px 16px;
    cursor: pointer;
}
.ctl-btn.on { background: #407ADD; border-color: #407ADD; color: White; }
.ctl-btn.danger { background: #E02424; border-color: #E02424; color: White; }
.ctl-btn.warn { background: #F05A3C; border-color: #F05A3C; color: White; }
.ctl-btn:disabled { opacity: .5; cursor: default; }

/* 侧栏：聊天/成员 */
.side {
    width: 300px;
    flex: none;
    background: White;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.side-tabs { display: flex; border-bottom: 1px solid #E5E7EB; flex: none; }
.side-tab {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    font-size: 11pt;
    color: #6B7280;
    cursor: pointer;
}
.side-tab.active { color: #407ADD; border-bottom: 2px solid #407ADD; font-weight: bold; }
.panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.chat-list { flex: 1; overflow-y: auto; padding: 10px; }
.chat-item { margin-bottom: 8px; font-size: 10.5pt; word-break: break-all; }
.chat-item .who { color: #407ADD; }
.chat-item .who.teacher { color: #E02424; }
.chat-item.sys { color: #9CA3AF; font-size: 9.5pt; }
.chat-input-row { display: flex; gap: 6px; padding: 8px; border-top: 1px solid #E5E7EB; flex: none; }
.chat-input-row input {
    flex: 1;
    font-size: 11pt;
    padding: 8px 10px;
    border: 1px solid #CCCCCC;
    border-radius: 6px;
    outline: none;
    min-width: 0;
}
.btn-small {
    background: #407ADD;
    color: White;
    border: none;
    border-radius: 6px;
    font-size: 11pt;
    font-family: inherit;
    padding: 0 16px;
    cursor: pointer;
}

.roster-list { flex: 1; overflow-y: auto; padding: 10px; }
.roster-item {
    display: flex;
    align-items: center;
    padding: 7px 4px;
    border-bottom: 1px solid #F3F4F6;
    font-size: 11pt;
}
.roster-item .r-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-item .tag {
    font-size: 8.5pt;
    border-radius: 4px;
    padding: 1px 6px;
    margin-left: 6px;
    flex: none;
}
.tag-teacher { background: #FDE8E8; color: #E02424; }
.tag-hand { background: #FFF3E8; color: #C05621; }
.tag-mic { background: #E8F5E9; color: #2E7D32; }
.roster-item button {
    margin-left: 6px;
    flex: none;
    font-size: 9pt;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #407ADD;
    background: White;
    color: #407ADD;
    font-family: inherit;
    cursor: pointer;
}

/* 手机竖屏：上下布局 */
@media (max-width: 760px) {
    .room-main { flex-direction: column; }
    .stage { min-height: 0; flex: none; aspect-ratio: 16/9; }
    .stage-wrap { flex: none; }
    .side { width: auto; flex: 1; min-height: 220px; }
    #pipVideo { width: 120px; }
}
