/* HUMANMINK early-2000s DVD menu
   Scoped under .dvd-stage so it can drop into the existing React site. */

/* Local files win when present; Google Fonts covers a CRA drop-in without /fonts. */
@font-face {
  font-family: "Racing Sans One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/racing-sans-one.woff2") format("woff2");
}
@font-face {
  font-family: "Oswald";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/oswald-700.woff2") format("woff2");
}
@font-face {
  font-family: "Russo One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/russo-one.woff2") format("woff2");
}

@font-face {
  font-family: "Bebas Neue";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/bebas-neue.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bebas Neue";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/bebas-neue-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}


:root {
  --hm-red: #f21d04;
  --hm-red-deep: #b10f00;
  --hm-black: #0a0a0a;
}

.dvd-stage,
.dvd-stage * {
  box-sizing: border-box;
}

.dvd-stage {
  position: relative;
  width: 100%;
  max-width: 1280px;
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  overflow: hidden;
  background: #000;
  color: #111;
  user-select: none;
  font-family: "Oswald", "Arial Narrow", "Arial Black", Impact, sans-serif;
  isolation: isolate;
}

.dvd-stage video,
.dvd-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}
.dvd-poster {
  z-index: 0;
}
.dvd-stage video {
  z-index: 1;
}
.dvd-stage.is-screenshot video,
.dvd-stage.is-skipped video {
  opacity: 0;
  pointer-events: none;
}

/* Bottom vignette — only after the menu appears, and only low enough
   that it never washes over the HUMANMINK wordmark or shield. */
.dvd-stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 26%;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.7s ease;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.7) 0%,
    rgba(0, 0, 0, 0.38) 38%,
    rgba(0, 0, 0, 0.1) 70%,
    rgba(0, 0, 0, 0) 100%
  );
}
.dvd-stage.is-menu::after {
  opacity: 1;
}

/* Very faint scan / grain, period DVD-OSD feel */
.dvd-grain {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("noise.png");
  background-size: 256px 256px;
}
.dvd-scan {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0.08;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 3px
  );
}

/* ---------- chrome plate (shared by buttons, setup, OSD) ---------- */
.dvd-plate {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 1.2em 3px;
  height: 58px;
  border: 2.5px solid var(--hm-red);
  border-radius: 2px;
  cursor: pointer;
  color: #151515;
  font-family: "Bebas Neue", "Oswald", "Arial Black", Impact, sans-serif;
  font-weight: 400;
  font-size: 21px;
  font-style: normal;
  letter-spacing: 0.07em;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.78),
    0 -1px 0 rgba(0, 0, 0, 0.5);
  background-color: #8a8a8a;
  background-image:
    linear-gradient(
      115deg,
      transparent 0%,
      rgba(255, 255, 255, 0.0) 10%,
      rgba(255, 255, 255, 0.5) 20%,
      rgba(255, 255, 255, 0.08) 28%,
      transparent 40%,
      transparent 60%,
      rgba(255, 255, 255, 0.22) 74%,
      transparent 86%
    ),
    linear-gradient(
      180deg,
      #ffffff 0%,
      #e8e8e8 8%,
      #c0c0c0 22%,
      #8d8d8d 38%,
      #4e4e4e 50%,
      #6a6a6a 58%,
      #f4f4f4 78%,
      #a0a0a0 90%,
      #6c6c6c 100%
    );
  box-shadow:
    0 0 0 4px #111111,
    1px 1px 0 4px #1c1c1c,
    2px 2px 0 4px #111111,
    3px 4px 0 4px #000000,
    5px 8px 0 3px #000000,
    6px 12px 14px rgba(0, 0, 0, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.95),
    inset 0 -3px 3px rgba(0, 0, 0, 0.4),
    inset 1px 0 0 rgba(255, 255, 255, 0.28),
    inset -1px 0 0 rgba(0, 0, 0, 0.28);
  transform: none;
  transition: box-shadow 0.15s linear, filter 0.15s linear;
}
.dvd-plate:focus {
  outline: none;
}
.dvd-plate:focus-visible {
  outline: none;
}

/* Inner bevel highlight ring */
.dvd-plate::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 1px;
  pointer-events: none;
  border-top: 1px solid rgba(255, 255, 255, 0.55);
  border-left: 1px solid rgba(255, 255, 255, 0.28);
  border-bottom: 1px solid rgba(0, 0, 0, 0.28);
  border-right: 1px solid rgba(0, 0, 0, 0.16);
}

/* Selected / hovered DVD highlight */
.dvd-plate.is-selected,
.dvd-plate[aria-current="true"] {
  color: #111111;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.88),
    0 -1px 0 rgba(0, 0, 0, 0.45);
  filter: brightness(1.08);
  animation: dvd-pulse 1.15s ease-in-out infinite;
  z-index: 1;
}

@keyframes dvd-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 4px #111111,
      1px 1px 0 4px #1c1c1c,
      2px 2px 0 4px #111111,
      3px 4px 0 4px #000000,
      5px 8px 0 3px #000000,
      0 0 0 8px var(--hm-red),
      0 0 12px 4px rgba(242, 29, 4, 0.8),
      0 0 26px 10px rgba(242, 29, 4, 0.42),
      6px 12px 14px rgba(0, 0, 0, 0.55),
      inset 0 2px 0 rgba(255, 255, 255, 0.95),
      inset 0 -3px 3px rgba(0, 0, 0, 0.4);
  }
  50% {
    box-shadow:
      0 0 0 4px #111111,
      1px 1px 0 4px #1c1c1c,
      2px 2px 0 4px #111111,
      3px 4px 0 4px #000000,
      5px 8px 0 3px #000000,
      0 0 0 9px #ff2a0c,
      0 0 20px 7px rgba(255, 50, 20, 0.95),
      0 0 38px 16px rgba(242, 29, 4, 0.55),
      6px 12px 14px rgba(0, 0, 0, 0.55),
      inset 0 2px 0 rgba(255, 255, 255, 0.97),
      inset 0 -3px 3px rgba(0, 0, 0, 0.4);
  }
}

/* Freeze the glow at its peak for the static mockup */
.dvd-stage.is-screenshot .dvd-plate.is-selected {
  animation: none;
  box-shadow:
    0 0 0 4px #111111,
    1px 1px 0 4px #1c1c1c,
    2px 2px 0 4px #111111,
    3px 4px 0 4px #000000,
    5px 8px 0 3px #000000,
    0 0 0 9px #ff2a0c,
    0 0 18px 6px rgba(255, 50, 20, 0.95),
    0 0 34px 14px rgba(242, 29, 4, 0.55),
    6px 12px 14px rgba(0, 0, 0, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.97),
    inset 0 -3px 3px rgba(0, 0, 0, 0.4);
}

/* Red arrow cursor — classic remote highlight */
.dvd-pointer {
  position: absolute;
  left: -26px;
  top: 50%;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent var(--hm-red);
  transform: translateY(-50%);
  filter:
    drop-shadow(0 0 0 2px #000)
    drop-shadow(1px 2px 1px rgba(0, 0, 0, 0.7))
    drop-shadow(0 0 6px rgba(242, 29, 4, 0.9));
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
.dvd-plate.is-selected > .dvd-pointer {
  opacity: 1;
  animation: dvd-arrow-pulse 1.15s ease-in-out infinite;
}
.dvd-stage.is-screenshot .dvd-plate.is-selected > .dvd-pointer {
  animation: none;
  filter:
    drop-shadow(-1px 0 0 #000)
    drop-shadow(1px 0 0 #000)
    drop-shadow(0 -1px 0 #000)
    drop-shadow(0 1px 0 #000)
    drop-shadow(1px 2px 1px rgba(0, 0, 0, 0.7))
    drop-shadow(0 0 6px rgba(242, 29, 4, 0.95));
}

@keyframes dvd-arrow-pulse {
  0%,
  100% { opacity: 0.85; transform: translateY(-50%) translateX(0); }
  50%  { opacity: 1;    transform: translateY(-50%) translateX(3px); }
}

/* ---------- intro OSD ---------- */
.dvd-osd {
  position: absolute;
  z-index: 5;
  top: 22px;
  left: 22px;
  right: 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.45s ease;
}
.dvd-osd .dvd-plate {
  pointer-events: auto;
  height: 36px;
  padding: 0 0.95em;
  font-size: 14px;
  letter-spacing: 0.12em;
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 700;
  font-style: italic;
  transform: skewX(-8deg);
}
.dvd-osd .dvd-plate > span {
  display: inline-block;
  transform: skewX(8deg);
}
.dvd-stage.is-menu .dvd-osd-skip {
  opacity: 0;
  pointer-events: none;
}
.dvd-sound.is-on {
  display: none;
}

/* ---------- main menu ---------- */
.dvd-menu {
  position: absolute;
  inset: 0;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease;
}
.dvd-menu.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.dvd-row {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 26px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding-left: 20px; /* room for the red arrow on PLAY */
  list-style: none;
  margin: 0;
}

.dvd-row > li {
  position: relative;
  display: flex;
  margin: 0;
  padding: 0;
}

/* Long labels: slightly tighter size so the row stays on the floor */
.dvd-row .dvd-plate {
  font-size: 22px;
  height: 58px;
  padding: 0 1.15em 3px 1.2em;
}
.dvd-row .dvd-plate[data-id="play"] {
  font-size: 26px;
  padding: 0 1.45em 3px;
  min-width: 148px;
}

/* SETUP sits in the lower-left, clear of the logo and the main row */
.dvd-setup-btn {
  position: absolute;
  left: 28px;
  bottom: 110px;
  height: 40px;
  padding: 0 1em 2px;
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 700;
  font-style: italic;
  font-size: 16px;
  letter-spacing: 0.18em;
  transform: skewX(-8deg);
}
.dvd-setup-btn > .dvd-label {
  display: inline-block;
  transform: skewX(8deg);
}
.dvd-setup-btn > .dvd-pointer {
  left: -22px;
  transform: translateY(-50%) skewX(8deg);
  border-width: 8px 0 8px 13px;
}
.dvd-setup-btn.is-selected > .dvd-pointer {
  transform: translateY(-50%) skewX(8deg);
}

/* ---------- submenu panels ---------- */
.dvd-panel {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: min(920px, calc(100% - 72px));
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 16px 20px 14px;
  border: 2.5px solid var(--hm-red);
  border-radius: 3px;
  background:
    linear-gradient(
      180deg,
      rgba(28, 28, 28, 0.82) 0%,
      rgba(10, 10, 10, 0.9) 100%
    );
  box-shadow:
    0 0 0 4px #0a0a0a,
    0 6px 18px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.dvd-panel.is-open {
  display: flex;
}
.dvd-panel-title {
  margin: 0 0 2px;
  color: #f3f3f3;
  font-family: "Bebas Neue", "Oswald", sans-serif;
  font-size: 18px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(242, 29, 4, 0.55), 0 2px 0 #000;
}
.dvd-panel-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px 22px;
  width: 100%;
  margin: 0;
  padding: 8px 16px 4px;
  list-style: none;
}
.dvd-panel .dvd-plate {
  height: 42px;
  font-size: 16px;
  letter-spacing: 0.08em;
}
.dvd-panel .dvd-back {
  height: 32px;
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 700;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.16em;
  transform: skewX(-8deg);
}
.dvd-panel .dvd-back > .dvd-label {
  display: inline-block;
  transform: skewX(8deg);
}

.dvd-menu.is-sub .dvd-row,
.dvd-menu.is-sub .dvd-setup-btn {
  visibility: hidden;
  pointer-events: none;
}

/* Hide OSDs from the static mockup if needed */
.dvd-stage.is-screenshot .dvd-osd {
  display: none;
}

@media (max-width: 820px) {
  .dvd-row {
    left: 12px;
    right: 12px;
    bottom: 16px;
    gap: 16px;
    padding-left: 16px;
  }
  .dvd-row .dvd-plate {
    font-size: 13px;
    height: 40px;
    padding: 0 0.7em;
    box-shadow:
      0 0 0 3px #0a0a0a,
      0 2px 0 3px #000000,
      1px 4px 8px rgba(0, 0, 0, 0.55),
      inset 0 1px 0 rgba(255, 255, 255, 0.92);
  }
  .dvd-row .dvd-plate[data-id="play"] {
    font-size: 16px;
    min-width: 0;
  }
  .dvd-setup-btn {
    left: 14px;
    bottom: 68px;
  }
  .dvd-pointer {
    left: -18px;
    border-width: 8px 0 8px 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dvd-plate.is-selected,
  .dvd-plate.is-selected > .dvd-pointer {
    animation: none;
  }
  .dvd-menu,
  .dvd-stage::after {
    transition: none;
  }
}

/* Pixel-perfect 1280x720 capture */
body:has(.dvd-stage.is-screenshot) {
  margin: 0;
  width: 1280px;
  height: 720px;
  overflow: hidden;
}
.dvd-stage.is-screenshot {
  width: 1280px;
  height: 720px;
  max-width: none;
  aspect-ratio: auto;
  margin: 0;
}

/* =====================================================================
   SCENE SELECTION + CHAPTER VIEW
   ===================================================================== */

.dvd-stage.is-scenes .dvd-menu,
.dvd-stage.is-scenes .dvd-osd,
.dvd-stage.is-scenes video,
.dvd-stage.is-scenes .dvd-poster {
  opacity: 0;
  pointer-events: none;
}
.dvd-stage.is-scenes::after {
  opacity: 0;
}

.dvd-scenes,
.dvd-chapter-view {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: none;
  flex-direction: column;
  color: #111;
  background: #0a0a0a url("scenes-bg.jpg") center / cover no-repeat;
  overscroll-behavior: contain;
}
.dvd-scenes.is-open,
.dvd-chapter-view.is-open {
  display: flex;
}

.dvd-scenes-head,
.dvd-chapter-head {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px 8px;
  flex: 0 0 auto;
}

.dvd-scenes-title,
.dvd-chapter-title {
  height: 42px;
  padding: 0 1.4em 2px;
  font-size: 20px;
  letter-spacing: 0.18em;
  pointer-events: none;
}

.dvd-chapter-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 16px 48px;
  padding: 6px 56px 12px 80px;
  min-height: 0;
  align-items: stretch;
  justify-items: center;
}
.dvd-chapter-grid > .dvd-chapter-card {
  min-height: 0;
}

.dvd-chapter-card {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 100%;
  height: 100%;
  aspect-ratio: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font: inherit;
  overflow: visible;
  justify-self: center;
}
.dvd-chapter-card:focus {
  outline: none;
}

.dvd-chapter-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  flex: 1 1 auto;
  min-height: 0;
  padding: 7px 7px 8px;
  border: 2.5px solid var(--hm-red);
  border-radius: 2px;
  background-color: #8a8a8a;
  background-image:
    linear-gradient(
      115deg,
      transparent 0%,
      rgba(255, 255, 255, 0.45) 18%,
      transparent 32%,
      transparent 62%,
      rgba(255, 255, 255, 0.2) 76%,
      transparent 88%
    ),
    linear-gradient(
      180deg,
      #f7f7f7 0%,
      #c8c8c8 16%,
      #8a8a8a 40%,
      #4e4e4e 52%,
      #d8d8d8 78%,
      #8a8a8a 100%
    );
  box-shadow:
    0 0 0 4px #111111,
    1px 1px 0 4px #1c1c1c,
    2px 2px 0 4px #111111,
    3px 4px 0 4px #000000,
    5px 8px 0 3px #000000,
    6px 12px 14px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  overflow: hidden;
}
.dvd-chapter-frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  flex: 0 0 auto;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  background: #0c0c0c;
}
.dvd-chapter-frame::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 7px;
  height: 64px;
  pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
}

.dvd-chapter-card.is-selected .dvd-chapter-frame {
  animation: dvd-pulse 1.15s ease-in-out infinite;
}
.dvd-stage.is-screenshot .dvd-chapter-card.is-selected .dvd-chapter-frame {
  animation: none;
  box-shadow:
    0 0 0 4px #111111,
    1px 1px 0 4px #1c1c1c,
    2px 2px 0 4px #111111,
    3px 4px 0 4px #000000,
    5px 8px 0 3px #000000,
    0 0 0 9px #ff2a0c,
    0 0 18px 6px rgba(255, 50, 20, 0.95),
    0 0 34px 14px rgba(242, 29, 4, 0.55),
    6px 12px 14px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.97);
}

.dvd-chapter-card > .dvd-pointer {
  left: -22px;
  top: 42%;
  border-width: 12px 0 12px 18px;
  z-index: 3;
}
.dvd-chapter-card.is-selected > .dvd-pointer {
  opacity: 1;
}

.dvd-chapter-meta {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 0;
  width: 100%;
  z-index: 2;
}
.dvd-chapter-meta .dvd-plate {
  height: 28px;
  padding: 0 0.8em 1px;
  font-size: 12px;
  letter-spacing: 0.12em;
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 700;
  font-style: italic;
  pointer-events: none;
}
.dvd-chapter-meta .chap-num {
  min-width: 108px;
}
.dvd-chapter-meta .chap-name {
  flex: 1 1 auto;
  max-width: 260px;
  font-family: "Bebas Neue", "Oswald", sans-serif;
  font-style: normal;
  font-size: 14px;
  letter-spacing: 0.08em;
  font-weight: 400;
}

.dvd-scenes-foot,
.dvd-chapter-foot {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 28px 16px;
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 6;
  pointer-events: auto;
  background: linear-gradient(to top, #0a0a0a 62%, rgba(10, 10, 10, 0.88) 82%, rgba(10, 10, 10, 0));
}

.dvd-page-nums {
  display: flex;
  gap: 10px;
  align-items: center;
}
.dvd-page-nums .dvd-plate {
  height: 32px;
  padding: 0 0.85em 1px;
  font-size: 14px;
  letter-spacing: 0.1em;
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 700;
  font-style: italic;
}
.dvd-scenes-foot .dvd-arrow-btn,
.dvd-chapter-foot .dvd-arrow-btn {
  width: 46px;
  height: 32px;
  padding: 0 0 2px;
  font-size: 16px;
  letter-spacing: 0;
}
.dvd-scenes-foot .dvd-back,
.dvd-chapter-foot .dvd-back,
.dvd-chapter-foot .dvd-scenes-back {
  height: 32px;
  padding: 0 1em 1px;
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 700;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.16em;
  transform: skewX(-8deg);
  margin-left: 10px;
}
.dvd-scenes-foot .dvd-back > .dvd-label,
.dvd-chapter-foot .dvd-back > .dvd-label,
.dvd-chapter-foot .dvd-scenes-back > .dvd-label {
  display: inline-block;
  transform: skewX(8deg);
}

/* ----- chapter view (pieces) ----- */
.dvd-piece-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 12px 18px;
  padding: 6px 48px 4px;
  align-items: stretch;
}
.dvd-piece-grid.is-few {
  grid-template-columns: repeat(auto-fit, minmax(200px, 280px));
  grid-template-rows: none;
  justify-content: center;
  align-content: center;
}
.dvd-piece-grid.is-few {
  padding-top: 8px;
  gap: 18px 36px;
}
.dvd-piece-grid.is-few .dvd-piece-card {
  max-width: 380px;
  min-height: 340px;
}
.dvd-piece-grid.is-few .dvd-piece-wrap {
  max-width: 380px;
}
.dvd-piece-grid.is-few .dvd-piece-frame img {
  max-height: 300px;
  object-fit: contain;
}

.dvd-piece-card {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font: inherit;
  min-width: 0;
}
.dvd-piece-card:focus { outline: none; }

.dvd-piece-frame {
  position: relative;
  flex: 0 1 auto;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  min-height: 0;
  padding: 5px;
  border: 2px solid var(--hm-red);
  border-radius: 2px;
  background:
    linear-gradient(180deg, #f4f4f4 0%, #8a8a8a 45%, #efefef 78%, #8a8a8a 100%);
  box-shadow:
    0 0 0 3px #111,
    2px 3px 0 3px #000,
    3px 6px 10px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.dvd-piece-frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 168px;
  object-fit: contain;
  background: #111;
}
.dvd-piece-card.is-selected .dvd-piece-frame {
  animation: dvd-pulse 1.15s ease-in-out infinite;
}
.dvd-stage.is-screenshot .dvd-piece-card.is-selected .dvd-piece-frame {
  animation: none;
  box-shadow:
    0 0 0 3px #111,
    2px 3px 0 3px #000,
    0 0 0 7px #ff2a0c,
    0 0 16px 5px rgba(255, 50, 20, 0.9),
    3px 6px 10px rgba(0, 0, 0, 0.5);
}
.dvd-piece-card > .dvd-pointer {
  left: -20px;
  top: 38%;
  border-width: 9px 0 9px 14px;
}
.dvd-piece-card.is-selected > .dvd-pointer { opacity: 1; }

.dvd-claimed {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%) rotate(-14deg);
  z-index: 2;
  pointer-events: none;
  padding: 6px 16px 7px;
  border: 3px solid var(--hm-red);
  border-radius: 50%;
  color: #ff2a0c;
  font-family: "Bebas Neue", "Oswald", sans-serif;
  font-size: 20px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: rgba(10, 0, 0, 0.28);
  box-shadow:
    0 0 0 2px #111,
    0 0 0 4px var(--hm-red),
    1px 2px 0 #000;
  text-shadow: 0 1px 0 #000, 0 0 8px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.dvd-piece-caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-top: 6px;
  min-height: 36px;
}
.dvd-piece-caption .piece-title {
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 700;
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f3f3f3;
  text-shadow: 0 1px 0 #000, 0 0 8px rgba(0, 0, 0, 0.8);
  text-align: center;
  line-height: 1.15;
  max-width: 100%;
}
.dvd-piece-caption .piece-code {
  opacity: 0.8;
  font-size: 10px;
  letter-spacing: 0.14em;
}
.dvd-commission {
  height: 26px !important;
  padding: 0 0.85em 1px !important;
  font-size: 11px !important;
  letter-spacing: 0.1em !important;
  font-family: "Oswald", "Arial Narrow", sans-serif !important;
  font-weight: 700 !important;
  font-style: italic !important;
  margin-top: 4px;
}

.dvd-chapter-sub {
  margin: -2px 0 2px;
  text-align: center;
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ddd;
  text-shadow: 0 1px 0 #000;
}

.dvd-piece-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  min-height: 0;
}
.dvd-piece-wrap .dvd-piece-card {
  width: 100%;
  flex: 1 1 auto;
}
.dvd-plate:disabled {
  opacity: 0.35;
  cursor: default;
  filter: grayscale(0.4);
}

.dvd-page-nums .dvd-plate.is-current:not(.is-selected) {
  filter: brightness(1.08);
  color: #111;
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (orientation: landscape) and (max-width: 900px), (orientation: landscape) and (max-height: 520px) {
  .dvd-setup-btn { left: 14px; bottom: 58px; height: 32px; font-size: 13px; }
  .dvd-row { gap: 10px; left: 8px; right: 8px; }
  .dvd-row .dvd-plate { font-size: 12px; height: 36px; padding: 0 0.6em; }
  .dvd-row .dvd-plate[data-id="play"] { font-size: 14px; }
}
/* Short / landscape windows: fit the 16:9 stage inside the viewport height */
.dvd-stage:not(.is-screenshot) { width: min(100%, calc(100vh * 16 / 9)); width: min(100%, calc(100dvh * 16 / 9)); }

/* =====================================================================
   PHONE PORTRAIT: full-height stage, video band on top, stacked buttons
   ===================================================================== */
@media (orientation: portrait) and (max-width: 760px) {
  body { align-items: stretch !important; }
  .dvd-stage {
    aspect-ratio: auto;
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
  }
  .dvd-stage video,
  .dvd-poster {
    inset: auto 0 auto 0;
    top: 12dvh;
    height: 56.25vw;
  }
  .dvd-row {
    top: calc(12dvh + 56.25vw + 32px);
    bottom: auto;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(80vw, 330px);
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding-left: 0;
  }
  .dvd-row > li { width: 100%; }
  .dvd-row .dvd-plate,
  .dvd-row .dvd-plate[data-id="play"] {
    width: 100%;
    height: 50px;
    font-size: 17px;
    justify-content: center;
    min-width: 0;
  }
  .dvd-row .dvd-plate[data-id="play"] { font-size: 21px; }
  .dvd-setup-btn {
    top: 18px;
    right: 16px;
    left: auto;
    bottom: auto;
  }
  .dvd-panel {
    top: calc(12dvh + 56.25vw + 24px);
    bottom: auto;
    width: calc(100% - 28px);
  }
  .dvd-panel-items { flex-direction: column; align-items: stretch; gap: 12px; }
  .dvd-panel-items .dvd-plate { width: 100%; justify-content: center; }

  /* scene selection + chapter view: scroll vertically, one column */
  .dvd-scenes,
  .dvd-chapter-view {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }
  .dvd-scenes-title,
  .dvd-chapter-title { font-size: 15px; letter-spacing: 0.12em; padding: 0 0.9em 2px; max-width: calc(100vw - 24px); white-space: nowrap; overflow: hidden; }
  .dvd-chapter-grid {
    flex: 0 0 auto;
    grid-template-columns: 1fr;
    grid-template-rows: none;
    gap: 22px;
    padding: 10px 22px 12px;
  }
  .dvd-chapter-card { width: 100%; height: auto; }
  .dvd-chapter-meta .chap-num { min-width: 0; }
  .dvd-chapter-meta .chap-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dvd-piece-grid,
  .dvd-piece-grid.is-few {
    flex: 0 0 auto;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: none;
    gap: 18px 14px;
    padding: 8px 16px 12px;
    align-content: start;
  }
  .dvd-piece-grid.is-few .dvd-piece-card { min-height: 0; }
  .dvd-piece-frame img,
  .dvd-piece-grid.is-few .dvd-piece-frame img { max-height: 40vw; }
  .dvd-claimed { font-size: 13px; padding: 4px 10px 5px; }
  .dvd-scenes-foot,
  .dvd-chapter-foot {
    flex-wrap: wrap;
    padding: 8px 8px 18px;
    gap: 8px;
    max-width: 100%;
  }
  .dvd-page-nums {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    max-width: 100%;
  }
  .dvd-page-nums .dvd-plate {
    height: 28px;
    padding: 0 0.55em 1px;
    font-size: 12px;
  }
  .dvd-scenes-foot .dvd-arrow-btn,
  .dvd-chapter-foot .dvd-arrow-btn { width: 40px; height: 28px; }
  .dvd-scenes-foot .dvd-back,
  .dvd-chapter-foot .dvd-back,
  .dvd-chapter-foot .dvd-scenes-back { height: 28px; font-size: 11px; padding: 0 0.7em 1px; }
  .dvd-scenes-foot .dvd-back,
  .dvd-chapter-foot .dvd-back,
  .dvd-chapter-foot .dvd-scenes-back { margin-left: 0; }
}
