/* What Happens Next? player. Same table look as the card set and Story Cards players. */

/* 1. Tokens */

.lh-player {
  --table: #e9e3d8;
  --ink: #2b2a28;
  --title: #4d473d;
  --muted: #8a7f6c;
  --counter: #9a917f;
  --icon: #7d7466;
  --icon-hover: #4d473d;
  --navy: #26436e;
  --blue: #1875d0;
  --blue-edge: #125ca6;
  --white: #fff;
  --focus: rgba(24, 117, 208, 0.35);
  --edge: #d6cebf;
  --shadow-card: 0 16px 34px rgba(60, 45, 20, 0.20);
  --radius: 18px;
  --radius-inner: 10px;
  --radius-pill: 999px;
  --font: "Nunito", sans-serif;
  --stage-w: min(100%, 720px, calc((100vh - 360px) * 1.6));
}

body.page-whn {
  overflow-x: hidden;
  background: var(--table, #e9e3d8);
}

body.page-whn .mainCenter {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

/* 2. Layout */

.lh-player {
  box-sizing: border-box;
  width: 100%;
  min-height: calc(100vh - 60px);
  margin: 0;
  padding: 28px 16px 36px;
  overflow-x: hidden;
  background: var(--table);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.lh-player *,
.lh-player *::before,
.lh-player *::after {
  box-sizing: border-box;
}

.lh-player p {
  margin: 0;
  max-width: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.lh-player button {
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
}

.lh-player button:hover,
.lh-player button:disabled {
  background: transparent;
  color: inherit;
  box-shadow: none;
}

.lh-player button:focus {
  outline: none;
}

.lh-player h1 {
  margin: 0;
  padding: 0;
  color: var(--title);
  font-family: var(--font);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
}

.lh-player .player-description {
  width: min(100%, 560px);
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
}

/* 3. The screen */

.whn-stage {
  width: var(--stage-w);
  margin: 28px auto 0;
}

.whn-frame {
  padding: 10px;
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-card);
}

.whn-screen {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-inner);
  background: #1d1c1a;
  cursor: pointer;
}

.lh-player[data-state="start"] .whn-screen,
.lh-player[data-state="end"] .whn-screen,
.lh-player[data-state="ended"] .whn-screen {
  cursor: default;
}

.whn-screen video {
  display: block;
  width: 100%;
  height: auto;
  min-height: 160px;
  aspect-ratio: 500 / 300;
  object-fit: contain;
  background: #1d1c1a;
}

/* Big play button, before the clip starts */
.lh-player .whn-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--navy);
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.25), 0 10px 24px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, -50%);
  transition: transform 160ms ease, opacity 160ms ease;
}

.lh-player .whn-play:hover {
  background: var(--white);
  color: var(--navy);
  transform: translate(-50%, -50%) scale(1.05);
}

.lh-player .whn-play:focus-visible {
  box-shadow: 0 0 0 8px var(--focus), 0 10px 24px rgba(0, 0, 0, 0.25);
}

.whn-play svg {
  width: 34px;
  height: 34px;
  margin-left: 4px;
  fill: currentColor;
}

.lh-player:not([data-state="ready"]) .whn-play {
  opacity: 0;
  pointer-events: none;
}

/* "What happens next?" when the clip stops */
.whn-question {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 16px 7%;
  background: linear-gradient(to top, rgba(20, 18, 15, 0.55), rgba(20, 18, 15, 0) 55%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.whn-question span {
  padding: 14px 30px;
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--navy);
  font-size: clamp(18px, 3.4vw, 28px);
  font-weight: 900;
  line-height: 1.1;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.25);
  transform: translateY(10px) scale(0.96);
  transition: transform 260ms cubic-bezier(.3, 1.4, .5, 1);
}

.lh-player[data-state="stopped"] .whn-question {
  opacity: 1;
}

.lh-player[data-state="stopped"] .whn-question span {
  transform: none;
}

/* Loading ring */
.whn-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  animation: whn-spin 800ms linear infinite;
}

.lh-player.is-loading:not([data-state="ready"]) .whn-loading {
  opacity: 1;
}

@keyframes whn-spin {
  to { transform: rotate(360deg); }
}

.lh-player .whn-count {
  margin: 14px 0 0;
  color: var(--counter);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

/* 4. Buttons */

.lh-player .player-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 14px;
  width: var(--stage-w);
  margin: 22px auto 0;
}

.lh-player .player-tools {
  display: flex;
  justify-self: start;
  align-items: center;
  gap: 8px;
}

.lh-player .pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  height: 54px;
  padding: 0 40px;
  border-radius: var(--radius-pill);
  background: var(--blue);
  color: var(--white);
  font-family: var(--font);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 4px 0 var(--blue-edge);
}

.lh-player .pill-btn:hover {
  background: var(--blue);
  color: var(--white);
  box-shadow: 0 4px 0 var(--blue-edge);
}

.lh-player .pill-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--blue-edge);
}

.lh-player .pill-btn:focus-visible {
  box-shadow: 0 4px 0 var(--blue-edge), 0 0 0 3px var(--focus);
}

.lh-player .pill-btn:disabled {
  background: var(--counter);
  color: var(--white);
  box-shadow: 0 4px 0 var(--edge);
  cursor: default;
}

.lh-player .round-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--white);
  color: var(--title);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  padding-bottom: 4px;
  box-shadow: 0 2px 0 var(--edge);
}

.lh-player #prevBtn {
  justify-self: end;
}

.lh-player .round-btn:hover {
  background: var(--white);
  color: var(--title);
  box-shadow: 0 2px 0 var(--edge);
}

.lh-player .round-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--edge);
}

.lh-player .round-btn:focus-visible {
  box-shadow: 0 2px 0 var(--edge), 0 0 0 3px var(--focus);
}

.lh-player .round-btn:disabled,
.lh-player .round-btn:disabled:hover {
  background: var(--white);
  color: var(--title);
  opacity: 0.35;
  cursor: default;
  transform: none;
}

.lh-player .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--icon);
}

.lh-player .icon-btn svg {
  display: block;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lh-player .icon-btn:hover {
  background: transparent;
  color: var(--icon-hover);
}

.lh-player .icon-btn:focus-visible {
  border-radius: 8px;
  box-shadow: 0 0 0 3px var(--focus);
}

.lh-player .icon-btn[hidden] {
  display: none;
}

.lh-player .whn-again {
  min-height: 40px;
  margin: 14px 0 0;
  text-align: center;
}

.lh-player .text-btn {
  padding: 10px 4px;
  color: var(--title);
  font-size: 16px;
  font-weight: 800;
}

.lh-player .text-btn:hover {
  color: var(--ink);
  text-decoration: underline;
}

.lh-player .text-btn:focus-visible {
  border-radius: 6px;
  box-shadow: 0 0 0 3px var(--focus);
}

.lh-player .text-btn[hidden] {
  display: none;
}

/* 5. Full screen */

.lh-player:fullscreen,
.lh-player:-webkit-full-screen {
  --stage-w: min(100%, calc((100vh - 220px) * 1.6));
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  height: 100%;
  padding: 16px 24px 20px;
  overflow: auto;
}

.lh-player:fullscreen h1,
.lh-player:-webkit-full-screen h1 {
  color: var(--muted);
  font-size: 16px;
}

.lh-player:fullscreen .player-description,
.lh-player:-webkit-full-screen .player-description {
  display: none;
}

.lh-player:fullscreen .whn-stage,
.lh-player:-webkit-full-screen .whn-stage {
  margin-top: 14px;
}

.lh-player:fullscreen .player-actions,
.lh-player:fullscreen .whn-again,
.lh-player:fullscreen .player-heading,
.lh-player:-webkit-full-screen .player-actions,
.lh-player:-webkit-full-screen .whn-again,
.lh-player:-webkit-full-screen .player-heading {
  transition: opacity 200ms ease;
}

.lh-player:fullscreen.is-idle,
.lh-player:fullscreen.is-idle *,
.lh-player:-webkit-full-screen.is-idle,
.lh-player:-webkit-full-screen.is-idle * {
  cursor: none;
}

.lh-player:fullscreen.is-idle .player-actions,
.lh-player:fullscreen.is-idle .whn-again,
.lh-player:fullscreen.is-idle .player-heading,
.lh-player:-webkit-full-screen.is-idle .player-actions,
.lh-player:-webkit-full-screen.is-idle .whn-again,
.lh-player:-webkit-full-screen.is-idle .player-heading {
  opacity: 0;
  pointer-events: none;
}

/* 6. Phones */

@media (max-width: 560px) {
  .lh-player {
    padding: 24px 12px 28px;
  }

  .whn-stage,
  .lh-player .player-actions {
    width: 100%;
  }

  .whn-frame {
    padding: 6px;
    border-radius: 14px;
  }

  .lh-player .player-actions {
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    column-gap: 8px;
  }

  .lh-player .pill-btn {
    min-width: 0;
    width: 100%;
    height: 52px;
    padding: 0 16px;
  }

  .lh-player .round-btn {
    width: 52px;
    height: 52px;
  }

  .lh-player .full-btn {
    display: none;
  }

  .lh-player .whn-play {
    width: 68px;
    height: 68px;
  }
}

/* 7. Reduced motion */

@media (prefers-reduced-motion: reduce) {
  .whn-question,
  .whn-question span,
  .lh-player .whn-play {
    transition: none;
  }

  .whn-question span {
    transform: none;
  }
}
