/* cloud.css —— 云端叠加层（不改动 styles.css，仅在需要处追加） */

.viewer-mode { background: #0b1118; margin: 0; overflow: hidden; }
.viewer-root { position: fixed; inset: 0; display: flex; flex-direction: column; }
.viewer-stage { flex: 1; min-height: 0; display: block; padding: 0; }
/* 分享大屏直接复用控制端 .score-display，按 16:9 铺满整块屏幕 */
.viewer-stage .scoreboard.display-only { width: 100%; height: 100%; min-height: 0; }
.viewer-stage .display-only .score-display {
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  max-width: 100%;
  max-height: 100%;
}
.viewer-foot {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  min-height: 0; padding: 0; border: 0; background: transparent; pointer-events: none;
}
.viewer-foot .display-watermark { position: absolute; right: 2vw; bottom: 1.6vh; }

/* 只读大屏的比赛画面：复用现有配色变量与排版质感 */
.viewer-board { width: 100%; height: 100%; display: grid; grid-template-rows: 1fr auto; padding: 3vh 3vw; box-sizing: border-box; }
.viewer-main { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 3vw; }
.viewer-team { display: flex; flex-direction: column; gap: 1.2vh; min-width: 0; }
.viewer-team.away { align-items: flex-end; text-align: right; }
.viewer-name { font-size: clamp(20px, 3.4vw, 64px); font-weight: 800; letter-spacing: .02em; color: var(--team-home, #e5edf6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.viewer-team.away .viewer-name { color: var(--team-away, #e5edf6); }
.viewer-score { font-size: clamp(56px, 12vw, 240px); font-weight: 900; line-height: .92; font-variant-numeric: tabular-nums; }
.viewer-mid { display: flex; flex-direction: column; align-items: center; gap: 1vh; }
.viewer-clock { font-size: clamp(28px, 6vw, 120px); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.viewer-period { font-size: clamp(12px, 1.5vw, 24px); text-transform: uppercase; letter-spacing: .18em; opacity: .7; }
.viewer-sub { font-size: clamp(12px, 1.4vw, 22px); opacity: .72; text-align: center; }

.viewer-foot { position: relative; }
.viewer-status {
  position: absolute; top: 1.2vh; left: 50%; transform: translateX(-50%);
  z-index: 5; padding: .4rem 1rem; border-radius: 999px;
  background: rgba(15, 23, 42, .92); color: #cbd5e1; font-size: 13px; letter-spacing: .04em;
  border: 1px solid rgba(148, 163, 184, .28); pointer-events: none;
}
.viewer-status[hidden] { display: none; }
.sb-ended-banner {
  position: absolute; bottom: 5vh; left: 50%; transform: translateX(-50%);
  z-index: 4; padding: .35rem 1.1rem; border-radius: 999px;
  background: rgba(190, 24, 93, .9); color: #fff; font-weight: 800; letter-spacing: .16em; font-size: 13px;
}

/* Account dropdown in the top navigation */
.account-menu { position: relative; z-index: 30; }
.account-dropdown { position: relative; }
.account-trigger { min-height: 40px; padding: 0 13px; display: inline-flex; align-items: center; gap: 10px; list-style: none; border: 1px solid rgba(52,211,153,.25); border-radius: 9px; color: #dfe8ec; background: linear-gradient(180deg,#15212b,#101820); font-size: 12px; font-weight: 760; letter-spacing: .025em; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.account-trigger:hover,.account-dropdown[open] .account-trigger { border-color: rgba(52,211,153,.62); background: #15232d; }
.account-trigger::-webkit-details-marker { display: none; }
.account-trigger i { width: 7px; height: 7px; border-right: 1.5px solid #8ba0ab; border-bottom: 1.5px solid #8ba0ab; transform: rotate(45deg) translateY(-2px); transition: transform .15s ease; }
.account-dropdown[open] .account-trigger i { transform: rotate(225deg) translate(-2px,-1px); }
.account-popover { position: absolute; top: calc(100% + 9px); right: 0; width: min(340px, calc(100vw - 28px)); overflow: hidden; border: 1px solid #263741; border-radius: 12px; color: #dfe8ec; background: #0e161e; box-shadow: 0 18px 48px rgba(0,0,0,.48), 0 0 0 1px rgba(52,211,153,.035); }
.account-profile { min-height: 76px; padding: 15px 16px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.08); background: linear-gradient(120deg,rgba(52,211,153,.08),transparent 68%); }
.account-profile > div { min-width: 0; }
.account-profile strong,.account-profile span { display: block; overflow-wrap: anywhere; }
.account-profile strong { color: #edf5f2; font-size: 14px; font-weight: 760; }
.account-profile span { margin-top: 4px; color: #8ba0ab; font-size: 11px; }
.account-profile-mark { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(52,211,153,.34); border-radius: 10px; color: #b9f27c; background: #14251f; font-size: 14px; font-weight: 800; }
.account-nav { padding: 5px 7px; }
.account-nav button { width: 100%; min-height: 43px; padding: 0 8px; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 7px; color: #cbd8dd; background: transparent; text-align: left; font-size: 12px; font-weight: 650; cursor: pointer; transition: color .12s ease, background .12s ease; }
.account-nav button:hover { color: #f0f8f4; background: rgba(52,211,153,.08); }
.account-nav button small { margin-left: auto; padding: 3px 6px; border: 1px solid rgba(139,160,171,.14); border-radius: 999px; color: #728894; background: rgba(255,255,255,.025); font-size: 9px; }
.account-icon { width: 29px; height: 29px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.07); border-radius: 8px; color: #8ba0ab; background: #141f28; }
.account-nav button:hover .account-icon { border-color: rgba(52,211,153,.22); color: #6ee7b7; background: #162a25; }
.account-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.account-status-list { margin: 3px 12px 10px; padding: 9px 10px; display: grid; gap: 7px; border: 1px solid rgba(255,255,255,.07); border-radius: 8px; color: #8296a0; background: #111b23; font-size: 10px; }
.account-status-list div { display: flex; justify-content: space-between; gap: 10px; }
.account-status-list strong { color: #cdd9de; text-align: right; font-weight: 650; }
.account-logout { width: calc(100% - 24px); min-height: 37px; margin: 0 12px 12px; padding: 0 9px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid rgba(255,143,154,.2); border-radius: 8px; color: #d99aa1; background: rgba(255,143,154,.035); font-size: 11px; font-weight: 700; cursor: pointer; }
.account-logout .account-icon { width: 23px; height: 23px; border: 0; color: inherit; background: transparent; }
.account-logout:hover { border-color: rgba(255,143,154,.48); color: #ffc3c8; background: rgba(255,143,154,.09); }
.account-login { padding: 15px 16px 7px; color: #91a3ac; font-size: 11px; }
.account-login p { margin: 0 0 5px; line-height: 1.5; }
.account-login small { color: #728894; }
.account-login-buttons { padding: 5px 14px 14px; display: grid; gap: 7px; }
.account-login-buttons .button { width: 100%; min-height: 40px; border-color: #2b3c46; color: #dfe8ec; background: #15212a; }
.account-login-buttons .button:hover { border-color: rgba(52,211,153,.5); background: #192a31; }
.account-settings-dialog { width: min(520px, calc(100vw - 28px)); max-height: min(88vh, 720px); padding: 20px; border: 1px solid #263741; border-radius: 14px; color: #dfe8ec; background: #0e161e; box-shadow: 0 22px 70px rgba(0,0,0,.5); }
.account-settings-dialog::backdrop { background: rgba(0,0,0,.7); }
.account-settings-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.account-settings-head h2 { margin: 0; font-size: 20px; }
.account-settings-head p,.account-settings-note { color: #8ba0ab; font-size: 12px; line-height: 1.5; }
.account-settings-head p { margin: 6px 0 16px; }
.account-settings-head button { width: 32px; height: 32px; border: 1px solid rgba(255,255,255,.08); border-radius: 7px; color: #9bb0b9; background: #15212a; font-size: 21px; cursor: pointer; }
.account-settings-dialog dl { display: grid; gap: 8px; margin: 0; }
.account-settings-dialog dl div { display: grid; grid-template-columns: 120px 1fr; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,.08); }
.account-settings-dialog dt { color: #8ba0ab; font-size: 12px; }
.account-settings-dialog dd { margin: 0; overflow-wrap: anywhere; color: #dfe8ec; font-size: 13px; }
.account-settings-dialog h3 { margin: 18px 0 8px; font-size: 13px; }
.account-identities { margin: 0; padding: 0; list-style: none; }
.account-identities li { display: grid; grid-template-columns: minmax(70px, .6fr) minmax(0, 1.5fr) auto; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.account-identities li span { overflow-wrap: anywhere; color: #b4c3c9; }
.account-identities li small { color: #7d929d; }
.account-settings-dialog > .button { margin-top: 6px; border-color: #2b3c46; color: #dfe8ec; background: #15212a; }
@media (max-width: 560px) { .account-popover { right: -2px; } }

/* 登录 / 分享弹窗 */
.sb-dialog { border: 1px solid rgba(148, 163, 184, .3); border-radius: 14px; background: #0e1621; color: #e5edf6; padding: 1.2rem; width: min(560px, 92vw); max-height: min(92vh, 900px); overflow-y: auto; overscroll-behavior: contain; }
.sb-dialog::backdrop { background: rgba(0, 0, 0, .62); }
.sb-dialog h3 { margin: 0 0 .6rem; font-size: 16px; }
.sb-dialog p { margin: 0 0 .8rem; color: #a9bbc7; font-size: 13px; line-height: 1.5; }
.sb-dialog h4 { margin: .8rem 0 .35rem; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #9fb2bf; }
.sb-dialog-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.sb-room-row { display: block; width: 100%; text-align: left; margin: .35rem 0; padding: .55rem .7rem; border: 1px solid rgba(148, 163, 184, .22); border-radius: 8px; background: rgba(148, 163, 184, .08); color: #dbe9f0; font-size: 12px; cursor: pointer; }
.sb-room-row:hover { border-color: rgba(58, 210, 159, .5); }
.sb-share-url { width: 100%; margin: .5rem 0; padding: .6rem .7rem; border: 1px solid rgba(148, 163, 184, .3); border-radius: 8px; background: #0b1118; color: #e2e8f0; font-size: 12px; }
.cloud-toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 40; display: none; max-width: 22rem; padding: .7rem .9rem; border-radius: 10px; background: rgba(15, 23, 42, .96); color: #e2e8f0; font-size: 13px; border: 1px solid rgba(148, 163, 184, .3); }
.cloud-toast.show { display: block; }

/* ===== Streaming transparent overlay (/o/:token) =====
   1920×1080 Browser Source 直接叠加在直播画面上。
   页面与外层容器全部透明，只有叠加图形自身保留深色半透明底，保证可读性。 */
html,
body.viewer-mode.overlay-mode,
body.viewer-mode.overlay-mode .viewer-root,
body.viewer-mode.overlay-mode .viewer-stage {
  background: transparent !important;
}
body.viewer-mode.overlay-mode .scoreboard.overlay-only {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: transparent !important;
}

/* 叠加图形本体：底色跟随所选流媒体主题（--sb-bg），轻微半透明保留广播质感 */
.stream-overlay {
  position: absolute;
  z-index: 5;
  max-width: 90%;
  color: var(--sb-text);
  background: color-mix(in srgb, var(--sb-bg, #060a10) 94%, transparent);
  border: 1px solid var(--sb-border, rgba(255, 255, 255, .14));
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .42);
  padding: 1.1vh 1.2vw;
}

/* 流媒体字体：与大屏 .score-display.font-* 同一套字体栈，作用域改为 .stream-overlay */
.stream-overlay.font-condensed { font-family: "Bahnschrift Condensed", "Arial Narrow", Impact, sans-serif; }
.stream-overlay.font-serif { font-family: Georgia, "Times New Roman", serif; }
.stream-overlay.font-mono { font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace; }
.stream-overlay.font-tech { font-family: "DIN Alternate", Eurostile, "Bahnschrift", ui-sans-serif, system-ui, sans-serif; letter-spacing: -.01em; }
.stream-overlay.font-display { font-family: "Arial Black", "Helvetica Neue", Impact, ui-sans-serif, sans-serif; }

/* Workbuddy：四边保留 5% 标题安全区，底部图形留出 13% 给字幕和播放器控件。 */
.stream-pos-top { top: 5%; left: 50%; transform: translateX(-50%); }
.stream-pos-bottom { bottom: 13%; left: 50%; transform: translateX(-50%); }
.stream-pos-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.stream-pos-top-left { top: 5%; left: 5%; }
.stream-pos-top-right { top: 5%; right: 5%; }
.stream-pos-bottom-left { bottom: 13%; left: 5%; }
.stream-pos-bottom-right { bottom: 13%; right: 5%; }

/* ---- 形态：整宽横条 ---- */
.stream-style-bar { width: min(92vw, 1760px); border-radius: 10px; }
.stream-style-bar .stream-head {
  justify-content: center; gap: 1.4vw;
  margin-bottom: .8vh;
}
.stream-style-bar .stream-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2vw;
}
.stream-style-bar .stream-row {
  display: flex;
  align-items: center;
  gap: .9vw;
  min-width: 0;
}
.stream-style-bar .stream-row:last-child { flex-direction: row-reverse; }

/* ---- 形态：紧凑角标（pill） ---- */
.stream-style-bug {
  padding: .8vh 1.1vw;
  border-radius: 999px;
}
.stream-style-bug .stream-head {
  justify-content: center;
  margin-bottom: .5vh;
}
.stream-style-bug .stream-body {
  display: flex;
  align-items: center;
  gap: 1vw;
}
.stream-style-bug .stream-row {
  display: flex;
  align-items: center;
  gap: .55vw;
  min-width: 0;
}

/* ---- 形态：下三分之一（nameplate） ---- */
.stream-style-lower-third {
  min-width: min(40vw, 760px);
  max-width: min(55vw, 1050px);
  border-radius: 0 10px 10px 0;
  border-left: 4px solid var(--stream-accent, var(--team-home));
}
.stream-style-lower-third .stream-head {
  justify-content: flex-start;
  margin-bottom: .7vh;
}
.stream-style-lower-third .stream-body {
  display: grid;
  gap: .6vh;
}
.stream-style-lower-third .stream-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2vw;
  min-width: 0;
}

/* ---- 形态：居中数据卡 ---- */
.stream-style-card {
  min-width: min(34vw, 660px);
  max-width: min(48vw, 920px);
}
.stream-style-card .stream-head {
  justify-content: space-between;
  margin-bottom: 1vh;
}
.stream-style-card .stream-body {
  display: grid;
  gap: .8vh;
}
.stream-style-card .stream-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2vw;
  min-width: 0;
}

/* Split panels keep each club in its own broadcast panel. */
.stream-style-split {
  width: min(76vw, 1420px);
  padding: .65vh .7vw;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.stream-style-split .stream-head { justify-content: center; margin-bottom: .55vh; }
.stream-style-split .stream-body { display: grid; grid-template-columns: 1fr 1fr; gap: .55vw; }
.stream-style-split .stream-row {
  display: flex; align-items: center; gap: .8vw; min-width: 0;
  padding: .6vh 1vw; border: 1px solid var(--sb-border); border-radius: 8px;
  background: color-mix(in srgb, var(--sb-bg) 92%, transparent);
}
.stream-style-split .stream-row:last-child { flex-direction: row-reverse; text-align: right; }

/* A compact standalone score capsule for corner placement. */
.stream-style-pill { display: flex; align-items: center; width: fit-content; max-width: min(70vw, 1100px); padding: .7vh 1vw; border-radius: 999px; }
.stream-style-pill .stream-head { display: inline-flex; margin: 0 .6vw 0 0; font-size: clamp(9px, .75vw, 12px); }
.stream-style-pill .stream-body { display: inline-flex; align-items: center; gap: .5vw; }
.stream-style-pill .stream-row { display: inline-flex; align-items: center; gap: .35vw; }
.stream-style-pill .stream-row:last-child { flex-direction: row; }
.stream-style-pill .stream-name { max-width: 10vw; font-size: clamp(11px, 1vw, 17px); }
.stream-style-pill .stream-score { font-size: clamp(19px, 2vw, 34px); }

/* Team identity keeps crests sharp and aligned in every broadcast composition. */
.stream-team-identity { display: flex; align-items: center; gap: .55vw; flex: 1 1 auto; min-width: 0; }
.stream-crest { width: clamp(22px, 2.4vw, 44px); height: clamp(22px, 2.4vw, 44px); flex: 0 0 auto; object-fit: contain; filter: drop-shadow(0 2px 4px #0008); }
.stream-row:last-child .stream-team-identity { flex-direction: row-reverse; text-align: right; }
.stream-style-pill .stream-row:last-child .stream-team-identity { flex-direction: row; text-align: left; }

/* Network bar: crests flank a score line, with a broadcast rail above. */
.stream-style-network { width: min(88vw, 1500px); padding: 0; overflow: hidden; border-radius: 8px; border-top: 3px solid var(--stream-accent, var(--team-home)); }
.stream-style-network .stream-head { justify-content: space-between; padding: .45vh 1.2vw; margin: 0; background: color-mix(in srgb, var(--sb-bg) 76%, #fff 24%); }
.stream-style-network .stream-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.stream-style-network .stream-row { display: flex; align-items: center; gap: .8vw; min-width: 0; padding: .8vh 1.2vw; }
.stream-style-network .stream-row:first-child { background: color-mix(in srgb, var(--team-home) 24%, var(--sb-bg)); }
.stream-style-network .stream-row:last-child { flex-direction: row; border-left: 1px solid var(--sb-border); background: color-mix(in srgb, var(--team-away) 24%, var(--sb-bg)); }
.stream-style-network .stream-row:last-child .stream-team-identity { flex-direction: row; text-align: left; }

/* Angled team plates evoke a TV scorebug while preserving horizontal text. */
.stream-style-angled { display: flex; align-items: center; gap: .65vw; padding: .55vh .75vw; border-radius: 5px; }
.stream-style-angled .stream-head { display: flex; flex-direction: column; align-items: center; gap: .25vh; margin: 0; padding: 0 .6vw; }
.stream-style-angled .stream-body { display: flex; align-items: center; gap: .35vw; }
.stream-style-angled .stream-row { display: flex; align-items: center; gap: .5vw; min-width: 0; padding: .5vh .8vw; background: color-mix(in srgb, var(--team-home) 26%, var(--sb-bg)); clip-path: polygon(0 0, 100% 0, 92% 100%, 0 100%); }
.stream-style-angled .stream-row:last-child { flex-direction: row; background: color-mix(in srgb, var(--team-away) 26%, var(--sb-bg)); clip-path: polygon(8% 0, 100% 0, 100% 100%, 0 100%); }
.stream-style-angled .stream-row:last-child .stream-team-identity { flex-direction: row; text-align: left; }
.stream-style-angled .stream-crest { width: clamp(20px, 1.9vw, 36px); height: clamp(20px, 1.9vw, 36px); }

/* Stacked corner scorebox puts the period rail above two unmistakable team rows. */
.stream-style-stacked { min-width: min(22vw, 420px); padding: 0; overflow: hidden; border-radius: 8px; }
.stream-style-stacked .stream-head { justify-content: space-between; padding: .55vh .8vw; margin: 0; background: color-mix(in srgb, var(--sb-bg) 72%, #fff 28%); }
.stream-style-stacked .stream-body { display: grid; gap: 1px; background: var(--sb-border); }
.stream-style-stacked .stream-row { display: flex; align-items: center; gap: .65vw; min-width: 0; padding: .5vh .8vw; background: var(--sb-bg); }
.stream-style-stacked .stream-row:last-child { flex-direction: row; }
.stream-style-stacked .stream-row:last-child .stream-team-identity { flex-direction: row; text-align: left; }
.stream-style-stacked .stream-crest { width: clamp(18px, 1.7vw, 30px); height: clamp(18px, 1.7vw, 30px); }
.stream-style-stacked .stream-score { min-width: 2ch; text-align: center; padding: .15em .4em; background: color-mix(in srgb, var(--team-home) 28%, var(--sb-bg)); }
.stream-style-stacked .stream-row:last-child .stream-score { background: color-mix(in srgb, var(--team-away) 28%, var(--sb-bg)); }

/* Symmetric center bug is designed as a small center-screen score lockup. */
.stream-style-center-bug { display: flex; align-items: center; gap: .8vw; padding: .6vh 1vw; border-radius: 8px; }
.stream-style-center-bug .stream-head { display: flex; flex-direction: column; align-items: center; gap: .25vh; margin: 0; }
.stream-style-center-bug .stream-body { display: flex; align-items: center; gap: .3vw; }
.stream-style-center-bug .stream-row { display: flex; align-items: center; gap: .45vw; min-width: 0; padding: .35vh .55vw; }
.stream-style-center-bug .stream-row:last-child { flex-direction: row; }
.stream-style-center-bug .stream-row:last-child .stream-team-identity { flex-direction: row; text-align: left; }
.stream-style-center-bug .stream-row:first-child { border-left: 3px solid var(--team-home); }
.stream-style-center-bug .stream-row:last-child { border-right: 3px solid var(--team-away); }
.stream-style-center-bug .stream-crest { width: clamp(19px, 1.8vw, 34px); height: clamp(19px, 1.8vw, 34px); }

/* ---- 文字尺寸与可读性 ---- */
.stream-head {
  display: flex;
  align-items: center;
  gap: 1vw;
  font-size: clamp(10px, .95vw, 15px);
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .85;
}
.stream-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: clamp(14px, 1.5vw, 26px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 6px #000;
}
.stream-score {
  font-size: clamp(26px, 3.1vw, 54px);
  line-height: 1;
  text-shadow: 0 1px 6px #000;
}
.stream-clock {
  color: var(--sb-timer);
  font-size: clamp(13px, 1.35vw, 23px);
  font-variant-numeric: tabular-nums;
}

/* 水印在 overlay 下保持右下角小字，不占叠加图形位置 */
body.viewer-mode.overlay-mode .viewer-foot .display-watermark {
  right: 2vw;
  bottom: 1.6vh;
  font-size: 9px;
  opacity: .55;
}

/* 单独计时屏（P2 路由上线后复用同一套 viewer） */
html,
body.viewer-mode.clock-mode,
body.viewer-mode.clock-mode .viewer-root,
body.viewer-mode.clock-mode .viewer-stage {
  background: transparent !important;
}
body.viewer-mode.clock-mode .scoreboard.display-only { width: 100%; height: 100%; background: transparent !important; }
body.viewer-mode.clock-mode .score-display.clock-only-board {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent !important;
  box-shadow: none;
}
body.viewer-mode.clock-mode .clock-only {
  color: #fff;
  font-size: clamp(80px, 18vw, 360px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 18px #000;
}

/* 分享面板：四张能力链接卡片 */
.sb-share-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: .8rem; }
.sb-share-card { min-width: 0; padding: 10px; border: 1px solid rgba(148, 163, 184, .22); border-radius: 10px; background: rgba(148, 163, 184, .06); }
.sb-share-card.disabled { opacity: .55; }
.sb-share-card h4 { margin: 0 0 .35rem; color: #dbe9f0; font-size: 12px; letter-spacing: .04em; }
.sb-share-card p { margin: 0 0 .45rem; color: #8fa6b4; font-size: 11px; line-height: 1.45; }
.sb-share-card .sb-share-url { margin: .4rem 0; }
.sb-share-card .sb-share-meta { color: #7f97a5; font-size: 10px; }
.sb-share-card .sb-dialog-actions { margin-top: .45rem; }
@media (max-width: 720px) {
  .sb-share-grid { grid-template-columns: 1fr; }
  .sb-dialog { padding: 1rem; }
  .sb-share-card .sb-dialog-actions { justify-content: space-between; }
}

/* ===== Restricted scorekeeper console ===== */
body.scorekeeper-mode {
  margin: 0;
  min-height: 100vh;
  background: #0b1118;
  color: #e5edf6;
}
.scorekeeper-root {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
  box-sizing: border-box;
}
.sk-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.sk-header h1 { margin: 0 0 4px; font-size: clamp(24px, 4vw, 38px); }
.sk-header p { margin: 0; color: #8fa6b4; font-size: 14px; }
.sk-connection {
  flex: 0 0 auto;
  padding: .42rem .8rem;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid;
}
.sk-connection.online { color: #bbf7d0; background: rgba(34, 197, 94, .12); border-color: rgba(34, 197, 94, .35); }
.sk-connection.offline { color: #fde68a; background: rgba(251, 191, 36, .12); border-color: rgba(251, 191, 36, .35); }
.sk-error {
  margin-bottom: 14px;
  padding: .7rem .9rem;
  border: 1px solid rgba(251, 113, 133, .35);
  border-radius: 10px;
  background: rgba(251, 113, 133, .1);
  color: #fecdd3;
  font-size: 13px;
}
.sk-loading { padding: 80px 0; text-align: center; color: #8fa6b4; }
.sk-team-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.sk-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.sk-team-card,
.sk-control-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 14px;
  background: rgba(148, 163, 184, .06);
}
.sk-team-name {
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  color: #a9bbc7;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sk-score,
.sk-period,
.sk-clock {
  margin: 10px 0;
  font-size: clamp(48px, 9vw, 92px);
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.sk-control-card h2 { margin: 0; color: #a9bbc7; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.sk-clock-state { margin: -4px 0 12px; color: #8fa6b4; font-size: 12px; }
.sk-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sk-actions .button { min-width: 54px; min-height: 44px; }
.sk-possession { margin-top: 10px; min-height: 44px; }
.sk-possession[aria-pressed="true"] { border-color: #b6f27d; color: #b6f27d; }
.sk-stats { display: grid; gap: 8px; margin-top: 12px; }
.sk-stat { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.sk-stat .button { min-width: 44px; min-height: 44px; padding: 0 8px; }
@media (max-width: 720px) {
  .scorekeeper-root { width: calc(100% - 24px); padding-top: 18px; }
  .sk-header { flex-direction: column; }
  .sk-team-grid,
  .sk-control-grid { grid-template-columns: 1fr; }
  .sk-team-card,
  .sk-control-card { padding: 16px; }
}

.team-library-grid{display:grid;gap:8px;margin-top:9px}.team-library-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:end;gap:7px}.team-library-row .field-cell{min-width:0}.team-library-row select{width:100%;height:34px;min-width:0;padding:0 8px;border:1px solid var(--inputline);border-radius:7px;background:var(--inputbg);color:var(--ptext);font-size:10px}.team-library-row .mini-button{white-space:nowrap}.team-library-row .mini-button:disabled,.team-library-row select:disabled{opacity:.55;cursor:not-allowed}.team-library-grid>.hint-text{margin:0}@media(max-width:520px){.team-library-row{grid-template-columns:minmax(0,1fr) auto}.team-library-row .field-cell{grid-column:1/-1}}

[data-live-imported-preview][aria-busy="true"] > * { visibility: hidden; }
.sb-has-imported-frame { position:relative; overflow:hidden; }
.sb-html-canvas.sb-imported-frame {
  position:absolute; top:50%; left:50%; width:1920px; height:1080px; max-width:none; max-height:none;
  border:0; pointer-events:none; background:transparent;
}

/* Keep the portrait overlay inside a transparent 9:16 canvas. */
body.viewer-mode.overlay-mode .viewer-stage.stream-portrait-stage {
  position:relative;
  flex:none;
  width:min(100vw, 56.25vh);
  height:min(100vh, 177.7778vw);
  margin:auto;
}
.stream-preview-frame.stream-portrait {
  aspect-ratio:9 / 16;
}
.stream-portrait { container-type:size; }
.stream-portrait .stream-overlay { max-width:90cqw; }
.stream-portrait .stream-style-bar { width:90cqw; }
.stream-portrait .stream-style-lower-third,
.stream-portrait .stream-style-network { min-width:0; }

.sb-new-room { display: grid; gap: 8px; margin: 10px 0; }
.sb-new-room label { display: grid; gap: 4px; font-size: 12px; }
.sb-new-room input, .sb-new-room select { width: 100%; min-width: 0; min-height: 44px; }
[data-creation-status], [data-room-catalog-error] { padding: 10px; border: 1px solid #63758a; border-radius: 8px; margin-bottom: 10px; overflow-wrap: anywhere; }
