/* Shared brand signature, followed by phone layouts. */
.topbar .brand-lockup{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:1px;min-width:0;flex-shrink:0;pointer-events:none}
.topbar .brand-lockup .brand{line-height:20px;white-space:nowrap}
.topbar .brand-tagline{font:11px/15px "Songti SC","STSong","SimSun",serif;letter-spacing:.1em;color:#cbbd9e;white-space:nowrap;text-shadow:0 1px 5px #0009}
.tv-mobile-only{display:none}
@media(max-width:760px),(max-width:1024px) and (max-height:600px) and (pointer:coarse){
  html.tv-mobile{--tv-safe-top:env(safe-area-inset-top,0px);--tv-safe-bottom:env(safe-area-inset-bottom,0px);--tv-bar-height:112px;--tv-panel-bottom:124px;color-scheme:dark}
  html.tv-mobile body{overscroll-behavior:none}
  html.tv-mobile{-webkit-text-size-adjust:100%;text-size-adjust:100%}
  html.tv-mobile .tv-mobile-only{display:flex}
  html.tv-mobile button,html.tv-mobile [role=button],html.tv-mobile a{touch-action:manipulation}
  html.tv-mobile button:focus-visible,html.tv-mobile [role=button]:focus-visible{outline:2px solid #e2ca92;outline-offset:-3px}
  html.tv-mobile input,html.tv-mobile select,html.tv-mobile textarea{font-size:16px!important}
  html.tv-mobile .topbar{height:calc(50px + var(--tv-safe-top))!important;padding:var(--tv-safe-top) max(10px,env(safe-area-inset-right)) 0 max(10px,env(safe-area-inset-left))!important;gap:6px}
  html.tv-mobile .topbar .brand{min-width:0;font-size:13px!important;line-height:18px;white-space:nowrap}
  html.tv-mobile .topbar>div{flex-shrink:0;gap:4px!important}
  html.tv-mobile .topbar>.brand-lockup{gap:0!important}
  html.tv-mobile .topbar .brand-tagline{letter-spacing:.04em}
  html.tv-mobile .topbar button,html.tv-mobile .topbar a{display:flex;align-items:center;justify-content:center;min-height:44px;padding:6px 9px!important;border-radius:16px!important;white-space:nowrap}
  html.tv-mobile .einfo{top:calc(52px + var(--tv-safe-top));left:max(12px,env(safe-area-inset-left));max-width:calc(100vw - 24px)}
  html.tv-mobile .einfo .ei2{font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  html.tv-mobile #earthLoading{top:calc(70px + var(--tv-safe-top))!important}
  html.tv-mobile .bottombar{left:max(8px,env(safe-area-inset-left));right:max(8px,env(safe-area-inset-right));bottom:calc(8px + var(--tv-safe-bottom) + var(--tv-keyboard,0px));padding:5px 8px 7px;border-radius:20px;display:flex;flex-direction:column;gap:4px;overflow:visible;backdrop-filter:blur(10px)}
  /* Raise the toolbar's entire stacking context above narration, below submenus. */
  html.tv-mobile .bottombar.tv-tools-open{z-index:31}
  html.tv-mobile .tv-mobile-date{display:flex;width:100%;min-width:0}
  html.tv-mobile .bar-date{display:flex;align-items:center;min-height:38px;flex:1;order:0;white-space:nowrap;min-width:0;font-size:12px;padding:6px 8px;border-radius:12px;overflow:hidden}
  html.tv-mobile .tv-mobile-transport{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));align-items:center;gap:4px;width:100%}
  html.tv-mobile .tv-mobile-transport.tv-has-god-hand{grid-template-columns:repeat(6,minmax(0,1fr))}
  html.tv-mobile .tv-mobile-transport #pGod{font-size:10px;padding:3px 0;white-space:normal;line-height:1.25}
  html.tv-mobile .tv-mobile-transport>*{display:flex;align-items:center;justify-content:center;min-height:44px;min-width:0;margin:0;padding:4px;font-size:14px;line-height:1.2;white-space:nowrap;cursor:pointer;border-radius:14px}
  html.tv-mobile .tv-mobile-transport .bar-play{width:44px;height:44px;justify-self:center;border-radius:50%}
  html.tv-mobile #tvMobileMore{border:1px solid #5fd6f030;background:#14303b66;color:#9dc9d6;font-family:inherit;font-size:12px;line-height:1.2}
  html.tv-mobile #tvMobileMore[aria-expanded=true]{color:#e6d29f;border-color:#d1b67980}
  html.tv-mobile .tv-mobile-tools{position:absolute;bottom:calc(100% + 8px);left:0;right:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;padding:12px;max-height:calc(var(--tv-vh,100dvh) - var(--tv-bar-height) - 90px);overflow-y:auto;overscroll-behavior:contain;border:1px solid #68899088;border-radius:18px;background:#0b1c2bf7;box-shadow:0 -14px 40px #0005}
  html.tv-mobile .tv-mobile-tools[hidden]{display:none}
  html.tv-mobile .tv-mobile-tools>*{min-width:0;min-height:44px;height:auto;display:flex;align-items:center;justify-content:center;padding:7px 5px;font-size:12px;line-height:1.35;white-space:normal;text-align:center;background:#10283a;border:1px solid #5fd6f02e;border-radius:10px}
  html.tv-mobile .tv-mobile-tools .bar-sep{display:none}
  html.tv-mobile #tv-fab{top:auto;right:max(12px,env(safe-area-inset-right));bottom:var(--tv-panel-bottom);padding:10px 15px;min-height:44px;font-size:12px;border-radius:16px;box-shadow:0 6px 24px #0004}
  html.tv-mobile #tv-assist{left:max(8px,env(safe-area-inset-left));right:max(8px,env(safe-area-inset-right));top:auto;bottom:var(--tv-panel-bottom)!important;width:auto;max-width:none;height:clamp(228px,40dvh,350px);max-height:calc(var(--tv-vh,100dvh) - var(--tv-bar-height) - 84px);border-radius:18px;font-size:14px;line-height:1.65;backdrop-filter:blur(10px)}
  html.tv-mobile #tv-assist header{padding:2px 10px 6px}
  html.tv-mobile #tv-assist .top{gap:4px}
  html.tv-mobile #tv-assist .kicker{display:none}
  html.tv-mobile #tv-assist .tv-panel-actions{display:flex;align-items:center;gap:4px;flex:1}
  html.tv-mobile #tv-assist .tv-panel-actions button{font-size:11px;min-height:40px;padding:4px 8px;color:#d9c797}
  html.tv-mobile #tv-assist h2{font-size:16px;line-height:1.4;margin:0}
  html.tv-mobile #tv-assist .sub{display:none}
  html.tv-mobile #tvClose{min-width:44px;min-height:44px;line-height:1;font-size:21px}
  html.tv-mobile #tv-assist .body{padding:3px 12px 12px;scroll-padding:12px;touch-action:pan-y}
  html.tv-mobile #tv-assist .line{padding:8px 0}
  html.tv-mobile #tv-assist .line p{line-height:1.8}
  html.tv-mobile #tv-assist .stage-nav{padding:0 10px 3px;display:grid;grid-template-columns:1fr auto;align-items:center;gap:0 8px}
  html.tv-mobile #tvMobileChapters{grid-column:2;grid-row:1;min-height:36px;padding:3px 8px;font-size:11px;color:#d9c797}
  html.tv-mobile #tvStageLabel{grid-column:1;grid-row:1}
  html.tv-mobile #tv-assist .cue-track{display:none;grid-column:1/-1;height:44px;overflow-x:auto;gap:4px;justify-content:flex-start;scrollbar-width:none;touch-action:pan-x}
  html.tv-mobile #tv-assist.tv-show-chapters .cue-track{display:flex}
  html.tv-mobile #tv-assist .cue-track:before{top:19px}
  html.tv-mobile #tv-assist .cue-point{width:40px;height:38px;flex:0 0 40px}
  html.tv-mobile #tv-assist footer{padding:4px 10px 6px}
  html.tv-mobile #tv-assist .controls{gap:8px;min-height:40px}
  html.tv-mobile #tv-assist .controls>div{display:flex;flex-shrink:0}
  html.tv-mobile #tv-assist .controls button{min-width:48px;min-height:44px;font-size:12px;padding:4px 8px}
  html.tv-mobile #tvStatus{font-size:11px;line-height:1.35;min-width:0;overflow-wrap:anywhere}
  html.tv-mobile #tv-assist .speech-rate{display:none;margin-top:0;font-size:11px;min-height:36px}
  html.tv-mobile #tv-assist.tv-panel-expanded .speech-rate{display:flex}
  html.tv-mobile #tvRate{min-height:34px;padding:3px 6px!important;max-width:100%}
  html.tv-mobile #tv-assist .skip-paragraph{min-height:40px;font-size:11px;padding:4px 8px}
  html.tv-mobile #tv-assist .reply-choice{min-height:44px}
  html.tv-mobile #tv-assist.tv-panel-expanded,html.tv-mobile #tv-assist.replying{height:calc(var(--tv-vh,100dvh) - var(--tv-bar-height) - 84px);z-index:28}
  html.tv-mobile #tv-assist.tv-panel-mini:not(.replying){height:auto;max-height:none}
  html.tv-mobile #tv-assist.tv-panel-mini:not(.replying) .body,html.tv-mobile #tv-assist.tv-panel-mini:not(.replying) .stage-nav,html.tv-mobile #tv-assist.tv-panel-mini:not(.replying) .speech-rate{display:none}
  html.tv-mobile #tv-assist.tv-panel-mini:not(.replying) h2{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  html.tv-mobile #tv-assist.tv-panel-mini:not(.replying) header{padding-bottom:2px}
  html.tv-mobile #tv-assist .date-parts{gap:5px}
  html.tv-mobile #tv-assist .date-parts select{min-height:44px}
  html.tv-mobile .tv-mobile-card{padding:0!important;border-radius:14px!important;z-index:23!important}
  html.tv-mobile .tv-mobile-card:not(.tv-card-expanded)>:not(.tv-card-summary){display:none!important}
  html.tv-mobile .tv-card-summary{align-items:center;gap:2px;min-height:44px;background:#0e2430;position:sticky;top:0;z-index:2;border-radius:12px}
  html.tv-mobile .tv-card-summary button{border:0;background:none;color:#e1ce9f;cursor:pointer;min-height:44px;padding:8px 10px;font-family:inherit;font-size:12px;line-height:1.4}
  html.tv-mobile .tv-card-summary .tv-card-open{flex:1;text-align:left;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  html.tv-mobile .tv-card-summary .tv-card-dismiss{min-width:44px;color:#b7c8cb;font-size:18px;padding:8px}
  html.tv-mobile .tv-mobile-card.tv-card-expanded{z-index:27!important;padding:10px 12px!important}
  html.tv-mobile .tv-mobile-card.tv-card-expanded .tv-card-summary{margin:-10px -12px 8px;border-bottom:1px solid #ffffff18}
  html.tv-mobile .tv-mobile-card.tv-card-expanded .card-close,html.tv-mobile .tv-mobile-card.tv-card-expanded .tb-close,html.tv-mobile .tv-mobile-card .hdr .close{display:none}
  html.tv-mobile #tv-course-visual .cv-heading{font-size:16px}
  html.tv-mobile #tv-course-visual .cv-note{font-size:12px;line-height:1.65}
  html.tv-mobile #tv-course-visual .cv-term{font-size:12px;gap:8px;flex-wrap:wrap}
  html.tv-mobile #planetCard .card-desc,html.tv-mobile #threeBodyCard .tb-desc{font-size:13px;line-height:1.75}
  html.tv-mobile #planetCard .card-grid{gap:8px 12px}
  html.tv-mobile #tvMobileShade{position:fixed;inset:0;z-index:29;border:0;background:#020714b8;display:none;width:100%;height:100%;padding:0;touch-action:none}
  html.tv-mobile #datePicker,html.tv-mobile #spdPopup,html.tv-mobile #tzPopup,html.tv-mobile #skinPopup,html.tv-mobile #layerPopup{z-index:32!important;left:max(10px,env(safe-area-inset-left))!important;right:max(10px,env(safe-area-inset-right))!important;bottom:calc(var(--tv-bar-height) + 18px + var(--tv-safe-bottom) + var(--tv-keyboard,0px))!important;top:auto!important;transform:none!important;width:auto!important;max-width:420px;max-height:calc(var(--tv-vh,100dvh) - var(--tv-bar-height) - 90px)!important;overflow-y:auto!important;overscroll-behavior:contain;touch-action:pan-y;box-shadow:0 12px 50px #0008}
  html.tv-mobile #datePicker{top:calc(var(--tv-vtop,0px) + var(--tv-safe-top) + 10px)!important;bottom:auto!important;max-width:420px;max-height:calc(var(--tv-vh,100dvh) - var(--tv-safe-top) - var(--tv-safe-bottom) - 20px)!important}
  html.tv-mobile #spdPopup>div,html.tv-mobile #skinPopup>div{display:flex;flex-wrap:wrap;gap:6px}
  html.tv-mobile .spd-opt,html.tv-mobile .tz-opt,html.tv-mobile .layer-opt{min-height:44px;display:flex;align-items:center;font-size:14px}
  html.tv-mobile #datePicker .dp-tab,html.tv-mobile #datePicker .dp-nav{min-width:44px;min-height:44px}
  html.tv-mobile #datePicker .dp-cell{height:46px}
  html.tv-mobile #datePicker .dp-cell.head{height:26px}
  html.tv-mobile #datePicker #dpYear{min-height:44px;width:100px!important}
  html.tv-mobile #datePicker #dpTime{min-height:44px;width:160px!important}
  html.tv-mobile #lunarPanel>div:first-child{display:grid!important;grid-template-columns:1fr 1fr;gap:8px}
  html.tv-mobile #lunarPanel select{min-width:0;min-height:44px;width:100%}
  html.tv-mobile #datePicker .dp-actions{padding-bottom:2px}
  html.tv-mobile #datePicker .dp-btn{min-height:48px}
  html.tv-mobile #introSkip{top:calc(12px + var(--tv-safe-top))!important;right:max(12px,env(safe-area-inset-right))!important;min-height:44px}
  html.tv-mobile #introChooser{padding:calc(12px + var(--tv-safe-top)) 16px calc(12px + var(--tv-safe-bottom));overflow:auto;align-items:flex-start}
  html.tv-mobile .intro-choice-card{margin:auto;max-height:none}
  html.tv-mobile .intro-choice-close{min-width:44px;min-height:44px}
  html.tv-mobile .guide-card{top:auto!important;bottom:calc(var(--tv-bar-height) + 20px + var(--tv-safe-bottom))!important;width:calc(100vw - 32px);max-width:360px;max-height:calc(var(--tv-vh,100dvh) - var(--tv-bar-height) - 90px);overflow:auto}
  html.tv-mobile .guide-card .next,html.tv-mobile .guide-card .prev,html.tv-mobile .guide-card .skip{display:flex;align-items:center;min-height:44px}
  html.tv-mobile .admin-page{padding-bottom:calc(30px + var(--tv-safe-bottom))}
  html.tv-mobile .admin-page .hd{position:relative;padding:calc(10px + var(--tv-safe-top)) 12px 10px;gap:8px;flex-wrap:wrap}
  html.tv-mobile .admin-page .hd h1{width:100%;font-size:17px}
  html.tv-mobile .admin-page .wrap{padding:0 12px}
  html.tv-mobile .admin-page .admin-tabs{padding:0 12px;gap:8px;flex-wrap:wrap}
  html.tv-mobile .admin-page .btn{min-height:44px;white-space:normal}
  html.tv-mobile .admin-page .course-toolbar{position:static;display:grid;grid-template-columns:1fr 1fr;padding:10px;gap:8px}
  html.tv-mobile .admin-page .course-toolbar>label,html.tv-mobile .admin-page .course-msg{grid-column:1/-1;min-width:0}
  html.tv-mobile .admin-page .course-toolbar>label{display:grid;grid-template-columns:52px minmax(0,1fr);overflow:hidden}
  html.tv-mobile .admin-page .course-toolbar select{flex:1;min-width:0;width:100%;max-width:100%;min-height:44px}
  html.tv-mobile .admin-page .course-line .role-row{flex-wrap:wrap}
  html.tv-mobile .admin-page .f .row{flex-direction:column}
  html.tv-mobile .admin-page .course-section{padding:10px}
  html.tv-mobile .admin-page .course-section summary{min-height:44px;padding:8px 0}
  html.tv-mobile .admin-page .modal{max-height:calc(var(--tv-vh,100dvh) - 24px);padding:16px}
  html.tv-mobile .admin-page .mask{top:var(--tv-vtop,0px);height:var(--tv-vh,100dvh);bottom:auto;padding:12px}
  html.tv-mobile .admin-page .f .btns{position:sticky;bottom:-16px;background:#0a1426;padding:10px 0}
}
@media(max-width:1024px) and (max-height:600px) and (orientation:landscape) and (pointer:coarse){
  html.tv-mobile .bottombar{left:max(8px,env(safe-area-inset-left));right:max(8px,env(safe-area-inset-right));flex-direction:row;gap:8px;padding:5px 8px}
  html.tv-mobile .tv-mobile-date{flex:1;width:auto;min-width:0}
  html.tv-mobile .tv-mobile-transport{width:270px;flex-shrink:0}
  html.tv-mobile .tv-mobile-transport.tv-has-god-hand{width:320px}
  html.tv-mobile .tv-mobile-tools{left:auto;width:min(430px,90vw)}
  html.tv-mobile #tv-assist{left:auto;right:max(8px,env(safe-area-inset-right));top:calc(54px + var(--tv-safe-top));bottom:var(--tv-panel-bottom)!important;width:320px;height:auto;max-height:none}
  html.tv-mobile #tv-assist.tv-panel-expanded,html.tv-mobile #tv-assist.replying{top:calc(8px + var(--tv-safe-top));height:auto;width:min(420px,calc(100vw - 100px))}
  html.tv-mobile #tv-assist.tv-panel-mini:not(.replying){top:auto;width:290px}
  html.tv-mobile #tv-assist .stage-nav{padding-bottom:2px}
  html.tv-mobile #tv-assist .cue-track{display:none}
  html.tv-mobile #tv-assist h2{font-size:14px}
  html.tv-mobile #tv-assist .speech-rate{display:none}
  html.tv-mobile #tv-assist .controls{min-height:38px}
  html.tv-mobile #tv-assist .controls button{min-height:40px}
  html.tv-mobile #datePicker{left:50%!important;right:auto!important;transform:translateX(-50%)!important;width:min(540px,calc(100vw - 40px))!important;max-width:none}
  html.tv-mobile #introChooser .intro-city-grid{grid-template-columns:1fr 1fr}
  html.tv-mobile #introChooser .intro-city{display:grid;grid-template-columns:40% 1fr}
  html.tv-mobile #introChooser .intro-city img{height:100%;min-height:100px}
  html.tv-mobile #introChooser .intro-choice-heading h2{font-size:22px}
  html.tv-mobile .intro-choice-note{margin-top:8px}
}

/* Short portrait viewports, including iPhone in-app browser chrome. */
html.tv-mobile.tv-compact .topbar{height:calc(44px + var(--tv-safe-top))!important}
html.tv-mobile.tv-compact .topbar .brand{font-size:12px!important;line-height:17px}
html.tv-mobile.tv-compact .topbar .brand-tagline{font-size:10px;line-height:13px}
html.tv-mobile.tv-compact .topbar button,html.tv-mobile.tv-compact .topbar a{font-size:12px!important;min-height:40px;padding:5px 8px!important}
html.tv-mobile.tv-compact .einfo{top:calc(46px + var(--tv-safe-top))}
html.tv-mobile.tv-compact .einfo .ei2{font-size:10px}
html.tv-mobile.tv-compact .bottombar{padding:4px 6px 5px;gap:2px;border-radius:16px}
html.tv-mobile.tv-compact .bar-date{min-height:28px;padding:4px 6px;font-size:11px}
html.tv-mobile.tv-compact .tv-mobile-transport>*{min-height:40px;font-size:13px}
html.tv-mobile.tv-compact .tv-mobile-transport .bar-play{width:40px;height:40px}
html.tv-mobile.tv-compact #tv-assist{font-size:13px;line-height:1.6;border-radius:15px}
html.tv-mobile.tv-compact #tv-assist:not(.tv-panel-expanded):not(.replying):not(.tv-panel-mini){height:clamp(180px,calc(var(--tv-vh,100dvh) * .32),220px)}
/* The stage row already carries the chapter title; avoid a duplicate heading. */
html.tv-mobile.tv-compact #tv-assist:not(.tv-panel-expanded):not(.replying):not(.tv-panel-mini) h2{display:none}
html.tv-mobile.tv-compact #tv-assist header{padding:0 8px}
html.tv-mobile.tv-compact #tv-assist h2{font-size:14px;line-height:1.4}
html.tv-mobile.tv-compact #tv-assist .tv-panel-actions button{min-height:40px;padding:3px 6px;font-size:11px}
html.tv-mobile.tv-compact #tvClose{min-height:40px;min-width:40px;font-size:20px}
html.tv-mobile.tv-compact #tv-assist .stage-nav{padding:0 8px;gap:0 4px}
html.tv-mobile.tv-compact #tvStageLabel{font-size:11px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
html.tv-mobile.tv-compact #tvMobileChapters{min-height:32px;padding:2px 6px;font-size:11px}
html.tv-mobile.tv-compact #tv-assist .body{padding:2px 10px 6px;scroll-padding:6px}
html.tv-mobile.tv-compact #tv-assist .line{padding:4px 0}
html.tv-mobile.tv-compact #tv-assist .line p{font-size:13px;line-height:1.6;margin-top:3px}
html.tv-mobile.tv-compact #tv-assist .speaker{font-size:10px;line-height:1.4}
html.tv-mobile.tv-compact #tv-assist footer{padding:0 8px}
html.tv-mobile.tv-compact #tv-assist .controls{min-height:40px;gap:4px}
html.tv-mobile.tv-compact #tv-assist .controls button{min-height:40px;min-width:44px;padding:3px 6px;font-size:11px}
html.tv-mobile.tv-compact #tvStatus{font-size:10px}
