/* ---------- Day: Sky & Clouds ---------- */
.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  filter: blur(1px);
}

/* 右→左に流れる雲 */
.cloud:nth-child(1) { width: 120px; height: 40px; top: 15%; left: 100%; animation: drift-right-to-left 28s linear infinite; }
.cloud:nth-child(2) { width: 80px; height: 30px; top: 35%; left: 100%; animation: drift-right-to-left 32s linear infinite 6s; }
.cloud:nth-child(3) { width: 100px; height: 35px; top: 55%; left: 100%; animation: drift-right-to-left 25s linear infinite 3s; }
/* 左→右に流れる雲 */
.cloud:nth-child(4) { width: 90px; height: 28px; top: 25%; left: -90px; animation: drift-left-to-right 30s linear infinite 10s; }
.cloud:nth-child(5) { width: 70px; height: 25px; top: 65%; left: -70px; animation: drift-left-to-right 26s linear infinite 4s; }

/* たまに出てくる大きくて遅い雲 */
.cloud--large {
  width: 220px;
  height: 70px;
  background: rgba(255, 255, 255, 0.45);
  filter: blur(2px);
}
.cloud--large:nth-child(6) { top: 20%; left: 100%; animation: drift-right-to-left 58s linear infinite; }
.cloud--large:nth-child(7) { top: 50%; left: -220px; animation: drift-left-to-right 62s linear infinite 28s; }
.cloud--large:nth-child(8) { top: 70%; left: 100%; animation: drift-right-to-left 55s linear infinite 15s; }

@keyframes drift-right-to-left {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(-100vw - 200px)); }
}

@keyframes drift-left-to-right {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(100vw + 200px)); }
}

/* ---------- Day: Birds（JSで動的生成） ---------- */
.bird-wrap {
  position: fixed;
  pointer-events: none;
  z-index: 10;
}
.bird {
  width: 100%;
  height: 100%;
  background: url('../images/bird.png') center / contain no-repeat;
}

/* 左→右（やや上下に揺れる） */
@keyframes fly-around {
  0%   { left: -25%; top: 25%; transform: rotate(-5deg) scale(1); }
  15%  { left: 15%; top: 18%; transform: rotate(8deg) scale(1.02); }
  35%  { left: 45%; top: 28%; transform: rotate(-3deg) scale(1); }
  55%  { left: 72%; top: 20%; transform: rotate(6deg) scale(0.98); }
  75%  { left: 95%; top: 32%; transform: rotate(-4deg) scale(1); }
  100% { left: 115%; top: 25%; transform: rotate(5deg) scale(1); }
}
/* 右→左 */
@keyframes fly-around-2 {
  0%   { left: 115%; top: 45%; transform: scale(0.85) rotate(5deg); }
  20%  { left: 82%; top: 35%; transform: scale(0.85) rotate(-6deg); }
  40%  { left: 52%; top: 42%; transform: scale(0.85) rotate(8deg); }
  60%  { left: 25%; top: 55%; transform: scale(0.85) rotate(-4deg); }
  80%  { left: 5%; top: 48%; transform: scale(0.85) rotate(6deg); }
  100% { left: -25%; top: 40%; transform: scale(0.85) rotate(-5deg); }
}
/* 左→右（やや低め） */
@keyframes fly-around-3 {
  0%   { left: -25%; top: 60%; transform: scale(0.7) rotate(-8deg); }
  25%  { left: 28%; top: 52%; transform: scale(0.7) rotate(5deg); }
  50%  { left: 58%; top: 62%; transform: scale(0.7) rotate(-6deg); }
  75%  { left: 85%; top: 55%; transform: scale(0.7) rotate(4deg); }
  100% { left: 115%; top: 58%; transform: scale(0.7) rotate(-5deg); }
}
@keyframes flap {
  0%, 100% { transform: scaleY(1) scaleX(1); }
  50%       { transform: scaleY(1.08) scaleX(0.98); }
}

/* トップ用: common.css の body を上書き */
body {
  overflow: hidden;
  background: linear-gradient(180deg,
    #87CEEB 0%,
    #B0E0E6 25%,
    #E0F4FF 50%,
    #B0E0E6 75%,
    #87CEEB 100%);
  background-size: 100% 400%;
}
body.night-mode {
  background: linear-gradient(180deg, #0a0e1a 0%, #12162a 35%, #0d1120 70%, #0a0e1a 100%);
}

/* ---------- Content ---------- */
.content {
  position: relative;
  z-index: 5;
  overflow: visible;
}
/* 夜: 従来どおり 1 画面で中央配置 */
body.night-mode .content {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
}
/* 昼: 縦スクロールは .day-scroll-stack 内のみ（body は overflow:hidden のまま） */
body:not(.night-mode) .content {
  height: 100vh;
  height: 100dvh;
  padding: 0;
  box-sizing: border-box;
}
.day-scroll-stack {
  height: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
/* 縦線 | のタイプ完了まで次セクションへスクロール不可 */
.day-scroll-stack.is-scroll-locked {
  overflow-y: hidden;
  overscroll-behavior: none;
}
.day-scroll-stack.is-game-active {
  overflow-y: hidden;
  overscroll-behavior: none;
  touch-action: none;
}
@media (prefers-reduced-motion: reduce) {
  .day-scroll-stack { scroll-snap-type: none; }
}
.hero-snap {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2rem;
  box-sizing: border-box;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.hero-snap-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 4rem);
  min-height: calc(100dvh - 4rem);
  width: 100%;
  transform-origin: center center;
  will-change: transform, opacity;
}
.business-snap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2rem;
  box-sizing: border-box;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.business-snap-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 48rem);
  min-height: calc(100vh - 4rem);
  min-height: calc(100dvh - 4rem);
  text-align: center;
}
.business-link-wrap {
  position: relative;
  width: clamp(14rem, 52vw, 29rem);
}
.business-link {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #171b1e;
  cursor: pointer;
}
.business-link:focus-visible {
  outline: 2px solid rgba(26, 58, 82, 0.72);
  outline-offset: 0.5rem;
}
.business-logo {
  display: block;
  width: 100%;
  height: auto;
}
.business-confirm {
  position: absolute;
  z-index: 5;
  top: calc(100% + 0.8rem);
  right: -4rem;
  display: flex;
  width: max-content;
  max-width: calc(100vw - 2rem);
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(23, 27, 30, 0.22);
  align-items: center;
  gap: 0.55rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0.55rem 1.5rem rgba(23, 27, 30, 0.1);
  color: #171b1e;
  font-size: 0.7rem;
  letter-spacing: 0.035em;
  white-space: nowrap;
}
.business-confirm[hidden] {
  display: none;
}
.business-confirm p {
  margin: 0;
}
.business-confirm-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.business-confirm button,
.business-confirm a {
  padding: 0.18rem 0.1rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.business-confirm button:hover,
.business-confirm a:hover {
  color: rgba(26, 58, 82, 0.72);
}
.business-confirm button:focus-visible,
.business-confirm a:focus-visible {
  outline: 1px solid rgba(26, 58, 82, 0.72);
  outline-offset: 0.2rem;
}
@media (max-width: 600px) {
  .business-confirm {
    top: calc(100% + 0.65rem);
    right: -2.75rem;
    width: min(15rem, calc(100vw - 2rem));
    justify-content: space-between;
    gap: 0.55rem;
    white-space: normal;
  }
  .business-confirm p {
    text-align: left;
  }
  .business-confirm > span {
    display: none;
  }
  .business-confirm-actions {
    flex: 0 0 auto;
  }
}
.night-hero-stack {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* 3D: ロゴの rotateY を奥行き付きで見せる */
  perspective: 1100px;
  -webkit-perspective: 1100px;
}

.logo {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}
/* 昼: テキスト「Omna」表示 */
.logo-text {
  display: block;
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #1a3a52;
  text-shadow: 0 2px 20px rgba(255, 255, 255, 0.4);
}
body.night-mode .night-hero-stack .logo {
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}
/* 回転で細く見えてもスワイプ判定が一定幅・高さを確保（内側は pointer-events なし） */
.night-logo-hit-area {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: min(92vw, 380px);
  min-height: min(46vh, 360px);
  max-width: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.night-logo-hit-area:active {
  cursor: grabbing;
}
/* 縦軸（Y）まわりの横回転 ― コインのように見える */
.night-logo-spin-layer {
  position: relative;
  display: inline-block;
  transform-origin: center center;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  -webkit-backface-visibility: visible;
  backface-visibility: visible;
  filter: brightness(1) drop-shadow(0 0 0 rgba(180, 210, 255, 0));
  transition: filter 2.4s cubic-bezier(0.22, 0.61, 0.36, 1);
  pointer-events: none;
}
.night-logo-spin-layer::before,
.night-logo-spin-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: url('../images/omna_logo-a.svg') center / contain no-repeat;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  transform-origin: center center;
  will-change: transform, opacity, filter;
}
.night-logo-spin-layer .logo-img {
  position: relative;
  z-index: 1;
  display: block;
  pointer-events: none;
}
.logo-img {
  height: clamp(126px, 27vw, 235px);
  width: auto;
  filter: drop-shadow(0 2px 20px rgba(255, 255, 255, 0.4));
}
/* タイプライター式ターミナルテキスト
   absolute にしてロゴの位置に影響させない */
.tagline {
  position: absolute;
  /* ロゴの下端 = コンテナ中心(50%) + ロゴ半高さ + マージン */
  top: calc(50% + clamp(1.4rem, 4.5vw, 2.5rem) + 1rem);
  left: 50%;
  transform: translateX(-50%);
  width: 16rem;
  max-width: calc(100vw - 4rem);
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(0.78rem, 1.9vw, 0.95rem);
  font-weight: 400;
  line-height: 1.85;
  color: #1a3a52;
  text-align: center;
  white-space: normal;
}
@media (min-width: 900px) {
  .tagline {
    width: 22rem;
  }
}
/* ブリンクカーソル（█） */
.terminal-cursor {
  display: inline-block;
  width: 0.58em;
  height: 1.05em;
  background: rgba(26, 58, 82, 0.82);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: cursor-blink 1s step-end infinite;
}
.hero-snap .terminal-cursor {
  transition:
    width 360ms cubic-bezier(0.22, 0.61, 0.36, 1),
    height 360ms cubic-bezier(0.22, 0.61, 0.36, 1),
    border-radius 360ms cubic-bezier(0.22, 0.61, 0.36, 1),
    background 360ms ease,
    box-shadow 360ms ease,
    clip-path 360ms ease,
    -webkit-clip-path 360ms ease,
    transform 260ms ease;
}
/* 最下行到達後: 同じ箱のまま下向き矢印頭（逆三角形）に切り抜き */
.terminal-cursor.terminal-cursor--triangle {
  -webkit-clip-path: polygon(0 0, 100% 0, 50% 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.hero-snap .terminal-cursor.terminal-cursor--triangle {
  cursor: pointer;
  touch-action: none;
}
.hero-breakout-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  touch-action: none;
  z-index: 14;
  opacity: 0;
  transition: opacity 220ms ease;
}
.hero-breakout-overlay.is-visible {
  opacity: 1;
}
.hero-breakout-frame {
  position: absolute;
  left: 12px;
  width: calc(100% - 24px);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  overflow: hidden;
}
.hero-breakout-blocks {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.hero-breakout-char {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: center center;
  will-change: opacity, transform;
  transition: opacity 140ms ease, transform 140ms ease;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
.hero-breakout-char.is-gone {
  opacity: 0;
  transform: scale(0.82);
}
.hero-breakout-svg {
  display: block;
  width: 100%;
  height: 100%;
}
.hero-breakout-stroke {
  fill: none;
  stroke: rgba(26, 58, 82, 0.82);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.hero-breakout-status {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  /* 文章は左寄せ、ブロック自体は中央へ（絶対配置の shrink-to-fit を活かす） */
  width: auto;
  max-width: calc(100% - 24px);
  box-sizing: border-box;
  padding: 0 8px;
  color: rgba(245, 251, 255, 0.99);
  text-shadow: 0 0 10px rgba(8, 16, 24, 0.75);
  font: 700 clamp(0.58rem, 2.5vw, 0.92rem)/1.35 'Courier New', Courier, monospace;
  letter-spacing: 0.04em;
  text-align: left;
  white-space: pre-line;
  overflow-wrap: normal;
  word-break: normal;
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}
.hero-breakout-inline-cursor {
  display: inline-block;
  width: 0.66em;
  height: 1.08em;
  background: rgba(245, 251, 255, 0.92);
  vertical-align: -0.12em;
  margin-right: 0.3em;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
  animation: cursor-blink 1s step-end infinite;
}
.hero-breakout-status.is-visible {
  opacity: 1;
}
.hero-breakout-dim {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background: rgba(7, 12, 18, 0.56);
  transition: opacity 220ms ease;
}
.hero-breakout-dim.is-visible {
  opacity: 1;
}
.hero-snap .terminal-cursor.is-breakout-paddle {
  width: clamp(54px, 18vw, 92px);
  height: clamp(10px, 2.1vw, 14px);
  margin-left: 0;
  border-radius: 999px;
  animation: none;
  -webkit-clip-path: none;
  clip-path: none;
  background: linear-gradient(180deg, rgba(26, 58, 82, 0.95), rgba(26, 58, 82, 0.74));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.24) inset;
  vertical-align: middle;
  cursor: default;
}
.hero-snap .terminal-cursor.is-breakout-paddle.is-game-control {
  transition: none !important;
}
.pipe-dot {
  display: inline-block;
  width: 0.09em;
  height: 0.9em;
  border-radius: 50%;
  background: rgba(26, 58, 82, 0.74);
  vertical-align: middle;
  transform: translateY(-0.03em);
  transition:
    width 340ms cubic-bezier(0.22, 0.61, 0.36, 1),
    height 340ms cubic-bezier(0.22, 0.61, 0.36, 1),
    border-radius 340ms ease,
    opacity 220ms ease;
}
.pipe-dot.is-dot-ready {
  width: 0.34em;
  height: 0.34em;
  border-radius: 50%;
}
.pipe-dot.is-game-ball {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  margin: 0;
  opacity: 1;
  transition: none;
  transform: translate(0, 0);
  pointer-events: none;
  z-index: 2;
}
body.top-breakout-active #menu-wrap,
body.top-breakout-active #menu-trigger,
body.top-breakout-active #menu-panel,
body.top-breakout-active #menu-overlay {
  pointer-events: none !important;
}
body.top-breakout-active .logo-text,
body.top-breakout-active #terminal-text {
  color: transparent !important;
  text-shadow: none !important;
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* スクロールヒントはタイプライターの続きとして表示 */

/* ---------- Night Mode (18:00–6:00) ---------- */
body.night-mode {
  background: linear-gradient(180deg, #0a0e1a 0%, #12162a 35%, #0d1120 70%, #0a0e1a 100%);
}
/* ロゴ・夜専用スタイル（表示制御は top-night-only クラスで行う） */
body.night-mode .logo-img {
  height: clamp(102px, 22vw, 196px);
  will-change: transform;
  animation: logo-drift 38s ease-in-out infinite;
}
body.night-mode .logo img {
  filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.12))
          drop-shadow(0 0 0 rgba(150, 190, 255, 0));
  transition: filter 2.8s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.night-logo-hit-area.is-da-capo-playing .night-logo-spin-layer {
  filter: brightness(1.08) drop-shadow(0 0 18px rgba(180, 210, 255, 0.24));
}
.night-logo-hit-area.is-da-capo-playing .logo-img {
  filter: drop-shadow(0 0 34px rgba(255, 255, 255, 0.22))
          drop-shadow(0 0 64px rgba(150, 190, 255, 0.2));
}

/* 無重力っぽい漂い（上下だけでなく全体的に） */
@keyframes logo-drift {
  0%   { transform: translate3d(0, 0, 0) rotate(-0.18deg); }
  20%  { transform: translate3d(3px, -3px, 0) rotate(0.06deg); }
  45%  { transform: translate3d(-3px, 1.5px, 0) rotate(0.14deg); }
  70%  { transform: translate3d(2.4px, 3px, 0) rotate(-0.08deg); }
  100% { transform: translate3d(0, 0, 0) rotate(-0.18deg); }
}

/* 夜空: 表示制御は top-night-only クラスで行う */
.night-sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

/* 夜ロゴを連続回転したときのワープ演出 */
.night-warp-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  opacity: 0;
  mix-blend-mode: screen;
  will-change: opacity;
}

/* 色は入口の気配としてだけ残し、最後は必ず黒へ沈ませる。 */
.night-portal-color-field {
  position: fixed;
  inset: 0;
  z-index: 7;
  background:
    radial-gradient(circle at 28% 31%, rgba(244, 234, 168, 0.96) 0 8%, rgba(246, 209, 160, 0.7) 25%, transparent 55%),
    radial-gradient(circle at 72% 32%, rgba(163, 214, 215, 0.96) 0 10%, rgba(153, 185, 170, 0.72) 28%, transparent 58%),
    radial-gradient(circle at 31% 73%, rgba(176, 152, 201, 0.9) 0 11%, rgba(164, 167, 217, 0.68) 30%, transparent 60%),
    radial-gradient(circle at 74% 72%, rgba(234, 157, 164, 0.9) 0 9%, rgba(218, 156, 139, 0.7) 29%, transparent 59%),
    linear-gradient(135deg, #d09bbf 0%, #a3d6d7 38%, #f4eaa8 66%, #e98c8d 100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  filter: saturate(0.9);
  will-change: opacity;
}

/* はっきりした円ではなく、ロゴの奥で揺らぐ不定形な光として見せる。 */
.night-portal-aura {
  position: fixed;
  left: calc(var(--night-portal-x, 50vw) + var(--night-portal-shift-x, 0px));
  top: calc(var(--night-portal-y, 50vh) + var(--night-portal-shift-y, 0px));
  width: 76vmin;
  height: 76vmin;
  z-index: 8;
  border-radius: 47% 53% 56% 44% / 52% 44% 56% 48%;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 22%, rgba(181, 225, 232, 0.12) 35%, rgba(201, 166, 222, 0.2) 47%, transparent 69%),
    conic-gradient(from 18deg, transparent 0 9%, rgba(170, 219, 226, 0.34) 17%, transparent 29%, rgba(236, 174, 203, 0.28) 43%, transparent 58%, rgba(241, 220, 162, 0.24) 72%, transparent 87%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  mix-blend-mode: screen;
  filter: blur(15px) saturate(1.25);
  transform: translate3d(-50%, -50%, 0) scale(0.42) rotate(0deg);
  will-change: transform, opacity, filter;
}

/* 周辺から暗さを閉じ、中央の一点へ視線と奥行きを集める。 */
.night-portal-vignette {
  position: fixed;
  inset: 0;
  z-index: 11;
  overflow: hidden;
  background: radial-gradient(
    circle at calc(var(--night-portal-x, 50vw) + var(--night-portal-shift-x, 0px))
              calc(var(--night-portal-y, 50vh) + var(--night-portal-shift-y, 0px)),
    transparent 0 13%,
    rgba(1, 3, 10, 0.05) 31%,
    rgba(0, 0, 4, 0.44) 67%,
    rgba(0, 0, 0, 0.92) 100%
  );
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  will-change: opacity;
}

.night-portal-blackout {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  will-change: opacity;
}

body.night-portal-active {
  cursor: default;
  touch-action: none;
  overscroll-behavior: none;
}

body.night-portal-active .night-stars {
  transform-origin: var(--night-portal-x, 50vw) var(--night-portal-y, 50vh);
  animation:
    night-sky-tunnel 4.6s cubic-bezier(0.32, 0.02, 0.64, 0.92) forwards,
    night-sky-fade 4.6s linear forwards;
  will-change: transform, opacity;
}

body.night-portal-active .night-stars .star {
  animation-play-state: paused;
}

body.night-portal-active .night-warp-canvas {
  animation: night-warp-canvas-in 4.9s linear forwards;
}

body.night-portal-active .shooting-stars-container {
  opacity: 0;
  transition: opacity 420ms ease;
}

body.night-portal-active .night-logo-hit-area {
  position: relative;
  z-index: 10;
  pointer-events: none;
  transform-origin:
    var(--night-logo-origin-x, 50%)
    var(--night-logo-origin-y, 50%);
  animation:
    night-logo-dive 4.6s cubic-bezier(0.38, 0.02, 0.7, 0.78) forwards,
    night-logo-fade 4.6s linear forwards;
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

body.night-portal-active .night-logo-spin-layer {
  animation: night-logo-eclipse-glow 4.6s linear forwards;
}

body.night-portal-active .night-logo-spin-layer::before {
  animation: night-logo-velocity-smear-left 4.6s linear forwards;
}

body.night-portal-active .night-logo-spin-layer::after {
  animation: night-logo-velocity-smear-right 4.6s linear forwards;
}

body.night-portal-active .night-logo-hit-area .logo-img {
  animation: night-logo-chromatic-edge 4.6s linear forwards;
}

body.night-portal-active #menu-wrap,
body.night-portal-active .mode-toggle-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 360ms ease;
}

body.night-portal-active .night-portal-color-field {
  visibility: visible;
  animation: night-portal-color-field 4.9s linear forwards;
}

body.night-portal-active .night-portal-aura {
  visibility: visible;
  animation: night-portal-aura 4.9s cubic-bezier(0.3, 0.05, 0.62, 0.96) forwards;
}

body.night-portal-active .night-portal-vignette {
  visibility: visible;
  animation: night-portal-vignette 4.6s linear forwards;
}

body.night-portal-active .night-portal-blackout {
  visibility: visible;
  pointer-events: auto;
  animation: night-portal-blackout 4.9s linear forwards;
}

@keyframes night-sky-tunnel {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  100% {
    transform:
      translate3d(var(--night-portal-shift-x, 0px), var(--night-portal-shift-y, 0px), 0)
      scale(7.2);
  }
}

@keyframes night-sky-fade {
  0%, 76% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes night-warp-canvas-in {
  0%, 9% { opacity: 0; }
  30%  { opacity: 0.2; }
  68%  { opacity: 0.78; }
  88%  { opacity: 0.62; }
  100% { opacity: 0; }
}

@keyframes night-logo-dive {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  100% {
    transform:
      translate3d(var(--night-portal-shift-x, 0px), var(--night-portal-shift-y, 0px), 0)
      scale(26);
  }
}

/* 拡大したロゴが静止画として見える前に、回転したまま視界から抜ける。 */
@keyframes night-logo-fade {
  0%, 72% { opacity: 1; }
  90%, 100% { opacity: 0; }
}

@keyframes night-portal-color-field {
  0%, 42% { opacity: 0; }
  61%     { opacity: 0.05; }
  78%     { opacity: 0.2; }
  91%     { opacity: 0.1; }
  100%    { opacity: 0; }
}

@keyframes night-portal-aura {
  0%, 13% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(0.42) rotate(0deg);
    filter: blur(18px) saturate(1.05);
  }
  36% {
    opacity: 0.24;
    transform: translate3d(-50%, -50%, 0) scale(0.72) rotate(31deg);
  }
  69% {
    opacity: 0.72;
    transform: translate3d(-50%, -50%, 0) scale(1.48) rotate(112deg);
    filter: blur(12px) saturate(1.45);
  }
  88% {
    opacity: 0.38;
    transform: translate3d(-50%, -50%, 0) scale(2.32) rotate(185deg);
  }
  100% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(3.15) rotate(238deg);
    filter: blur(22px) saturate(1.2);
  }
}

@keyframes night-portal-vignette {
  0%, 20% { opacity: 0; }
  50%     { opacity: 0.2; }
  76%     { opacity: 0.64; }
  92%, 100% { opacity: 1; }
}

@keyframes night-logo-eclipse-glow {
  0%, 22% { filter: brightness(1) saturate(1); }
  52% {
    filter: brightness(1.07) saturate(1.08)
            drop-shadow(0 0 9px rgba(171, 222, 231, 0.32));
  }
  77% {
    filter: brightness(1.2) saturate(1.3) blur(0.7px)
            drop-shadow(0 0 17px rgba(206, 170, 224, 0.43))
            drop-shadow(0 0 32px rgba(124, 191, 222, 0.22));
  }
  92%, 100% {
    filter: brightness(1.26) saturate(1.52) contrast(1.08) blur(3.2px)
            drop-shadow(0 0 26px rgba(229, 170, 206, 0.35))
            drop-shadow(0 0 48px rgba(132, 203, 222, 0.2));
  }
}

@keyframes night-logo-velocity-smear-left {
  0%, 46% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scaleX(1);
    filter: blur(0) brightness(1);
  }
  61% {
    opacity: 0.16;
    transform: translate3d(-2.5%, 0, 0) scaleX(1.16);
    filter: blur(3px) brightness(1.18) hue-rotate(-12deg);
  }
  74% {
    opacity: 0.42;
    transform: translate3d(-8%, 0, 0) scaleX(1.52);
    filter: blur(9px) brightness(1.4) hue-rotate(-18deg);
  }
  86%, 100% {
    opacity: 0.68;
    transform: translate3d(-17%, 0, 0) scaleX(2.14);
    filter: blur(17px) brightness(1.62) hue-rotate(-24deg);
  }
}

@keyframes night-logo-velocity-smear-right {
  0%, 50% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scaleX(1);
    filter: blur(0) brightness(1);
  }
  65% {
    opacity: 0.14;
    transform: translate3d(3%, 0, 0) scaleX(1.2);
    filter: blur(4px) brightness(1.2) hue-rotate(14deg);
  }
  77% {
    opacity: 0.38;
    transform: translate3d(9%, 0, 0) scaleX(1.58);
    filter: blur(10px) brightness(1.44) hue-rotate(20deg);
  }
  86%, 100% {
    opacity: 0.64;
    transform: translate3d(18%, 0, 0) scaleX(2.24);
    filter: blur(19px) brightness(1.68) hue-rotate(27deg);
  }
}

@keyframes night-logo-chromatic-edge {
  0%, 39% {
    opacity: 1;
    transform: scaleX(1);
    filter: none;
  }
  61% {
    opacity: 0.94;
    transform: scaleX(1.01);
    filter: drop-shadow(1.2px 0 rgba(237, 168, 201, 0.28))
            drop-shadow(-1.2px 0 rgba(146, 220, 229, 0.28));
  }
  76% {
    opacity: 0.7;
    transform: scaleX(1.07);
    filter: blur(0.8px)
            drop-shadow(3.6px 0 rgba(237, 168, 201, 0.44))
            drop-shadow(-3.6px 0 rgba(146, 220, 229, 0.42));
  }
  100% {
    opacity: 0.28;
    transform: scaleX(1.24);
    filter: blur(4.5px) brightness(1.38)
            drop-shadow(8px 0 rgba(237, 168, 201, 0.42))
            drop-shadow(-8px 0 rgba(146, 220, 229, 0.4));
  }
}

@keyframes night-portal-blackout {
  0%, 68% { opacity: 0; }
  82%     { opacity: 0.14; }
  92%     { opacity: 0.58; }
  99%, 100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body.night-portal-active .night-stars,
  body.night-portal-active .night-warp-canvas,
  body.night-portal-active .night-logo-hit-area,
  body.night-portal-active .night-portal-color-field,
  body.night-portal-active .night-portal-aura,
  body.night-portal-active .night-portal-vignette {
    animation-duration: 1.1s;
  }
  body.night-portal-active .night-portal-blackout {
    animation: night-portal-blackout-reduced 1.25s linear forwards;
  }
  body.night-portal-active .night-logo-spin-layer::before,
  body.night-portal-active .night-logo-spin-layer::after {
    animation: none;
  }
  @keyframes night-portal-blackout-reduced {
    0%, 42% { opacity: 0; }
    88%, 100% { opacity: 1; }
  }
}

/* Night: Twinkling stars */
.night-stars {
  position: absolute;
  inset: 0;
}

.night-stars .star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 4px rgba(255,255,255,0.6);
  animation: star-sway 2.5s ease-in-out infinite;
}

@keyframes star-sway {
  0%, 100% { opacity: 0.5; transform: scale(1); filter: brightness(0.8); }
  50%      { opacity: 1;   transform: scale(1.15); filter: brightness(1.2); }
}

.night-stars .star:nth-child(1)  { left: 6%;  top: 10%; width: 1px; height: 1px; opacity: 0.9; animation-duration: 2.2s; animation-delay: 0s;    box-shadow: 0 0 3px #fff; }
.night-stars .star:nth-child(2)  { left: 18%; top: 6%;  width: 2px; height: 2px; opacity: 0.6; animation-duration: 2.8s; animation-delay: 0.3s;  box-shadow: 0 0 5px rgba(255,255,255,0.8); }
.night-stars .star:nth-child(3)  { left: 28%; top: 14%; width: 1px; height: 1px; opacity: 1;   animation-duration: 2.5s; animation-delay: 0.6s;  box-shadow: 0 0 4px #fff; }
.night-stars .star:nth-child(4)  { left: 42%; top: 8%;  width: 3px; height: 3px; opacity: 0.75; animation-duration: 3s;   animation-delay: 0.1s;  box-shadow: 0 0 8px rgba(255,255,255,0.9); }
.night-stars .star:nth-child(5)  { left: 55%; top: 12%; width: 1px; height: 1px; opacity: 0.55; animation-duration: 2.3s; animation-delay: 0.5s;  box-shadow: 0 0 3px #fff; }
.night-stars .star:nth-child(6)  { left: 68%; top: 18%; width: 2px; height: 2px; opacity: 0.85; animation-duration: 2.7s; animation-delay: 0.8s;  box-shadow: 0 0 6px #fff; }
.night-stars .star:nth-child(7)  { left: 82%; top: 9%;  width: 1px; height: 1px; opacity: 0.7;  animation-duration: 2.4s; animation-delay: 0.2s;  box-shadow: 0 0 4px #fff; }
.night-stars .star:nth-child(8)  { left: 92%; top: 15%; width: 2px; height: 2px; opacity: 0.65; animation-duration: 2.9s; animation-delay: 0.4s;  box-shadow: 0 0 5px rgba(255,255,255,0.7); }
.night-stars .star:nth-child(9)  { left: 12%; top: 28%; width: 1px; height: 1px; opacity: 0.8;  animation-duration: 2.6s; animation-delay: 0.7s;  box-shadow: 0 0 3px #fff; }
.night-stars .star:nth-child(10) { left: 35%; top: 24%; width: 2px; height: 2px; opacity: 0.5;  animation-duration: 3.1s; animation-delay: 0s;    box-shadow: 0 0 6px rgba(255,255,255,0.6); }
.night-stars .star:nth-child(11) { left: 58%; top: 30%; width: 1px; height: 1px; opacity: 0.95; animation-duration: 2.2s; animation-delay: 0.35s; box-shadow: 0 0 4px #fff; }
.night-stars .star:nth-child(12) { left: 75%; top: 22%; width: 3px; height: 3px; opacity: 0.7;  animation-duration: 2.8s; animation-delay: 0.55s; box-shadow: 0 0 9px rgba(255,255,255,0.85); }
.night-stars .star:nth-child(13) { left: 8%;  top: 42%; width: 2px; height: 2px; opacity: 0.6;  animation-duration: 2.5s; animation-delay: 0.2s;  box-shadow: 0 0 5px #fff; }
.night-stars .star:nth-child(14) { left: 22%; top: 38%; width: 1px; height: 1px; opacity: 0.9;  animation-duration: 2.9s; animation-delay: 0.9s;  box-shadow: 0 0 3px #fff; }
.night-stars .star:nth-child(15) { left: 48%; top: 45%; width: 1px; height: 1px; opacity: 0.65; animation-duration: 2.3s; animation-delay: 0.45s; box-shadow: 0 0 4px #fff; }
.night-stars .star:nth-child(16) { left: 62%; top: 40%; width: 2px; height: 2px; opacity: 0.8;  animation-duration: 2.7s; animation-delay: 0.65s; box-shadow: 0 0 6px rgba(255,255,255,0.75); }
.night-stars .star:nth-child(17) { left: 88%; top: 48%; width: 1px; height: 1px; opacity: 0.55; animation-duration: 2.4s; animation-delay: 0.15s; box-shadow: 0 0 3px #fff; }
.night-stars .star:nth-child(18) { left: 15%; top: 58%; width: 2px; height: 2px; opacity: 0.75; animation-duration: 3s;   animation-delay: 0.5s;  box-shadow: 0 0 5px #fff; }
.night-stars .star:nth-child(19) { left: 38%; top: 55%; width: 1px; height: 1px; opacity: 0.85; animation-duration: 2.6s; animation-delay: 0.75s; box-shadow: 0 0 4px #fff; }
.night-stars .star:nth-child(20) { left: 52%; top: 62%; width: 2px; height: 2px; opacity: 0.6;  animation-duration: 2.8s; animation-delay: 0.25s; box-shadow: 0 0 6px rgba(255,255,255,0.7); }
.night-stars .star:nth-child(21) { left: 72%; top: 58%; width: 1px; height: 1px; opacity: 0.95; animation-duration: 2.2s; animation-delay: 0.6s;  box-shadow: 0 0 4px #fff; }
.night-stars .star:nth-child(22) { left: 5%;  top: 72%; width: 1px; height: 1px; opacity: 0.7;  animation-duration: 2.5s; animation-delay: 0.4s;  box-shadow: 0 0 3px #fff; }
.night-stars .star:nth-child(23) { left: 25%; top: 68%; width: 3px; height: 3px; opacity: 0.65; animation-duration: 2.9s; animation-delay: 0.1s;  box-shadow: 0 0 8px rgba(255,255,255,0.8); }
.night-stars .star:nth-child(24) { left: 45%; top: 75%; width: 1px; height: 1px; opacity: 0.9;  animation-duration: 2.4s; animation-delay: 0.7s;  box-shadow: 0 0 4px #fff; }
.night-stars .star:nth-child(25) { left: 65%; top: 70%; width: 2px; height: 2px; opacity: 0.5;  animation-duration: 2.6s; animation-delay: 0.3s;  box-shadow: 0 0 5px #fff; }
.night-stars .star:nth-child(26) { left: 85%; top: 78%; width: 1px; height: 1px; opacity: 0.8;  animation-duration: 2.3s; animation-delay: 0.55s; box-shadow: 0 0 3px #fff; }
.night-stars .star:nth-child(27) { left: 30%; top: 12%; width: 1px; height: 1px; opacity: 0.6;  animation-duration: 3s;   animation-delay: 0.2s;  box-shadow: 0 0 3px #fff; }
.night-stars .star:nth-child(28) { left: 78%; top: 35%; width: 2px; height: 2px; opacity: 0.85; animation-duration: 2.4s; animation-delay: 0.8s;  box-shadow: 0 0 6px #fff; }
.night-stars .star:nth-child(29) { left: 50%; top: 18%; width: 1px; height: 1px; opacity: 0.55; animation-duration: 2.7s; animation-delay: 0.5s;  box-shadow: 0 0 4px #fff; }
.night-stars .star:nth-child(30) { left: 10%; top: 48%; width: 2px; height: 2px; opacity: 0.75; animation-duration: 2.5s; animation-delay: 0.35s; box-shadow: 0 0 5px rgba(255,255,255,0.65); }
.night-stars .star:nth-child(31) { left: 95%; top: 55%; width: 1px; height: 1px; opacity: 0.65; animation-duration: 2.8s; animation-delay: 0.6s;  box-shadow: 0 0 3px #fff; }
.night-stars .star:nth-child(32) { left: 40%; top: 65%; width: 1px; height: 1px; opacity: 0.9;  animation-duration: 2.2s; animation-delay: 0.1s;  box-shadow: 0 0 4px #fff; }
.night-stars .star:nth-child(33) { left: 90%; top: 28%; width: 2px; height: 2px; opacity: 0.7;  animation-duration: 2.6s; animation-delay: 0.45s; box-shadow: 0 0 5px #fff; }
.night-stars .star:nth-child(34) { left: 2%;  top: 22%; width: 1px; height: 1px; opacity: 0.8;  animation-duration: 2.9s; animation-delay: 0.7s;  box-shadow: 0 0 3px #fff; }
.night-stars .star:nth-child(35) { left: 60%; top: 8%;  width: 2px; height: 2px; opacity: 0.6;  animation-duration: 2.3s; animation-delay: 0.25s; box-shadow: 0 0 6px #fff; }
.night-stars .star:nth-child(36) { left: 18%; top: 78%; width: 1px; height: 1px; opacity: 0.85; animation-duration: 2.5s; animation-delay: 0.55s; box-shadow: 0 0 4px #fff; }
.night-stars .star:nth-child(37) { left: 55%; top: 82%; width: 2px; height: 2px; opacity: 0.5;  animation-duration: 2.7s; animation-delay: 0.15s; box-shadow: 0 0 5px #fff; }
.night-stars .star:nth-child(38) { left: 32%; top: 48%; width: 1px; height: 1px; opacity: 0.95; animation-duration: 2.4s; animation-delay: 0.9s;  box-shadow: 0 0 4px #fff; }
.night-stars .star:nth-child(39) { left: 70%; top: 52%; width: 2px; height: 2px; opacity: 0.7;  animation-duration: 2.6s; animation-delay: 0.4s;  box-shadow: 0 0 6px rgba(255,255,255,0.8); }
.night-stars .star:nth-child(40) { left: 14%; top: 35%; width: 3px; height: 3px; opacity: 0.65; animation-duration: 2.8s; animation-delay: 0.65s; box-shadow: 0 0 8px rgba(255,255,255,0.85); }

/* ---------- 流れ星 ---------- */
.shooting-stars-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}

.shooting-star {
  position: absolute;
  left: var(--meteor-start-x, 92vw);
  top: var(--meteor-start-y, 10vh);
  width: 0;
  height: 0;
  opacity: 0;
  will-change: transform, opacity;
  animation: meteor-run var(--meteor-duration, 0.82s) linear forwards;
}

.shooting-star::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: var(--meteor-length, 180px);
  height: var(--meteor-thickness, 1.4px);
  transform: translateY(-50%) rotate(var(--meteor-angle, 156deg));
  transform-origin: right center;
  border-radius: 999px;
  background:
    linear-gradient(90deg,
      rgba(255,255,255,0) 0%,
      var(--meteor-tail-faint, rgba(163, 202, 255, 0.04)) 18%,
      var(--meteor-tail-mid, rgba(184, 214, 255, 0.2)) 52%,
      var(--meteor-tail-bright, rgba(237, 247, 255, 0.78)) 86%,
      var(--meteor-tail-core, rgba(255,255,255,0.98)) 100%);
  filter:
    drop-shadow(0 0 var(--meteor-glow, 7px) var(--meteor-glow-color, rgba(175, 212, 255, 0.38)))
    blur(var(--meteor-blur, 0.08px));
}

.shooting-star::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: var(--meteor-head-size, 5px);
  height: var(--meteor-head-size, 5px);
  transform: translate(50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--meteor-head-core, #fff) 0 24%, var(--meteor-head-ring, rgba(224, 240, 255, 0.9)) 42%, var(--meteor-head-aura, rgba(139, 190, 255, 0.22)) 72%, transparent 100%);
  box-shadow:
    0 0 var(--meteor-head-glow, 6px) var(--meteor-head-glow-color, rgba(255, 255, 255, 0.7)),
    0 0 var(--meteor-head-glow-wide, 13px) var(--meteor-head-glow-wide-color, rgba(135, 187, 255, 0.28));
}

@keyframes meteor-run {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 0;
  }
  8% {
    opacity: var(--meteor-opacity-soft, 0.61);
  }
  16% {
    opacity: var(--meteor-opacity, 0.72);
  }
  76% {
    opacity: var(--meteor-opacity, 0.72);
  }
  100% {
    transform: translate3d(var(--meteor-x, -104vw), var(--meteor-y, 44vh), 0);
    opacity: 0;
  }
}

/* ---------- ギフト（風船・UFO）飛翔用：Omna・タグライン・メニューの裏を通る ---------- */
#gift-fly-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
}
.gift-fly-balloon {
  position: absolute;
  width: 52px;
  height: 52px;
  bottom: -80px;
  margin-left: -26px;
  animation: balloon-rise-sway 16s linear forwards;
}
.gift-fly-balloon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
@keyframes balloon-rise-sway {
  0%   { transform: translate(0, 0) rotate(-3deg); }
  20%  { transform: translate(12px, -20vh) rotate(2deg); }
  40%  { transform: translate(-10px, -40vh) rotate(-2deg); }
  60%  { transform: translate(14px, -60vh) rotate(1deg); }
  80%  { transform: translate(-8px, -80vh) rotate(-1deg); }
  100% { transform: translate(5px, -130vh) rotate(0deg); }
}
.gift-fly-ufo {
  position: absolute;
  width: 56px;
  height: 56px;
  margin-left: -28px;
  margin-top: -28px;
  opacity: 0;
  transition: opacity 1s ease-out, left 0.18s ease-out, top 0.18s ease-out;
}
.gift-fly-ufo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
@media (max-width: 767px) {
  .gift-fly-ufo {
    width: 36px;
    height: 36px;
    margin-left: -18px;
    margin-top: -18px;
  }
}

.mode-toggle-btn {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 52;
  width: 52px;
  height: 52px;
  border: none;
  padding: 0;
  background: transparent;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 120ms ease;
}
.mode-toggle-btn:active { transform: scale(0.96); }
.mode-toggle-btn img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
body.night-mode .mode-toggle-btn img {
  transform: rotate(180deg);
}
