:root {
  --page: #eef1f3;
  --surface: #ffffff;
  --text: #17202a;
  --muted: #65717c;
  --line: #c9d0d5;
  --accent: #1d6fc2;
  --accent-dark: #124d87;
  --frame: #151b20;
  --shadow: 0 18px 48px rgba(27, 39, 48, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--page);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.embedded {
  background: #071526;
}

body.embedded .demo-page {
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
}

body.embedded .demo-header,
body.embedded .demo-footnote {
  display: none;
}

body.embedded .cinematic-player {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: #071526;
  box-shadow: none;
}

body.embedded .cinematic-viewport {
  width: 100%;
  height: calc(100% - 58px);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

body.embedded .timeline-track {
  width: 100%;
  margin: 0;
}

body.embedded .player-controls {
  height: 54px;
  margin: 0;
  background: #ffffff;
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

.demo-page {
  width: min(100% - 32px, 760px);
  margin: 0 auto;
  padding: 44px 0 56px;
}

.demo-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.theme-picker {
  display: inline-flex;
  border: 1px solid var(--line);
  background: var(--surface);
}

.theme-picker a {
  min-width: 72px;
  padding: 9px 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.theme-picker a + a {
  border-left: 1px solid var(--line);
}

.theme-picker a[aria-current="page"] {
  background: var(--text);
  color: #ffffff;
}

.cinematic-player {
  padding: 26px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.cinematic-viewport {
  position: relative;
  width: min(640px, 100%);
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  overflow: hidden;
  border: 8px solid var(--frame);
  border-radius: 6px;
  background: #0d1216;
  box-shadow: 0 4px 18px rgba(11, 19, 25, 0.28);
}

.camera-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 1194px;
  height: 834px;
  transform-origin: 0 0;
  will-change: transform;
}

#prototypeFrame {
  display: block;
  width: 1194px;
  height: 834px;
  border: 0;
  pointer-events: none;
}

.touch-pointer {
  position: absolute;
  z-index: 10;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  opacity: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  will-change: left, top, opacity;
}

.touch-pointer span {
  position: absolute;
  inset: 5px;
  border: 2px solid #17202a;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.42);
}

.touch-pointer::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.55);
}

.touch-pointer.tapping::after {
  animation: tap-pulse 460ms ease-out;
}

@keyframes tap-pulse {
  0% {
    opacity: 0.95;
    transform: scale(0.55);
  }
  100% {
    opacity: 0;
    transform: scale(1.45);
  }
}

.player-state {
  position: absolute;
  z-index: 9;
  top: 10px;
  right: 10px;
  padding: 5px 8px;
  border-radius: 3px;
  background: rgba(12, 18, 23, 0.74);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.viewport-chyron {
  position: absolute;
  z-index: 8;
  left: 12px;
  right: 12px;
  bottom: 10px;
  min-height: 54px;
  display: grid;
  grid-template-columns: 105px 1fr;
  align-items: center;
  gap: 12px;
  padding: 9px 13px;
  border-left: 4px solid #f4c843;
  background: rgba(9, 17, 24, 0.9);
  color: #ffffff;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 320ms ease, transform 320ms ease;
  pointer-events: none;
}

.cinematic-player.is-playing .viewport-chyron,
.cinematic-player.is-complete .viewport-chyron {
  opacity: 1;
  transform: translateY(0);
}

.viewport-chyron span {
  color: #f4c843;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  text-transform: uppercase;
}

.viewport-chyron p {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.demo-poster {
  position: absolute;
  z-index: 11;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 30px;
  background: rgba(12, 20, 27, 0.42);
  color: #ffffff;
  text-align: center;
  backdrop-filter: blur(5px);
  transition: opacity 520ms ease, visibility 520ms ease;
}

.demo-poster.hidden {
  visibility: hidden;
  opacity: 0;
}

.demo-poster p {
  margin: 0 0 8px;
  color: #f4c843;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.demo-poster h2 {
  margin: 0 0 9px;
  font-size: 30px;
  line-height: 1;
}

.demo-poster span {
  font-size: 13px;
  font-weight: 600;
}

.timeline-track {
  width: min(640px, 100%);
  height: 4px;
  margin: 14px auto 0;
  overflow: hidden;
  background: #dce2e6;
}

.timeline-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 280ms ease;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.player-controls button {
  min-height: 42px;
  padding: 0 22px;
  border-radius: 4px;
  font-weight: 700;
}

.play-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.play-button:hover,
.play-button:focus-visible {
  background: var(--accent-dark);
}

.replay-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

.replay-button:hover,
.replay-button:focus-visible {
  border-color: var(--accent);
}

.player-controls button:disabled {
  cursor: default;
  opacity: 0.45;
}

.duration {
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
}

.demo-footnote {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.cinematic-player.error .player-state {
  background: #982c2c;
}

.cinematic-player.error .viewport-chyron p {
  color: #7b1f1f;
}

@media (max-width: 620px) {
  .demo-page {
    width: min(100% - 20px, 760px);
    padding-top: 24px;
  }

  .demo-header {
    align-items: start;
    flex-direction: column;
  }

  .cinematic-player {
    padding: 16px;
  }

  .duration {
    display: none;
  }
}

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