/* ============================================================
   ピクセル妖怪 — YOKAI PIXEL
   レトロ8bit / ドット絵スタイル
   ============================================================ */

:root {
  --bg:      #14101f;   /* 深い夜の紫黒 */
  --bg2:     #1d1730;
  --panel:   #241c3a;
  --ink:     #f4ecd8;   /* 和紙のオフホワイト */
  --muted:   #9a90bf;
  --accent:  #e0394e;   /* 提灯の朱 */
  --accent2: #4fd0c0;   /* 幽玄の青緑 */
  --accent3: #f2c14e;   /* 提灯の灯り（琥珀）*/
  --line:    #38305a;

  --px: 4px;            /* ピクセル単位 */
  --font-jp: 'DotGothic16', 'Hiragino Sans', sans-serif;
  --font-en: 'Press Start 2P', monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-jp);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.9;
  overflow-x: hidden;
  position: relative;
  /* 微かなドットグリッド背景 */
  background-image:
    radial-gradient(circle at 50% 0%, #2a2046 0%, var(--bg) 60%),
    linear-gradient(rgba(255,255,255,.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.015) 1px, transparent 1px);
  background-size: 100% 100%, 8px 8px, 8px 8px;
}

img, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

/* 背景アニメ & スキャンライン -------------------------------- */
#starfield {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
}
.scanlines {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px,
    rgba(0,0,0,.12) 3px, rgba(0,0,0,.12) 4px);
  mix-blend-mode: multiply;
  opacity: .6;
}

section, header, footer { position: relative; z-index: 1; }

/* 共通: ピクセルボーダー（角を欠いた箱）---------------------- */
.pixel-box {
  position: relative;
  background: var(--panel);
  box-shadow:
    0 calc(-1 * var(--px)) 0 0 var(--line),
    0 var(--px) 0 0 var(--line),
    calc(-1 * var(--px)) 0 0 0 var(--line),
    var(--px) 0 0 0 var(--line);
}

/* NAV ------------------------------------------------------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  transition: background .25s, box-shadow .25s, padding .25s;
}
.nav.scrolled {
  background: rgba(20,16,31,.92);
  box-shadow: 0 var(--px) 0 0 var(--line);
  padding: 10px 24px;
}
.nav-brand {
  font-family: var(--font-jp);
  font-size: 22px; font-weight: 700;
  color: var(--ink); text-decoration: none; letter-spacing: 2px;
  text-shadow: var(--px) var(--px) 0 var(--accent);
  white-space: nowrap; flex: none; margin-right: 20px;
}
@media (max-width: 900px) {
  .nav-links { gap: 14px; }
  .nav-links a:not(.nav-ig) { font-size: 13px; }
}
.nav-brand span { color: var(--accent3); }
.nav-links { display: flex; align-items: center; gap: 22px; margin-left: auto; margin-right: 18px; }
.nav-links a {
  color: var(--ink); text-decoration: none; font-size: 14px;
  letter-spacing: 1px; transition: color .15s; white-space: nowrap;
}
.nav-links a:hover { color: var(--accent3); }
#stories .story-list { max-width: 820px; margin: 0 auto; }
.stories-more { text-align: center; margin-top: 30px; }
.footer-lang { margin-top: 16px; display: flex; justify-content: center; }

/* 言語切替（日本語 / English / 中文）— 全ページ共通 */
.lang-switch { display: flex; flex: none; box-shadow: inset 0 0 0 2px var(--line); }
.lang-switch a {
  color: var(--muted); text-decoration: none; font-size: 12px; letter-spacing: 1px;
  padding: 5px 9px; white-space: nowrap;
}
.lang-switch a:hover { color: var(--accent3); }
.lang-switch a[aria-current] { color: var(--bg); background: var(--accent3); }

/* 中文はドットフォントに無い繁体字を台湾向けフォントで補う */
html[lang="zh-Hant"] body { font-family: 'DotGothic16', 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif; }

/* 下層ページ（図鑑・マップ）共通のヘッダー / フッター */
.sub-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: var(--px) solid var(--line); position: relative; z-index: 2;
}
.sub-back { color: var(--accent2); text-decoration: none; font-size: 14px; letter-spacing: 1px; white-space: nowrap; }
.sub-back:hover { color: var(--accent3); }
.sub-brand {
  color: var(--ink); text-decoration: none; font-size: 20px; letter-spacing: 2px; white-space: nowrap;
  text-shadow: 3px 3px 0 var(--accent);
}
.sub-brand span { color: var(--accent3); }
.sub-foot { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; padding: 30px 16px 50px; position: relative; z-index: 2; }
.sub-foot a { color: var(--muted); text-decoration: none; font-size: 13px; letter-spacing: 1px; }
.sub-foot a:hover { color: var(--accent3); }
@media (max-width: 540px) {
  .sub-head .sub-brand { display: none; }
}
.nav-ig {
  font-family: var(--font-en); font-size: 9px !important;
  padding: 8px 12px; color: var(--bg) !important;
  background: var(--accent2);
  box-shadow: var(--px) var(--px) 0 0 #2a8a80;
}
.nav-ig:hover { color: var(--bg) !important; transform: translate(1px,1px);
  box-shadow: calc(var(--px) - 2px) calc(var(--px) - 2px) 0 0 #2a8a80; }

/* HERO ------------------------------------------------------ */
.hero {
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 120px 24px 60px; max-width: 1100px; margin: 0 auto;
}
.hero-inner {
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 40px;
  align-items: center;
}
.hero-kicker {
  font-family: var(--font-en); font-size: 11px; color: var(--accent2);
  letter-spacing: 2px; margin-bottom: 20px;
}
.hero-title {
  font-family: var(--font-jp); font-weight: 700;
  font-size: clamp(48px, 9vw, 96px); line-height: 1; letter-spacing: 4px;
  text-shadow:
    var(--px) var(--px) 0 var(--accent),
    calc(var(--px) * 2) calc(var(--px) * 2) 0 #5a1620;
  margin-bottom: 26px;
}
.hero-sub { color: var(--muted); font-size: 16px; margin-bottom: 34px; }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

.btn {
  font-family: var(--font-jp); font-size: 15px; letter-spacing: 1px;
  text-decoration: none; padding: 14px 22px; display: inline-block;
  transition: transform .1s, box-shadow .1s; cursor: pointer;
}
.btn-primary {
  background: var(--accent); color: var(--ink);
  box-shadow: var(--px) var(--px) 0 0 #7a1320;
}
.btn-ghost {
  background: transparent; color: var(--ink);
  box-shadow: inset 0 0 0 var(--px) var(--line);
}
.btn:hover { transform: translate(2px, 2px); }
.btn-primary:hover { box-shadow: calc(var(--px) - 2px) calc(var(--px) - 2px) 0 0 #7a1320; }

.hero-art { display: flex; flex-direction: column; align-items: center; gap: 16px; text-decoration: none; }
.hero-art:hover .hero-stage { transform: translateY(-4px); }
.hero-stage { transition: transform .2s; }
.hero-stage {
  width: 280px; aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background: #8a2318; /* 実作風の単色背景 */
  box-shadow:
    0 calc(-1 * var(--px)) 0 0 var(--accent3),
    0 var(--px) 0 0 var(--accent3),
    calc(-1 * var(--px)) 0 0 0 var(--accent3),
    var(--px) 0 0 0 var(--accent3);
}
.hero-canvas {
  width: 200px; height: 200px;
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 8px 0 rgba(0,0,0,.22));
}
img.hero-canvas {
  width: 100%; height: 100%; object-fit: cover;
  animation: none; filter: none;
}
.hero-art-label {
  font-size: 14px; color: var(--accent3); letter-spacing: 2px;
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-14px); }
}

.scroll-cue {
  margin: 40px auto 0; color: var(--muted); text-decoration: none;
  font-size: 18px; animation: bob 1.6s infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0); opacity:.5 } 50% { transform: translateY(6px); opacity:1 } }

/* SECTION 共通 ---------------------------------------------- */
.section { max-width: 1100px; margin: 0 auto; padding: 90px 24px; }
.section-head { text-align: center; margin-bottom: 56px; }
.section-tag {
  font-family: var(--font-en); font-size: 10px; color: var(--accent2);
  letter-spacing: 3px; display: inline-block; margin-bottom: 16px;
}
.section-title {
  font-family: var(--font-jp); font-weight: 700;
  font-size: clamp(30px, 5vw, 46px); letter-spacing: 3px;
  text-shadow: var(--px) var(--px) 0 var(--accent);
}
.section-lead { color: var(--muted); margin-top: 16px; font-size: 15px; }

/* GALLERY --------------------------------------------------- */
.gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 24px;
}
.yokai-card {
  background: var(--panel);
  color: var(--ink); text-decoration: none;
  text-align: center; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow:
    0 calc(-1 * var(--px)) 0 0 var(--line),
    0 var(--px) 0 0 var(--line),
    calc(-1 * var(--px)) 0 0 0 var(--line),
    var(--px) 0 0 0 var(--line);
  transition: transform .15s, box-shadow .15s;
  animation: rise .5s both; animation-delay: var(--delay);
}
@keyframes rise { from { opacity:0; transform: translateY(20px) } to { opacity:1; transform:none } }
.yokai-card:hover {
  transform: translateY(-6px);
  box-shadow:
    0 calc(-1 * var(--px)) 0 0 var(--accent3),
    0 var(--px) 0 0 var(--accent3),
    calc(-1 * var(--px)) 0 0 0 var(--accent3),
    var(--px) 0 0 0 var(--accent3),
    0 16px 0 -4px rgba(0,0,0,.45);
}
/* ビビッドな単色ステージ（実作風: 1枚1色のべた塗り背景）*/
.yokai-stage {
  position: relative; aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.yokai-no {
  font-family: var(--font-en); font-size: 9px;
  color: rgba(255,255,255,.65);
  letter-spacing: 1px; position: absolute; top: 12px; left: 14px;
}
.yokai-canvas {
  width: 72%; max-width: 200px; height: auto;
  transition: transform .25s;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,.18));
}
/* 実画像（Instagram投稿）はステージいっぱいに */
img.yokai-canvas {
  width: 100%; max-width: none; height: 100%;
  object-fit: cover; filter: none;
}
.yokai-card:hover .yokai-canvas { transform: scale(1.07) translateY(-2px); }
.yokai-meta {
  padding: 18px 16px 22px;
  background: rgba(12,9,22,.55);
  border-top: var(--px) solid var(--line);
}
/* 空きスロット */
.yokai-badge {
  position: absolute; bottom: 12px; right: 12px;
  font-family: var(--font-en); font-size: 8px; letter-spacing: 1px;
  color: rgba(255,255,255,.92); background: rgba(0,0,0,.4);
  padding: 6px 8px;
}
.is-placeholder .yokai-canvas {
  opacity: .85; animation: phPulse 2.4s ease-in-out infinite;
}
.is-placeholder .yokai-name { color: var(--muted); }
@keyframes phPulse { 0%,100% { opacity:.55 } 50% { opacity:.95 } }
.yokai-name {
  font-family: var(--font-jp); font-size: 22px; letter-spacing: 2px;
  margin-bottom: 4px;
}
.yokai-reading {
  font-family: var(--font-en); font-size: 8px; color: var(--accent2);
  letter-spacing: 1px; margin-bottom: 12px;
}
.yokai-desc { font-size: 13px; color: var(--muted); line-height: 1.8; }
.gallery-note {
  text-align: center; margin-top: 40px; color: var(--muted); font-size: 12px;
}

/* ABOUT ----------------------------------------------------- */
.about-grid {
  display: grid; grid-template-columns: 1.4fr .9fr; gap: 48px; align-items: start;
}
.about-text .section-tag, .about-text .section-title { text-align: left; }
.about-text .section-title { margin-bottom: 24px; }
.about-text p { color: var(--muted); margin-bottom: 18px; font-size: 15px; }
.about-text strong { color: var(--accent3); }
.about-stats {
  list-style: none; display: flex; flex-direction: column; gap: 16px;
}
.about-stats li {
  background: var(--panel); padding: 22px 24px;
  box-shadow: inset 0 0 0 var(--px) var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.stat-num {
  font-family: var(--font-jp); font-size: 30px; color: var(--accent);
  letter-spacing: 2px; text-shadow: 2px 2px 0 #5a1620;
}
.stat-label { font-size: 13px; color: var(--muted); }

/* ZINE ------------------------------------------------------ */
.zine { display: flex; justify-content: center; }
.zine-card {
  display: grid; grid-template-columns: auto 1fr; gap: 40px; align-items: center;
  max-width: 900px; width: 100%; padding: 44px;
  background: linear-gradient(135deg, var(--panel), #2c2148);
  box-shadow:
    0 calc(-1 * var(--px)) 0 0 var(--accent3),
    0 var(--px) 0 0 var(--accent3),
    calc(-1 * var(--px)) 0 0 0 var(--accent3),
    var(--px) 0 0 0 var(--accent3);
}
.zine-icon { display: flex; align-items: center; justify-content: center; }
.book {
  display: block; width: 96px; height: 120px; position: relative;
  background: var(--accent); image-rendering: pixelated;
  box-shadow:
    0 0 0 var(--px) #7a1320,
    /* 背表紙 */ -10px 0 0 0 #b02a3c, -10px 0 0 var(--px) #7a1320,
    /* ページ */ inset -8px 0 0 0 #f4ecd8, inset -8px 0 0 calc(var(--px)) #c9c0a8;
  animation: float 5s ease-in-out infinite;
}
.book::after {
  content: '妖'; position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-jp); font-size: 34px; color: var(--ink);
  text-shadow: 2px 2px 0 #7a1320; padding-right: 16px;
}
.zine-body .section-tag, .zine-body .section-title { text-align: left; }
.zine-body .section-title { margin-bottom: 18px; }
.zine-body p { color: var(--muted); margin-bottom: 16px; font-size: 15px; }
.soon {
  font-family: var(--font-en); font-size: 11px; color: var(--bg);
  background: var(--accent3); padding: 6px 10px; letter-spacing: 1px;
  vertical-align: middle; margin-left: 8px;
  animation: blink 1.4s steps(2) infinite;
}
@keyframes blink { 50% { opacity: .35 } }

/* CONTROLLER（画面下に追従するパッド）----------------------- */
.pad-fixed {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  pointer-events: none; /* ボタンだけ反応させる */
  height: 0;
}
.pad-fixed button, .pad-fixed a { pointer-events: auto; }

/* 十字キー（左下）*/
.pad-fixed .dpad {
  position: absolute; left: 22px; bottom: 22px;
  width: 108px; height: 108px;
}
.dpad-btn {
  position: absolute; width: 36px; height: 36px;
  background: #e8e4dc; color: #3a3642;
  border: 0; cursor: pointer; font-size: 11px; line-height: 1;
  font-family: var(--font-jp);
  box-shadow: inset 0 -4px 0 0 #b8b2a4, 0 4px 0 0 rgba(0,0,0,.35);
  opacity: .92;
}
.dpad-up    { top: 0;    left: 36px; }
.dpad-down  { bottom: 0; left: 36px; }
.dpad-left  { left: 0;   top: 36px; }
.dpad-right { right: 0;  top: 36px; }
.dpad-center {
  position: absolute; top: 36px; left: 36px; width: 36px; height: 36px;
  background: #e8e4dc; opacity: .92;
}
.dpad-btn:hover { background: #fffdf6; }
.dpad-btn:active { transform: translateY(3px); box-shadow: inset 0 -2px 0 0 #b8b2a4; }

/* 中央下: 図鑑 / ZINE（斜めボタン）*/
.pad-center {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; gap: 14px;
}
.ss-btn {
  display: inline-block; text-decoration: none; text-align: center;
  font-family: var(--font-en); font-size: 8px; letter-spacing: 1px;
  color: #e8e4dc; background: #2a2430;
  border: 0; cursor: pointer; padding: 9px 14px;
  transform: skewX(-18deg);
  box-shadow: inset 0 -3px 0 0 #14101a, 0 4px 0 0 rgba(0,0,0,.35);
  opacity: .92;
}
.ss-btn:hover { background: #3a3444; color: #fff; }
.ss-btn:active { transform: skewX(-18deg) translateY(3px); box-shadow: inset 0 -1px 0 0 #14101a; }

/* ABXY（右下・日本版スーファミ配色: X青・Y緑・A赤・B黄）*/
.pad-fixed .abxy {
  position: absolute; right: 22px; bottom: 22px;
  width: 118px; height: 118px;
}
.ab-btn {
  position: absolute; width: 40px; height: 40px;
  border: 0; border-radius: 50%; cursor: pointer;
  font-family: var(--font-en); font-size: 10px; color: rgba(255,255,255,.95);
  text-shadow: 1px 1px 0 rgba(0,0,0,.4);
}
.btn-x { top: 0; left: 39px;  background: #3f66c0; box-shadow: inset 0 -5px 0 0 #27408a, 0 4px 0 0 rgba(0,0,0,.35); }
.btn-y { top: 39px; left: 0;  background: #3f9e5a; box-shadow: inset 0 -5px 0 0 #26703a, 0 4px 0 0 rgba(0,0,0,.35); }
.btn-a { top: 39px; right: 0; background: #d8344a; box-shadow: inset 0 -5px 0 0 #9a1f32, 0 4px 0 0 rgba(0,0,0,.35); }
.btn-b { bottom: 0; left: 39px; background: #e8b93a; box-shadow: inset 0 -5px 0 0 #b08618, 0 4px 0 0 rgba(0,0,0,.35); }
.ab-btn:hover { filter: brightness(1.12); }
.ab-btn:active { transform: translateY(3px); box-shadow: inset 0 -2px 0 0 rgba(0,0,0,.35); }

/* パッドと重ならないよう下に余白 */
.footer { padding-bottom: 170px !important; }

@media (max-width: 640px) {
  .pad-fixed .dpad { left: 10px; bottom: 12px; transform: scale(.78); transform-origin: left bottom; }
  .pad-fixed .abxy { right: 10px; bottom: 12px; transform: scale(.78); transform-origin: right bottom; }
  .pad-center { bottom: 10px; gap: 8px; }
  .ss-btn { font-size: 7px; padding: 8px 10px; }
}

/* FOOTER ---------------------------------------------------- */
.footer {
  text-align: center; padding: 60px 24px 80px; border-top: var(--px) solid var(--line);
  margin-top: 40px;
}
.footer-brand {
  font-family: var(--font-jp); font-size: 26px; letter-spacing: 3px;
  text-shadow: var(--px) var(--px) 0 var(--accent); margin-bottom: 16px;
}
.footer-brand span { color: var(--accent3); }
.footer-ig {
  font-family: var(--font-en); font-size: 12px; color: var(--accent2);
  text-decoration: none; letter-spacing: 1px;
}
.footer-ig:hover { color: var(--accent3); }
.footer-copy { color: var(--muted); font-size: 11px; margin-top: 18px; }

/* レスポンシブ ---------------------------------------------- */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-text { order: 2; }
  .hero-art  { order: 1; }
  .hero-actions { justify-content: center; }
  .about-grid { grid-template-columns: 1fr; }
  .zine-card { grid-template-columns: 1fr; text-align: center; padding: 32px 24px; }
  .zine-body .section-tag, .zine-body .section-title { text-align: center; }
  .book { margin: 0 auto; }
}
@media (max-width: 540px) {
  .nav-links { gap: 12px; }
  .nav-links a:not(.nav-ig) { display: none; }
  .nav-links { margin-right: 10px; }
  .nav .lang-switch a { padding: 4px 6px; font-size: 11px; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .yokai-meta { padding: 12px 8px 14px; }
  .yokai-name { font-size: 16px; letter-spacing: 1px; }
  .yokai-desc { display: none; }
  .hero-title { letter-spacing: 2px; }
}
