.fp {
  position: absolute; inset: 0; z-index: 4;
  font-family: var(--fives-body);
  color: var(--fives-bg);
  --fp-ink: var(--fives-bg);
  --fp-ground: var(--fives-primary-700);
  --fp-ball-d: 14px;
  --fp-bar-h: 56px;
  container-type: inline-size;
  pointer-events: none;
}
.fp > * { pointer-events: auto; }
.fp:focus { outline: none; }

.fp-surface {
  position: absolute; inset: 0; z-index: 1;
  cursor: pointer;
}
.fp.is-idle .fp-surface { cursor: none; }

.fp-scrim {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  height: calc(var(--fp-bar-h) + 56px);
  background: linear-gradient(to top,
    color-mix(in srgb, var(--fp-ground) 78%, transparent) 0%,
    color-mix(in srgb, var(--fp-ground) 46%, transparent) 46%,
    transparent 100%);
  pointer-events: none;
  transition: opacity var(--fives-t-gentle) var(--fives-e-settle);
}
.fp-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  height: var(--fp-bar-h);
  display: flex; align-items: center; gap: 2px;
  padding: 0 8px 0 6px;
  box-sizing: border-box;
  animation: fp-bar-in var(--fives-t-gentle) var(--fives-e-settle) both;
  transition: opacity var(--fives-t-gentle) var(--fives-e-settle),
              transform var(--fives-t-gentle) var(--fives-e-settle);
}
@keyframes fp-bar-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.fp.is-idle .fp-bar   { opacity: 0; transform: translateY(8px); pointer-events: none; }
.fp.is-idle .fp-scrim { opacity: 0; }

.fp-btn {
  flex: 0 0 auto;
  width: 44px; height: 44px; margin: 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--fives-r-sm);
  background: transparent; color: var(--fp-ink);
  cursor: pointer;
  transition: transform var(--fives-t-standard) var(--fives-e-rebound),
              background var(--fives-t-quick) var(--fives-e-settle),
              color var(--fives-t-quick) var(--fives-e-settle);
}
.fp-btn svg { width: 22px; height: 22px; display: block; }
.fp-btn--play svg { width: 24px; height: 24px; }
@media (hover: hover) and (pointer: fine) {
  .fp-btn:hover { transform: translateY(-1px) scale(1.06); background: color-mix(in srgb, var(--fp-ink) 12%, transparent); }
}
.fp-btn:active { transform: scale(0.94); transition-duration: var(--fives-t-instant); transition-timing-function: var(--fives-e-settle); }
.fp-btn:focus-visible { outline: 2px solid var(--fives-accent); outline-offset: 1px; }

.fp-btn--cc {
  width: auto; min-width: 44px; padding: 0 9px;
  font: 500 12px/1 var(--fives-mono); letter-spacing: 0.08em;
  border: 2px solid transparent;
}
.fp-btn--cc.is-on { background: var(--fp-ink); color: var(--fives-primary); border-color: var(--fives-accent); }
@media (hover: hover) and (pointer: fine) {
  .fp-btn--cc.is-on:hover { background: #fff; }
}

.fp-time {
  flex: 0 0 auto;
  display: inline-flex; align-items: baseline; gap: 5px;
  margin: 0 8px 0 4px;
  font-family: var(--fives-mono); font-size: 12px; letter-spacing: 0.4px;
  font-variant-numeric: tabular-nums;
  color: var(--fp-ink);
  white-space: nowrap;
}
.fp-time-sep { opacity: 0.45; }
.fp-time > span:last-child { opacity: 0.7; }

.fp-rule {
  position: relative; flex: 1 1 auto; min-width: 60px;
  height: 44px; margin: 0 10px;
  cursor: pointer; touch-action: none;
  border-radius: var(--fives-r-sm);
}
.fp-rule:focus-visible { outline: 2px solid var(--fives-accent); outline-offset: -2px; }
.fp-rule-svg {
  position: absolute; left: 0; right: 0; top: 50%;
  width: 100%; height: 10px; margin-top: -5px;
  display: block; overflow: visible;
}
.fp-rule-svg path {
  fill: none; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 0;
}
.fp-rule-track  { stroke: color-mix(in srgb, var(--fp-ink) 30%, transparent); stroke-width: 1.8; }
.fp-rule-buffer { stroke: color-mix(in srgb, var(--fp-ink) 42%, transparent); stroke-width: 1.8; stroke-dashoffset: 100; }
.fp-rule-fill   { stroke: var(--fives-accent); stroke-width: 2.6; stroke-dashoffset: 100; }
.fp-tick {
  position: absolute; top: 50%; width: 2px; height: 8px; margin: -4px 0 0 -1px;
  background: color-mix(in srgb, var(--fp-ink) 70%, transparent);
  border-radius: 1px; pointer-events: none;
}
.fp-ball {
  position: absolute; top: 50%; left: 0;
  width: var(--fp-ball-d); height: var(--fp-ball-d);
  margin: calc(var(--fp-ball-d) / -2) 0 0 calc(var(--fp-ball-d) / -2);
  pointer-events: none;
}
.fp-ball-face {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  background: var(--fives-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--fp-ground) 70%, transparent),
              0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform var(--fives-t-standard) var(--fives-e-rebound);
}
@media (hover: hover) and (pointer: fine) {
  .fp-rule:hover .fp-ball-face { transform: scale(1.3); }
}
.fp.is-scrubbing .fp-ball-face, .fp-rule:focus-visible .fp-ball-face { transform: scale(1.3); }

.fp.is-waiting .fp-ball-face { animation: fp-breathe 1100ms ease-in-out infinite; }
@keyframes fp-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.35); }
}

.fp-tip {
  position: absolute; bottom: calc(100% - 4px); left: 0;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 5px 8px;
  background: var(--fp-ground); color: var(--fp-ink);
  border: 1px solid color-mix(in srgb, var(--fp-ink) 22%, transparent);
  border-radius: var(--fives-r-sm);
  white-space: nowrap; pointer-events: none;
  animation: fp-pop 220ms var(--fives-e-rebound) both;
}
.fp-tip-tc { font-family: var(--fives-mono); font-size: 11px; letter-spacing: 0.4px; }
.fp-tip-ch { font-size: 12px; font-weight: 500; opacity: 0.85; }
@keyframes fp-pop {
  from { opacity: 0; transform: translateX(-50%) translateY(4px) scale(0.96); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.fp-cues {
  position: absolute; left: 6%; right: 6%; z-index: 3;
  bottom: calc(var(--fp-bar-h) + 10px);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-align: center; pointer-events: none;
  transition: bottom var(--fives-t-gentle) var(--fives-e-settle);
}
.fp.is-idle .fp-cues { bottom: 18px; }
.fp-cue {
  display: inline-block;
  padding: 4px 10px;
  font-size: 15px; font-weight: 500; line-height: 1.35;
  font-size: clamp(12px, 2.4cqw, 22px);
  color: var(--fp-ink);
  background: color-mix(in srgb, var(--fp-ground) 88%, transparent);
  border-radius: var(--fives-r-sm);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

.fp-flash {
  position: absolute; left: 50%; top: 50%; z-index: 4;
  width: 68px; height: 68px; margin: -34px 0 0 -34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--fives-accent); color: var(--fp-ink);
  pointer-events: none;
  animation: fp-flash 560ms var(--fives-e-settle) both;
}
.fp-flash svg { width: 28px; height: 28px; }
.fp-flash--play svg { margin-left: 4px; }
@keyframes fp-flash {
  0%   { opacity: 0;   transform: scale(0.7); }
  22%  { opacity: 0.95; transform: scale(1.06); }
  100% { opacity: 0;   transform: scale(1.35); }
}

.fp-end {
  position: absolute; inset: 0; z-index: 7;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 24px;
  box-sizing: border-box;

  background: color-mix(in srgb, var(--fp-ground) 84%, transparent);
  animation: fp-fade 400ms var(--fives-e-settle) both;
}
@keyframes fp-fade { from { opacity: 0; } to { opacity: 1; } }
.fp-end-title {
  margin: 0;
  font-family: var(--fives-display); font-weight: 600;
  font-size: clamp(18px, 4cqw, 30px); line-height: 1.1; letter-spacing: -0.5px;
  color: var(--fp-ink); text-align: center;
}
.fp-end-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 18px; }
.fp-end-replay {
  display: inline-flex; align-items: center; gap: 12px;
  margin: 0; padding: 6px 16px 6px 6px;
  border: 0; border-radius: 40px;
  background: color-mix(in srgb, var(--fp-ink) 96%, transparent); color: var(--fives-primary);
  font: 600 14px/1 var(--fives-body);
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.3);
  animation: fp-pop-in 420ms var(--fives-e-rebound) 80ms both;
  transition: transform var(--fives-t-standard) var(--fives-e-rebound),
              background var(--fives-t-quick) var(--fives-e-settle);
}
.fp-end-disc {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--fives-accent); color: var(--fp-ink);
}
.fp-end-disc svg { width: 22px; height: 22px; }
@media (hover: hover) and (pointer: fine) {
  .fp-end-replay:hover { transform: scale(1.04); background: #fff; }
}
.fp-end-replay:active { transform: scale(0.96); transition-duration: var(--fives-t-instant); }
.fp-end-replay:focus-visible { outline: 2px solid var(--fives-accent); outline-offset: 3px; }
.fp-end-next {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0; padding: 12px 4px;
  border: 0; background: none;
  font: 600 14px/1 var(--fives-body); color: var(--fp-ink);
  text-decoration: none; cursor: pointer;
  animation: fp-pop-in 420ms var(--fives-e-rebound) 160ms both;
  transition: gap var(--fives-t-standard) var(--fives-e-rebound), color var(--fives-t-quick);
}
.fp-end-next span { transition: transform var(--fives-t-standard) var(--fives-e-rebound); display: inline-block; }
@media (hover: hover) and (pointer: fine) {
  .fp-end-next:hover span { transform: translateX(4px); }
}
.fp-end-next:focus-visible { outline: 2px solid var(--fives-accent); outline-offset: 2px; border-radius: var(--fives-r-sm); }
@keyframes fp-pop-in {
  from { opacity: 0; transform: scale(0.9) translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.fp.is-ended .fp-surface { pointer-events: none; }

.fp-host:fullscreen, .fp-host:-webkit-full-screen {
  background: var(--fives-primary-700) !important;
  border-radius: 0 !important; border: 0 !important;
  width: 100vw; height: 100vh;
}
.fp-host:fullscreen video, .fp-host:-webkit-full-screen video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; transform: none !important; opacity: 1 !important;
  border-radius: 0 !important; background: var(--fives-primary-700) !important;
}
.fp.is-fs .fp-bar  { padding-bottom: var(--safe-bottom); height: calc(var(--fp-bar-h) + var(--safe-bottom)); padding-left: calc(6px + var(--safe-left)); padding-right: calc(8px + var(--safe-right)); }
.fp.is-fs .fp-cues { bottom: calc(var(--fp-bar-h) + var(--safe-bottom) + 10px); }

@container (max-width: 420px) {

  .fp > * { --fp-bar-h: 50px; }
  .fp-time > .fp-time-sep, .fp-time > span:last-child { display: none; }
  .fp-time { margin-right: 4px; }
  .fp-rule { margin: 0 6px; }
  .fp-btn { width: 40px; }
}

@container (max-width: 300px) {
  .fp-time { display: none; }
  .fp-btn--mute { display: none; }
  .fp-rule { margin: 0 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .fp *, .fp *::before, .fp *::after { animation: none !important; transition: none !important; }
  .fp-flash { display: none !important; }
}
html.fv-rm .fp *, html.fv-rm .fp *::before, html.fv-rm .fp *::after { animation: none !important; transition: none !important; }
html.fv-rm .fp-flash { display: none !important; }
