/*
 * any2.video 16x16 pixel-character story engine styles.
 * Native palette only: #fbfcff paper, #f0f3fc panel, #0b1a4a ink,
 * #1b5bff blue, #ff3f8e pink, #ffc31a yellow, #0d8a4f green.
 * Font: JetBrains Mono. Zero emojis.
 */

.s2v-film.px-ready .s2v-beat {
  padding-top: 22cqw;
}

@media (min-width: 768px) {
  .s2v-film.px-ready .s2v-beat {
    padding-top: 138px;
    padding-bottom: 84px;
  }
  .s2v-film.px-ready .s2v-beat.is-dark,
  .s2v-film.px-ready .s2v-beat.is-white {
    gap: 16px;
  }
  .s2v-film.px-ready .s2v-twodays .two {
    font-size: min(30vh, 18vw);
  }
  .s2v-film.px-ready .s2v-twodays .days {
    font-size: min(8.5vh, 4.8vw);
  }
}

@media (max-width: 767px) {
  .s2v-film.px-ready .s2v-twodays .two {
    font-size: 36cqw;
  }
  .s2v-film.px-ready .s2v-twodays .days {
    font-size: 9cqw;
  }
}

/* Crisp pixel rendering everywhere */
.px-sprite-img,
.px-canvas {
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Persistent Pixel Cast & Story HUD strip at top of .s2v-stage */
.px-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  gap: 1.2cqw;
  padding: 1.6cqw 2cqw;
  background: #fbfcff;
  color: #0b1a4a;
  border-bottom: 2px solid #0b1a4a;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.s2v-film.is-dark .px-hud {
  background: #0b1a4a;
  color: #fbfcff;
  border-bottom-color: #fbfcff;
}

.px-hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5cqw;
  padding-right: 76px; /* keep top-right .vc (2x + fullscreen) buttons unobstructed on mobile */
  min-height: 28px;
}

.px-cast-readout {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1cqw;
  font-size: 2.3cqw;
  font-weight: 700;
  line-height: 1.2;
  min-width: 0;
}

.px-seed-tag {
  background: #ffc31a;
  color: #0b1a4a;
  border: 1.5px solid #0b1a4a;
  padding: 1px 5px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.px-cast-slot {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.px-cast-slot img {
  width: 16px;
  height: 16px;
  display: block;
}

.px-cast-op {
  color: #ff3f8e;
  font-weight: 800;
}

.px-hud-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.px-hud-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 2px 8px;
  border: 2px solid #0b1a4a;
  background: #ffc31a;
  color: #0b1a4a;
  box-shadow: 2px 2px 0 #0b1a4a;
  font: 700 10px/1 'JetBrains Mono', ui-monospace, monospace;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s;
}

.px-hud-btn:hover {
  transform: translateY(-1px);
  background: #ff3f8e;
  color: #fbfcff;
}

.s2v-film.is-dark .px-hud-btn {
  border-color: #fbfcff;
  box-shadow: 2px 2px 0 #ff3f8e;
}

.px-cast-strip {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 1px;
}

.px-cast-strip::-webkit-scrollbar {
  display: none;
}

.px-sprite-btn {
  position: relative;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 2px;
  border: 1.5px solid #d5dcf0;
  background: #f0f3fc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, background-color 0.12s;
}

.s2v-film.is-dark .px-sprite-btn {
  background: #132561;
  border-color: #273c85;
}

.px-sprite-btn:hover {
  transform: translateY(-2px);
  border-color: #1b5bff;
}

.px-sprite-btn[aria-pressed="true"] {
  border-color: #0b1a4a;
  background: #ffc31a;
  box-shadow: 2px 2px 0 #0b1a4a;
}

.px-sprite-btn[data-role="bug"][aria-pressed="true"] {
  background: #ff3f8e;
}

.px-sprite-btn[data-role="fix"][aria-pressed="true"],
.px-sprite-btn[data-role="reward"][aria-pressed="true"] {
  background: #0d8a4f;
}

.px-sprite-btn[data-role="hero"][aria-pressed="true"] {
  background: #1b5bff;
}

.s2v-film.is-dark .px-sprite-btn[aria-pressed="true"] {
  border-color: #fbfcff;
  box-shadow: 2px 2px 0 #ffc31a;
}

.px-sprite-btn img {
  width: 16px;
  height: 16px;
  display: block;
}

@media (min-width: 768px) {
  .px-hud {
    top: 70px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(1160px, calc(100% - 40px));
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 12px;
    border: 2px solid #0b1a4a;
    box-shadow: 4px 4px 0 #0b1a4a;
  }

  .s2v-film.is-dark .px-hud {
    border-color: #fbfcff;
    box-shadow: 4px 4px 0 #1b5bff;
  }

  .px-hud-top {
    padding-right: 0;
    gap: 10px;
    min-height: 0;
  }

  .px-cast-readout {
    font-size: 12px;
    gap: 6px;
  }

  .px-cast-strip {
    gap: 4px;
    overflow: visible;
  }

  .px-sprite-btn {
    width: 26px;
    height: 26px;
  }

  .px-hud-btn {
    min-height: 28px;
    padding: 3px 10px;
    font-size: 11px;
  }
}

/* Bottom bar $ random-story button */
.px-bar-btn {
  min-height: 40px;
  padding: 0 12px;
  border: 2px solid #0b1a4a;
  background: #ffc31a;
  color: #0b1a4a;
  font: 700 12px 'JetBrains Mono', ui-monospace, monospace;
  cursor: pointer;
  box-shadow: 2px 2px 0 #0b1a4a;
  transition: transform 0.12s, background-color 0.12s;
}

.px-bar-btn:hover {
  transform: translateY(-1px);
  background: #ff3f8e;
  color: #fbfcff;
}

/* Beat 1: Cold open pixel stage */
.px-beat1-stage {
  width: min(92%, 520px);
  margin-top: 1cqw;
  background: #132561;
  border: 2px solid #fbfcff;
  box-shadow: 5px 5px 0 #1b5bff;
  padding: 2cqw;
  display: flex;
  flex-direction: column;
  gap: 1.5cqw;
  text-align: left;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.px-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 2.5cqw;
  font-weight: 700;
  color: #ffc31a;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.px-stage-pill {
  background: #ff3f8e;
  color: #fbfcff;
  padding: 1px 6px;
  font-size: 2.2cqw;
}

.px-beat1-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 240 / 72;
  display: block;
  background: #0b1a4a;
  border: 1.5px solid #273c85;
}

.px-stage-caption {
  margin: 0;
  font-size: 2.7cqw;
  line-height: 1.35;
  color: #fbfcff;
}

@media (min-width: 768px) {
  .px-beat1-stage {
    padding: 10px 14px;
    gap: 8px;
    margin-top: 6px;
  }
  .px-stage-head {
    font-size: 11px;
  }
  .px-stage-pill {
    font-size: 10px;
  }
  .px-stage-caption {
    font-size: 13px;
  }
}

/* Beat 2: Pixel art theatre replacing static SVG + pixel card icons */
.px-beat2-stage {
  width: 100%;
  background: #132561;
  border: 2px solid #fbfcff;
  box-shadow: 5px 5px 0 #ff3f8e;
  padding: 6px;
}

.px-beat2-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 192 / 128;
  display: block;
  background: #0b1a4a;
}

.s2v-pile .card i.px-card-slot {
  background: #f0f3fc;
  border: 1.5px solid #0b1a4a;
  border-radius: 0;
  padding: 2px;
}

.s2v-pile .card i.px-card-slot img {
  width: 100%;
  height: 100%;
  display: block;
}

/* Beat 3: Pixel AI Operator turn stage */
.px-beat3-stage {
  width: min(94%, 640px);
  margin-top: 1cqw;
  background: #f0f3fc;
  border: 2px solid #0b1a4a;
  box-shadow: 5px 5px 0 #0b1a4a;
  padding: 2cqw;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2cqw;
  text-align: left;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.px-beat3-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 224 / 64;
  display: block;
  background: #0b1a4a;
  border: 1.5px solid #0b1a4a;
}

.px-op-log {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 2.5cqw;
  line-height: 1.35;
  color: #0b1a4a;
}

.px-op-log .px-log-line {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.px-op-log .px-tag-op { color: #1b5bff; font-weight: 700; }
.px-op-log .px-tag-retry { color: #ff3f8e; font-weight: 700; }
.px-op-log .px-tag-ok { color: #0d8a4f; font-weight: 700; }

@media (min-width: 768px) {
  .px-beat3-stage {
    padding: 12px 14px;
    gap: 10px;
    margin-top: 4px;
  }
  .px-op-log {
    font-size: 12px;
  }
}

/* Beat 4: Fixed cards pixel sprite badge + verified checkmark animation */
.px-fix-badge {
  position: relative;
  flex: 0 0 11cqw;
  width: 11cqw;
  aspect-ratio: 1 / 1;
  background: #0b1a4a;
  border: 2px solid #0b1a4a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.px-fix-badge::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(251, 252, 255, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(251, 252, 255, 0.06) 1px, transparent 1px);
  background-size: 25% 25%;
  pointer-events: none;
}

.px-fix-badge img.px-fix-sprite {
  width: 68%;
  height: 68%;
  display: block;
  position: relative;
  z-index: 1;
}

.px-fix-check {
  position: absolute;
  right: 2px;
  bottom: 2px;
  z-index: 2;
  width: 4.4cqw;
  height: 4.4cqw;
  background: #0d8a4f;
  border: 1.5px solid #fbfcff;
  color: #fbfcff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 800 2.8cqw/1 'JetBrains Mono', ui-monospace, monospace;
}

@media (min-width: 768px) {
  .px-fix-badge {
    flex-basis: 72px;
    width: 72px;
  }
  .px-fix-check {
    width: 22px;
    height: 22px;
    font-size: 13px;
  }
}

/* Beat 5: Closing pixel celebration + $ roll-another-story button */
.px-beat5-stage {
  width: min(92%, 480px);
  background: #132561;
  border: 2px solid #ffc31a;
  box-shadow: 5px 5px 0 #ff3f8e;
  padding: 2cqw;
  display: flex;
  flex-direction: column;
  gap: 1.2cqw;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.px-beat5-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 224 / 64;
  display: block;
  background: #0b1a4a;
}

.px-beat5-note {
  margin: 0;
  font-size: 2.5cqw;
  font-weight: 700;
  color: #ffc31a;
  text-align: center;
}

.px-roll-btn {
  background: #1b5bff;
  color: #fbfcff;
  border-color: #fbfcff;
  box-shadow: 4px 4px 0 #ff3f8e;
}

.px-roll-btn:hover {
  background: #ff3f8e;
  border-color: #fbfcff;
}

@media (min-width: 768px) {
  .px-beat5-stage {
    padding: 10px 12px;
    gap: 8px;
  }
  .px-beat5-note {
    font-size: 12px;
  }
}
