.cinema-optics-player,
.cinema-optics-player .lesson-section-stage,
.cinema-optics-player .lesson-blocks,
.cinema-optics-player :where(p, h1, h2, h3, h4, figcaption, label, small, article, aside) {
  direction: rtl;
  text-align: right;
}

.cinema-optics-player :where(ol, ul) {
  direction: rtl;
  padding-inline-start: 1.55rem;
  padding-inline-end: 0;
  list-style-position: outside;
  text-align: right;
}

.cinema-optics-player :where(ol, ul) > li { padding-inline: .25rem .2rem; text-align: right; }
.cinema-optics-player bdi[dir="ltr"],
.cinema-optics-player .cinema-technical-inline { display: inline-block; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }

.cinema-storybook-mount,
.course-simulation.cinema-exploration-lab {
  min-height: 0;
  border: 0;
  background: transparent;
}

.cinema-story-card,
.cinema-lab-card {
  overflow: hidden;
  margin: 18px 0 28px;
  border: 1px solid rgba(23, 75, 92, .2);
  border-radius: 26px;
  background: linear-gradient(145deg, #fbfcf8, #edf6f4);
  box-shadow: 0 20px 54px rgba(9, 40, 53, .14);
}

.cinema-story-card > header,
.cinema-lab-card > header {
  padding: 21px 24px 15px;
  background:
    radial-gradient(circle at 8% 0, rgba(249, 171, 59, .24), transparent 38%),
    linear-gradient(100deg, rgba(255,255,255,.8), rgba(232,245,241,.72));
}

.cinema-story-card > header > span,
.cinema-lab-card > header > span {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  background: #123d50;
  color: #fff4d5;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .01em;
}

.cinema-story-card > header h3,
.cinema-lab-card > header h3 {
  margin: 11px 0 5px;
  color: #0c3041;
  font: 850 clamp(1.2rem, 2.4vw, 1.55rem) "Rubik", "Heebo", sans-serif;
}

.cinema-story-card > header p,
.cinema-lab-card > header p { max-width: 76ch; margin: 0; color: #415e6c; line-height: 1.75; }

.cinema-story-stage,
.cinema-lab-stage {
  position: relative;
  padding: 0 18px;
  direction: ltr;
  touch-action: none;
}

.cinema-lab-stage[role="slider"] { cursor: crosshair; }
.cinema-lab-stage[role="slider"]:focus-visible { outline: 4px solid rgba(222, 139, 35, .5); outline-offset: 4px; border-radius: 24px; }

.cinema-learning-raster,
.cinema-raster-scene {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 20px;
  background: #071c2c;
  box-shadow: 0 10px 28px rgba(3, 24, 34, .2);
}

.cinema-learning-raster { height: auto; object-fit: cover; }
.cinema-story-stage .cinema-raster-missing,
.cinema-raster-scene .cinema-raster-missing {
  display: none;
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 20;
  transform: translate(-50%, -50%);
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(7, 28, 44, .88);
  color: #fff;
  font-weight: 800;
  white-space: nowrap;
}
.cinema-story-stage.is-missing .cinema-learning-raster { min-height: 280px; opacity: .12; }
.cinema-story-stage.is-missing .cinema-raster-missing,
.cinema-raster-scene.is-missing .cinema-raster-missing { display: block; }

.cinema-raster-scene {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.cinema-raster-scene > img,
.cinema-raster-scene > span:not(.cinema-raster-missing) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.cinema-raster-scene > img {
  object-fit: cover;
  transform: translate(var(--scene-pan-x), var(--scene-pan-y)) rotate(var(--scene-rotate)) scale(var(--scene-zoom));
  transform-origin: center;
  transition: filter .13s linear, transform .13s linear, opacity .13s linear, clip-path .13s linear;
}
.cinema-raster-base {
  filter: blur(var(--scene-blur)) brightness(var(--scene-brightness)) contrast(var(--scene-contrast)) saturate(var(--scene-saturate)) sepia(var(--scene-sepia)) hue-rotate(var(--scene-hue));
}
.cinema-raster-detail {
  z-index: 2;
  opacity: var(--detail-opacity);
  clip-path: inset(0 calc(100% - var(--wipe)) 0 0);
  filter: blur(var(--detail-blur)) brightness(var(--scene-brightness)) contrast(var(--scene-contrast)) saturate(var(--scene-saturate)) sepia(var(--scene-sepia)) hue-rotate(var(--scene-hue));
}
.cinema-raster-ghost { z-index: 1; opacity: var(--ghost-opacity); filter: saturate(.7) blur(1.2px); mix-blend-mode: screen; }
.cinema-raster-ghost.ghost-a { transform: translate(calc(var(--scene-pan-x) - 3.2%), var(--scene-pan-y)) scale(var(--scene-zoom)); }
.cinema-raster-ghost.ghost-b { transform: translate(calc(var(--scene-pan-x) + 3.2%), var(--scene-pan-y)) scale(var(--scene-zoom)); }

.cinema-raster-wash { z-index: 4; opacity: var(--wash-opacity); background: linear-gradient(105deg, #ff872c 0 42%, transparent 58%, #44bbff 100%); mix-blend-mode: color; }
.cinema-raster-vignette { z-index: 8; opacity: var(--vignette-opacity); box-shadow: inset 0 0 12vmin 4vmin #02080d; }
.cinema-raster-noise { z-index: 7; opacity: var(--noise-opacity); background-image: repeating-radial-gradient(circle at 17% 31%, rgba(255,48,160,.8) 0 1px, rgba(50,220,255,.5) 1px 2px, transparent 2px 5px); background-size: 13px 11px; mix-blend-mode: screen; }

.cinema-raster-focus { display: none; z-index: 6; left: var(--focus-left) !important; right: var(--focus-right) !important; width: auto !important; border-inline: 2px solid rgba(117, 236, 221, .72); background: linear-gradient(90deg, rgba(77,217,204,.04), rgba(255,255,255,.1), rgba(77,217,204,.04)); box-shadow: 0 0 24px rgba(91,226,214,.22); }
.cinema-raster-scene:is([data-model="optics-depth"], [data-model="microphone-field"]) .cinema-raster-detail { clip-path: inset(0 var(--focus-right) 0 var(--focus-left)); }
.cinema-raster-scene:is([data-model="optics-depth"], [data-model="microphone-field"]) .cinema-raster-focus { display: block; }

.cinema-raster-beam { display: none; z-index: 5; width: 38% !important; height: 145% !important; left: var(--beam-x) !important; top: var(--beam-y) !important; transform: translate(-50%, -50%) rotate(22deg); background: linear-gradient(90deg, transparent, rgba(255,218,132,.34), transparent); filter: blur(9px); mix-blend-mode: screen; }
.cinema-raster-scene[data-model="lighting-set"] .cinema-raster-beam { display: block; }

.cinema-raster-scene[data-model="safety-system"] .cinema-raster-wash { opacity: var(--heat); background: radial-gradient(circle at var(--beam-x) 72%, rgba(255,230,95,.75), rgba(255,55,26,.54) 35%, transparent 72%); mix-blend-mode: screen; }
.cinema-raster-scene[data-model="color-light"] .cinema-raster-wash { background: linear-gradient(90deg, #ff7d27, transparent 48%, #44baff); mix-blend-mode: color; }
.cinema-raster-scene:is([data-model="character-story"], [data-model="story-structure"]) .cinema-raster-wash { background: linear-gradient(95deg, #1b73cf, transparent var(--wipe), #f49328); mix-blend-mode: color; }

.cinema-raster-wave { display: none; z-index: 6; left: var(--focus-x) !important; top: 50% !important; width: 24px !important; height: 24px !important; border: 3px solid rgba(106,235,221,.86); border-radius: 50%; transform: translate(-50%, -50%) scale(var(--pulse)); opacity: .8; box-shadow: 0 0 16px rgba(106,235,221,.5); }
.cinema-raster-scene[data-model="sound-space"] .cinema-raster-wave { display: block; }
.cinema-raster-scene[data-model="sound-space"] .wave-b { transform: translate(-50%, -50%) scale(calc(var(--pulse) + .65)); opacity: .5; }
.cinema-raster-scene[data-model="sound-space"] .wave-c { transform: translate(-50%, -50%) scale(calc(var(--pulse) + 1.3)); opacity: .28; }

.cinema-raster-progress { display: none; z-index: 10; right: auto !important; width: var(--progress) !important; height: 5px !important; top: auto !important; bottom: 0 !important; background: linear-gradient(90deg, #59ddd2, #ffae52); box-shadow: 0 -2px 12px rgba(89,221,210,.6); }
.cinema-raster-scene:is([data-model="editing-timeline"], [data-model="story-structure"], [data-model="camera-motion"]) .cinema-raster-progress { display: block; }

.cinema-raster-scene[data-model="lens-perspective"] .cinema-raster-detail,
.cinema-raster-scene[data-model="camera-motion"] .cinema-raster-detail,
.cinema-raster-scene[data-model="documentary-reality"] .cinema-raster-detail { opacity: 0; }
.cinema-raster-scene[data-model="production-workflow"] .cinema-raster-detail,
.cinema-raster-scene[data-model="editing-timeline"] .cinema-raster-detail,
.cinema-raster-scene[data-model="story-structure"] .cinema-raster-detail,
.cinema-raster-scene[data-model="film-concepts"] .cinema-raster-detail { clip-path: inset(0 calc(100% - var(--wipe)) 0 0); filter: brightness(1.1) contrast(1.08) saturate(1.12); }

.cinema-raster-scene[data-variant="1"] > img { transform-origin: 38% 52%; }
.cinema-raster-scene[data-variant="2"] > img { transform-origin: 62% 43%; }
.cinema-raster-scene[data-variant="3"] > img { transform-origin: 50% 38%; }
.cinema-raster-scene[data-variant="4"] > img { transform-origin: 32% 60%; }
.cinema-raster-scene[data-variant="5"] > img { transform-origin: 70% 55%; }
.cinema-raster-scene[data-variant="6"] > img { transform-origin: 45% 65%; }
.cinema-raster-scene[data-variant="7"] > img { transform-origin: 64% 62%; }
.cinema-raster-scene[data-variant="8"] > img { transform-origin: 28% 42%; }
.cinema-raster-scene[data-variant="9"] > img { transform-origin: 76% 46%; }
.cinema-raster-scene[data-variant="10"] > img { transform-origin: 43% 34%; }
.cinema-raster-scene[data-variant="11"] > img { transform-origin: 58% 68%; }

.cinema-story-card > figcaption {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 17px 20px 4px;
}

.cinema-story-card > figcaption p {
  margin: 0;
  padding: 13px 15px;
  border-radius: 15px;
  background: rgba(255,255,255,.88);
  color: #355565;
  line-height: 1.65;
  box-shadow: inset 0 0 0 1px rgba(20, 77, 95, .1);
}

.cinema-story-card > figcaption strong { display: block; margin-bottom: 3px; color: #0c6070; }

.cinema-story-guide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 20px 18px;
  padding: 0;
  list-style: none;
}

.cinema-story-guide li {
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid rgba(28, 93, 112, .13);
  border-radius: 15px;
  background: #fff;
  color: #405c69;
  line-height: 1.62;
}
.cinema-story-guide strong { display: block; margin-bottom: 3px; color: #133f51; }
.cinema-story-guide span { display: block; }

.cinema-story-card > footer,
.cinema-lab-card > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 20px;
  border-top: 1px solid rgba(22, 76, 94, .12);
  background: rgba(255,255,255,.7);
}
.cinema-story-card > footer small,
.cinema-lab-card > footer small { color: #775735; font-weight: 750; }

.cinema-lab-controls {
  margin: 16px 18px 0;
  padding: 14px 16px;
  border: 1px solid rgba(23, 76, 94, .15);
  border-radius: 17px;
  background: #fff;
}

.cinema-range-row { display: grid; grid-template-columns: minmax(130px, auto) minmax(90px, 1fr) 82px; align-items: center; gap: 12px; padding: 6px 0; }
.cinema-range-row > span { color: #163f52; font-weight: 850; }
.cinema-range-row input[type="range"] { grid-column: 2; width: 100%; direction: ltr; accent-color: #d88927; cursor: ew-resize; }
.cinema-range-row output,
.cinema-drag-readout output {
  min-width: 72px;
  padding: 5px 9px;
  border-radius: 9px;
  background: #e5f5f1;
  color: #0c5f61;
  font-weight: 900;
  text-align: center;
  direction: ltr;
  unicode-bidi: isolate;
}

.cinema-choice-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 9px; }
.cinema-choice-controls button,
.cinema-timeline-controls > button,
.cinema-toggle-control,
.cinema-lab-card > footer button {
  border: 1px solid #b7cfcc;
  border-radius: 999px;
  background: #fff;
  color: #204d5d;
  font: 800 .84rem "Heebo", sans-serif;
  cursor: pointer;
}
.cinema-choice-controls button { min-height: 43px; padding: 8px 12px; }
.cinema-choice-controls button[aria-pressed="true"] { border-color: #d88927; background: #fff1d8; color: #8a4a05; box-shadow: 0 0 0 3px rgba(216,137,39,.15); }

.cinema-toggle-control { display: flex; align-items: center; width: 100%; padding: 10px 14px; text-align: right; }
.cinema-toggle-control span { flex: 1; }
.cinema-toggle-control i { position: relative; width: 52px; height: 28px; margin-inline: 12px; border-radius: 999px; background: #c9d8d7; }
.cinema-toggle-control i::after { content: ""; position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: transform .2s ease; }
.cinema-toggle-control[aria-checked="true"] i { background: #15998e; }
.cinema-toggle-control[aria-checked="true"] i::after { transform: translateX(-24px); }

.cinema-blend-labels { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; color: #55707c; }
.cinema-blend-labels strong { text-align: center; color: #183f50; }
.cinema-timeline-controls { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; }
.cinema-timeline-controls > button { min-width: 95px; padding: 9px 12px; }
.cinema-timeline-controls .cinema-range-row { grid-template-columns: minmax(110px, auto) 1fr 76px; }
.cinema-drag-instruction { margin: 0 0 10px; color: #4c6874; }
.cinema-drag-readout { display: flex; justify-content: space-between; gap: 12px; color: #153f51; font-weight: 800; }

.cinema-lab-explanation { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 14px 18px 18px; }
.cinema-lab-explanation article { padding: 13px 14px; border-radius: 15px; background: #fff; box-shadow: inset 0 0 0 1px rgba(22,76,94,.1); }
.cinema-lab-explanation article:first-child { box-shadow: inset 0 4px 0 #d88927, inset 0 0 0 1px rgba(22,76,94,.1); }
.cinema-lab-explanation span { color: #0c6170; font-size: .76rem; font-weight: 900; }
.cinema-lab-explanation p { margin: 5px 0 0; color: #3d5968; font-size: .87rem; line-height: 1.68; }
.cinema-lab-card > footer button { padding: 8px 14px; }

.cinema-optics-player .cinema-recovery-focus { outline: 4px solid color-mix(in srgb, #e58b21 72%, white); outline-offset: 6px; border-radius: 24px; transition: outline-color .25s ease; }
.cinema-sim-error { padding: 18px; border: 1px solid #efc9c1; border-radius: 14px; background: #fff5f2; color: #8b584d; }

@media (max-width: 760px) {
  .cinema-story-stage,
  .cinema-lab-stage { padding-inline: 7px; }
  .cinema-story-card > header,
  .cinema-lab-card > header { padding-inline: 15px; }
  .cinema-story-card > figcaption,
  .cinema-story-guide,
  .cinema-lab-explanation { grid-template-columns: 1fr; }
  .cinema-story-card > figcaption { padding-inline: 9px; }
  .cinema-story-guide { margin-inline: 9px; }
  .cinema-lab-controls { margin-inline: 8px; padding-inline: 11px; }
  .cinema-lab-explanation { padding-inline: 8px; }
  .cinema-range-row { grid-template-columns: 1fr auto; }
  .cinema-range-row input[type="range"] { grid-column: 1 / -1; grid-row: 2; }
  .cinema-timeline-controls { grid-template-columns: 1fr; }
  .cinema-story-card > footer,
  .cinema-lab-card > footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .cinema-optics-player *,
  .cinema-optics-player *::before,
  .cinema-optics-player *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
