/* Cody PR video player — branded play-gate + iframe stage.
   Internal PR surface (not a student game), so the strict kid-rules don't
   apply; it just needs to look like a polished, on-brand video player. */
:root {
  --cody-bg: #0b0d12;
  --cody-turq: #3FC8A8;
  --cody-turq-lite: #7FE0C4;
  --cody-gold: #FFD24A;
  /* Same type system as the Cody site: Assistant for Hebrew/body, Fredoka
     for the "Cody" wordmark (Hebrew falls back to Assistant). */
  --cp-ff: 'Assistant', system-ui, 'Segoe UI', sans-serif;
  --cp-disp: 'Fredoka', 'Assistant', sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--cody-bg);
  color: #e8edf5;
  font-family: var(--cp-ff);
  overflow: hidden;
}
#cody-player { position: fixed; inset: 0; }

/* ---- Poster (the freeze-frame title card) ---- */
.cp-poster {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 22px; text-align: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% 8%, rgba(63,200,168,0.16), transparent 60%),
    radial-gradient(900px 500px at 50% 110%, rgba(255,210,74,0.10), transparent 60%),
    var(--cody-bg);
  transition: opacity 260ms ease;
  cursor: pointer;
  z-index: 3;
}
.cp-poster.cp-hide { opacity: 0; pointer-events: none; }

.cp-brand { display: flex; align-items: center; justify-content: center; }
.cp-brand img.cp-lockup { height: 168px; width: auto;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.45)); }
/* PlayLab watermark during playback — small, unobtrusive, never captures input. */
.cp-wm { position: absolute; bottom: 10px; inset-inline-start: 12px; z-index: 3; pointer-events: none; }
.cp-wm img { height: 26px; width: auto; opacity: 0.6; filter: drop-shadow(0 1px 4px rgba(0,0,0,0.6)); }

.cp-title {
  font-size: clamp(26px, 5vw, 46px);
  font-weight: 800; line-height: 1.15;
  max-width: 18ch;
}
.cp-desc {
  font-size: clamp(14px, 2.2vw, 18px);
  color: #aeb8c6; max-width: 40ch; line-height: 1.5;
}

/* Arabic variants: one consistent Arabic web font (Cairo) for the chrome text,
   so Arabic never falls back to an inconsistent system font. Latin (e.g. the
   "Cody" wordmark) keeps Assistant/Fredoka via per-character fallback. */
.cp-ar .cp-title,
.cp-ar .cp-desc,
.cp-ar .cp-hint { font-family: 'Assistant', 'Cairo', system-ui, sans-serif; }

/* Play button — circular, Cody-turquoise, SVG triangle (no bidi issues) */
.cp-play {
  margin-top: 8px;
  width: 104px; height: 104px; border-radius: 50%;
  border: none; cursor: pointer;
  background: linear-gradient(150deg, var(--cody-turq-lite), var(--cody-turq));
  box-shadow: 0 12px 40px rgba(63,200,168,0.40), 0 0 0 0 rgba(63,200,168,0.45);
  display: flex; align-items: center; justify-content: center;
  transition: transform 160ms ease, box-shadow 160ms ease;
  animation: cp-pulse 2.4s ease-out infinite;
}
.cp-play:hover { transform: scale(1.06); }
.cp-play:active { transform: scale(0.97); }
.cp-play svg { width: 46px; height: 46px; transform: translateX(3px); }
@keyframes cp-pulse {
  0%   { box-shadow: 0 12px 40px rgba(63,200,168,0.40), 0 0 0 0 rgba(63,200,168,0.40); }
  70%  { box-shadow: 0 12px 40px rgba(63,200,168,0.40), 0 0 0 22px rgba(63,200,168,0); }
  100% { box-shadow: 0 12px 40px rgba(63,200,168,0.40), 0 0 0 0 rgba(63,200,168,0); }
}
.cp-hint { font-size: 14px; color: #8b95a4; }
.cp-hint.cp-audio { color: var(--cody-turq-lite); }

/* Fullscreen toggle (top corner) */
.cp-fs {
  position: absolute; top: 14px; inset-inline-start: 16px;
  z-index: 5;
  width: 40px; height: 40px; border-radius: 50%;
  color: #cfd7e2; cursor: pointer;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 140ms ease, transform 140ms ease;
}
.cp-fs:hover { background: rgba(255,255,255,0.12); }
.cp-fs:active { transform: scale(0.94); }
.cp-fs svg { width: 20px; height: 20px; }
.cp-fs.cp-hidden { display: none; }

/* ---- Stage (the video iframe) ---- */
.cp-stage { position: absolute; inset: 0; z-index: 1; background: var(--cody-bg); }
.cp-stage iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Loading spinner shown after Play while the video unpacks */
.cp-loading {
  position: absolute; inset: 0; z-index: 2;
  display: none; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
  background: var(--cody-bg); color: #aeb8c6; font-size: 15px;
}
.cp-loading.cp-show { display: flex; }
.cp-spin {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid rgba(63,200,168,0.22);
  border-top-color: var(--cody-turq);
  animation: cp-rot 0.8s linear infinite;
}
@keyframes cp-rot { to { transform: rotate(360deg); } }

/* ---- Shared playback bar (outer player, drives the audio master) ----
   Same look as the guide's nicer bar: centred translucent pill, turquoise
   fill, white knob, pointer-capture scrubber, auto-hide. LTR so elapsed fills
   from the left regardless of page direction. */
.cp-bar {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  width: calc(100% - 48px); max-width: 680px; z-index: 6;
  display: flex; align-items: center; gap: 12px; direction: ltr;
  padding: 8px 16px; border-radius: 999px;
  background: rgba(10,14,22,0.62);
  border: 1px solid rgba(255,255,255,0.10);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  font-family: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
  opacity: 0; pointer-events: none;
  transition: opacity 360ms ease;
  user-select: none; -webkit-user-select: none;
}
.cp-bar.cp-b-show { opacity: 1; pointer-events: auto; }
.cp-b-reset, .cp-b-play {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 999px; border: none; cursor: pointer; padding: 0;
  background: transparent; color: #eaf2ee;
  transition: background 140ms ease, color 140ms ease;
}
.cp-b-reset:hover { background: rgba(255,255,255,0.10); }
.cp-b-play { color: #0a0e16; background: var(--cody-turq); }
.cp-b-play:hover { background: #54d8b8; }
.cp-b-time {
  font-size: 12.5px; color: #eaf2ee; width: 40px; text-align: center;
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.cp-b-dur { color: rgba(234,242,238,0.55); }
.cp-b-track {
  flex: 1; height: 40px; position: relative; cursor: pointer;
  display: flex; align-items: center; touch-action: none;
}
.cp-b-rail { position: absolute; left: 0; right: 0; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.16); }
.cp-b-fill { position: absolute; left: 0; width: 0; height: 5px; border-radius: 3px; background: var(--cody-turq); }
.cp-b-knob {
  position: absolute; left: 0; top: 50%;
  width: 14px; height: 14px; margin-left: -7px; margin-top: -7px;
  border-radius: 999px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* Bigger grab target + knob where the pointer is coarse (touch). */
@media (pointer: coarse) {
  .cp-b-track { height: 46px; }
  .cp-b-knob { width: 18px; height: 18px; margin-left: -9px; margin-top: -9px; }
  .cp-b-reset, .cp-b-play { width: 42px; height: 42px; }
}

@media (max-width: 560px) {
  .cp-play { width: 88px; height: 88px; }
  .cp-play svg { width: 38px; height: 38px; }
  .cp-brand img.cp-lockup { height: 122px; }
  .cp-bar { gap: 9px; padding: 7px 13px; bottom: 14px; }
}
