/* ========================================
   index page only
   top page 専用スタイル
======================================== */

.top-page {
  --index-border-color: var(--border-color, #e7e7e7);
  --index-text-main: var(--text-main, #222222);
  --index-text-sub: var(--text-sub, #666666);
  --index-bg-soft: var(--bg-soft, #fafafa);
  --index-bg-history: var(--bg-history, #efefef);
  --index-shadow-soft: var(--shadow-soft, 0 8px 20px rgba(0, 0, 0, 0.06));
  --index-radius-m: var(--radius-m, 14px);
  --index-radius-l: var(--radius-l, 20px);
  --index-scrollbar-size: 10px;
  --index-scrollbar-thumb: rgba(34, 34, 34, 0.28);
  --index-scrollbar-thumb-hover: rgba(34, 34, 34, 0.42);
  --index-scrollbar-track: rgba(0, 0, 0, 0.04);

  --index-signboard-action-right: 12px;
  --index-signboard-action-bottom: 12px;
  --index-hero-card-width: 144px;
  --index-hero-button-height: 48px;
  --index-hero-pointer-size: 46px;
  --index-hero-pointer-right: -10px;
  --index-hero-pointer-bottom: -14px;
}

body[data-page="top"] {
  min-height: 100svh;
}

body[data-page="top"] > .site-header,
body[data-page="top"] > .site-footer {
  display: none;
}

.top-page {
  min-height: 100svh;
  height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
  padding-top: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow: hidden;
}

.top-fixed-stack {
  position: relative;
  z-index: 5;
  display: grid;
  gap: 0;
  min-height: 0;
}

.top-length-intro .section-heading {
  margin-bottom: 0;
}

.top-scroll-area {
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--index-scrollbar-thumb) var(--index-scrollbar-track);
}

.top-scroll-area::-webkit-scrollbar {
  width: var(--index-scrollbar-size);
}

.top-scroll-area::-webkit-scrollbar-track {
  background: var(--index-scrollbar-track);
  border-radius: 999px;
}

.top-scroll-area::-webkit-scrollbar-thumb {
  background: var(--index-scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.top-scroll-area::-webkit-scrollbar-thumb:hover {
  background: var(--index-scrollbar-thumb-hover);
  background-clip: padding-box;
}

.top-scroll-area::-webkit-scrollbar-corner {
  background: transparent;
}

.top-scroll-area > section + section {
  margin-top: 20px;
}

/* ========================================
   section heading
======================================== */
.section-heading {
  margin-bottom: 10px;
}

.section-heading h1,
.section-heading h2 {
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
}

.section-heading p {
  margin-top: 4px;
  font-size: 10px;
  color: var(--index-text-sub);
  line-height: 1.4;
}

/* ========================================
   top header
======================================== */
.top-player,
.top-dock {
  border: 1px solid var(--index-border-color);
  border-radius: var(--index-radius-l);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--index-shadow-soft);
  backdrop-filter: blur(8px);
}

.top-player {
  padding: 14px;
}

.top-player-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.top-player-artwork {
  width: 88px;
  height: 88px;
  border-radius: 16px;
  overflow: hidden;
  background: #dddddd;
  flex: 0 0 auto;
}

.top-player-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  align-self: stretch;
}

.top-player-kicker {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: var(--index-text-sub);
}

.top-player-filename {
  margin-top: auto;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
   signboard
======================================== */
.top-signboard {
  position: relative;
}

.signboard-stage {
  position: relative;
  overflow: visible;
}

.signboard-visual {
  position: relative;
  border-radius: var(--index-radius-l);
  overflow: hidden;
  box-shadow: var(--index-shadow-soft);
}

.signboard-banner {
  display: block;
  width: 100%;
  height: auto;
}

.signboard-overlay {
  position: absolute;
  right: var(--index-signboard-action-right);
  top: calc(100% - var(--index-signboard-action-bottom) - var(--index-hero-button-height));
  bottom: auto;
  z-index: 5;
  transform-origin: right top;
}

/* Position the Video button independently from the swappable right-hand controls. */
.signboard-video-action {
  position: absolute;
  left: var(--index-signboard-action-right);
  bottom: var(--index-signboard-action-bottom);
  z-index: 6;
}

.signboard-action,
.top-howto-unit {
  position: relative;
  transform-origin: right top;
}

.top-howto-unit {
  display: none;
  box-sizing: border-box;
  width: var(--index-hero-card-width);
  max-width: calc(100vw - 22px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--index-text-main);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
  overflow: visible;
}

.hero-play-button {
  position: relative;
  min-width: var(--index-hero-card-width);
  height: var(--index-hero-button-height);
  padding: 0 28px 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--index-text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
  overflow: visible;
}

.hero-play-button:focus-visible {
  outline: 2px solid #222222;
  outline-offset: 3px;
}

.hero-play-icon,
.hero-play-label {
  position: relative;
  z-index: 2;
}

.hero-play-icon {
  font-size: 15px;
  line-height: 1;
}

.hero-play-label {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.hero-pointer {
  position: absolute;
  right: var(--index-hero-pointer-right);
  bottom: var(--index-hero-pointer-bottom);
  z-index: 1;
  width: var(--index-hero-pointer-size);
  height: auto;
  display: block;
  pointer-events: none;
  user-select: none;
}

.hero-video-button {
  min-width: var(--index-hero-card-width);
  padding-inline: 14px;
}

.hero-howto-button {
  width: 100%;
  min-width: 0;
  background: transparent;
  box-shadow: none;
}

.hero-howto-panel {
  position: static;
  box-sizing: border-box;
  width: 100%;
  padding: 0 12px 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.10);
  background: transparent;
  box-shadow: none;
  color: var(--index-text-main);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  display: none;
}

.hero-howto-panel p {
  margin: 0;
}

.hero-howto-panel p:first-child {
  padding-top: 8px;
}

.hero-howto-panel p + p {
  margin-top: 4px;
}

.hero-howto-panel .howto-separator {
  height: 0;
  margin: 8px 0 6px;
  border-top: 1px solid rgba(0, 0, 0, 0.10);
}

.top-tagline {
  margin: 0;
  padding: 4px 4px 0;
  color: var(--index-text-sub);
  font-size: clamp(10px, 2.8vw, 13px);
  font-weight: 700;
  line-height: 1.3;
}

.top-tagline-en,
.top-tagline-ja {
  display: block;
}

.top-tagline-ja {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid rgba(0, 0, 0, 0.10);
}

.signboard-copy {
  margin-top: 10px;
}

body[data-top-wait-ui="dismissed"] .signboard-action {
  display: none;
}

body[data-top-wait-ui="dismissed"] .top-howto-unit {
  display: inline-block;
}

body[data-top-howto-open="1"] .top-howto-unit {
  border-radius: 26px;
}

body[data-top-howto-open="1"] .hero-howto-button {
  border-radius: 26px 26px 0 0;
}

body[data-top-howto-open="1"] .hero-howto-panel {
  display: block;
}

body[data-top-howto-pointer="hidden"] .hero-howto-pointer {
  display: none;
}

.subtle-copy + .subtle-copy {
  margin-top: 2px;
}

h1.subtle-copy {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

p.subtle-copy {
  font-size: 10px;
  color: var(--index-text-sub);
  line-height: 1.4;
}

/* ========================================
   length selector
======================================== */
.length-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.length-button {
  position: relative;
  width: 100%;
  max-width: 220px;
  justify-self: stretch;
  box-sizing: border-box;
  aspect-ratio: 220 / 85;
  border: 1px solid var(--index-border-color);
  border-radius: 18px;
  background: var(--index-bg-soft);
  box-shadow: var(--index-shadow-soft);
  overflow: hidden;
  display: block;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.length-button:hover,
.length-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.length-button:focus-visible {
  outline: 2px solid #222222;
  outline-offset: 2px;
}

.length-button-fallback,
.length-button-image {
  position: absolute;
  inset: 0;
}

.length-button-fallback {
  padding: 14px 16px;
  background: #f3f3f3;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.length-button-sec {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  color: #222222;
}

.length-button-label {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.3;
  color: #555555;
}

.length-button-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.length-button[data-sec-label]::after {
  content: attr(data-sec-label);
  position: absolute;
  right: 10px;
  bottom: 7px;
  z-index: 2;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.78);
  pointer-events: none;
}

/* ========================================
   bottom dock
======================================== */
.top-dock {
  padding: 12px;
}

.top-dock-progress {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  gap: 10px;
  align-items: center;
}

.top-dock-time {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  color: var(--index-text-sub);
  font-variant-numeric: tabular-nums;
}

.top-dock-transport {
  margin-top: 12px;
  padding-bottom: 5px;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.top-dock-transport button {
  position: relative;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 999px;
  flex: 0 0 auto;
  transition:
    transform 0.12s ease,
    filter 0.12s ease,
    opacity 0.12s ease;
}

.top-dock-transport button:hover {
  filter: brightness(0.98);
}

.top-dock-transport button:active {
  transform: scale(0.98);
}

.top-dock-transport button:focus-visible {
  outline: 2px solid #222222;
  outline-offset: 2px;
}

.top-dock-transport button[data-transport-role="restart"],
.top-dock-transport button[data-transport-role="next"] {
  width: 46px;
  height: 46px;
}

.top-dock-transport button[data-transport-role="primary-play"],
.top-dock-transport button[data-transport-role="primary-pause"] {
  width: 70px;
  height: 70px;
}

.top-dock-transport button[data-transport-role="restart"] .transport-button-icon,
.top-dock-transport button[data-transport-role="next"] .transport-button-icon {
  background-image: url("transport-skip.svg");
}

.top-dock-transport button[data-transport-role="restart"] .transport-button-icon {
  transform: scaleX(-1);
}

.top-dock-transport button[data-transport-role="primary-play"] .transport-button-icon {
  background-image: url("transport-play.svg");
}

.top-dock-transport button[data-transport-role="primary-pause"] .transport-button-icon {
  background-image: url("transport-pause.svg");
}

.top-dock-transport button[data-transport-role="primary-pause"] {
  display: none;
}

body[data-transport-ui-state="playing"] .top-dock-transport button[data-transport-role="primary-play"] {
  display: none;
}

body[data-transport-ui-state="playing"] .top-dock-transport button[data-transport-role="primary-pause"] {
  display: block;
}

body[data-transport-ui-state="playing"] .top-dock-transport button[data-transport-role="primary-pause"] .transport-button-icon {
  background-image: url("transport-pause-active.svg");
}

body[data-transport-ui-state="paused"] .top-dock-transport button[data-transport-role="primary-play"] .transport-button-icon {
  background-image: url("transport-play-active.svg");
}

body[data-transport-skip-flash="1"] .top-dock-transport button[data-transport-role="next"] .transport-button-icon {
  background-image: url("transport-skip-active.svg");
}

.top-history {
  margin-top: 0;
  padding-top: 0;
  border-top: 1px solid var(--index-border-color);
}

.top-history .section-heading {
  display: none;
}

.history-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 0;
}

.history-item {
  width: 72px;
  height: 72px;
  border: 1px solid var(--index-border-color);
  border-radius: 16px;
  background: var(--index-bg-history);
  flex: 0 0 auto;
}

/* ========================================
   responsive
======================================== */
@media (max-width: 760px) {
  .length-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .length-button {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .top-page {
    gap: 0;
    padding: 10px;
    padding-top: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);

    --index-signboard-action-right: 6px;
    --index-signboard-action-bottom: 8px;
    --index-hero-card-width: 118px;
    --index-hero-button-height: 39px;
    --index-hero-pointer-size: 30px;
    --index-hero-pointer-right: -1px;
    --index-hero-pointer-bottom: -17px;
  }

  .top-player,
  .top-dock {
    border-radius: 16px;
  }

  .top-player {
    padding: 10px;
  }

  .top-player-main {
    align-items: center;
    gap: 10px;
  }

  .top-player-artwork {
    width: 72px;
    height: 72px;
  }

  .top-player-meta {
    justify-content: center;
    align-self: center;
    gap: 4px;
  }

  .top-player-kicker {
    font-size: 10px;
  }

  .top-player-filename {
    margin-top: 0;
    font-size: 12px;
  }

  .top-howto-unit {
    width: var(--index-hero-card-width);
  }

  .hero-play-button {
    min-width: var(--index-hero-card-width);
    height: var(--index-hero-button-height);
    padding: 0 12px 0 8px;
    gap: 5px;
  }

  .hero-play-label {
    font-size: 11.4px;
  }

  .hero-play-icon {
    font-size: 12px;
  }

  .hero-howto-panel {
    padding: 0 6px 7px;
    font-size: 9.2px;
    line-height: 1.35;
  }

  .hero-howto-panel p:first-child {
    padding-top: 6px;
  }

  .hero-howto-panel .howto-separator {
    margin: 6px 0 5px;
  }

  .top-dock {
    padding: 10px;
  }

  .top-dock-progress {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 8px;
  }

  .top-dock-time {
    font-size: 10px;
  }

  .top-dock-transport {
    gap: 10px;
  }

  .top-dock-transport button[data-transport-role="restart"],
  .top-dock-transport button[data-transport-role="next"] {
    width: 40px;
    height: 40px;
  }

  .top-dock-transport button[data-transport-role="primary-play"],
  .top-dock-transport button[data-transport-role="primary-pause"] {
    width: 60px;
    height: 60px;
  }

  .history-item {
    width: 64px;
    height: 64px;
    border-radius: 0 0 14px 14px;
  }

  .length-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .length-button {
    width: 100%;
    max-width: none;
    border-radius: 14px;
  }

  .length-button[data-sec-label]::after {
    right: 7px;
    bottom: 5px;
    font-size: 10.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.82);
  }

  .length-button-fallback {
    padding: 10px 10px;
  }

  .length-button-sec {
    font-size: clamp(14px, 5.6vw, 18px);
  }

  .length-button-label {
    margin-top: 2px;
    font-size: clamp(9px, 2.9vw, 11px);
    line-height: 1.2;
  }
}

@media (max-width: 360px) {
  .length-grid {
    gap: 6px;
  }

  .length-button {
    border-radius: 12px;
  }

  .length-button[data-sec-label]::after {
    right: 6px;
    bottom: 4px;
    font-size: 9.5px;
  }


  .length-button-fallback {
    padding: 8px 8px;
  }

  .length-button-sec {
    font-size: clamp(13px, 5.8vw, 16px);
  }

  .length-button-label {
    font-size: clamp(8px, 2.8vw, 10px);
  }
}


@media (orientation: landscape) and (max-height: 430px) {
  body[data-page="top"] {
    overflow: auto;
  }

  .top-page {
    height: auto;
    min-height: 100svh;
    overflow: visible;
  }

  .top-fixed-stack,
  .top-scroll-area {
    min-height: 0;
    overflow: visible;
  }

  .top-scroll-area {
    padding-right: 0;
  }
}

/* ========================================
   Trailer modal (native <dialog> and <video>)
======================================== */
.top-video-modal {
  border: 0;
  padding: 0;
  background: transparent;
  color: #ffffff;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow: visible;
}

.top-video-modal::backdrop {
  background: rgba(0, 0, 0, 0.87);
}

.top-video-dialog {
  width: min(92vw, calc((100dvh - 100px) * 1.7777778));
}

.top-video-modal[data-shape="portrait"] .top-video-dialog {
  width: min(90vw, calc((100dvh - 100px) * 0.5625));
}

.top-video-close {
  display: block;
  min-height: 40px;
  margin: 0 0 10px auto;
  padding: 5px 16px;
  background: #ffffff;
  color: #222222;
  border: 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
}

.top-video-close:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

.top-video-player {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  border-radius: 12px;
}

.top-video-modal[data-shape="portrait"] .top-video-player {
  aspect-ratio: 9 / 16;
}
