/* ============================================================
   晓猫鱼同步观看系统
   ============================================================ */

:root {
    --bg: #ffffff;
    --bg-soft: #f6f6f8;
    --bg-hover: #fafafb;
    --line: #ececf0;
    --line-2: #e1e2e7;
    --text: #16181d;
    --text-2: #52575f;
    --text-3: #8b909a;
    --text-4: #b6bac2;
    --ok: #16a34a;
    --warn: #b45309;
    --err: #dc2626;
    --radius: 12px;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

b {
    font-weight: 600;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92em;
    background: var(--bg-soft);
    border-radius: 4px;
    padding: 1px 5px;
}

/* ---------- 顶栏 ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(8px);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    max-width: 940px;
    margin: 0 auto;
    height: 56px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-side {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    white-space: nowrap;
}

.online {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.online b {
    color: var(--text-2);
}

.online-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ok);
}

.link-btn {
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text-2);
    font-family: inherit;
    font-size: 12.5px;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.link-btn:hover {
    border-color: var(--line-2);
    color: var(--text);
}

/* ---------- 首页 ---------- */

.home-main {
    max-width: 940px;
    margin: 0 auto;
    padding: 40px 24px 96px;
}

.section-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0 0 14px;
}

.section-head h1 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--text-3);
}

.section-count {
    font-size: 12px;
    color: var(--text-4);
    font-variant-numeric: tabular-nums;
}

.room-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.room-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.room-row:hover {
    border-color: var(--line-2);
    background: var(--bg-hover);
}

.room-thumb {
    flex: none;
    width: 124px;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-soft);
    color: var(--text-4);
    display: grid;
    place-items: center;
}

.room-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.room-info {
    min-width: 0;
}

.room-name {
    font-size: 15px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-sub {
    margin-top: 3px;
    font-size: 12.5px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.room-arrow {
    margin-left: auto;
    margin-right: 4px;
    flex: none;
    color: var(--text-4);
}

.empty {
    margin: 0;
    padding: 28px 0;
    color: var(--text-3);
    font-size: 14px;
}

/* ---------- 房间页 ---------- */

.room-main {
    max-width: 940px;
    margin: 0 auto;
    padding: 28px 24px 80px;
}

.room-title {
    margin: 0 0 4px;
    font-size: 19px;
    font-weight: 600;
    line-height: 1.4;
    word-break: break-word;
}

.room-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 12.5px;
    color: var(--text-3);
}

.room-meta b {
    color: var(--text-2);
}

.meta-lock {
    color: var(--warn);
}

.player-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}

.player-box {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.player-host {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.player-host .dplayer,
.player-host .art-video-player {
    width: 100%;
    height: 100%;
}

/* 进度条稍微加粗一点，紫色更醒目 */
.player-host .art-progress {
    height: 4px;
    border-radius: 2px;
}

.player-host .dplayer-bar-wrap .dplayer-bar,
.player-host .dplayer-bar-wrap .dplayer-loaded,
.player-host .dplayer-bar-wrap .dplayer-played {
    height: 4px;
}

/* 原生字幕往上抬一点，避开播放器控制条 */
.player-host video::-webkit-media-text-track-container {
    transform: translateY(-9%);
}

.player-host video::cue {
    font-size: 1.9vh;
    line-height: 1.45;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 0, 0, 0.6);
}

/* 遮罩：自动播放被拦 */
.gate {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    text-align: center;
    background: rgba(0, 0, 0, 0.62);
}

.gate-inner {
    padding: 20px;
}

.gate-title {
    margin: 0 0 14px;
    color: #fff;
    font-size: 14px;
}

.gate-text {
    margin: 0 0 14px;
    max-width: 260px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 12.5px;
    line-height: 1.6;
}

.btn-white {
    height: 34px;
    padding: 0 20px;
    border: none;
    border-radius: 8px;
    background: #fff;
    color: #111;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
}

.btn-white:hover {
    background: #f0f0f2;
}

.loading {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    font-size: 13px;
    background: #000;
}

.spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- 控制条 ---------- */

.syncbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

/* ---------- 按钮里的字一律水平垂直居中 ---------- */
.link-btn,
.btn-mini,
.btn-line,
.btn-dark,
.btn-play,
.btn-white,
.btn-primary,
.ghost-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    text-decoration: none;
}

.btn-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 84px;
    height: 34px;
    padding: 0 15px;
    border: none;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-play:hover {
    background: #000;
}

.btn-play:disabled,
.toggle:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-play .ico {
    font-size: 10px;
    line-height: 1;
}

.field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-3);
}

.field label {
    cursor: default;
}

/* 音量条：手机上调不了系统音量，这里给一个 */
/* 音量条：自绘轨道（轨道画在 input 自己的背景上，避开原生控件那条白缝） */
.vol {
    -webkit-appearance: none;
    appearance: none;
    flex: 1 1 auto;
    width: auto;
    max-width: 360px;
    height: 18px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    --vol-pct: 100%;
    background: linear-gradient(to right,
        #7851A9 0,
        #7851A9 var(--vol-pct),
        #e9e9ef var(--vol-pct),
        #e9e9ef 100%) center / 100% 4px no-repeat;
}

/* 原生轨道透明，让 input 自己的渐变露出来 */
.vol::-webkit-slider-runnable-track {
    height: 4px;
    border: none;
    background: transparent;
}

.vol::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    margin-top: -5px;
    border: none;
    border-radius: 50%;
    background: #7851A9;
    cursor: pointer;
}

.vol::-moz-range-track {
    height: 4px;
    border: none;
    border-radius: 2px;
    background: #e9e9ef;
}

.vol::-moz-range-progress {
    height: 4px;
    border-radius: 2px;
    background: #7851A9;
}

.vol::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: #7851A9;
    cursor: pointer;
}

.vol:focus-visible {
    outline: 2px solid #7851A9;
    outline-offset: 2px;
}
/* 音量单独占一行，放在最下面，不跟播放/倍速挤在一块 */
.field-vol {
    flex: 1 1 100%;
    gap: 8px;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}


select {
    height: 34px;
    padding: 0 26px 0 10px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.8L6 7.8L9 4.8' fill='none' stroke='%238b909a' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

select:focus {
    outline: none;
    border-color: var(--text-4);
}

select:disabled {
    color: var(--text-3);
    opacity: 0.6;
    cursor: not-allowed;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 11px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: #fff;
    color: var(--text-3);
    font-family: inherit;
    font-size: 12.5px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.toggle:hover {
    color: var(--text-2);
}

.toggle-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-4);
}

.toggle.is-on {
    color: var(--text);
}

.toggle.is-on .toggle-dot {
    background: var(--ok);
}

.spacer {
    flex: 1;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-3);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-4);
}

.status.is-ok .status-dot {
    background: var(--ok);
}

.status.is-warn .status-dot {
    background: var(--warn);
}

.status.is-err .status-dot {
    background: var(--err);
}

.room-desc {
    margin: 18px 0 0;
    font-size: 13.5px;
    line-height: 1.75;
    color: var(--text-2);
}

/* ---------- 在线名单 ---------- */

.people-wrap {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.people-head {
    margin-bottom: 10px;
    font-size: 12.5px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.people {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.person {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px 0 3px;
    border-radius: 999px;
    background: var(--bg-soft);
    font-size: 12.5px;
    color: var(--text-2);
}

.person.is-me {
    background: #eef0f4;
    color: var(--text);
}

.person-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e4e5e9;
    color: var(--text-2);
    font-size: 10.5px;
    display: grid;
    place-items: center;
}

.person.is-me .person-avatar {
    background: #111827;
    color: #fff;
}

.person-tag {
    padding: 0 3px;
    border: 1px solid var(--line-2);
    border-radius: 4px;
    font-size: 10px;
    line-height: 15px;
    color: var(--text-3);
}

.muted {
    color: var(--text-3);
    font-size: 12.5px;
}

/* ---------- 提示 ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    z-index: 60;
    transform: translate(-50%, 8px);
    padding: 9px 15px;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------- 说明页 ---------- */

.page-plain {
    background: var(--bg-soft);
}

.plain-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.plain-card {
    width: 100%;
    max-width: 520px;
    padding: 28px 30px 30px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.plain-card h1 {
    margin: 0 0 14px;
    font-size: 17px;
    font-weight: 600;
}

.plain-card p {
    margin: 0 0 10px;
    font-size: 13.5px;
    color: var(--text-2);
}

.plain-card .code {
    margin: 12px 0 14px;
}

.code {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg-soft);
    color: #33383f;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.7;
    overflow-x: auto;
}

.link {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--line-2);
}

.link:hover {
    text-decoration-color: var(--text-3);
}

/* ---------- 窄屏 ---------- */

/* ---------- 门禁页 ---------- */

.page-gate {
    background: var(--bg);
}

.gate-wrap {
    max-width: 420px;
    margin: 0 auto;
    padding: 56px 20px 80px;
}

.gate-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px 24px 24px;
    text-align: center;
}

.gate-card h1 {
    margin: 0 0 18px;
    font-size: 17px;
    font-weight: 600;
}

.qr-box {
    display: inline-block;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    line-height: 0;
}

.qr-box svg {
    display: block;
    width: 168px;
    height: 168px;
}

.qr-sm svg {
    width: 148px;
    height: 148px;
}

.gate-tip {
    margin: 14px 0 0;
    color: var(--text-3);
    font-size: 13px;
}

.gate-pwd {
    margin-top: 10px;
}

.gate-form {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.gate-input {
    flex: 1;
    min-width: 0;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
}

.gate-input:focus {
    outline: none;
    border-color: #c9b8ff;
    box-shadow: 0 0 0 3px rgba(120, 81, 169, 0.14);
}

.btn-dark {
    height: 38px;
    padding: 0 18px;
    border: none;
    border-radius: 8px;
    background: #16181d;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
}

.btn-dark:hover {
    background: #000;
}

.btn-dark:disabled {
    opacity: 0.5;
    cursor: default;
}

.btn-line {
    height: 38px;
    padding: 0 18px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
}

.btn-line:hover {
    border-color: var(--text-4);
}

.gate-err {
    margin: 12px 0 0;
    color: var(--err);
    font-size: 13px;
}

/* ---------- 门禁页：摄像头扫码 ---------- */

.scan {
    position: relative;
    width: 100%;
    max-width: 300px;
    margin: 0 auto 16px;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    background: #0e1014;
}

.scan video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.scan-frame {
    position: absolute;
    inset: 38px;
    pointer-events: none;
}

.scan-frame i {
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.9);
}

.scan-frame i:nth-child(1) {
    left: 0;
    top: 0;
    border-right: 0;
    border-bottom: 0;
    border-radius: 4px 0 0 0;
}

.scan-frame i:nth-child(2) {
    right: 0;
    top: 0;
    border-left: 0;
    border-bottom: 0;
    border-radius: 0 4px 0 0;
}

.scan-frame i:nth-child(3) {
    left: 0;
    bottom: 0;
    border-right: 0;
    border-top: 0;
    border-radius: 0 0 0 4px;
}

.scan-frame i:nth-child(4) {
    right: 0;
    bottom: 0;
    border-left: 0;
    border-top: 0;
    border-radius: 0 0 4px 0;
}

.scan-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 9px;
    margin: 0;
    color: #fff;
    font-size: 12px;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.scan.is-off {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-soft);
    border: 1px dashed var(--line-2);
}

.scan.is-off video,
.scan.is-off .scan-frame {
    display: none;
}

.scan.is-off .scan-hint {
    position: static;
    padding: 0 16px;
    color: var(--text-3);
    text-shadow: none;
    line-height: 1.6;
}

.gate-alt {
    margin: 0;
    color: var(--text-3);
    font-size: 13px;
}

.scan-actions + .scan-actions {
    margin-top: 10px;
}

.scan-actions {
    margin-top: 16px;
}

.scan-actions label.btn-line {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* ---------- 门禁页：手机竖屏 ---------- */

@media (max-width: 560px) {
    .gate-wrap {
        max-width: 460px;
        padding: 18px 14px 40px;
    }

    .gate-card {
        padding: 20px 16px 18px;
    }

    .gate-card h1 {
        margin-bottom: 14px;
        font-size: 16px;
    }

    .scan {
        width: min(280px, 100%);
        margin-bottom: 14px;
        border-radius: 10px;
    }

    .scan-frame {
        inset: 30px;
    }

    .scan-hint {
        font-size: 11.5px;
        bottom: 7px;
    }

    .gate-pwd {
    margin-top: 10px;
}

.gate-form {
        margin-top: 16px;
    }

    .scan-actions + .scan-actions {
    margin-top: 10px;
}

.scan-actions {
        margin-top: 12px;
    }

    .scan-actions label.btn-line,
    .scan-actions .btn-line {
        width: 100%;
        max-width: 280px;
    }
}

/* ---------- 门禁页：横屏 / 矮窗口，改成左右两栏 ---------- */

@media (max-height: 560px) and (min-width: 480px) {
    .page-gate .topbar {
        position: static;
    }

    .gate-wrap {
        max-width: 680px;
        padding: 16px 20px;
    }

    .gate-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        column-gap: 22px;
        padding: 16px 20px;
        text-align: left;
    }

    .gate-card--qr {
        grid-template-areas:
            "head head"
            "scan alt"
            "scan act";
    }

    .gate-card--pwd {
        grid-template-areas:
            "head head"
            "alt form";
    }

    .gate-card h1 {
        grid-area: head;
        margin: 0 0 12px;
        font-size: 16px;
    }

    .gate-card--qr .scan {
        grid-area: scan;
        align-self: start;
        width: min(200px, 52vh);
        margin: 0;
    }

    .gate-card--qr .scan-hint {
        display: none;
    }

    .gate-card--qr .scan-frame {
        inset: 18px;
    }

    .gate-card--qr .scan-hint {
        bottom: 5px;
        font-size: 11px;
    }

    .gate-card--qr .gate-alt {
        grid-area: alt;
        align-self: end;
    }

    .gate-card--qr .scan-actions + .scan-actions {
    margin-top: 10px;
}

.scan-actions {
        grid-area: act;
        align-self: start;
        margin: 12px 0 0;
    }

    .gate-card--pwd .gate-alt {
        grid-area: alt;
        align-self: center;
    }

    .gate-card--pwd .gate-pwd {
    margin-top: 10px;
}

.gate-form {
        grid-area: form;
        margin: 12px 0 0;
    }

    .gate-card .gate-err {
        grid-column: 1 / -1;
        margin: 10px 0 0;
    }
}

/* ---------- 弹层 ---------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    /* 内容高过屏幕时贴顶排，靠 margin:auto 在放得下的时候居中 —— 避免顶部被裁掉 */
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    background: rgba(20, 20, 26, 0.42);
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* 内容比屏幕高时（手机上很常见）：从顶部排，卡片自己滚，底部按钮钉住 */
@media (max-width: 640px) {
    .modal {
        align-items: flex-start;
        padding: 14px;
        overflow: hidden;
    }

    .modal-card {
        max-height: calc(100vh - 28px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    @supports (height: 100dvh) {
        .modal-card {
            max-height: calc(100dvh - 28px);
        }
    }

    .modal-actions {
        position: sticky;
        bottom: -20px;
        margin-bottom: -20px;
        padding: 12px 0 20px;
        background: #fff;
    }
}

.modal-card {
    width: 100%;
    max-width: 340px;
    margin: auto 0;
    background: #fff;
    border-radius: 14px;
    padding: 18px 18px 20px;
    box-shadow: 0 18px 48px rgba(18, 20, 26, 0.18);
    text-align: center;
}

.modal-wide {
    max-width: 520px;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
}

.modal-head #btnShotClear {
    margin-left: auto;
}

.modal-x {
    border: none;
    background: none;
    color: var(--text-3);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.modal-x:hover {
    color: var(--text);
}

.modal-tip {
    margin: 10px 0 0;
    color: var(--text-3);
    font-size: 13px;
    line-height: 1.55;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 18px;
}

/* 编辑房间表单 */
.edit-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
    text-align: left;
}

.field-line {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.field-name {
    color: var(--text-3);
    font-size: 13px;
}

.edit-form .gate-input {
    width: 100%;
    height: 36px;
}

.edit-form textarea.gate-input {
    height: auto;
    min-height: 62px;
    padding: 8px 10px;
    line-height: 1.5;
    resize: vertical;
    font-size: 13px;
}

.edit-form select.gate-input {
    height: 36px;
    padding-right: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%236b7280' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-color: #fff;
}

.field-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 2px;
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.5;
    cursor: pointer;
}

.field-check input {
    margin: 3px 0 0;
    accent-color: #7851A9;
}

.field-hint {
    margin: 0;
    color: var(--text-3);
    font-size: 12.5px;
    line-height: 1.5;
}

/* 编辑弹窗里 URL 简写说明：跟在「封面」那一行后面 */
.edit-hint-url {
    margin: -2px 0 2px 72px;
    color: var(--text-3);
    font-size: 12px;
}

.edit-hint-url span {
    color: var(--text-2);
    word-break: break-all;
}

@media (max-width: 640px) {
    .edit-hint-url {
        margin-left: 0;
    }
}

.link-btn.danger {
    color: #dc2626;
}

.admin-flag.is-hidden {
    background: #fef3c7;
    color: #92400e;
}

.admin-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: #f4f4f6;
    color: var(--text-3);
    font-size: 12px;
    line-height: 1;
}

.share-pwd {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--text-3);
    font-size: 13px;
}

.share-pwd b {
    color: var(--text);
    font-size: 16px;
    letter-spacing: 1px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.shot-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.shot-actions .modal-tip {
    margin: 0;
}

.shot-summary {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f7f7f9;
    font-size: 12.5px;
    color: var(--text-2);
    line-height: 1.6;
}

.shot-sum-head {
    margin: 0;
    color: var(--text);
}

.shot-sum-list {
    margin: 6px 0 0;
    padding-left: 18px;
}

.shot-sum-list li {
    margin: 2px 0;
}

.shot-sum-sub {
    margin: 6px 0 0;
    color: var(--text-3);
}
/* 进房间记录 */
.log-list {
    margin-top: 16px;
    max-height: 56vh;
    overflow-y: auto;
    border-top: 1px solid var(--line);
}

.log-row {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr) auto;
    grid-template-areas:
        "time name ip"
        "time how  ip";
    column-gap: 12px;
    align-items: baseline;
    padding: 9px 2px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.log-time {
    grid-area: time;
    color: var(--text-3);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.log-name {
    grid-area: name;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-how,
.log-ip {
    color: var(--text-3);
    font-size: 12px;
}

.log-how {
    grid-area: how;
}

.log-ip {
    grid-area: ip;
    align-self: center;
    font-variant-numeric: tabular-nums;
}

.log-n {
    margin-left: 6px;
    color: var(--text-4);
    font-size: 11px;
}

.log-empty {
    margin: 0;
    padding: 22px 0;
    text-align: center;
    color: var(--text-4);
    font-size: 13px;
}

.shot-kind {
    flex: 0 0 auto;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.92);
    color: #6a4595;
    font-size: 11px;
}

/* 左上角：标记已读 / 未读 */
.shot-rd {
    position: absolute;
    left: 6px;
    top: 6px;
    height: 20px;
    padding: 0 7px;
    border: none;
    border-radius: 10px;
    background: rgba(12, 14, 18, 0.62);
    color: #fff;
    font-family: inherit;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
}

.shot-rd:hover {
    background: rgba(12, 14, 18, 0.84);
}

.shot-item.is-unread .shot-rd {
    background: #dc2626;
}

.shot-item.is-unread .shot-rd:hover {
    background: #b91c1c;
}

.shot-item.is-read img {
    opacity: 0.88;
}

/* 卡片上「照片」按钮的未读小红点 */
.link-btn .dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 5px;
    border-radius: 50%;
    background: #dc2626;
    vertical-align: 2px;
}
/* 照片多了以后，网格自己滚，别把弹层撑到屏幕外面 */
.shot-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 16px;
    max-height: min(56vh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 2px 6px;
    /* 下面这条淡淡的阴影是在暗示「还能往下滚」 */
    box-shadow: inset 0 -10px 10px -12px rgba(20, 20, 26, 0.35);
}

.shot-grid::-webkit-scrollbar {
    width: 6px;
}

.shot-grid::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background: #dcdce3;
}

.shot-grid:empty::after {
    content: '还没有照片';
    grid-column: 1 / -1;
    padding: 22px 0;
    color: var(--text-4);
    font-size: 13px;
}

.shot-item {
    position: relative;
    display: block;
    margin: 0;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-soft);
}

.shot-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.shot-del {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(12, 14, 18, 0.62);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}

.shot-item:hover .shot-del,
.shot-del:focus {
    opacity: 1;
}

.shot-del:hover {
    background: #dc2626;
}

@media (hover: none) {
    .shot-del {
        opacity: 1;
    }
}

/* 说明条：左边「进房 · 前置」标签、中间昵称、右边时间，三段分开排，不再叠在一起 */
.shot-item > figcaption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.18));
    color: #fff;
    font-size: 11px;
    line-height: 1.3;
    text-align: left;
}

.shot-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.shot-time {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.82);
}

/* ---------- 管理台 ---------- */

.page-admin {
    background: var(--bg-hover);
}

.admin-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 26px 20px 90px;
}

.admin-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(120, 81, 169, 0.12);
    color: #6a4595;
    font-size: 12px;
    line-height: 1;
}

.admin-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 0 0 14px;
}

.admin-head #btnNewRoom {
    margin-left: auto;
}

.admin-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.admin-sub {
    color: var(--text-3);
    font-size: 13px;
}

.admin-rooms {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-room.is-hidden {
    opacity: 0.72;
}

.admin-room {
    padding: 16px 18px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.admin-room-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-room-name {
    font-size: 15px;
    font-weight: 600;
}

.admin-room-id {
    margin-left: 8px;
    color: var(--text-4);
    font-size: 12px;
    font-weight: 400;
}

.admin-room-side {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-online {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-2);
    font-size: 13px;
}

.admin-people {
    margin: 8px 0 12px;
    color: var(--text-3);
    font-size: 13px;
}

.admin-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-mini {
    height: 30px;
    padding: 0 12px;
    border: 1px solid var(--line-2);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-mini:hover {
    border-color: var(--text-4);
}

.admin-seek {
    flex: 1;
    min-width: 70px;
    height: 18px;
    margin: 0;
    accent-color: #7851A9;
}

.admin-rate {
    height: 30px;
    padding: 0 4px;
    border: 1px solid var(--line-2);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}

.admin-time {
    min-width: 104px;
    color: var(--text-3);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.admin-empty {
    color: var(--text-3);
    font-size: 14px;
}

.admin-share-url {
    margin-top: 10px;
    color: var(--text-3);
    font-size: 11px;
    text-align: center;
    word-break: break-all;
}

a.link-btn {
    text-decoration: none;
}

.login-card {
    max-width: 340px;
    margin: 9vh auto 0;
    padding: 26px 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.login-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    text-align: center;
}

.login-tip {
    margin: 8px 0 0;
    color: var(--text-3);
    font-size: 13px;
    text-align: center;
}

.login-card form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

.login-card .btn-dark {
    width: 100%;
}


@media (max-width: 720px) {
    .topbar-inner {
        height: 52px;
        padding: 0 14px;
        gap: 10px;
    }

    .brand {
        font-size: 14px;
    }

    .home-main,
    .room-main {
        padding-left: 14px;
        padding-right: 14px;
    }

    .home-main {
        padding-top: 26px;
    }

    .room-main {
        padding-top: 20px;
    }

    .room-thumb {
        width: 92px;
    }

    .room-row {
        gap: 12px;
    }

    .room-title {
        font-size: 17px;
    }

    /* 播放器在手机上占满整行 */
    .player-card {
        margin-left: -14px;
        margin-right: -14px;
        border-left: none;
        border-right: none;
        border-radius: 0;
    }

    .syncbar {
        gap: 8px;
    }

    /* 手机上音量条窄一点，跟倍速一行放得下 */
    .field-vol {
        gap: 6px;
        padding-top: 10px;
    }

    .field-vol .vol {
        max-width: none;
    }

    .btn-play {
        min-width: 78px;
    }

    .spacer {
        display: none;
    }

    .status {
        width: 100%;
        margin-top: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- 管理台：手机 ---------- */

@media (max-width: 420px) {
    /* 品牌本身就是首页链接，小屏上省掉「回首页」 */
    .page-admin .topbar-side a.link-btn {
        display: none;
    }

    .admin-tag {
        display: none;
    }
}

@media (max-width: 640px) {
    .field-line {
        grid-template-columns: minmax(0, 1fr);
        gap: 5px;
    }

    .field-name {
        font-size: 12.5px;
    }
    .admin-main {
        padding: 16px 14px 60px;
    }

    .admin-head {
        flex-wrap: wrap;
        row-gap: 4px;
        margin-bottom: 12px;
    }

    .admin-room {
        padding: 14px;
    }

    .admin-room-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .admin-room-name {
        width: 100%;
        line-height: 1.35;
    }

    .admin-room-side {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .admin-people {
        margin: 6px 0 10px;
        line-height: 1.5;
    }

    .admin-controls {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .admin-seek {
        order: 1;
        flex: 1 1 100%;
    }

    .admin-rate {
        order: 2;
    }

    .admin-time {
        order: 3;
        flex: 1 1 auto;
        min-width: 0;
        text-align: right;
    }
}
/* ---------- 管理台：一键开关 ---------- */
.admin-bulk {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin: 0 0 12px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fafafb;
}

.admin-bulk .bulk-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-bulk .bulk-group + .bulk-group {
    padding-left: 12px;
    border-left: 1px solid var(--line);
}

.admin-bulk .bulk-label {
    font-size: 12.5px;
    color: var(--text-3);
}

.admin-bulk .bulk-label + .btn-mini {
    margin-right: 6px;
}

@media (max-width: 640px) {
    .admin-bulk {
        padding: 10px 12px;
    }
}