* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --scaleFactor: 1;
  --base-width: 1920px;
  --base-height: 1080px;
  --color-header: #1e3a7a;
  --color-header-light: #2a4d94;
  --color-stage-bg: #2d4a8f;
  --color-panel: rgba(10, 20, 45, 0.55);
  --color-correct: #3fae5a;
  --color-wrong: #e0685c;
  --color-option: #f0a020;
  --color-white: #ffffff;
  --font-family-primary: Arial, sans-serif;
}

html,
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-family-primary);
  background: #000;
}

.responsive-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.responsive-wrapper {
  width: var(--base-width);
  height: var(--base-height);
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: top left;
  transform: scale(var(--scaleFactor)) translate(-50%, -50%);
  background: #16305e;
}

.light-applet {
  width: 1920px;
  height: 1080px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------- Header ---------- */
.applet-header {
  height: 108px;
  flex: 0 0 auto;
  background: linear-gradient(180deg, var(--color-header-light), var(--color-header));
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  padding: 0 60px;
}

.applet-header span {
  color: var(--color-white);
  font-size: 34px;
  text-align: center;
}

/* ---------- Body / Stage ---------- */
.applet-body {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 32px 48px;
  gap: 32px;
  background: linear-gradient(160deg, #274a8f 0%, #1c3970 60%, #142a58 100%);
  overflow: hidden;
}

.stage-panel {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Scenes shown alongside options/feedback always keep the same 75/25 split. */
.stage-panel--split {
  flex: 0 0 75%;
}

.scene {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}

.hero-frame {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.hero-image {
  max-width: 100%;
  max-height: 100%;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  object-fit: contain;
}

.scene img.scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.side-panel {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: stretch;
  justify-content: flex-start;
}

.side-panel-split {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.side-panel-top {
  flex: 0 0 60%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 18px;
}

.side-panel-bottom {
  flex: 0 0 40%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Footer ---------- */
.applet-footer {
  height: 96px;
  flex: 0 0 auto;
  background: linear-gradient(0deg, var(--color-header-light), var(--color-header));
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 2px solid rgba(255, 255, 255, 0.2);
  padding: 0 60px;
  position: relative;
}

.applet-footer span {
  color: var(--color-white);
  font-size: 26px;
  text-align: center;
}

/* ---------- Buttons ---------- */
.option-button {
  width: 100%;
  padding: 24px 30px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  background: linear-gradient(180deg, #17284f, #0c1a38);
  color: var(--color-white);
  font-size: 32px;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.option-button-icon {
  font-size: 34px;
  line-height: 1;
  flex: 0 0 auto;
}

.option-button-label {
  flex: 1 1 auto;
  text-align: center;
}

.option-button:hover {
  transform: translateY(-2px);
}

.option-button--correct {
  background: linear-gradient(180deg, #4bc26f, var(--color-correct));
  border-color: var(--color-correct);
}

.option-button--wrong {
  background: linear-gradient(180deg, #ef8378, var(--color-wrong));
  border-color: var(--color-wrong);
}

.option-button--mcq {
  background: linear-gradient(180deg, #ffb648, var(--color-option));
  border-color: var(--color-option);
  color: #2a1a00;
}

.option-button--disabled {
  cursor: default;
  opacity: 0.9;
}

/* ---------- Next chevron ---------- */
.next-button {
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: var(--color-option);
  color: #2a1a00;
  font-size: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.next-button[disabled] {
  opacity: 0.35;
  cursor: default;
}

.next-button--pulse {
  animation: nextPulse 1.1s ease-in-out infinite;
}

@keyframes nextPulse {
  0%, 100% { transform: translateY(-50%) scale(1); }
  50% { transform: translateY(-50%) scale(1.12); }
}

/* ---------- Feedback / property badges ---------- */
.feedback-box {
  padding: 18px 22px;
  border-radius: 10px;
  color: var(--color-white);
  font-size: 22px;
  text-align: center;
  background: var(--color-wrong);
}

.feedback-box--correct {
  background: var(--color-correct);
}

.property-badge {
  padding: 16px 20px;
  border-radius: 10px;
  color: var(--color-white);
  font-size: 22px;
  text-align: center;
  background: linear-gradient(180deg, #2f8f4f, #1c6b39);
}

.property-badge--muted {
  background: linear-gradient(180deg, #6b6b6b, #4a4a4a);
}

/* ---------- Flashlight prop ---------- */
.flashlight {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: 168px;
  cursor: pointer;
  transition: filter 0.2s;
  z-index: 5;
}

.gesture-hint {
  position: absolute;
  pointer-events: none;
  z-index: 6;
}

.gesture-hint-img {
  display: block;
  width: 84px;
  height: auto;
  user-select: none;
}

.gesture-hint--flashlight {
  left: 150px;
  bottom: -6px;
}

.gesture-hint--beamlight {
  left: 15%;
  top: 60%;
}

/* Flashlight positioned as the beam source: lens at (16%, 55%) of the scene. */
.flashlight--beam {
  left: 3%;
  top: 55%;
  bottom: auto;
  width: 12%;
  transform: translateY(-50%);
  transform-origin: 85% 50%;
  transition: transform 0.35s ease, filter 0.2s;
}

/* Bulb light source: hangs so its glowing glass sits at the beam origin
   (lens ≈ 16% x, 55% y of the scene). */
.lightsource-bulb {
  position: absolute;
  left: 9%;
  top: 55%;
  width: 8%;
  transform: translateY(-58%);
  filter: drop-shadow(0 0 22px rgba(255, 235, 150, 0.9));
  z-index: 5;
}

.lightsource-bulb.flashlight--pulse {
  animation: flashlightPulse 1.2s ease-in-out infinite;
}

/* Rotatable wrapper for the beam overlay (rotation pivots on the lens). */
.light-beam-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  transition: transform 0.35s ease;
}

.gesture-hint--option {
  right: -70px;
  top: 50%;
  transform: translateY(calc(-50% + 16px));
}

.flashlight--pulse {
  animation: flashlightPulse 1.2s ease-in-out infinite;
}

@keyframes flashlightPulse {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 230, 140, 0)); }
  50% { filter: drop-shadow(0 0 18px rgba(255, 230, 140, 0.85)); }
}

/* ---------- Light beam (SVG) ---------- */
.light-beam {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

/* ---------- Brightness overlay ---------- */
.brightness-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  pointer-events: none;
  z-index: 3;
}

.brightness-overlay--animated {
  transition: opacity 0.4s ease;
}

/* ---------- Drag objects (S8 sort) ---------- */
.sort-stage {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.sort-stage-top {
  flex: 0 0 80%;
  min-height: 0;
}

.sort-stage-bottom {
  flex: 0 0 20%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.baskets-row {
  display: flex;
  gap: 40px;
  height: 100%;
}

.basket-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.basket {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border: 3px dashed rgba(255, 255, 255, 0.6);
  border-radius: 14px;
  padding: 16px;
  overflow: hidden;
}

.basket-title {
  background: rgba(10, 20, 45, 0.6);
  color: var(--color-white);
  font-size: 22px;
  padding: 10px 18px;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 10px;
}

.drag-object {
  width: 110px;
  height: 110px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drag-object--locked {
  width: 140px;
  height: 140px;
  cursor: default;
}

.drag-object img {
  max-width: 100%;
  max-height: 100%;
  pointer-events: none;
}

.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  width: 110px;
  height: 110px;
  opacity: 0.9;
}

.object-tray {
  width: 100%;
  height: 100%;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  align-items: center;
  gap: 18px;
  justify-content: center;
  overflow: hidden;
}

/* ---------- Slider (S7 brightness) ---------- */
.brightness-slider-track {
  position: relative;
  width: 8px;
  height: 320px;
  background: #3f6ac2;
  border-radius: 6px;
  margin: 0 auto;
}

.brightness-slider-handle {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-option);
  cursor: grab;
  touch-action: none;
}

.brightness-slider-label {
  position: absolute;
  left: 26px;
  transform: translateY(-50%);
  background: var(--color-correct);
  color: var(--color-white);
  font-size: 18px;
  padding: 6px 14px;
  border-radius: 6px;
  white-space: nowrap;
}

/* ---------- Materials (transparent sheet / cardboard / S17) ---------- */
.material-prop {
  position: absolute;
  width: 90px;
  height: 130px;
  border-radius: 4px;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.material-prop--transparent {
  background: rgba(255, 255, 255, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.7);
}

.material-prop--translucent {
  background: rgba(255, 250, 230, 0.55);
  border: 2px solid rgba(255, 250, 230, 0.8);
}

.material-prop--opaque {
  background: #6b3a2a;
  border: 2px solid #4a2818;
}

.material-tray {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

.material-slot-hint {
  position: absolute;
  width: 90px;
  height: 130px;
  border: 2px dashed rgba(255, 255, 255, 0.5);
  border-radius: 4px;
}

/* Shadow silhouette cast ON the wall, centred at beam height. */
.wall-shadow {
  position: absolute;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.65) 70%, rgba(0, 0, 0, 0.35) 100%);
  border-radius: 10px;
  transform: skewY(-4deg);
  pointer-events: none;
  z-index: 3;
  transition: width 0.08s linear, height 0.08s linear, opacity 0.2s ease;
}

/* Material standing in the light beam (percent-based, scene coords). */
.material-prop--inbeam {
  position: absolute;
  width: 7%;
  height: 30%;
  z-index: 6;
}

.material-prop--draggable {
  cursor: grab;
  touch-action: none;
}

.material-prop--draggable:active {
  cursor: grabbing;
}

/* ---------- Review mini-panels (S16) ---------- */
.review-row {
  display: flex;
  gap: 24px;
  width: 100%;
  height: 100%;
  align-items: stretch;
}

.review-card {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.review-thumb {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #d8c39a;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal-card {
  width: 560px;
  max-width: 80%;
  background: linear-gradient(180deg, #1e3a7a, #10254e);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.modal-title {
  color: var(--color-option);
  font-size: 28px;
  margin-bottom: 14px;
}

.modal-text {
  color: var(--color-white);
  font-size: 22px;
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-close {
  padding: 12px 32px;
  border-radius: 8px;
  border: none;
  background: var(--color-option);
  color: #2a1a00;
  font-size: 20px;
  cursor: pointer;
}
