@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@300;400;700&family=Cinzel:wght@400;700;900&family=Noto+Sans+JP:wght@300;400&display=swap');

:root {
  --bg: rgba(8, 8, 8, 0.65);
  --surface: rgba(15, 15, 15, 0.85);
  --accent: #9b1a1a;
  --accent2: #e03030;
  --gold: #f0f0f0;
  --text: #eeeeee;
  --muted: #a4a4a4;
  --border: rgba(180, 30, 30, 0.8);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

/* ↓ bodyから背景関係の指定を全部消してスッキリさせる */
body {
  background-color: #000;
  color: var(--text);
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 300;
  line-height: 1.8;
  overflow-x: hidden;
}

/* ── Safariバグ回避：背景用の固定シート ── */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-repeat: no-repeat;
  background-color: #000;
  /* ここにあった background-position は消して、下でそれぞれ指定するよ */
}

/* PC版の背景 */
body.bg-pc::after {
  background-image: url('../img/keyArt_PC.jpg');
  background-size: cover;
  /* PCはスクロールで動かさないから、常にド真ん中(center)に固定！ */
  background-position: center;
}

/* スマホ版の背景 */
body.bg-sp::after {
  background-image: url('../img/keyArt.jpg');
  background-size: auto 100%;
  /* JSから受け取った変数を使って動かす。JSが動く前(初期値)は 5% にしておくよ */
  background-position: var(--bg-pos-x, 5%) center;
}

/* ── ノイズのエフェクト ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: .035;
  pointer-events: none;
  z-index: 9999;
}

/* ── トランジションエフェクト (斜めブロックワイプ) ── */
#transition-overlay {
  position: fixed;
  top: 0;
  left: -10vw;
  width: 120vw;
  height: 100vh;
  z-index: 99900;
  pointer-events: none;
  display: flex;
  transform: skewX(-25deg);
}

.stripe {
  flex: 1;
  background-color: #080808;
  transform: translateY(-101%);
  margin-right: -1px;
}

.stripe:last-child {
  margin-right: 0;
}

.stripe-3 {
  background-color: var(--accent);
}

#transition-overlay.animate .stripe {
  animation: stripeWipe 1.2s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

#transition-overlay.animate .stripe-1 {
  animation-delay: 0.0s;
}

#transition-overlay.animate .stripe-2 {
  animation-delay: 0.1s;
}

#transition-overlay.animate .stripe-3 {
  animation-delay: 0.05s;
}

#transition-overlay.animate .stripe-4 {
  animation-delay: 0.15s;
}

#transition-overlay.animate .stripe-5 {
  animation-delay: 0.08s;
}

@keyframes stripeWipe {
  0% {
    transform: translateY(-101%);
  }

  40%,
  60% {
    transform: translateY(0%);
  }

  100% {
    transform: translateY(101%);
  }
}

/* ── ナビゲーション ── */
nav {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 3rem;
  background: linear-gradient(to bottom, rgba(8, 8, 8, .95) 0%, transparent 100%);
  backdrop-filter: blur(4px);
}

.nav-logo {
  font-family: 'Cinzel', serif;
  font-size: .85rem;
  letter-spacing: .25em;
  color: var(--gold);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .15em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color .3s;
}

.nav-links a:hover {
  color: var(--accent2);
}

/* ── ヒーローセクション ── */
#hero {
  min-height: 100vh;
  position: relative;
}

.glitch-text {
  display: inline-block;
  transition: all 0.1s;
}

.glitch-text:hover {
  animation: glitch-skew 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
  color: var(--text);
  text-shadow: 2px 0px var(--accent2), -2px 0px #2b45a2;
}

@keyframes glitch-skew {
  0% {
    transform: skew(0deg);
  }

  20% {
    transform: skew(-10deg);
  }

  40% {
    transform: skew(10deg);
  }

  60% {
    transform: skew(-5deg);
  }

  80% {
    transform: skew(5deg);
  }

  100% {
    transform: skew(0deg);
  }
}

@media (min-width: 1025px) {
  .sp-only {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .pc-only {
    display: none !important;
  }
}

.hero-content.pc-layout {
  position: fixed;
  right: 5%;
  top: 0;
  height: 100vh;
  width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
  pointer-events: none;
  text-align: center;
}

.pc-layout .hero-text-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 15px;
}

.pc-layout .hero-text-bottom {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  transform: translateY(-55px);
}

.logo-spacer {
  height: 350px;
  flex-shrink: 0;
}

.eyebrow {
  font-family: 'Cinzel', serif;
  font-size: .7rem;
  letter-spacing: .5em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 0;
}

.hero-desc {
  font-size: .95rem;
  color: var(--text);
  line-height: 2;
  opacity: .8;
  margin: 0;
}

h1.title {
  font-family: 'Cinzel', serif;
  font-size: clamp(2.8rem, 8vw, 6.5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: .05em;
  background: linear-gradient(135deg, #ffffff 0%, #e8c8c8 35%, #e03030 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 2rem;
  text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.8);
}

.title-sqrt {
  color: var(--gold);
  -webkit-text-fill-color: var(--gold);
  animation: pulse-glow 3s infinite alternate;
}

@keyframes pulse-glow {
  0% {
    text-shadow: 0 0 0px transparent;
  }

  100% {
    text-shadow: 0 0 15px var(--accent2), 0 0 30px var(--accent);
  }
}

#about {
  background: linear-gradient(to bottom, transparent 0%, var(--surface) 150px, var(--surface) 100%);
  position: relative;
  z-index: 10;
  margin-top: 0;
}

#screenshots {
  background: linear-gradient(to bottom, var(--surface) 0%, var(--bg) 150px, var(--bg) 100%);
  position: relative;
  z-index: 10;
}

#characters {
  background: linear-gradient(to bottom, var(--bg) 0%, var(--surface) 150px, var(--surface) 100%);
  position: relative;
  z-index: 10;
}

#links {
  background: linear-gradient(to bottom, var(--surface) 0%, var(--bg) 150px, var(--bg) 100%);
  position: relative;
  z-index: 10;
}

footer {
  background-color: #000;
  position: relative;
  z-index: 10;
}

section {
  padding: 7rem 2rem;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
}

.section-label {
  font-family: 'Cinzel', serif;
  font-size: .68rem;
  letter-spacing: .5em;
  color: var(--gold);
  text-transform: uppercase;
  text-align: center;
  margin-bottom: .8rem;
}

.section-title {
  font-family: 'Noto Serif JP', serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 300;
  text-align: center;
  color: #f0eded;
  margin-bottom: 1rem;
  letter-spacing: .05em;
}

.section-divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--accent2), transparent);
  margin: 0 auto 3.5rem;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.about-image-placeholder {
  aspect-ratio: 16/9;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.about-text h3 {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--accent2);
  margin-bottom: 1rem;
  letter-spacing: .05em;
}

.about-text p {
  font-size: .9rem;
  color: var(--text);
  opacity: .8;
  margin-bottom: 1rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1.5rem;
}

.tag {
  padding: .3rem .9rem;
  border: 1px solid var(--border);
  font-size: .7rem;
  letter-spacing: .1em;
  color: var(--muted);
}

.about-key-visual {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#movie {
  background-color: var(--surface);
  position: relative;
  z-index: 10;
}

.movie-wrapper {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  aspect-ratio: 16/9;
  border: 1.5px solid var(--border);
  background: rgba(8, 8, 8, 0.7);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transition: border-color .3s, transform .3s;
}

.movie-wrapper:hover {
  border-color: var(--accent);
}

.movie-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.screenshots-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.screenshot-item {
  width: calc(33.333% - 0.67rem);
  min-width: 250px;
  aspect-ratio: 16/9;
  background: rgba(8, 8, 8, 0.7);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color .3s, transform .3s;
}

.screenshot-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.screenshot-item:hover img {
  transform: scale(1.05);
}

.screenshot-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(224, 48, 48, .08), transparent);
  opacity: 0;
  transition: opacity .3s;
}

.screenshot-item:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.screenshot-item:hover::before {
  opacity: 1;
}

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, .92);
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

#lightbox.active {
  display: flex;
}

#lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  border: 1px solid var(--border);
}

#lightbox-close {
  position: absolute;
  top: 2rem;
  right: 2.5rem;
  font-size: 2rem;
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: none;
  transition: color .3s;
}

#lightbox-close:hover {
  color: var(--accent2);
}

.characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
}

.character-card {
  border: 1.5px solid var(--border);
  background: rgba(8, 8, 8, 0.7);
  padding: 0;
  overflow: hidden;
  transition: border-color .3s, transform .3s;
}

.character-card:hover {
  border-color: var(--accent);
  transform: translateY(-8px);
  box-shadow: 0 10px 20px rgba(155, 26, 26, 0.15);
}

.character-portrait {
  aspect-ratio: 2/3;
  background: linear-gradient(160deg, rgba(155, 26, 26, .18) 0%, rgba(8, 8, 8, .96) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: .5rem;
  color: var(--muted);
  font-size: .65rem;
  letter-spacing: .1em;
}

.character-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.character-portrait svg {
  opacity: .2;
}

.character-info {
  padding: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.character-name {
  font-family: 'Noto Serif JP', serif;
  font-size: .95rem;
  color: #f0eded;
  margin-bottom: .2rem;
}

.character-role {
  font-size: .7rem;
  color: var(--muted);
  letter-spacing: .1em;
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.5rem;
  border: 1.5px solid var(--border);
  background: rgba(8, 8, 8, 0.7);
  text-decoration: none;
  color: var(--text);
  transition: border-color .3s, background .3s, transform .3s;
}

.link-card:hover {
  border-color: var(--accent);
  background: rgba(155, 26, 26, .1);
  transform: translateY(-2px);
}

.link-icon {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent2);
}

.link-info {
  min-width: 0;
}

.link-name {
  font-size: .85rem;
  color: #f0eded;
  font-weight: 400;
}

.link-handle {
  font-size: .72rem;
  color: var(--muted);
  letter-spacing: .05em;
}

footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 2rem;
  text-align: center;
}

.footer-logo {
  font-family: 'Cinzel', serif;
  font-size: .8rem;
  letter-spacing: .3em;
  color: var(--gold);
  margin-bottom: .8rem;
}

.footer-copy {
  font-size: .72rem;
  color: var(--muted);
  letter-spacing: .05em;
}

.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 1s ease-out, transform 0.5s ease-out;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

#splash {
  position: fixed;
  inset: 0;
  background-color: #000;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 1.5s ease, visibility 1.5s ease;
}

#splash.loaded {
  opacity: 0;
  visibility: hidden;
}

.splash-logo {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  color: var(--gold);
  letter-spacing: 0.2em;
  opacity: 0;
  transition: opacity 2.5s ease;
}

.splash-logo.show {
  opacity: 1;
}

body.no-scroll {
  overflow: hidden;
}

/* ── 4K & ウルトラワイドモニター対応 ── */
@media (min-width: 1600px) {
  .container {
    /* 画面が大きくてもこれ以上は広げない上限値 */
    max-width: 1440px;
  }

  .movie-wrapper {
    /* 4Kなら動画プレイヤーも少しリッチに大きく */
    max-width: 1080px;
  }

  .hero-content.pc-layout {
    /* 画面の右端（5%）ではなく、1440pxのコンテンツ幅の右端に固定する */
    right: calc(50vw - 720px);
  }
}

@media (max-width: 1024px) {
  .nav-logo {
    display: none;
  }

  .hero-content.sp-layout {
    display: flex !important;
    position: absolute;
    inset: 0;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding-top: 5vh;
    padding-bottom: 8%;
    text-align: center;
    z-index: 1;
  }

  .sp-text-top,
  .sp-text-bottom {
    width: 100%;
  }

  h1.title {
    font-size: clamp(2rem, 7vw, 3.5rem);
    margin: 0 0 1rem 0;
    text-shadow: none;
    background: none;
    -webkit-text-fill-color: #ffffff;
    color: #ffffff;
  }

  .title-sqrt {
    animation: none;
    text-shadow: none;
    -webkit-text-fill-color: var(--accent2);
    color: var(--accent2);
  }

  .hero-desc {
    text-align: center;
    text-shadow: none;
  }

  nav {
    padding: 1rem 1.5rem;
  }

  .nav-links {
    gap: 1.2rem;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .screenshot-item {
    width: calc(50% - 0.5rem);
  }
}

@media (max-width: 480px) {
  .screenshot-item {
    width: 100%;
  }

  .nav-links {
    display: none;
  }
}