:root {
  --bg: #070b14;
  --bg2: #0c1324;
  --panel: rgba(12, 22, 42, 0.72);
  --line: rgba(0, 240, 255, 0.18);
  --cyan: #00f0ff;
  --magenta: #ff2bd6;
  --text: #d7e3f4;
  --muted: #8a9bb8;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "Consolas", "Menlo", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.75;
  background:
    radial-gradient(ellipse at 15% -10%, rgba(255, 43, 214, 0.16), transparent 55%),
    radial-gradient(ellipse at 90% 0%, rgba(0, 240, 255, 0.14), transparent 50%),
    linear-gradient(var(--bg), var(--bg2));
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
}

/* 遠近のグリッド床 */
body::before {
  content: "";
  position: fixed;
  left: -50%;
  right: -50%;
  bottom: -10vh;
  height: 55vh;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: perspective(420px) rotateX(62deg);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, rgba(0,0,0,0.9), transparent 85%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.9), transparent 85%);
  pointer-events: none;
  z-index: 0;
}

/* うっすら走査線 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.025) 0 1px, transparent 1px 3px);
  pointer-events: none;
  z-index: 1;
}

.wrap {
  position: relative;
  z-index: 2;
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 22px 80px;
}

header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

header.site a { color: var(--muted); text-decoration: none; }
header.site a:hover { color: var(--cyan); }

.brand { letter-spacing: 0.08em; }
.brand b { color: var(--cyan); font-weight: 600; }

nav a + a { margin-left: 18px; }

.hero { padding: 72px 0 40px; }

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: var(--magenta);
  border: 1px solid rgba(255, 43, 214, 0.5);
  padding: 2px 10px;
  margin-bottom: 18px;
}

h1 {
  font-family: var(--mono);
  font-size: clamp(2.2rem, 7vw, 3.6rem);
  line-height: 1.1;
  margin: 0 0 18px;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 0 18px rgba(0, 240, 255, 0.55), 0 0 2px rgba(0, 240, 255, 0.9);
}

h1 .accent { color: var(--cyan); }

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 0.9em;
  margin-left: 6px;
  background: var(--magenta);
  vertical-align: -0.05em;
  box-shadow: 0 0 12px var(--magenta);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
}

.lead { font-size: 1.1rem; color: var(--text); max-width: 640px; }
.lead-ja { color: var(--muted); max-width: 640px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  padding: 22px 24px;
  margin: 26px 0;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.panel h2 {
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 10px;
}

.panel h2::before { content: "> "; color: var(--magenta); }

.panel p, .panel ul { margin: 0.4em 0; }
.panel ul { padding-left: 1.2em; }
.panel li { margin: 0.25em 0; }

.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--bg);
  background: var(--cyan);
  padding: 10px 20px;
  text-decoration: none;
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.45);
  transition: background 0.2s, box-shadow 0.2s;
}

.btn:hover { background: #fff; box-shadow: 0 0 26px rgba(0, 240, 255, 0.8); }

a { color: var(--cyan); }
a:hover { color: #fff; }

.doc h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }

.meta {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.ja { color: var(--muted); font-size: 0.92rem; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  color: var(--magenta);
}

footer.site {
  margin-top: 60px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

footer.site a { color: var(--muted); }
footer.site a:hover { color: var(--cyan); }

.cta { margin-top: 16px; }
.hero-doc { padding-bottom: 10px; }

/* ============================================================
   ネオンのちらつき・グリッチ・画面ノイズ
   ============================================================ */

/* 切れかけのネオン管 */
.neon { animation: neon-flicker 6.5s infinite; }

@keyframes neon-flicker {
  0%, 17%, 21%, 23.5%, 52%, 56%, 100% {
    opacity: 1;
    text-shadow: 0 0 18px rgba(0, 240, 255, 0.55), 0 0 2px rgba(0, 240, 255, 0.9), 0 0 42px rgba(0, 240, 255, 0.25);
  }
  18%, 22.5%, 54% { opacity: 0.45; text-shadow: none; }
  19.5%           { opacity: 0.85; text-shadow: 0 0 6px rgba(0, 240, 255, 0.4); }
}

.brand b { animation: neon-flicker 8s infinite 2.1s; }
.tag     { animation: tag-flicker 9s infinite 0.7s; }

@keyframes tag-flicker {
  0%, 40%, 43%, 100% { opacity: 1; box-shadow: 0 0 10px rgba(255, 43, 214, 0.35); }
  41%, 42.5%         { opacity: 0.35; box-shadow: none; }
}

/* グリッチ（マゼンタとシアンのズレ＋横ノイズ） */
.glitch {
  position: relative;
  display: inline-block;
  animation: glitch-skew 4.6s infinite steps(1);
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  text-shadow: none;
  opacity: 0;
}

.glitch::before { color: var(--magenta); animation: glitch-a 4.6s infinite steps(1); }
.glitch::after  { color: var(--cyan);    animation: glitch-b 4.6s infinite steps(1); }

@keyframes glitch-skew {
  0%, 88%, 96%, 100% { transform: none; }
  89%                { transform: translateX(2px) skewX(-6deg); }
  91%                { transform: translateX(-3px) skewX(4deg); }
  93%                { transform: translateX(1px) skewX(-2deg); }
}

@keyframes glitch-a {
  0%, 88%, 95%, 100% { opacity: 0; transform: none; clip-path: inset(0 0 100% 0); }
  89% { opacity: 0.9; transform: translate(-4px, -1px); clip-path: inset(8% 0 62% 0); }
  90.5% { opacity: 0.9; transform: translate(5px, 1px);  clip-path: inset(58% 0 18% 0); }
  92% { opacity: 0.9; transform: translate(-2px, 0);    clip-path: inset(32% 0 44% 0); }
  93.5% { opacity: 0.9; transform: translate(3px, -1px); clip-path: inset(75% 0 5% 0); }
}

@keyframes glitch-b {
  0%, 88%, 95%, 100% { opacity: 0; transform: none; clip-path: inset(0 0 100% 0); }
  89.5% { opacity: 0.9; transform: translate(4px, 1px);  clip-path: inset(40% 0 35% 0); }
  91% { opacity: 0.9; transform: translate(-5px, 0);   clip-path: inset(12% 0 70% 0); }
  92.5% { opacity: 0.9; transform: translate(2px, 1px);  clip-path: inset(66% 0 12% 0); }
  94% { opacity: 0.9; transform: translate(-3px, -1px); clip-path: inset(22% 0 58% 0); }
}

/* 画面全体の砂嵐（グリッチと同じタイミングで一瞬強くなる） */
html::after {
  content: "";
  position: fixed;
  inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.05;
  pointer-events: none;
  z-index: 3;
  animation: noise-move 0.45s steps(1) infinite, noise-burst 4.6s infinite steps(1);
}

@keyframes noise-move {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-6%, 4%); }
  40%  { transform: translate(5%, -7%); }
  60%  { transform: translate(-3%, 8%); }
  80%  { transform: translate(7%, 2%); }
  100% { transform: translate(-8%, -4%); }
}

@keyframes noise-burst {
  0%, 88%, 95%, 100% { opacity: 0.05; }
  89%, 91%, 93%      { opacity: 0.16; }
  90%, 92%           { opacity: 0.09; }
}

/* 動きを減らす設定の人には止める */
@media (prefers-reduced-motion: reduce) {
  .neon, .brand b, .tag, .glitch, .glitch::before, .glitch::after, html::after {
    animation: none !important;
  }
  .glitch::before, .glitch::after { display: none; }
}
