/* WEB-O: one viewport, original media proportions, and legible paper. */
:root { color-scheme: only light; }
html, body { height:100%; overflow:hidden; }
.app-shell { height:100dvh; min-height:0; }
#letterScene, #stageScene { height:100dvh; min-height:0; overflow:clip; }
body:not([data-stage="A3_BLESSING"]) #letterScene .letter-film {
  position:absolute; inset:0; width:100%; height:100%; margin:0; aspect-ratio:auto;
}
body:not([data-stage="A3_BLESSING"]) #letterScene .letter-video {
  width:100%; height:100%; object-fit:contain; object-position:center;
}
#letterScene .letter-vignette { height:100%; bottom:0; }
body[data-stage="A3_BLESSING"] .letter-film:not(.is-receive-camera) {
  left:var(--letter-film-left) !important; transform:none; overflow:clip;
}
.letter-paper-still { display:none; position:absolute; inset:0; width:100%; height:100%; object-fit:fill; z-index:4; pointer-events:none; }
body[data-stage="A3_BLESSING"] .letter-paper-still { display:block; }
body[data-stage="A3_BLESSING"] :is(#letterForm,#mobileLetterForm) {
  color-scheme:only light; color:#24180f; text-shadow:none; -webkit-text-size-adjust:100%;
}
body[data-stage="A3_BLESSING"] :is(.letter-kicker,.letter-scroll-hint,.paper-field > span,.paper-field input,.paper-field textarea,.paper-field small,.paper-field small span,.visibility,.visibility label,.visibility legend,.form-status) {
  color:#24180f !important; -webkit-text-fill-color:#24180f !important; text-shadow:none !important; opacity:1;
}
body[data-stage="A3_BLESSING"] :is(input,textarea)::placeholder {
  color:#59402d !important; -webkit-text-fill-color:#59402d !important; opacity:1;
}
body[data-stage="A3_BLESSING"] .form-status { font-weight:700; }
body[data-stage="A3_BLESSING"] .seal-button { -webkit-text-fill-color:#fff7e7; }
body[data-stage="A3_BLESSING"] .mobile-paper { flex-shrink:1; }
body[data-stage="A3_BLESSING"] .mobile-paper > * { flex-shrink:0; }

/* The A4/A5/A6 video, bridge and frozen frames share the same centered plane. */
body:is([data-stage="A3_BLESSING"],[data-stage="A4_RETURN"],[data-stage="A5_THREAD_CURTAIN"],[data-stage="A6_CURTAIN_OPEN"],[data-stage="A7_ENTRANCE"]) #stageScene > .stage-media {
  inset:0; margin:auto; width:min(100vw,177.7778dvh); height:min(56.25vw,100dvh); object-fit:contain;
}
@media(max-width:760px) {
  body[data-stage="A7_DIALOGUE"] #stageScene > .stage-media {
    top:max(12px,calc((100dvh - 56.25vw)/2)); bottom:auto; margin:0;
    width:100%; height:56.25vw; max-height:none; aspect-ratio:16/9; object-fit:contain;
  }
  body[data-stage="A7_DIALOGUE"] .dialogue-panel {
    top:calc(max(12px,(100dvh - 56.25vw)/2) + 56.25vw + 12px);
    bottom:auto; max-height:min(190px,calc((100dvh - 56.25vw)/2 - 72px)); overflow:auto; scrollbar-width:none;
  }
}

#guestFullscreenToggle { position:fixed; z-index:201; left:max(10px,env(safe-area-inset-left)); top:max(10px,env(safe-area-inset-top)); min-height:40px; padding:6px 12px; border:1px solid #796049; border-radius:5px; background:#251911e8; color:#f7e5c8; font:14px/1.3 system-ui; cursor:pointer; }
body.approved-performance-active #guestFullscreenToggle, body:has(.song-review-active) #guestFullscreenToggle { display:none; }
#guestFullscreenNotice { position:fixed; z-index:220; left:5%; right:5%; bottom:82px; margin:auto; width:min(90%,520px); background:#fff6e7; color:#34241b; padding:16px; border:1px solid #796049; border-radius:8px; }
#guestFullscreenNotice[hidden] { display:none; }
#guestFullscreenNotice button { float:right; margin-left:12px; }

/* Same presentation and controls for S01 and every adopted song. */
#approvedPerformance { display:grid; grid-template-rows:auto minmax(0,1fr) auto auto auto; gap:7px; height:100%; min-height:0; padding:10px max(12px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left)); overflow:hidden; }
#approvedPerformance > header { grid-row:1; position:relative; display:flex; align-items:center; justify-content:center; min-height:40px; padding:0 86px; text-align:center; }
#approvedPerformance h2 { margin:0; font:24px/1.2 Georgia,"Noto Serif TC",serif; }
#approvedPerformance header nav { position:absolute; right:0; top:0; }
#approvedPerformance [data-full] { font-size:13px; min-height:34px; padding:4px 10px; }
#approvedPerformance .approved-main { display:contents; }
#approvedPerformance .approved-screen { grid-row:2; min-height:0; overflow:hidden; }
#approvedPerformance video { width:100%; height:100%; max-height:none; object-fit:contain; }
#approvedPerformance .approved-lyrics { grid-row:3; width:100%; height:90px; max-height:none; padding:0; overflow:hidden; display:flex; flex-direction:column; justify-content:center; }
#approvedPerformance .approved-lyrics p { margin:0; }
#approvedPerformance .lyric-now { font-size:24px; font-weight:700; line-height:1.35; color:#fff0d3; text-wrap:balance; }
#approvedPerformance .lyric-before, #approvedPerformance .lyric-after { font-size:12px; line-height:1.3; }
#approvedPerformance .approved-controls, #chapterShell.song-review-layout .main-song-player {
  display:grid; grid-row:4; grid-template-columns:48px 42px minmax(30px,1fr) 42px 48px; align-items:center; gap:8px;
  padding:3px; min-height:50px; background:#21160f; border-top:1px solid #79604955;
}
#approvedPerformance .approved-controls button, #chapterShell.song-review-layout .main-song-icon-button {
  display:flex; align-items:center; justify-content:center; min-width:48px; min-height:48px; width:48px; height:48px; margin:0; padding:0; border:1px solid #796049; border-radius:50%; color:#ffecd2; background:#251911; line-height:1; text-align:center;
}
.guest-player-icon { display:block; width:22px; height:22px; flex:none; fill:currentColor; }
#approvedPerformance .approved-time { font:14px/1.2 system-ui; text-align:center; font-variant-numeric:tabular-nums; }
#approvedPerformance .approved-seek { width:100%; min-width:0; height:32px; margin:0; accent-color:#b3444e; cursor:pointer; }
#chapterShell.song-review-layout .main-song-volume-wrap { display:none !important; }
#chapterShell.song-review-layout .main-song-status { grid-column:1/-1; font-size:12px; }
#chapterShell.song-review-layout .main-song-status:empty { display:none; }
#approvedPerformance footer { grid-row:5; display:grid; grid-template-columns:1fr 1fr; align-items:center; gap:6px; min-height:44px; }
#approvedPerformance footer button { border-radius:2px; font:14px/1.3 inherit; padding:6px 14px; background:#251911; color:#f7e5c8; border-color:#796049; }
#approvedPerformance [data-prev] { justify-self:start; }
#approvedPerformance [data-back] { justify-self:end; }
#approvedPerformance .approved-status { grid-column:1/-1; margin:0; font-size:12px; text-align:center; }
#approvedPerformance .approved-status:empty { display:none; }
#approvedPerformance button[hidden] { display:none!important; }
#approvedPerformance[data-has-lyrics="false"] .approved-lyrics { display:none; }
@media(max-width:760px),(max-height:520px) {
  #approvedPerformance { gap:5px; padding-top:6px; }
  #approvedPerformance > header { padding:0 72px 0 0; min-height:34px; }
  #approvedPerformance h2 { font-size:20px; }
  #approvedPerformance .lyric-before,#approvedPerformance .lyric-after { display:none; }
  #approvedPerformance .approved-lyrics { height:60px; }
  #approvedPerformance .lyric-now { font-size:22px; }
  #approvedPerformance .approved-controls,#chapterShell.song-review-layout .main-song-player { grid-template-columns:48px 34px minmax(25px,1fr) 34px 48px; gap:5px; }
  #approvedPerformance .approved-time { font-size:12px; }
  #approvedPerformance footer button { font-size:13px; padding:5px 12px; }
}
@media(max-height:450px) and (min-width:600px) {
  #approvedPerformance .approved-lyrics { height:32px; }
  #approvedPerformance .lyric-now { font-size:21px; }
}
/* Keep the song header and its fullscreen control unobstructed. */
body:has(.song-review-active) .web-tools { display:none; }
@media(max-width:760px) and (max-height:520px) {
  body[data-stage="A7_DIALOGUE"] .dialogue-panel { top:auto; bottom:8px; max-height:110px; }
}

/* WEB-R: stable full-button target; media progress cannot replace the pointer target. */
.guest-player-icon[hidden] { display:none !important; }
:is(#approvedPerformance .approved-controls button, #chapterShell.song-review-layout .main-song-icon-button, #letterMusicToggle) {
  cursor:pointer; touch-action:manipulation; -webkit-tap-highlight-color:transparent; user-select:none;
}
:is(#approvedPerformance .approved-controls button, #chapterShell.song-review-layout .main-song-icon-button, #letterMusicToggle) * { pointer-events:none; }
:is(#approvedPerformance .approved-controls button, #chapterShell.song-review-layout .main-song-icon-button):active { background:#67472e; }
:is(#approvedPerformance .approved-controls button, #chapterShell.song-review-layout .main-song-icon-button):focus-visible { outline:3px solid #f7dca4; outline-offset:2px; }
