/* Media module: player page + embeddable _Player partial (Views/Play/_Player.cshtml). Depends on mindreset.css tokens. */

.player-page .main { padding-bottom: 2rem; }
.player-back { margin: 0 0 1rem; }
.player-cta h2 { font-size: 1.4rem; }

.player {
  position: relative;
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ---------- Stage (Visual Guide) ---------- */
.player__stage {
  position: relative;
  aspect-ratio: 16 / 10;
  min-height: 260px;
  background: radial-gradient(120% 90% at 50% 100%, #1a2150 0%, #0B1026 70%);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.player--compact .player__stage { aspect-ratio: 16 / 7; min-height: 200px; }
.player__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.player__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem 1.25rem 2.6rem;
  text-align: center;
  pointer-events: none;
  color: #F3F4FF;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .55);
}
.player__section {
  position: absolute;
  top: .9rem;
  left: 1rem;
  margin: 0;
  font-family: var(--font-display);
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(243, 244, 255, .7);
  transition: opacity .6s;
}
.player__section:empty { opacity: 0; }
.player__affirmation {
  margin: 0;
  max-width: 28ch;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.1rem, 2.6vw, 1.7rem);
  line-height: 1.3;
  opacity: 0;
  transform: scale(.96) translateY(6px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
}
.player__affirmation.is-visible { opacity: 1; transform: none; }
.player__phrase {
  margin: .6rem 0 0;
  max-width: 60ch;
  font-size: clamp(.85rem, 1.6vw, 1rem);
  color: rgba(243, 244, 255, .85);
  background: rgba(11, 16, 38, .45);
  padding: .25rem .7rem;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
}
.player__phrase:empty { display: none; }
.player__stage-tools {
  position: absolute;
  top: .6rem;
  right: .6rem;
  display: flex;
  gap: .35rem;
}
.player__tool {
  min-width: 36px;
  height: 36px;
  padding: 0 .55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(11, 16, 38, .45);
  color: #F3F4FF;
  font: 600 .8rem/1 var(--font-display);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background .2s, border-color .2s;
}
.player__tool:hover { background: rgba(124, 77, 255, .35); }
.player__tool[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); }
.player__watermark {
  position: absolute;
  right: .8rem;
  bottom: .5rem;
  margin: 0;
  font-size: .68rem;
  letter-spacing: .04em;
  color: rgba(243, 244, 255, .45);
  pointer-events: none;
}
.player__stage.is-night .player__overlay { color: rgba(243, 244, 255, .55); }
.player__stage.is-night .player__watermark { color: rgba(243, 244, 255, .25); }
.player__stage:fullscreen, .player__stage.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  aspect-ratio: auto;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  border-radius: 0;
}
.player__stage:fullscreen .player__affirmation, .player__stage.is-fullscreen .player__affirmation { font-size: clamp(1.4rem, 3.4vw, 2.6rem); max-width: 30ch; }
.player__stage:fullscreen .player__overlay, .player__stage.is-fullscreen .player__overlay { padding-bottom: 12vh; }

/* ---------- Panel ---------- */
.player__panel { padding: 1.1rem 1.25rem 1.25rem; display: grid; gap: .9rem; }
.player__meta .eyebrow { margin-bottom: .25rem; }
.player__title { font-size: clamp(1.2rem, 2.4vw, 1.6rem); margin: 0 0 .3rem; }
.player__sub { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0; }
.player__controls { display: grid; grid-template-columns: auto 1fr; gap: .9rem 1rem; align-items: center; }
.player__play {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #fff;
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: 0 12px 30px -14px rgba(124, 77, 255, .8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s var(--ease), box-shadow .2s;
}
.player__play:hover { transform: translateY(-1px); }
.player__play:disabled { opacity: .6; cursor: progress; }
.player__play .player__icon-pause { display: none; letter-spacing: -.1em; }
.player.is-playing .player__play .player__icon-play { display: none; }
.player.is-playing .player__play .player__icon-pause { display: inline; }
.player.is-loading .player__play { animation: player-pulse 1.2s ease-in-out infinite; }
@keyframes player-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(124, 77, 255, .5); } 50% { box-shadow: 0 0 0 14px rgba(124, 77, 255, 0); } }
.player__progress { display: grid; gap: .25rem; }
.player__times { display: flex; justify-content: space-between; }
.player__volume { grid-column: 1 / -1; display: flex; align-items: center; gap: .6rem; }
.player__volume .player__tool { background: var(--surface); color: var(--text); border-color: var(--line); }
.player__vol { max-width: 180px; }

/* range inputs */
.player input[type="range"] {
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.player input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: var(--surface-2); }
.player input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--surface-2); }
.player input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 999px; background: var(--primary-2); border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.player input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 999px; background: var(--primary-2); border: 2px solid #fff; }
.player input[type="range"]:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 2px; }

.player__status { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; min-height: 1.4rem; color: var(--muted); }
.player__message { color: var(--warn); }
.player__message:empty { display: none; }
.player.is-completed .player__credit { color: var(--ok); }

/* ---------- Gate (headphones / do-not-drive) ---------- */
.player__gate {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(11, 16, 38, .72);
  backdrop-filter: blur(6px);
}
.player__gate[hidden] { display: none; }
.player__gate-card { max-width: 440px; width: 100%; padding: 1.4rem; }
.player__gate-card h3 { margin-bottom: .6rem; }
.player__gate-list { margin: 0 0 1.2rem; padding-left: 1.1rem; color: var(--muted); display: grid; gap: .4rem; }

@media (min-width: 720px) {
  .player__controls { grid-template-columns: auto 1fr auto; }
  .player__volume { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .player__affirmation { transition: opacity .3s; transform: none; }
  .player.is-loading .player__play { animation: none; }
}

[data-theme="light"] .player__volume .player__tool { color: var(--text); }

/* ---------- Opening talk: slides, "up next" countdown, autoplay fallback (docs/PROGRESS_TRACKING.md §7) ---------- */
.player__slide {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 2;
  margin: 1rem auto 0;
  width: min(92%, 34rem);
  padding: .9rem 1.1rem;
  border-radius: var(--radius);
  background: rgba(11, 16, 38, .62);
  border: 1px solid rgba(255, 255, 255, .12);
  color: #F3F4FF;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-align: left;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .2rem .8rem;
  align-items: start;
}
.player__slide[hidden] { display: none; }
.player__slide.is-entering { animation: mr-slide-in .6s var(--ease) both; }
.player__slide-icon { grid-row: span 2; font-size: clamp(1.6rem, 4vw, 2.3rem); line-height: 1; }
.player__slide-title { margin: 0; font-family: var(--font-display); font-size: clamp(1.05rem, 2.4vw, 1.45rem); color: #FFFFFF; }
.player__slide-bullets { margin: .2rem 0 0; padding-left: 1.1rem; font-size: clamp(.85rem, 1.7vw, 1rem); color: rgba(243, 244, 255, .9); }
.player__slide-bullets li + li { margin-top: .15rem; }
.player.has-slide .player__affirmation { display: none; }
.player__stage:fullscreen .player__slide, .player__stage.is-fullscreen .player__slide { margin-top: 10vh; width: min(88%, 46rem); padding: 1.4rem 1.8rem; }
@keyframes mr-slide-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.player__next {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(11, 16, 38, .55);
}
.player__next[hidden] { display: none; }
.player__next-card { max-width: 26rem; width: 100%; text-align: center; }
.player__next-card .cluster { justify-content: center; }
.player__next-title { margin: .35rem 0 .2rem; }
.player__next-count { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--gold); margin: .2rem 0 .8rem; }
.player__next.is-cancelled .player__next-count, .player__next.is-cancelled [data-next-cancel] { display: none; }

.player__bigplay {
  position: absolute;
  inset: 0;
  z-index: 7;
  margin: auto;
  width: min(80%, 18rem);
  height: 9rem;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #FFFFFF;
  font: 600 1rem var(--font-body);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
}
.player__bigplay[hidden] { display: none; }
.player__bigplay span[aria-hidden] { font-size: 2.6rem; line-height: 1; }
@media (prefers-reduced-motion: reduce) { .player__slide.is-entering { animation: none; } }
