/* The optional movie keeps the same book-like outlines and lettering as the game (spec 4.4).
   One play button on the picture, one row of controls, one line of note. The sheet's size and scrolling are the
   shared U.sheet's (portrait: a sheet under the header; phone landscape: the whole screen); this file sizes the
   player only. One file owns the opening: the rules once kept in polish-20261017.css live here. */
.op-sheet .c-sheet__head { background: #079bd0; color: #fff; border-bottom: 2px solid #173d59; }
.op-sheet .c-sheet__title { font-family: var(--font-display, var(--font-body, sans-serif)); font-weight: 400; color: inherit; }
.op-sheet .c-sheet__x { background: #fff; color: #173d59; border: 2px solid #173d59; }
.op-sheet .c-sheet__body { padding: 12px 12px calc(12px + var(--safe-b)); background: #f5fbff; }

.op-button { min-height: 44px; border: 2px solid #173d59; border-radius: 12px; padding: 0 16px; background: #fff; color: #173d59; font: 800 15px/1.3 var(--font-body, sans-serif); cursor: pointer; touch-action: manipulation; white-space: nowrap; }
.op-button:focus-visible { outline: 3px solid #ffcb38; outline-offset: 3px; }
.op-button--primary { background: #ffda53; box-shadow: 0 3px 0 #173d59; }
@media (hover: hover) { .op-button:hover { background: #e8f9ff; } .op-button--primary:hover { background: #ffe888; } }

.op-player { width: 100%; min-width: 0; color: #173d59; }
.op-player [hidden] { display: none !important; }
.op-screen { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 9; margin: 0 auto; overflow: hidden; border: 2px solid #173d59; border-radius: 12px; background: #0d1d30; cursor: pointer; }
.op-video { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
/* ready / paused: a big button in the middle; playing: the same button, small, in the corner (pause) */
.op-big-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); min-height: 56px; padding: 0 24px; font-size: 18px; box-shadow: 0 4px 0 #173d59, 0 0 0 6px #fff9; }
.op-player[data-state="playing"] .op-big-play, .op-player[data-state="loading"] .op-big-play {
left: 8px; top: auto; bottom: 8px; transform: none;
width: 44px; min-height: 44px; height: 44px; padding: 0; border-radius: 50%;
font-size: 16px; background: #fffc; box-shadow: none; opacity: .9;
}
.op-timeline { display: flex; align-items: center; gap: 10px; margin: 10px 0 8px; }
.op-progress { flex: 1; display: block; min-width: 0; height: 8px; border: 0; border-radius: 20px; overflow: hidden; appearance: none; color: #079bd0; background: #cee6ef; }
.op-progress::-webkit-progress-bar { border-radius: 20px; background: #cee6ef; }
.op-progress::-webkit-progress-value { border-radius: 20px; background: #079bd0; }
.op-progress::-moz-progress-bar { border-radius: 20px; background: #079bd0; }
.op-time { font: 800 13px/1 var(--font-body, sans-serif); white-space: nowrap; font-variant-numeric: tabular-nums; }
.op-controls { display: flex; align-items: center; gap: 8px; }
.op-icon { flex: none; width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border-radius: 50%; }
.op-icon .c-icon, .op-ico { width: 22px; height: 22px; }
.op-skip { flex: 1 1 auto; min-width: 0; padding: 0 12px; }
.op-note { margin: 10px 0 0; color: #466579; font: 700 14px/1.5 var(--font-body, sans-serif); text-align: center; white-space: nowrap; }
.op-note__rot { display: none; }
@media (max-width: 599px) and (orientation: portrait) {
.op-note__rot { display: inline; }
.op-note__vol { display: none; }
}
@media (max-width: 359px) { .op-skip__pre { display: none; } }

/* portrait phones and tablets: the player fills the sheet and the three friends (original pictures, still) stand
   at the bottom, as tall as the room under the film allows (spec 4.4; the sheet itself keeps its shared size) */
.op-cast { display: none; }
@media (orientation: portrait) and (max-width: 899px) {
.op-player { display: flex; flex-direction: column; min-height: 100%; }
.op-cast { display: block; position: relative; flex: 1 1 auto; min-height: 0; margin: 8px -12px calc(-12px - var(--safe-b)); pointer-events: none; }
.op-cast::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 28%; background: linear-gradient(rgba(206, 230, 239, 0), #cee6ef); }
/* the trio keeps its proportions (1.36 : 1): as tall as the room, at most 300 px, and never wider than the sheet */
.op-cast__box { position: absolute; bottom: 0; left: 50%; height: 100%; max-height: min(300px, calc((100vw - 36px) / 1.36)); aspect-ratio: 1.36; transform: translateX(-50%); container-type: size; }
.op-cast__p { position: absolute; bottom: 0; display: block; width: auto; aspect-ratio: var(--op-r, .5); }
.op-cast__p[data-person="teacher"] { left: 33%; height: 100%; z-index: 1; }
.op-cast__p[data-person="boy"] { left: 0; height: 82%; z-index: 2; }
.op-cast__p[data-person="girl"] { right: 0; height: 80%; z-index: 3; }
.op-cast__img { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; object-position: 50% 100%; }
}
/* the friends come only when there is room for them at a readable size (the end panel can take most of it) */
@container (max-height: 111px) { .op-cast__p { display: none; } }

.op-end, .op-error { margin: 12px 0 0; padding: 14px; border: 2px solid #173d59; border-radius: 14px; background: #fff; }
.op-end { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; background: #fff7d6; }
.op-end h3 { flex: 1 1 100%; margin: 0; font: 800 20px/1.4 var(--font-display, var(--font-body, sans-serif)); }
.op-end .op-button { flex: 1 1 auto; }
.op-replay { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.op-replay .c-icon { flex: none; width: 18px; height: 18px; stroke-width: 2.4; }
/* phones: both end buttons fit on one row from 360 px, so the friends keep their room under the panel */
@media (max-width: 599px) {
.op-end { padding: 12px; column-gap: 8px; }
.op-end .op-button { padding: 0 12px; }
}
.op-error p { margin: 0 0 12px; font-weight: 700; line-height: 1.7; }
.op-error__actions { display: flex; flex-wrap: wrap; gap: 10px; }

.op-full[hidden] { display: none; }
/* full screen (Android Chrome and others; iPhone Safari uses its own player): the film, the pause button at the
   bottom left and 「小さく もどす」 at the bottom right. The film leaves full screen by itself when it ends.
   (Separate rules: a browser that does not know one of the two selectors would drop a shared rule.) */
.op-shrink { display: none; position: absolute; z-index: 1; right: 8px; bottom: 8px; background: #fffc; opacity: .9; }
.op-screen:fullscreen { max-height: none; width: 100vw; height: 100vh; aspect-ratio: auto; border: 0; border-radius: 0; background: #000; }
.op-screen:-webkit-full-screen { max-height: none; width: 100vw; height: 100vh; aspect-ratio: auto; border: 0; border-radius: 0; background: #000; }
.op-screen:fullscreen .op-video { width: 100%; height: 100%; object-fit: contain; }
.op-screen:-webkit-full-screen .op-video { width: 100%; height: 100%; object-fit: contain; }
.op-screen:fullscreen .op-shrink { display: grid; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
.op-screen:-webkit-full-screen .op-shrink { display: grid; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
.op-player[data-state="playing"] .op-screen:fullscreen .op-big-play, .op-player[data-state="loading"] .op-screen:fullscreen .op-big-play { left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); }
.op-player[data-state="playing"] .op-screen:-webkit-full-screen .op-big-play, .op-player[data-state="loading"] .op-screen:-webkit-full-screen .op-big-play { left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); }

/* phone landscape (the sheet is the whole screen): the picture as tall as it can be, then one row */
@media (orientation: landscape) and (max-height: 499px) {
.op-sheet .c-sheet__body { padding: 8px 16px calc(8px + var(--safe-b)); }
.op-player { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; }
.op-screen, .op-end, .op-error, .op-note { grid-column: 1 / -1; }
.op-screen { width: auto; max-width: 100%; height: calc(100vh - 44px - 16px - 52px - var(--safe-t) - var(--safe-b)); height: calc(100dvh - 44px - 16px - 52px - var(--safe-t) - var(--safe-b)); }
.op-timeline { margin: 8px 0 0; }
.op-controls { margin-top: 8px; }
.op-skip { flex: none; }
.op-note { display: none; }
}
/* desktop: a wide card; the picture is sized so the controls stay on screen */
@media (min-width: 900px) and (min-height: 500px) {
.op-sheet.c-sheet--wide .c-sheet__panel { max-width: 940px; }
.op-sheet .c-sheet__body { padding: 16px 20px 20px; }
.op-player { grid-template-columns: minmax(0, 1fr); }
.op-screen { width: min(100%, calc((86vh - 210px) * 16 / 9)); }
.op-controls { max-width: 560px; margin: 0 auto; }
}
/* phone landscape and desktop: the end (or error) panel lies over the bottom of the film like an end card, so its
   buttons are on the first screen without scrolling (spec 2.10); portrait keeps it under the film */
@media (orientation: landscape) and (max-height: 499px), (min-width: 900px) and (min-height: 500px) {
.op-player { display: grid; }
.op-screen { grid-row: 1; grid-column: 1 / -1; }
.op-end, .op-error { position: relative; z-index: 2; grid-row: 1; grid-column: 1 / -1; align-self: end; justify-self: center; width: min(calc(100% - 24px), 560px); margin: 0 0 12px; box-shadow: 0 4px 0 #173d59; }
}
@media (prefers-reduced-motion: reduce) { .op-player * { animation: none !important; transition: none !important; } }
[data-motion="reduced"] .op-player * { animation: none !important; transition: none !important; }
