/* FF40th / THE CRYSTAL — scoped to the page and its native track dialogs.
   The supplied SQUARE ENIX header and footer retain their template styles. */
#contents.ff40th,
.ff-track-dialog,
.ff-track-page {
  --ff-blue: #034ebf;
  --ff-ink: #1f2a3d;
  --ff-muted: #61738c;
  --ff-serif: "Noto Serif JP", "Yu Mincho", "Hiragino Mincho ProN", serif;
  --ff-sans: "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif;
  --ff-accent: linear-gradient(90deg, #0126ff 0%, #176bec 56%, #3eb0ff 100%);
  --ff-crystal: linear-gradient(90deg, #d3f5ff 0%, #edfcff 17%, #fff 38%, #fff 64%, #e5f8ff 84%, #cceaff 100%);
  color: var(--ff-ink);
  font-family: var(--ff-sans);
  font-weight: 400;
  text-align: left;
  overflow-wrap: break-word;
}

#contents.ff40th,
#contents.ff40th *,
#contents.ff40th *::before,
#contents.ff40th *::after,
.ff-track-dialog,
.ff-track-dialog *,
.ff-track-page,
.ff-track-page * {
  box-sizing: border-box;
}

#contents.ff40th :where(h1, h2, h3, h4, p, ul),
.ff-track-dialog :where(h2, h3, p, ol, form),
.ff-track-page :where(h1, h2, h3, p, ol, form) {
  margin: 0;
  padding: 0;
}

#contents.ff40th {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  background: linear-gradient(90deg, #effaff 0%, #fff 24%, #fff 70%, #eff6ff 100%);
}

#contents .ff-container {
  width: calc(100% - 80px);
  max-width: 1220px;
  margin-inline: auto;
}

#contents .ff-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 56px 20px 64px;
  overflow: hidden;
  background: var(--ff-crystal);
}

#contents .ff-language {
  position: absolute;
  top: 16px;
  right: 40px;
  z-index: 1;
  display: flex;
}

#contents .ff-language-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 40px;
  border: 1px solid var(--ff-blue);
  background: #fff;
  color: var(--ff-blue);
  font-family: var(--ff-sans);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  text-decoration: none;
  white-space: nowrap;
}

#contents .ff-language-item + .ff-language-item {
  border-left: 0;
}

#contents .ff-language-item[aria-current="true"] {
  background: var(--ff-blue);
  color: #fff;
}

#contents .ff-language-short {
  display: none;
}

#contents .ff-logo {
  position: relative;
  flex: none;
  width: 564px;
  max-width: 100%;
  aspect-ratio: 564 / 418.448;
  overflow: hidden;
}

/* Preserve the crop of the supplied full transparent logo artwork. */
#contents .ff-logo img {
  position: absolute;
  top: -36.9747%;
  left: -40.6365%;
  display: block;
  width: 182.2534%;
  max-width: none;
  height: 173.6794%;
  object-fit: contain;
}

#contents .ff-title {
  width: 100%;
  max-width: 1000px;
  color: var(--ff-blue);
  font-family: var(--ff-serif);
  font-size: 68px;
  font-weight: 400;
  line-height: 90px;
  letter-spacing: 2.72px;
  text-align: center;
}

#contents .ff-format {
  color: var(--ff-blue);
  font-size: 15px;
  font-weight: 500;
  line-height: 26px;
  letter-spacing: 3px;
  text-align: center;
  white-space: pre-wrap;
}

#contents .ff-release {
  color: var(--ff-blue);
  font-family: var(--ff-serif);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.16em;
  text-align: center;
  white-space: nowrap;
}

#contents .ff-rule {
  flex: none;
  width: 72px;
  height: 2px;
  background: var(--ff-accent);
}

#contents .ff-hero > .ff-rule {
  width: 96px;
  height: 3px;
}

#contents .ff-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  padding: 76px 100px 88px;
  text-align: center;
}

#contents .ff-catch {
  color: var(--ff-blue);
  font-family: var(--ff-serif);
  font-size: 48px;
  font-weight: 600;
  line-height: 76px;
  letter-spacing: 1.44px;
}

#contents .ff-catch-phrase {
  display: inline-block;
  white-space: nowrap;
}

#contents .ff-reveal-char {
  display: inline-block;
}

/* JS adds this before observing, so scrolling never exposes an unprepared reveal. */
#contents [data-reveal].ff-reveal-pending {
  opacity: 0;
}

#contents .ff-sp {
  display: none;
}

#contents .ff-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#contents .ff-description {
  width: 100%;
  font-family: var(--ff-serif);
  font-size: 20px;
  line-height: 42px;
  letter-spacing: 0.2px;
}

#contents .ff-lineup {
  display: flex;
  flex-direction: column;
  gap: 64px;
  padding-bottom: 88px;
}

#contents .ff-section-title {
  color: var(--ff-blue);
  font-family: var(--ff-serif);
  font-size: 46px;
  font-weight: 400;
  line-height: 64px;
  letter-spacing: 3.68px;
  text-align: center;
}

#contents .ff-product {
  display: grid;
  grid-template-columns: minmax(0, 500fr) minmax(0, 560fr);
  grid-template-areas:
    "image heading"
    "image title"
    "image spec"
    "image track"
    "image stores";
  gap: 24px 64px;
  align-items: start;
  padding: 48px;
  background: rgb(255 255 255 / 94%);
  box-shadow: inset 0 0 0 1px rgb(210 226 247 / 80%), 0 12px 18px rgb(4 90 190 / 6%);
}

#contents .ff-product--cd {
  grid-template-columns: minmax(0, 560fr) minmax(0, 500fr);
  grid-template-areas:
    "heading image"
    "title image"
    "spec image"
    "track image"
    "stores image";
}

#contents .ff-product > * {
  min-width: 0;
}

#contents .ff-product-heading {
  grid-area: heading;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
}

#contents .ff-product-kind {
  color: var(--ff-blue);
  font-family: var(--ff-serif);
  font-size: 44px;
  font-weight: 400;
  line-height: 60px;
  letter-spacing: 3.52px;
}

#contents .ff-product-image {
  grid-area: image;
  display: flex;
  justify-content: center;
  padding-top: 110px;
}

#contents .ff-product-image > img,
#contents .ff-bonus-body > img {
  display: block;
  flex: none;
  width: 480px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}

#contents .ff-product-title {
  grid-area: title;
  font-family: var(--ff-serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 40px;
}

#contents .ff-spec {
  grid-area: spec;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#contents .ff-price {
  color: var(--ff-blue);
  font-size: 32px;
  font-weight: 500;
  line-height: 48px;
}

#contents .ff-tax,
#contents .ff-format-detail {
  color: var(--ff-muted);
  font-size: 14px;
  line-height: 24px;
}

#contents .ff-track-button,
.ff-track-dialog .ff-close,
.ff-track-page .ff-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 60px;
  padding: 12px 16px;
  border: 0;
  border-radius: 2px;
  background: var(--ff-accent);
  color: #fff;
  font-family: var(--ff-sans);
  font-size: 17px;
  font-weight: 500;
  line-height: 28px;
  letter-spacing: 0.51px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

#contents .ff-track-button {
  grid-area: track;
}

/* Separate hover alpha from the reveal's opacity, with a gentler return on exit. */
#contents .ff-track-button,
#contents a.ff-language-item,
#contents a.ff-store-link[href]:not([aria-disabled="true"]),
.ff-track-dialog .ff-close,
.ff-track-page .ff-close {
  filter: opacity(1);
  transition: filter 650ms ease-out;
}

@media (hover: hover) and (pointer: fine) {
  #contents .ff-track-button:hover:not(:focus-visible),
  #contents a.ff-language-item:hover:not(:focus-visible),
  #contents a.ff-store-link[href]:not([aria-disabled="true"]):hover:not(:focus-visible),
  .ff-track-dialog .ff-close:hover:not(:focus-visible),
  .ff-track-page .ff-close:hover:not(:focus-visible) {
    filter: opacity(0.75);
    transition-duration: 180ms;
  }
}

@media (prefers-reduced-motion: reduce) {
  #contents .ff-track-button,
  #contents a.ff-language-item,
  #contents a.ff-store-link[href]:not([aria-disabled="true"]),
  .ff-track-dialog .ff-close,
  .ff-track-page .ff-close {
    transition: none;
  }
}

#contents .ff-track-button:focus-visible,
#contents a.ff-language-item:focus-visible,
#contents a.ff-store-link[href]:not([aria-disabled="true"]):focus-visible,
.ff-track-dialog .ff-close:focus-visible,
.ff-track-page .ff-close:focus-visible {
  outline: 3px solid var(--ff-blue);
  outline-offset: 4px;
}

#contents .ff-stores {
  grid-area: stores;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 16px;
}

#contents .ff-store-label {
  color: var(--ff-blue);
  font-size: 17px;
  font-weight: 500;
  line-height: 28px;
  letter-spacing: 0.51px;
}

#contents .ff-store-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 12px;
  list-style: none;
}

#contents .ff-store-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 58px;
  padding: 6px 10px;
  border: 1px solid rgb(119 168 236 / 65%);
  border-radius: 2px;
  background: rgb(255 255 255 / 86%);
  color: var(--ff-blue);
  font-size: 15px;
  font-weight: 500;
  line-height: 26px;
  text-align: center;
  text-decoration: none;
}

#contents .ff-store-link[aria-disabled="true"] {
  cursor: default;
}

#contents .ff-bonus {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 49px 48px;
  background: rgb(255 255 255 / 85%);
  box-shadow: inset 0 0 0 1px rgb(210 226 247 / 90%);
}

#contents .ff-bonus-body {
  display: flex;
  align-items: center;
  gap: 48px;
  width: max-content;
  max-width: 100%;
}

#contents .ff-bonus-body > img {
  width: 220px;
}

#contents .ff-bonus-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

#contents .ff-bonus-shop {
  color: var(--ff-muted);
  font-size: 17px;
  font-weight: 500;
  line-height: 28px;
  letter-spacing: 0.51px;
}

#contents .ff-bonus-name {
  font-family: var(--ff-serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 40px;
}

#contents .ff-bonus-notes {
  margin-top: 8px;
  color: var(--ff-muted);
  font-size: 12px;
  line-height: 1.8;
  list-style: none;
  text-align: left;
}

#contents .ff-bonus-notes li {
  padding-left: 1em;
  text-indent: -1em;
}

#contents .ff-bonus-notes li + li {
  margin-top: 4px;
}

#contents .ff-bonus-notes a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

#contents .ff-footer-space {
  height: 80px;
}

/* The same content is readable at its own URL when JavaScript is unavailable. */
.ff-track-dialog:not([open]) {
  display: none;
}

.ff-track-dialog {
  --ff-dialog-fade-duration: 480ms;
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 24px 20px;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.ff-track-dialog[open] {
  display: flex;
  flex-direction: column;
}

.ff-track-dialog::backdrop {
  --ff-dialog-fade-duration: 480ms;
  background: rgb(15 31 52 / 48%);
}

/* Keep the dialog open and the background locked until the exit fade finishes. */
.ff-track-dialog.is-animated .ff-dialog-content,
.ff-track-dialog.is-animated::backdrop {
  opacity: 0;
  transition: opacity var(--ff-dialog-fade-duration) ease-in-out;
}

.ff-track-dialog.is-visible .ff-dialog-content,
.ff-track-dialog.is-visible::backdrop {
  opacity: 1;
}

.ff-track-dialog.is-closing,
.ff-track-dialog.is-closing::backdrop {
  --ff-dialog-fade-duration: 320ms;
}

@media (prefers-reduced-motion: reduce) {
  .ff-track-dialog.is-animated .ff-dialog-content,
  .ff-track-dialog.is-animated::backdrop {
    transition: none;
  }
}

.ff-track-page {
  width: 620px;
  max-width: calc(100% - 40px);
  margin: 40px auto;
  background: rgb(255 255 255 / 98%);
  box-shadow: inset 0 0 0 1px #d2e2f7, 0 12px 40px rgb(4 90 190 / 10%);
}

.ff-track-dialog .ff-dialog-content,
.ff-track-page .ff-dialog-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 40px;
}

/* The viewport scrolls; the white panel never creates an inner scroll area. */
.ff-track-dialog .ff-dialog-content {
  flex: none;
  width: 620px;
  max-width: 100%;
  margin: auto;
  overflow: visible;
  background: rgb(255 255 255 / 98%);
  box-shadow: inset 0 0 0 1px #d2e2f7, 0 12px 40px rgb(4 90 190 / 10%);
}

.ff-track-dialog .ff-dialog-title,
.ff-track-page .ff-dialog-title {
  color: var(--ff-blue);
  font-family: var(--ff-serif);
  font-size: 42px;
  font-weight: 600;
  line-height: 58px;
  letter-spacing: 2.1px;
  text-align: center;
}

/* This heading receives the initial dialog focus, but is not a tab stop. */
.ff-track-dialog .ff-dialog-title[tabindex="-1"]:focus {
  outline: none;
}

.ff-track-dialog .ff-dialog-product,
.ff-track-page .ff-dialog-product {
  font-size: 14px;
  line-height: 24px;
  text-align: center;
}

.ff-track-dialog .ff-track-group,
.ff-track-page .ff-track-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ff-track-dialog .ff-track-side,
.ff-track-page .ff-track-side {
  padding: 12px;
  background: var(--ff-crystal);
  color: var(--ff-blue);
  font-size: 17px;
  font-weight: 500;
  line-height: 30px;
  letter-spacing: 0.51px;
  white-space: pre-wrap;
}

.ff-track-dialog .ff-track-list,
.ff-track-page .ff-track-list {
  list-style: none;
}

.ff-track-dialog .ff-track-list li,
.ff-track-page .ff-track-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 8px;
  font-size: 17px;
  line-height: 30px;
}

.ff-track-dialog .ff-track-number,
.ff-track-page .ff-track-number {
  flex: 0 0 28px;
}

.ff-track-dialog .ff-track-list li > :last-child,
.ff-track-page .ff-track-list li > :last-child {
  min-width: 0;
}

.ff-track-dialog .ff-close,
.ff-track-page .ff-close {
  min-height: 50px;
  padding-block: 11px;
}

@media (min-width: 901px) and (max-width: 1199px) {
  #contents .ff-intro {
    padding-inline: 40px;
  }

  #contents .ff-catch {
    font-size: 40px;
  }

  #contents .ff-product {
    gap: 24px 36px;
    padding: 32px;
  }

  #contents .ff-product-title {
    font-size: 22px;
    line-height: 36px;
  }

  #contents .ff-store-link {
    font-size: 13px;
  }
}

@media (max-width: 900px) {
  #contents .ff-pc {
    display: none;
  }

  #contents .ff-container {
    width: calc(100% - 40px);
    max-width: 560px;
  }

  #contents .ff-hero {
    gap: 16px;
    padding: 76px 20px 50px;
  }

  #contents .ff-language {
    top: 12px;
    right: 20px;
  }

  #contents .ff-language-item {
    width: 80px;
    height: 44px;
  }

  #contents .ff-language-full {
    display: none;
  }

  #contents .ff-language-short {
    display: inline;
  }

  #contents .ff-logo {
    width: 290px;
  }

  #contents .ff-title {
    font-size: clamp(28px, 8.5vw, 38px);
    line-height: 54px;
    letter-spacing: 3.04px;
  }

  #contents .ff-format {
    font-size: 12px;
    line-height: 24px;
    letter-spacing: 2.4px;
  }

  #contents .ff-release {
    font-size: 24px;
    letter-spacing: 0.12em;
  }

  #contents .ff-hero > .ff-rule {
    width: 72px;
  }

  #contents .ff-intro {
    gap: 28px;
    padding: 54px 0;
  }

  #contents .ff-catch {
    font-size: 30px;
    line-height: 48px;
    letter-spacing: 0.6px;
  }

  #contents .ff-sp {
    display: inline;
  }

  #contents .ff-description {
    font-size: 17px;
    line-height: 34px;
    letter-spacing: normal;
    text-align: left;
  }

  #contents .ff-lineup {
    gap: 28px;
    padding-bottom: 56px;
  }

  #contents .ff-lineup > .ff-section-title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  #contents .ff-product,
  #contents .ff-product--cd {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "heading" "image" "title" "spec" "track" "stores";
    gap: 20px;
    padding: 29px 20px;
    text-align: center;
  }

  #contents .ff-product-heading {
    align-items: center;
    gap: 20px;
  }

  #contents .ff-product-kind {
    font-size: 34px;
    line-height: 48px;
    letter-spacing: 2.72px;
  }

  #contents .ff-product-heading .ff-rule {
    width: 52px;
  }

  #contents .ff-product-image {
    padding-top: 0;
  }

  #contents .ff-product-image > img {
    width: 270px;
  }

  #contents .ff-product-title {
    font-size: 20px;
    line-height: 33px;
  }

  #contents .ff-price {
    font-size: 30px;
    line-height: 46px;
  }

  #contents .ff-tax,
  #contents .ff-format-detail {
    font-size: 13px;
    line-height: 23px;
  }

  #contents .ff-track-button {
    min-height: 58px;
    font-size: 16px;
    line-height: 26px;
    letter-spacing: 0.48px;
  }

  #contents .ff-store-label {
    font-size: 16px;
    letter-spacing: 0.48px;
  }

  #contents .ff-store-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  #contents .ff-store-link {
    min-height: 54px;
    padding: 8px 16px;
    font-size: 14px;
    line-height: 24px;
  }

  #contents .ff-bonus {
    gap: 24px;
    padding: 29px 20px 37px;
    text-align: center;
  }

  #contents .ff-bonus .ff-section-title {
    font-size: 36px;
    line-height: 50px;
    letter-spacing: 2.88px;
  }

  #contents .ff-bonus-body {
    flex-direction: column;
    gap: 24px;
    width: 100%;
  }

  #contents .ff-bonus-body > img {
    width: 230px;
  }

  #contents .ff-bonus-copy {
    width: 100%;
  }

  #contents .ff-bonus-shop {
    font-size: 16px;
    letter-spacing: 0.48px;
  }

  #contents .ff-bonus-name {
    font-size: 20px;
    line-height: 33px;
  }

  #contents .ff-footer-space {
    height: 52px;
  }
}

@media (max-width: 600px) {
  .ff-track-dialog .ff-dialog-content,
  .ff-track-page .ff-dialog-content {
    padding: 20px;
  }

  .ff-track-dialog .ff-dialog-title,
  .ff-track-page .ff-dialog-title {
    font-size: 20px;
    line-height: 33px;
    letter-spacing: normal;
  }

  .ff-track-dialog .ff-dialog-product,
  .ff-track-page .ff-dialog-product {
    font-size: 13px;
    line-height: 23px;
  }

  .ff-track-dialog .ff-track-side,
  .ff-track-page .ff-track-side {
    font-size: 16px;
    line-height: 28px;
    letter-spacing: 0.48px;
  }

  .ff-track-dialog .ff-track-list li,
  .ff-track-page .ff-track-list li {
    font-size: 16px;
  }

  .ff-track-dialog .ff-close,
  .ff-track-page .ff-close {
    min-height: 48px;
    font-size: 16px;
    line-height: 26px;
    letter-spacing: 0.48px;
  }
}

@media (max-width: 359px) {
  #contents .ff-title {
    font-size: 32px;
    letter-spacing: 2.56px;
  }

  #contents .ff-catch {
    font-size: 26px;
  }
}
