/* コード読解RPG / Code Reading RPG のサイト（tyefu.github.io/code-reading-rpg/）。
   外部の読み込み（フォント・解析・広告）は使わない。色はゲームの夕暮れの空と、光るコードの水色・金。 */
:root {
  --bg: #0f0c1d;
  --bg2: #171230;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.10);
  --fg: #ecebf5;
  --muted: #a3a0bd;
  --cyan: #9ff0ff;
  --cyan-deep: #3fb8e0;
  --gold: #ffd54a;
  --rose: #ff8f9c;
  --radius: 18px;
  --max: 1120px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 140, 90, 0.18), transparent 60%),
    radial-gradient(900px 500px at 0% 10%, rgba(120, 90, 255, 0.20), transparent 60%),
    linear-gradient(180deg, var(--bg2), var(--bg) 40%);
  background-attachment: fixed;
  color: var(--fg);
  font: 16px/1.8 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; height: auto; display: block; }
.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* 言語：html[data-lang] で片方だけ見せる（JS がなければ日本語） */
html[data-lang="ja"] [lang="en"]:not(html), html[data-lang="en"] [lang="ja"]:not(html) { display: none !important; }

/* ── ヘッダー ── */
.top {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: rgba(15, 12, 29, 0.72);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); font-weight: 700; letter-spacing: 0.02em; }
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.nav { display: flex; gap: 22px; margin-left: auto; font-size: 14px; }
.nav a { color: var(--muted); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); text-decoration: none; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.lang button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
  padding: 2px 12px; border-radius: 999px; cursor: pointer;
}
html[data-lang="ja"] .lang [data-set="ja"], html[data-lang="en"] .lang [data-set="en"] { background: var(--fg); color: var(--bg); }

/* ── 最初の画面 ── */
.hero { padding: 88px 0 56px; }
.hero .wrap { display: grid; grid-template-columns: 1.02fr 1fr; gap: 56px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--cyan);
  background: rgba(159, 240, 255, 0.08); border: 1px solid rgba(159, 240, 255, 0.25); padding: 4px 12px; border-radius: 999px;
}
.logo { width: min(100%, 480px); margin: 22px 0 18px; filter: drop-shadow(0 10px 30px rgba(63, 184, 224, 0.25)); }
.hero h1 { font-size: clamp(30px, 4.2vw, 46px); line-height: 1.25; margin: 0 0 14px; letter-spacing: -0.01em; }
.hero h1 em { white-space: nowrap; font-style: normal; background: linear-gradient(90deg, var(--cyan), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--muted); font-size: 17px; margin: 0 0 28px; max-width: 34em; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 22px; border-radius: 12px; font-weight: 700;
  background: var(--fg); color: var(--bg); border: 1px solid transparent;
}
.btn:hover { text-decoration: none; filter: brightness(0.95); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn[aria-disabled="true"] { cursor: default; opacity: 0.9; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.chip {
  font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.shot {
  position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--line);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.03);
  background: #000;
}
.shot::before {
  content: ""; display: block; height: 28px; background: linear-gradient(#2b2640, #221d36);
  border-bottom: 1px solid var(--line);
}
.shot::after {
  content: ""; position: absolute; top: 10px; left: 14px; width: 9px; height: 9px; border-radius: 50%;
  background: #ff6159; box-shadow: 15px 0 #ffbd2e, 30px 0 #28c941;
}
.hero .shot { transform: perspective(1400px) rotateY(-6deg) rotateX(2deg); }
.glow { position: relative; }
.glow::before {
  content: ""; position: absolute; inset: 8% 6%; z-index: -1; filter: blur(60px);
  background: radial-gradient(closest-side, rgba(63, 184, 224, 0.45), rgba(255, 213, 74, 0.15), transparent);
}

/* ── 数 ── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 8px 0 24px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.stat b { display: block; font-size: 30px; line-height: 1.2; letter-spacing: -0.02em; }
.stat span { color: var(--muted); font-size: 14px; }

/* ── 節 ── */
section.block { padding: 72px 0; }
.kicker { color: var(--gold); font-weight: 700; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; }
h2 { font-size: clamp(24px, 3vw, 34px); line-height: 1.35; margin: 8px 0 14px; letter-spacing: -0.01em; }
.sub { color: var(--muted); max-width: 40em; margin: 0 0 36px; }
.grid { display: grid; gap: 16px; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.four { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.card:hover { transform: translateY(-2px); background: var(--panel-strong); border-color: rgba(255, 255, 255, 0.16); }
.card h3 { margin: 12px 0 6px; font-size: 17px; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px;
  background: linear-gradient(135deg, rgba(159, 240, 255, 0.18), rgba(255, 213, 74, 0.12)); border: 1px solid var(--line);
}
.type .tag { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; color: var(--cyan); }

/* 3部 */
.parts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.part { position: relative; padding: 26px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.part::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--cyan), var(--gold)); }
.part .ch { font-family: ui-monospace, "SF Mono", Menlo, monospace; color: var(--muted); font-size: 13px; }
.part h3 { margin: 6px 0 10px; font-size: 19px; }
.part ul { margin: 0; padding-left: 1.1em; color: var(--muted); font-size: 14.5px; }

/* 画面写真 */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gallery figure { margin: 0; }
.gallery figcaption { color: var(--muted); font-size: 13.5px; margin-top: 10px; }
.gallery .shot::before { height: 20px; }
.gallery .shot::after { top: 6px; left: 10px; width: 7px; height: 7px; box-shadow: 11px 0 #ffbd2e, 22px 0 #28c941; }

/* 文章のページ（プライバシーポリシー・サポート） */
.doc { padding: 56px 0 80px; }
.doc .wrap { max-width: 820px; }
.doc h1 { font-size: clamp(28px, 4vw, 38px); margin: 10px 0 4px; letter-spacing: -0.01em; }
.doc .updated { color: var(--muted); font-size: 14px; margin: 0 0 32px; }
.doc .card { margin: 0 0 16px; }
.doc .card:hover { transform: none; }
.doc h2 { font-size: 20px; margin: 0 0 8px; }
.doc p, .doc li { color: #d6d4e6; }
.doc .card p:last-child, .doc .card ul:last-child { margin-bottom: 0; }
.doc ul { padding-left: 1.2em; }
.note { color: var(--muted); font-size: 14px; }
.contact {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between;
  background: linear-gradient(135deg, rgba(159, 240, 255, 0.10), rgba(255, 213, 74, 0.06));
}
.contact a.btn { font-size: 15px; }
details { border-top: 1px solid var(--line); padding: 14px 0; }
details:first-of-type { border-top: 0; padding-top: 0; }
summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 20px; line-height: 1.4; transition: transform 0.2s ease; }
details[open] summary::after { transform: rotate(45deg); }
details > *:not(summary) { margin-top: 10px; }
kbd {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.85em; padding: 1px 7px; border-radius: 6px;
  border: 1px solid var(--line); border-bottom-width: 2px; background: var(--panel-strong);
}

/* ── フッター ── */
footer { border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--muted); font-size: 14px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; }
footer nav { display: flex; gap: 22px; margin-left: auto; }
footer a { color: var(--muted); }

@media (max-width: 900px) {
  .hero { padding-top: 48px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 40px; }
  .hero .shot { transform: none; }
  .grid.three, .grid.four, .parts, .gallery { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .nav { display: none; }
  .lang { margin-left: auto; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 18px; }
  .grid.three, .grid.four, .parts, .gallery { grid-template-columns: 1fr; }
  section.block { padding: 56px 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .hero .shot { transition: none; transform: none; }
}
