/* ドパパーク — 駄菓子屋のネオン
 * 基調：夜の濃紫紺 #17103A × ネオンイエロー #FFC63D × クリーム #FFF3D6
 * 艦隊の既存サイトと色相が重ならないことを S1 で実測して確定（成果書 31_ 参照）。
 * Webフォントは読まない（初期転送 60KB 以内・体感の初速を最優先）。
 */

:root {
  --night: #17103a;
  --night-2: #1f1750;
  --night-3: #2a1f63;
  --neon: #ffc63d;
  --neon-soft: #ffe08a;
  --cream: #fff3d6;
  --cream-dim: #c9bea8;
  --toy-accent: #ffc63d;

  --hd-h: 52px;
  --bar-h: 64px;
  --tap: 44px;
  --r: 14px;

  --sans: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

html {
  background: var(--night);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--night);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

img,
svg,
canvas {
  max-width: 100%;
  display: block;
}

a {
  color: var(--neon);
}

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--neon);
  color: var(--night);
  padding: 10px 16px;
  z-index: 60;
  border-radius: 0 0 var(--r) 0;
}
.skip:focus {
  left: 0;
}

:focus-visible {
  outline: 3px solid var(--neon);
  outline-offset: 2px;
}

/* ---------- ヘッダ（1行） ---------- */

.hd {
  height: var(--hd-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: var(--night);
  border-bottom: 1px solid var(--night-3);
  position: relative;
  z-index: 20;
}

.hd__home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  min-height: var(--tap);
  color: var(--cream);
  text-decoration: none;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
}

.hd__logo {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--cream);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hd__logo a {
  color: inherit;
  text-decoration: none;
}
.hd__logo b {
  color: var(--neon);
}

.hd__tools {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}

.tgl {
  min-width: var(--tap);
  min-height: var(--tap);
  border: 1px solid var(--night-3);
  background: var(--night-2);
  color: var(--cream-dim);
  border-radius: 12px;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tgl[data-on="1"] {
  color: var(--night);
  background: var(--neon);
  border-color: var(--neon);
}
.tgl[data-unsupported="1"] {
  opacity: 0.55;
}

/* 言語切替（設計 §6-2：ヘッダに1つ・自動リダイレクトはしない）。
   吹き出しは position:absolute ＝流れの外に出す。ヘッダの高さを変えないので
   出ても出なくてもレイアウトは動かない（CLS 0）。 */
.hd__lang {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}
.tgl--lang {
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0 8px;
}
.hd__tip {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  max-width: 62vw;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--neon);
  color: var(--night);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* 押下を奪わない（クリック判定はリンク本体だけが持つ） */
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.hd__tip[hidden] {
  display: none;
}
@media (prefers-reduced-motion: no-preference) {
  .hd__tip {
    animation: tipIn 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }
}
@keyframes tipIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 体験の画面 ---------- */

.play {
  position: relative;
  /* CLS 0：キャンバスの高さを最初から確定させる */
  height: calc(100vh - var(--hd-h) - var(--bar-h));
  height: calc(100dvh - var(--hd-h) - var(--bar-h));
  max-width: 480px;
  margin: 0 auto;
  background: var(--night);
  overflow: hidden;
}

.play__canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.play__hud {
  position: absolute;
  inset: 8px 10px auto 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
  font-size: 14px;
  color: var(--cream-dim);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  z-index: 3;
}
.play__hud [data-hud-main] {
  color: var(--cream);
  font-weight: 700;
  font-size: 18px;
}

.flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: var(--flash, #fff);
  z-index: 4;
}
.flash.on {
  animation: flash 420ms ease-out 1;
}
@keyframes flash {
  0% {
    opacity: 0.55;
  }
  100% {
    opacity: 0;
  }
}

/* ---------- 山場のオーバーレイ ---------- */

.climax {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 42%, rgba(23, 16, 58, 0.82), rgba(23, 16, 58, 0.96));
}
.climax[hidden] {
  display: none;
}
.climax__title {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--cream-dim);
}
.climax__value {
  margin: 0;
  font-size: clamp(38px, 13vw, 64px);
  font-weight: 900;
  line-height: 1.05;
  color: var(--toy-accent);
  font-variant-numeric: tabular-nums;
}
.climax__note {
  margin: 0 0 6px;
  min-height: 1.2em;
  font-size: 14px;
  color: var(--cream-dim);
}
.climax__acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.climax__status {
  min-height: 1.2em;
  font-size: 13px;
  color: var(--neon-soft);
}

/* ---------- ボタン ---------- */

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: var(--tap);
  padding: 10px 18px;
  border-radius: var(--r);
  background: var(--night-2);
  color: var(--cream);
  border: 1px solid var(--night-3);
  box-shadow: 0 3px 0 var(--night-3), 0 6px 16px rgba(0, 0, 0, 0.35);
  transition: transform 90ms ease-out, box-shadow 90ms ease-out;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 var(--night-3), 0 3px 10px rgba(0, 0, 0, 0.3);
}
.btn--primary {
  background: var(--neon);
  color: #17103a;
  border-color: var(--neon);
  box-shadow: 0 3px 0 #b88a1f, 0 8px 20px rgba(255, 198, 61, 0.22);
}
.btn--primary:active {
  box-shadow: 0 2px 0 #b88a1f, 0 4px 12px rgba(255, 198, 61, 0.2);
}
.btn--big {
  width: 100%;
  font-size: 19px;
  min-height: 60px;
}

/* ---------- 下部バー（親指ゾーン） ---------- */

.bar {
  height: var(--bar-h);
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 10px;
  max-width: 480px;
  margin: 0 auto;
}
.bar .btn {
  flex: 1 1 0;
  min-width: 0;
  /* 🚨 3 つのボタンを 360px に並べると、日本語の「次のドパ →」も英語の
     「Next toy →」も 2 行に折れていた（S5 の折返し検出で判明・S1 から）。
     折り返さないと決めたうえで、幅に合わせて文字のほうを縮める。
     44px のタップ領域は min-height が持っているので、文字を小さくしても
     押しやすさは変わらない。 */
  white-space: nowrap;
  padding: 10px 10px;
  font-size: clamp(0.78rem, 3.3vw, 0.95rem);
}

/* ---------- 読み物（体験の下） ---------- */

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}

.sec {
  padding: 22px 0;
  border-top: 1px solid var(--night-3);
}
.sec:first-child {
  border-top: 0;
}
.sec h2 {
  font-size: 19px;
  margin: 0 0 10px;
  color: var(--neon);
  letter-spacing: 0.02em;
}
.sec h3 {
  font-size: 16px;
  margin: 18px 0 6px;
}
.sec p {
  margin: 0 0 12px;
  color: var(--cream);
}
.sec p:last-child {
  margin-bottom: 0;
}

.tagline {
  color: var(--cream-dim);
  font-size: 14px;
  margin: 0 0 14px;
}

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--toy-accent);
  color: var(--toy-accent);
  letter-spacing: 0.06em;
}

/* ---------- トップ ---------- */

.hero {
  padding: 26px 0 8px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(27px, 8vw, 38px);
  line-height: 1.25;
  margin: 0 0 8px;
  letter-spacing: 0.01em;
}
.hero h1 b {
  color: var(--neon);
}
.hero p {
  color: var(--cream-dim);
  margin: 0 0 18px;
  font-size: 15px;
}

.streak {
  min-height: 1.4em;
  color: var(--neon-soft);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 6px 0 4px;
  list-style: none;
  margin: 0;
}
@media (min-width: 620px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 104px;
  padding: 12px;
  border-radius: var(--r);
  background: linear-gradient(150deg, var(--night-2), var(--night-3));
  border: 1px solid var(--night-3);
  border-left: 4px solid var(--c, var(--neon));
  color: var(--cream);
  text-decoration: none;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3), 0 8px 18px rgba(0, 0, 0, 0.28);
  transition: transform 90ms ease-out, box-shadow 90ms ease-out;
}
.card:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3), 0 4px 10px rgba(0, 0, 0, 0.26);
}
.card__name {
  font-size: 21px;
  font-weight: 900;
  line-height: 1.2;
  color: var(--c, var(--neon));
}
.card__verb {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--cream-dim);
}
.card__meta {
  margin-top: auto;
  font-size: 12px;
  color: var(--cream-dim);
}
.card[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 0 0 8px;
  list-style: none;
}
.types li {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--night-2);
  border: 1px solid var(--night-3);
  color: var(--cream-dim);
}

/* ---------- フッタ ---------- */

.ft {
  margin-top: 8px;
  padding: 22px 16px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--night-3);
  color: var(--cream-dim);
  font-size: 13px;
  text-align: center;
}
.ft ul {
  list-style: none;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0;
  margin: 10px 0 0;
}
.ft a {
  color: var(--cream-dim);
}

.note {
  font-size: 13px;
  color: var(--cream-dim);
  background: var(--night-2);
  border: 1px solid var(--night-3);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0 0;
}

/* 振動に対応していない端末（iPhone・Firefox）でトグルを押した時の説明。
   これが無いと「押しても何も起きない」だけになる（設計 §0-11 無言で失敗させない）。 */
.note--vibe {
  margin: 8px 12px 0;
  border-color: var(--neon);
}
.note--vibe[hidden] {
  display: none;
}

/* ---------- 広告枠（空なら余白ゼロ・体験の操作領域からは離す） ---------- */

.ad {
  display: none;
  /* 🚨 設計 §0-12：広告は体験の操作領域から 24px 以上離す。ここを 24 未満に下げない
     （受け入れテストが computed margin を測って落とす）。 */
  margin: 26px auto;
  min-height: 0;
}
.ad:not(:empty) {
  display: block;
}

/* ---------- 物販（設計 §0-13・JA だけ・Search リンクのみ） ----------
   出典リスト（.src）と同じ作りにしてある＝「外に出ていくリンク」の見た目を
   サイト内で1つに保つため。PR 表記は .note で必ずリストの直前に出る。 */

.shop {
  margin: 0; padding-left: 1.3em; color: var(--cream); font-size: 0.92rem;
}
.shop li { margin: 0 0 12px; }
.shop li:last-child { margin-bottom: 0; }
.shop .lnk { min-height: 0; display: inline; font-weight: 700; }

/* ---------- 動きを減らす設定を尊重 ---------- */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .flash.on {
    animation: none;
    opacity: 0;
  }
}

/* ---------- 本文リンク ---------- */

.lnk {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--neon);
  font-weight: 700;
  text-underline-offset: 4px;
}

/* ---------- 絵札アルバム（/album/） ---------- */

.alb {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 6px 0 4px;
  margin: 0;
  list-style: none;
}
@media (min-width: 620px) {
  .alb {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.alb__i {
  position: relative;
  /* 絵札の縦横比を先に確保する＝画像が入っても行が動かない（CLS 0） */
  aspect-ratio: 5 / 7;
  border-radius: 10px;
  overflow: hidden;
}
.alb__i[data-owned='0'] {
  opacity: 0.72;
}
/* 🚨 キャンバスは流れから外して枠いっぱいに敷く。流れの中に置くと、JS が
   width/height を入れるまで canvas 既定の 300×150 で場所を取り、描いた瞬間に
   グリッドの高さが変わる（実測 CLS 0.060）。 */
.alb__c {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* 🚨 「まだ1枚もありません」は JS が持ち数を数えてから出す。出た瞬間にグリッドが
   79px 下がっていた（実測 CLS 0.060）。出ていない時も同じ場所を占めさせて、
   文字だけ見えなくする＝どちらの状態でも高さが変わらない。 */
.alb__empty[hidden] {
  display: block;
  visibility: hidden;
}

.alb__count {
  font-size: 15px;
  color: var(--cream);
  margin: 0 0 12px;
}
.alb__count .num {
  font-weight: 800;
  color: var(--neon);
  font-size: 20px;
}

/* ---------- 長押しプレビュー（トップ・3秒） ---------- */

.pv {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 18px;
  background: rgba(10, 6, 26, 0.86);
}
.pv__box {
  display: grid;
  gap: 10px;
  justify-items: center;
  width: min(92vw, 360px);
}
.pv__canvas {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--r);
  border: 2px solid var(--toy-accent, var(--neon));
  background: var(--night);
  touch-action: none;
}
.pv__close {
  min-width: 140px;
}

.note--motion {
  margin: 8px 12px 0;
  border-color: var(--neon);
}
.note--motion[hidden] {
  display: none;
}

/* 長押しでプレビューを出すため、カードの既定の長押しメニューは抑える */
.card {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* 遊びかたの切替（体験が modes を宣言した時だけ出る） */
.seg{display:inline-flex;gap:2px;padding:2px;border-radius:999px;
  background:rgba(255,243,214,.10);border:1px solid rgba(255,243,214,.18)}
.seg__b{min-height:44px;padding:0 14px;border:0;border-radius:999px;cursor:pointer;
  font:inherit;font-size:.92rem;color:var(--cream);background:transparent;
  transition:background .18s ease,color .18s ease}
.seg__b[aria-pressed="true"]{background:var(--neon);color:var(--night);font-weight:700}
.seg__b:focus-visible{outline:3px solid var(--neon);outline-offset:2px}
@media (prefers-reduced-motion:reduce){.seg__b{transition:none}}


/* ---------- S3: デイリー ---------- */
/* ホームの「今日のデイリー」カード。
   🚨 高さを先に確保する。中身を JS で入れるので、確保しないと文字が入った瞬間に
   下のグリッドが押し下がる（CLS が立つ）。 */
.dlyc {
  min-height: 210px;
  margin: 18px auto 6px;
  padding: 14px 16px 16px;
  max-width: 420px;
  border: 2px solid rgba(255, 198, 61, 0.45);
  border-radius: var(--r);
  background: rgba(255, 243, 214, 0.06);
  text-align: center;
}
/* 🚨 `.hero p`（0,1,1）が `.dlyc__meta`（0,1,0）に勝つので、ここは `.hero .dlyc__x`
   で書く。書かないと文字の大きさも余白も効かず、用意したはずの行の高さもズレて、
   JS が文字を入れた瞬間に下のグリッドが押し下がる（実測 CLS 0.064）。
   高さは min- ではなく固定にする＝中身が何行になっても外の箱が動かない。 */
.hero .dlyc__ttl {
  margin: 0; font-size: 0.86rem; letter-spacing: 0.08em; color: var(--neon);
  line-height: 1.6; height: 1.6em; overflow: hidden;
}
.hero .dlyc__name {
  margin: 2px 0 0; font-size: 1.24rem; font-weight: 700; color: var(--cream);
  line-height: 1.5; height: 1.5em; overflow: hidden;
}
.hero .dlyc__res {
  margin: 2px 0 10px; font-size: 1.05rem; color: var(--cream);
  line-height: 1.6; height: 1.6em; overflow: hidden;
}
.hero .dlyc__meta {
  margin: 10px 0 0; font-size: 0.84rem; color: var(--cream-dim);
  line-height: 1.6; height: 1.6em; overflow: hidden;
}
.hero__sub { margin: 10px 0 0; }

/* 体験の上の薄帯（#番号と、公式か練習か） */
.play--daily { position: relative; }
.dly__band {
  display: flex; gap: 10px; justify-content: center; align-items: center;
  margin: 0; padding: 6px 12px; font-size: 0.84rem; color: var(--cream-dim);
  background: rgba(23, 16, 58, 0.72);
}
.dly__tag {
  padding: 1px 10px; border-radius: 999px; font-weight: 700;
  color: var(--night); background: var(--neon);
}
.dly__blocks { margin: 4px 0 2px; font-size: 1.9rem; letter-spacing: 0.06em; }
.dly__next { margin: 8px 0 0; font-size: 0.9rem; color: var(--cream-dim); }
.rules { margin: 0; padding-left: 1.3em; }
.rules li { margin: 0 0 8px; }

/* 体験ページの小ボタン行（メニューに追加／今日のデイリーに挑戦） */
.acts2 { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }


/* ---------- S4: 読みもの・FAQ・出典（全ページ共通） ---------- */

.faq dt { font-weight: 700; margin-top: 12px; }
.faq dd { margin: 4px 0 0; color: var(--cream-dim); }
.faq dt:first-child { margin-top: 0; }

/* 本文中の箇条書き・番号つき。行間は本文（.sec p）とそろえる。 */
.bul { margin: 0 0 12px; padding-left: 1.3em; color: var(--cream); }
.bul li { margin: 0 0 8px; }
.bul li:last-child { margin-bottom: 0; }
.bul__d { display: block; color: var(--cream-dim); font-size: 0.86rem; margin-top: 2px; }

/* 出典。引用は折りたたまずそのまま出す（読者が原文を照合できるように）。 */
.src { margin: 0; padding-left: 1.3em; color: var(--cream); font-size: 0.92rem; }
.src li { margin: 0 0 12px; }
.src li:last-child { margin-bottom: 0; }
.src .lnk { min-height: 0; display: inline; font-weight: 700; }
.src__q {
  display: block; margin-top: 2px; color: var(--cream-dim);
  font-size: 0.84rem; line-height: 1.7; word-break: break-word;
}

/* 強調と等幅（content の ** と ` の行き先） */
.sec strong, .doc strong { color: var(--neon-soft); font-weight: 700; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em; background: var(--night-2);
  border: 1px solid var(--night-3); border-radius: 6px; padding: 1px 5px;
}

/* フッターの定型リンク（このサイトについて／プライバシー／利用規約）。
   運営者名・連絡先は置かない（独立管理ポリシー §2-1）。 */
.ft__nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: 10px; }
.ft__nav a { min-height: var(--tap); display: inline-flex; align-items: center; font-size: 0.88rem; }

/* === ui-polish v1 : reference_ui_microinteractions テク①③ === */
html{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
h1,h2,h3,h4{text-wrap:balance}
p,li,dd,figcaption{text-wrap:pretty}
/* === /ui-polish === */
