body:has(.endroll) {
  background: #05080b;
  color: #eaf3f1;
}

body:has(.endroll) > header {
  display: none;
}

main:has(.endroll) {
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.endroll {
  --accent: #99efcc;
  --muted: #9bafba;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(56, 189, 248, .08), transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(153, 239, 204, .06), transparent 55%),
    #05080b;
}

/* ---- 通常のスクロールページ（JS無効・動きを減らす設定のときの表示） ---- */
.roll-viewport {
  padding: 12vh 20px 16vh;
}

.roll-content {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.roll-static-back {
  position: absolute;
  top: 14px;
  left: 16px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.roll-static-back:hover {
  color: #fff;
}

.roll-noscript {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.roll-block {
  margin: 0 0 16vh;
}

.roll-eyebrow,
.roll-badge {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .24em;
  color: var(--muted);
}

.roll-title h1 {
  margin: 0;
  font-size: 46px;
  line-height: 1.15;
  letter-spacing: .16em;
  font-weight: 800;
}

.roll-title h1 span {
  display: block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .3em;
  color: var(--muted);
}

.roll-count {
  margin: 28px 0 0;
  font-size: 11px;
  letter-spacing: .24em;
  color: var(--muted);
}

.roll-heading {
  margin: 0 0 28px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .4em;
  color: var(--accent);
}

.roll-heading span {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .3em;
  color: var(--muted);
}

.roll-staff .roll-name {
  font-size: 30px;
  letter-spacing: .16em;
}

.roll-director .roll-eyebrow {
  letter-spacing: .4em;
}

.roll-director .roll-role {
  font-size: 12px;
  letter-spacing: .5em;
}

.roll-director .roll-name {
  margin-top: 10px;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: .24em;
}

.roll-names {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.roll-names li {
  font-size: 15px;
  letter-spacing: .06em;
}

.roll-lines p {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.8;
  letter-spacing: .08em;
  color: var(--muted);
}

.roll-game-title {
  font-size: 30px;
  letter-spacing: .14em;
  color: #fff;
}

.roll-game-title span {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .26em;
  color: var(--muted);
}

.roll-badge {
  color: var(--accent);
}

.roll-row {
  margin: 0 0 26px;
}

.roll-row p {
  margin: 0;
}

.roll-role {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3em;
  color: var(--muted);
}

.roll-name {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .06em;
  overflow-wrap: anywhere;
}

.roll-sub {
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--muted);
}

.roll-thanks-en {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .32em;
}

.roll-thanks-ja {
  margin: 14px 0 0;
  font-size: 13px;
  letter-spacing: .24em;
  color: var(--muted);
}

.roll-end {
  margin-bottom: 0;
}

.roll-the-end {
  margin: 0 0 28px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: .4em;
}

.roll-back {
  display: inline-block;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--accent, #99efcc);
  text-decoration: none;
  border: 1px solid rgba(153, 239, 204, .45);
  border-radius: 999px;
  transition: background .15s, color .15s;
}

.roll-back:hover,
.roll-back:focus-visible {
  color: #05080b;
  background: #99efcc;
  outline: none;
}

.roll-controls[hidden] {
  display: none;
}

.roll-controls [hidden] {
  display: none;
}

.roll-gate {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: rgba(5, 8, 11, .94);
}

.roll-gate[hidden] {
  display: none;
}

.roll-gate-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .14em;
}

.roll-gate-desc {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.roll-gate-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.roll-gate button {
  padding: 11px 20px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #eaf3f1;
  background: rgba(23, 36, 45, .9);
  border: 1px solid #2b3e49;
  border-radius: 999px;
  cursor: pointer;
}

.roll-gate button:hover,
.roll-gate button:focus-visible {
  border-color: #99efcc;
  outline: none;
}

.roll-gate .roll-gate-primary {
  color: #05080b;
  background: #99efcc;
  border-color: #99efcc;
}

/* ---- 自動スクロール（JSが .is-rolling を付けたとき） ---- */
body:has(.endroll.is-rolling) {
  overflow: hidden;
}

.endroll.is-rolling {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.is-rolling .roll-static-back {
  display: none;
}

.is-rolling .roll-viewport {
  position: absolute;
  inset: 0;
  padding: 0;
  cursor: pointer;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 86%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 86%, transparent 100%);
}

.is-rolling.is-finished .roll-viewport {
  cursor: default;
}

.is-rolling .roll-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 0 20px;
  will-change: transform;
}

.is-rolling .roll-block:last-child {
  margin-bottom: 0;
}

.roll-controls {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: .5;
  transition: opacity .2s;
}

.roll-controls:hover,
.roll-controls:focus-within {
  opacity: 1;
}

.roll-controls button,
.roll-controls a {
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #eaf3f1;
  text-decoration: none;
  background: rgba(23, 36, 45, .8);
  border: 1px solid #2b3e49;
  border-radius: 999px;
  cursor: pointer;
}

.roll-controls button:hover,
.roll-controls a:hover,
.roll-controls button[aria-pressed="true"] {
  border-color: #99efcc;
}

.roll-controls button:focus-visible,
.roll-controls a:focus-visible {
  outline: 2px solid #99efcc;
  outline-offset: 2px;
}

.is-finished .roll-controls [data-action] {
  display: none;
}

@media (max-width: 600px) {
  .roll-title h1 {
    font-size: 34px;
  }
  .roll-game-title {
    font-size: 24px;
  }
  .roll-director .roll-name {
    font-size: 34px;
  }
  .roll-name {
    font-size: 19px;
  }
  .roll-controls {
    top: 8px;
    right: 8px;
    gap: 4px;
  }
  .roll-controls button,
  .roll-controls a {
    padding: 5px 9px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .roll-back,
  .roll-controls {
    transition: none;
  }
}
