/* ==========================================================================
   THE DREAMSCAPE — game page
   Black page, animated wavy pastel texture (canvas) with glitch bands,
   scanlines, and black "game UI" panels on top.
   ========================================================================== */

@font-face { font-family: "Oyatsupokke"; src: url("../fonts/Oyatsupokke.woff2") format("woff2"); font-display: swap; }

:root {
  --pink: #e7a3d6;
  --violet: #b26fc7;
  --teal: #8fd3c8;
  --ice: #c9f2ef;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --dot: "DotGothic16", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif; /* full Japanese coverage */
  --title: "Oyatsupokke", "Space Grotesk", sans-serif;
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: #000; scroll-behavior: smooth; overflow-x: clip; -webkit-text-size-adjust: 100%; }
body { margin: 0; color: #fff; font-family: var(--dot); line-height: 1.9; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--ice); outline-offset: 3px; }
::selection { background: var(--pink); color: #000; }
html[lang="ja"] body [lang="en"], html[lang="en"] body [lang="ja"] { display: none !important; }

/* ---------- Background layers ---------- */
#dream-bg {
  position: fixed; inset: 0; z-index: -3; width: 100%; height: 100%;
  image-rendering: pixelated; opacity: 0.62; filter: saturate(1.1);
}
.vignette { position: fixed; inset: 0; z-index: -2; pointer-events: none; background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.85) 100%); }
.scanlines {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.35;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0 1px, transparent 1px 3px);
}

/* ---------- Top bar ---------- */
.d-top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 18px 12px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0));
  font-family: var(--mono); font-size: 0.8rem;
}
.d-back { text-decoration: none; padding: 6px 10px; border: 1px solid rgba(255, 255, 255, 0.5); background: rgba(0, 0, 0, 0.7); transition: background-color 0.2s, color 0.2s; }
.d-back:hover { background: #fff; color: #000; }
.d-lang { display: inline-flex; gap: 6px; padding: 6px 10px; border: 1px solid rgba(255, 255, 255, 0.5); background: rgba(0, 0, 0, 0.7); font-family: var(--mono); font-size: 0.8rem; }
.d-lang:hover { border-color: #fff; }
.d-lang-opt { opacity: 0.5; transition: opacity 0.2s, color 0.2s; }
html[lang="ja"] .d-lang-opt[data-l="ja"], html[lang="en"] .d-lang-opt[data-l="en"] { opacity: 1; color: var(--pink); }
.d-lang-sep { opacity: 0.4; }

/* ---------- Layout ---------- */
.d-main { width: min(100% - 36px, 1000px); margin: 0 auto; padding-bottom: 80px; }

.d-hero { min-height: calc(100svh - 70px); display: grid; place-content: center; justify-items: center; gap: 22px; text-align: center; padding: 40px 0; }
.d-kicker { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.14em; color: var(--ice); text-shadow: 0 0 8px rgba(143, 211, 200, 0.6); }
.d-sub { max-width: 34em; padding: 14px 18px; background: rgba(0, 0, 0, 0.78); border: 1px solid rgba(255, 255, 255, 0.3); font-size: 1rem; }

/* Glitch title: two coloured copies flicker and slice */
.d-title {
  position: relative; font-family: var(--title); font-weight: 400; line-height: 1.05; letter-spacing: 0.04em;
  font-size: clamp(2.2rem, 11vw, 7rem); white-space: nowrap;
  text-shadow: 0 0 18px rgba(231, 163, 214, 0.55);
}
.d-title::before, .d-title::after {
  content: attr(data-text); position: absolute; inset: 0; pointer-events: none;
}
.d-title::before { color: var(--pink); transform: translate(-3px, 0); mix-blend-mode: screen; animation: sliceA 3.2s steps(1) infinite; }
.d-title::after { color: var(--teal); transform: translate(3px, 0); mix-blend-mode: screen; animation: sliceB 2.7s steps(1) infinite; }
@keyframes sliceA {
  0%, 86%, 100% { clip-path: inset(100% 0 0 0); }
  88% { clip-path: inset(10% 0 62% 0); transform: translate(-8px, 0); }
  91% { clip-path: inset(55% 0 20% 0); transform: translate(6px, 0); }
  94% { clip-path: inset(30% 0 45% 0); transform: translate(-4px, 0); }
}
@keyframes sliceB {
  0%, 80%, 100% { clip-path: inset(100% 0 0 0); }
  82% { clip-path: inset(70% 0 5% 0); transform: translate(7px, 0); }
  85% { clip-path: inset(20% 0 60% 0); transform: translate(-6px, 0); }
  89% { clip-path: inset(45% 0 35% 0); transform: translate(4px, 0); }
}

/* ---------- Panels ---------- */
.d-panel {
  position: relative; margin-top: 56px; padding: 26px 20px 28px;
  background: rgba(0, 0, 0, 0.84); border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: -3px 0 0 rgba(231, 163, 214, 0.45), 3px 0 0 rgba(143, 211, 200, 0.45), 0 18px 40px rgba(0, 0, 0, 0.6);
}
.d-panel p + p { margin-top: 1em; }

/* Under construction */
.d-wip { text-align: center; padding-block: 48px; }
.d-wip-title { position: relative; display: inline-block; margin-bottom: 14px; font-family: var(--mono); font-size: clamp(1.3rem, 5.5vw, 2.4rem); letter-spacing: 0.12em; color: var(--ice); }
.d-wip-title::after { content: "_"; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.d-wip p { color: rgba(255, 255, 255, 0.75); }

.d-end { display: flex; justify-content: center; margin-top: 64px; }
.d-btn {
  padding: 14px 26px; border: 1px solid #fff; background: rgba(0, 0, 0, 0.8); font-family: var(--mono); font-size: 0.9rem; text-decoration: none;
  transition: background-color 0.25s, color 0.25s, box-shadow 0.25s;
}
.d-btn:hover { background: linear-gradient(90deg, var(--violet), var(--pink), var(--teal)); color: #000; box-shadow: 0 0 24px rgba(231, 163, 214, 0.5); }

.d-foot { padding: 24px 18px calc(24px + env(safe-area-inset-bottom, 0px)); text-align: center; font-family: var(--mono); font-size: 0.75rem; color: rgba(255, 255, 255, 0.6); }

/* reveal */
.js .d-panel { opacity: 0; translate: 0 24px; transition: opacity 0.8s var(--ease), translate 0.8s var(--ease); }
.js .d-panel.is-in { opacity: 1; translate: none; }

/* ---------- Desktop ---------- */
@media (min-width: 1025px) and (hover: hover) and (pointer: fine) {
  .d-top { padding-inline: 32px; }
  .d-panel { margin-top: 88px; padding: 40px 48px 44px; }
  .d-panel p { font-size: 1.08rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .d-title::before, .d-title::after, .d-wip-title::after { animation: none; }
  .js .d-panel { opacity: 1; translate: none; }
}

/* touch screens: 44px tall tap areas */
@media (pointer: coarse) {
  .d-back, .d-lang { min-height: 44px; display: inline-flex; align-items: center; }
}
