:root { color-scheme: dark; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #000; }
body { font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; user-select: none; }
button, input { font: inherit; }
.player, .stage { position: fixed; inset: 0; overflow: hidden; background: #000; }
.stage { isolation: isolate; inset: auto; left: 50%; top: 50%; transform: translate(-50%,-50%); }
.landscape-player .bottom-slot img { object-fit: contain; background: #000; }
.landscape-player .bottom-slot p { padding: 1vh 2vw; font-size: clamp(18px,2.3vw,88px); line-height: 1.4; }
.program-scene { position: absolute; z-index: 0; inset: 0; display: flex; flex-direction: column; overflow: hidden; background: #000; opacity: 0; transform: scale(1.008); pointer-events: none; will-change: opacity, transform, filter; }
.program-scene.scene-active { z-index: 1; opacity: 1; transform: none; pointer-events: auto; }
.program-scene.scene-entering { z-index: 3; animation: sceneCrossIn .72s cubic-bezier(.22,.7,.18,1) both; }
.program-scene.scene-exiting { z-index: 2; animation: sceneCrossOut .72s cubic-bezier(.4,0,.2,1) both; }
.program-scene.scene-entering::after { content: ""; position: absolute; z-index: 5; inset: 0; pointer-events: none; background: linear-gradient(180deg,rgba(0,0,0,.28) 0%,rgba(0,0,0,.08) 30%,rgba(0,0,0,.18) 79%,rgba(0,0,0,.04) 100%); mix-blend-mode: multiply; animation: sceneShadowLift .72s ease-out both; }
@keyframes sceneCrossIn { from { opacity: 0; transform: scale(1.012); filter: brightness(.82); } to { opacity: 1; transform: none; filter: brightness(1); } }
@keyframes sceneCrossOut { from { opacity: 1; transform: none; filter: brightness(1); } to { opacity: .16; transform: scale(.994); filter: brightness(.7); } }
@keyframes sceneShadowLift { from { opacity: .72; } to { opacity: 0; } }
.main-slot { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: #000; }
.main-slot img, .main-slot video, .main-slot iframe, .bottom-slot img { width: 100%; height: 100%; display: block; border: 0; object-fit: cover; }
.main-slot.fit-contain img, .main-slot.fit-contain video { object-fit: contain; }
.main-slot video { background: #000; }
.main-slot .video-poster { position: absolute; inset: 0; }
.main-slot video { position: relative; }
/* 低配置屏只保留封面托底，不创建全屏滤镜和缩放合成层。 */
.lite-playback .program-scene { transform: none; filter: none; will-change: auto; }
.lite-playback .program-scene::after { display: none; }
.lite-playback .program-scene video { opacity: 0; }
.lite-playback .program-scene.video-running video { opacity: 1; }
.main-slot iframe { background: #fff; }
.bottom-slot { flex: 0 0 var(--bottom-ratio,25%); display: grid; place-items: center; min-height: 0; overflow: hidden; background: #eef5ea; }
.bottom-slot p { margin: 0; padding: clamp(22px,4vw,60px); color: #17392b; font-size: clamp(24px,3.5vw,54px); font-weight: 700; line-height: 1.6; text-align: center; white-space: pre-wrap; }
.fade-in { animation: fadeIn .5s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: scale(1.008); } }

.welcome-screen { position: absolute; inset: 0; overflow: hidden; color: white; background: radial-gradient(circle at 90% 10%,rgba(201,241,104,.2),transparent 35%),linear-gradient(155deg,#163e30 0%,#0c1913 65%,#07100c 100%); }
.welcome-screen::before { content: ""; position: absolute; width: 70vw; height: 70vw; right: -35vw; bottom: -18vw; border: 1px solid rgba(201,241,104,.2); border-radius: 50%; box-shadow: 0 0 0 10vw rgba(201,241,104,.025),0 0 0 20vw rgba(201,241,104,.018); }
.welcome-grid { position: absolute; inset: 0; opacity: .08; background-image: linear-gradient(rgba(255,255,255,.5) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.5) 1px,transparent 1px); background-size: 12vw 12vw; mask-image: linear-gradient(to bottom,black,transparent 78%); }
.welcome-content { position: absolute; left: 9vw; right: 9vw; top: 15vh; }
.welcome-mark { position: relative; width: 72px; height: 82px; transform: rotate(-10deg); margin-bottom: 8vh; }
.welcome-mark i { position: absolute; bottom: 0; display: block; border-radius: 5px; background: #c9f168; }
.welcome-mark i:nth-child(1) { left: 0; width: 21px; height: 72px; }
.welcome-mark i:nth-child(2) { left: 28px; width: 21px; height: 54px; opacity: .8; }
.welcome-mark i:nth-child(3) { left: 56px; width: 9px; height: 30px; opacity: .58; }
.welcome-content > p { margin: 0 0 2.5vh; color: #c9f168; font-size: clamp(11px,1.7vw,22px); font-weight: 800; letter-spacing: .28em; }
.welcome-content h1 { margin: 0; max-width: 80vw; font-size: clamp(42px,8vw,110px); line-height: 1.14; letter-spacing: -.06em; }
.welcome-content > span { display: inline-flex; align-items: center; gap: 12px; margin-top: 5vh; color: rgba(255,255,255,.55); font-size: clamp(13px,2.1vw,28px); }
.welcome-content > span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #c9f168; box-shadow: 0 0 0 6px rgba(201,241,104,.1); animation: pulse 1.5s infinite; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.75); } }
.welcome-foot { position: absolute; left: 9vw; bottom: 7vh; color: rgba(255,255,255,.35); font-size: clamp(10px,1.6vw,20px); letter-spacing: .08em; }

.empty-program { position: absolute; inset: 0; display: grid; align-content: center; justify-items: start; padding: 9vw; overflow: hidden; color: white; background: linear-gradient(165deg,#173f31,#0c1712 70%); }
.empty-program::before { content: ""; position: absolute; width: 80vw; height: 80vw; right: -35vw; top: -10vw; border: 1px solid rgba(201,241,104,.22); border-radius: 50%; box-shadow: 0 0 0 12vw rgba(201,241,104,.025),0 0 0 24vw rgba(201,241,104,.018); }
.empty-program small { position: relative; color: #c9f168; font-size: clamp(11px,1.7vw,20px); letter-spacing: .22em; font-weight: 800; }
.empty-program h2 { position: relative; margin: 3vh 0 2vh; font-size: clamp(45px,9vw,116px); line-height: 1.1; letter-spacing: -.06em; }
.empty-program p { position: relative; max-width: 75vw; color: rgba(255,255,255,.55); font-size: clamp(15px,2.5vw,32px); line-height: 1.8; }
.empty-program code { position: relative; margin-top: 6vh; padding: 10px 15px; color: rgba(255,255,255,.7); background: rgba(255,255,255,.08); border-radius: 8px; font-size: clamp(12px,1.8vw,22px); }

.connection-badge { position: fixed; z-index: 20; left: 18px; bottom: max(18px,env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; padding: 8px 11px; color: rgba(255,255,255,.72); background: rgba(6,13,9,.58); border: 1px solid rgba(255,255,255,.1); border-radius: 999px; backdrop-filter: blur(12px); font-size: 10px; opacity: 0; transform: translateY(8px); transition: .25s; }
.connection-badge.visible { opacity: 1; transform: none; }
.connection-badge i { width: 6px; height: 6px; border-radius: 50%; background: #f1b75a; }
.connection-badge.online i { background: #8ae295; }
.connection-badge.offline i { background: #e57268; }
.fullscreen-prompt { position: fixed; z-index: 25; left: 50%; bottom: max(24px,env(safe-area-inset-bottom)); transform: translate(-50%,20px); display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 18px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; color: white; background: rgba(16,54,40,.92); box-shadow: 0 12px 38px rgba(0,0,0,.34); backdrop-filter: blur(14px); opacity: 0; pointer-events: none; transition: .25s; }
.fullscreen-prompt.visible { opacity: 1; transform: translate(-50%,0); pointer-events: auto; }
.fullscreen-prompt span { color: #c9f168; font-size: 22px; line-height: 1; }
.fullscreen-prompt b { font-size: 13px; white-space: nowrap; }
.settings-button { position: fixed; z-index: 20; right: 14px; bottom: max(14px,env(safe-area-inset-bottom)); padding: 8px 11px; border: 1px solid rgba(255,255,255,.13); border-radius: 8px; color: rgba(255,255,255,.7); background: rgba(7,14,10,.55); backdrop-filter: blur(12px); font-size: 10px; opacity: .12; transition: .2s; }
.settings-button:active, .settings-button:focus { opacity: 1; }
.tap-hint { position: fixed; z-index: 30; left: 50%; bottom: 65px; transform: translate(-50%,10px); padding: 8px 12px; color: white; background: rgba(0,0,0,.7); border-radius: 6px; font-size: 11px; opacity: 0; transition: .25s; pointer-events: none; }
.tap-hint.show { opacity: 1; transform: translate(-50%,0); }

.setup-dialog { width: min(560px,calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 18px; color: #17201d; background: #fff; box-shadow: 0 30px 90px rgba(0,0,0,.45); }
.setup-dialog::backdrop { background: rgba(4,12,8,.78); backdrop-filter: blur(8px); }
.setup-dialog form { padding: clamp(24px,5vw,42px); overflow-y: auto; }
.setup-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 35px; }
.setup-brand b, .setup-brand small { display: block; }
.setup-brand b { font-size: 18px; letter-spacing: .05em; }
.setup-brand small { margin-top: 3px; color: #8d9a92; font-size: 8px; letter-spacing: .18em; }
.setup-logo { position: relative; width: 38px; height: 42px; transform: rotate(-9deg); }
.setup-logo i { position: absolute; bottom: 0; width: 10px; border-radius: 3px; background: #1e6247; }
.setup-logo i:nth-child(1) { left: 0; height: 37px; }
.setup-logo i:nth-child(2) { left: 14px; height: 27px; opacity: .75; }
.setup-logo i:nth-child(3) { left: 28px; width: 5px; height: 15px; opacity: .5; }
.setup-dialog h2 { margin: 0 0 9px; font-size: 29px; letter-spacing: -.04em; }
.setup-intro { margin: 0 0 26px; color: #718078; font-size: 12px; line-height: 1.7; }
.setup-dialog label { display: grid; gap: 8px; margin-top: 16px; }
.setup-dialog label span, .device-context span { color: #4f5f56; font-size: 11px; font-weight: 800; }
.setup-dialog input { width: 100%; height: 49px; padding: 0 13px; border: 1px solid #dce3dd; outline: 0; border-radius: 9px; color: #17201d; background: #fafbf9; font-size: 14px; user-select: text; }
.setup-dialog input:focus { border-color: #4f8a6b; box-shadow: 0 0 0 3px rgba(30,98,71,.09); }
.device-context { display: grid; gap: 0; margin-top: 18px; overflow: hidden; border: 1px solid #dce7df; border-radius: 10px; background: #edf4ef; }
.device-context div { display: flex; justify-content: space-between; align-items: center; min-height: 42px; padding: 8px 13px; }
.device-context div + div { border-top: 1px solid #dce7df; }
.device-context b { max-width: 68%; overflow: hidden; color: #1e6247; font-size: 12px; letter-spacing: .025em; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.setup-error { min-height: 18px; margin: 10px 0 0; color: #d25148; font-size: 11px; }
#connectButton { width: 100%; height: 52px; border: 0; border-radius: 10px; color: white; background: #1e6247; font-weight: 800; }
.cancel-button { width: 100%; height: 42px; margin-top: 7px; border: 0; color: #1e6247; background: transparent; font-size: 12px; }
.identity-recovery { margin-top: 18px; padding: 14px; border: 1px solid #e4e8e4; border-radius: 10px; background: #fafbf9; }
.identity-recovery > b { color: #263c32; font-size: 12px; }
.identity-recovery > p { margin: 6px 0 10px; color: #718078; font-size: 10px; line-height: 1.6; }
.identity-recovery button { min-height: 40px; padding: 0 13px; border: 1px solid #cbd8d0; border-radius: 8px; color: #345947; background: #fff; font-size: 11px; font-weight: 700; }
.identity-recovery button.confirming { border-color: #d99b73; color: #8e3e24; background: #fff5ef; }
.identity-recovery button:disabled { opacity: .55; }
#identityStatus { min-height: 0; margin-bottom: 0; color: #8e3e24; }
.setup-tip { margin: 17px 0 0; color: #98a29c; font-size: 9px; line-height: 1.6; text-align: center; }

@media (orientation: landscape) {
  .welcome-content { top: 12vh; }
  .welcome-mark { margin-bottom: 5vh; transform: scale(.75) rotate(-10deg); transform-origin: left bottom; }
  .welcome-content h1 { font-size: clamp(38px,7vw,84px); }
}
