/* 化合物ポーカー 公開サイト
   色と形はゲームの画面から取った値（game/ui/lab_art.gd と build 15 の実画面）。
   押せる物は厚みと影、押せない情報は平らな印刷、今は押せない物は灰色の点線（追補14 E-46）。 */

@font-face {
  font-family: "Noto Sans JP Game";
  src: url("../fonts/noto-sans-jp-subset.woff2") format("woff2-variations"),
       url("../fonts/noto-sans-jp-subset.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --desk: #150f0a;
  --desk-2: #1f160e;
  --paper: #ece0ca;
  --paper-line: #e0d6bf;
  --paper-edge: #cdbd9c;
  --ink: #1c2733;
  --ink-soft: #4b4f4c;
  --gold: #937635;
  --gold-ink: #1e160a;
  --brass: #c9a24b;
  --brass-dark: #80623a;
  --button: #e0d0ab;
  --button-edge: #826746;
  --outline: #171211;
  --go: #d2ae5b;
  --go-light: #e7d4a7;
  --slate: #202c2d;
  --slate-2: #2c413f;
  --teal: #467877;
  --spine: #29413f;
  --spine-tick: #a98f65;
  --off: #7c7564;
  --off-line: #464946;
  --stamp: #be5139;
  --glow: #f3d77a;
  --glow-soft: rgba(243, 215, 122, 0.45);
  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 48px);
  --font: "Noto Sans JP Game", "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--paper);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.85;
  font-weight: 400;
  background-color: var(--desk);
  background-image:
    linear-gradient(180deg, rgba(10, 7, 4, 0) 0, rgba(10, 7, 4, 0.35) 100%),
    url("../img/desk-planks.webp");
  background-repeat: repeat, repeat-y;
  background-size: 100% 100%, max(100vw, 1100px) auto;
  background-position: center top;
  overflow-x: hidden;
  line-break: strict;
  word-break: auto-phrase;
  text-wrap: pretty;
}
h1, h2 { text-wrap: balance; }
.nb { display: inline-block; }

img { max-width: 100%; }

a { color: inherit; }

.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- 机の上端（ゲームの机の絵。左上にランプ、右上に定規） ---------- */

.desk-top {
  position: relative;
  background: url("../img/desk.webp") center top / max(100vw, 1100px) auto no-repeat;
}
.desk-top::after {
  /* 絵の下端を木目の繰り返しへつなぐ */
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 180px;
  background: linear-gradient(180deg, rgba(21, 15, 10, 0), rgba(21, 15, 10, 0.55));
  pointer-events: none;
}

.bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 22px;
  padding-bottom: 18px;
}
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: 0.04em;
  color: var(--paper);
}
.brand img { width: 36px; height: 36px; display: block; }
.bar nav { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* 押せる物：ゲームのクリーム色のボタン。下の縁が厚み、押すと沈む */
.key {
  --face: var(--button);
  --edge: var(--button-edge);
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  padding: 6px 16px 10px;
  color: var(--ink);
  background: var(--face);
  border: 0;
  border-radius: 0;
  box-shadow: inset 0 -5px 0 var(--edge), 0 3px 0 rgba(0, 0, 0, 0.45);
  font: 500 15px/1.3 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: transform 60ms steps(2), box-shadow 60ms steps(2);
  -webkit-tap-highlight-color: transparent;
}
.key:hover { --face: #e9dbb9; }
.key:active, .key[aria-pressed="true"]:active {
  transform: translateY(3px);
  box-shadow: inset 0 -2px 0 var(--edge), 0 1px 0 rgba(0, 0, 0, 0.45);
}
.key:focus-visible { outline: 3px solid var(--glow); outline-offset: 3px; }
.key.small { min-height: 40px; padding: 4px 12px 8px; font-size: 14px; }

/* 進む操作：ゲームの［反応］と同じ金色 */
.key.go {
  --face: var(--go);
  --edge: #8a6a2c;
  outline: 3px solid var(--outline);
  outline-offset: 0;
  font-weight: 700;
}
.key.go:hover { --face: #dcbb6a; }
.key.go:focus-visible { outline: 3px solid var(--glow); }

/* 今は押せない：灰色の平らな面に点線 */
.key[aria-disabled="true"] {
  --face: var(--off);
  color: #b9b3a3;
  box-shadow: none;
  outline: 3px dashed var(--off-line);
  outline-offset: -3px;
  cursor: not-allowed;
}
.key[aria-disabled="true"]:active { transform: none; }

/* ---------- 最初の画面 ---------- */

.hero { position: relative; z-index: 1; padding-top: clamp(8px, 2vw, 24px); padding-bottom: 72px; }

.screen {
  position: relative;
  margin: 0;
  background: #0d0906;
  box-shadow:
    0 0 0 2px var(--outline),
    0 0 0 5px var(--brass-dark),
    0 0 0 6px var(--brass),
    0 34px 70px rgba(0, 0, 0, 0.65);
}
.screen video, .screen img.poster {
  display: block; width: 100%; height: auto;
  aspect-ratio: 2532 / 1170;
  background: #1a130d center / cover no-repeat;
}
.screen.crop-m video { aspect-ratio: 2532 / 1170; }

.plate-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px 40px;
  margin-top: -18px;
  padding-left: clamp(0px, 3vw, 40px);
}

/* ゲームの左上の金の札（ステージ・目標点の欄）と同じ面 */
.plate {
  position: relative;
  max-width: 640px;
  padding: 22px 28px 24px;
  color: var(--gold-ink);
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--outline), 0 14px 30px rgba(0, 0, 0, 0.5);
}
.plate .for {
  margin: 0 0 2px;
  font-size: 15px; font-weight: 500;
}
.plate h1 {
  margin: 0;
  font-size: clamp(38px, 6.2vw, 72px);
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: 0.01em;
}
.plate .lead {
  margin: 14px 0 0;
  font-size: clamp(16px, 1.6vw, 18px);
  line-height: 1.8;
  font-weight: 500;
  max-width: 34em;
}

.buy { display: grid; gap: 10px; justify-items: start; padding-bottom: 6px; }
.buy .key.go { min-height: 60px; padding: 10px 26px 15px; font-size: 18px; }
.buy .price { margin: 0; font-size: 14px; line-height: 1.6; color: #d8ccb3; }
.buy .price strong { color: var(--paper); font-weight: 700; font-size: 16px; }

.video-note {
  margin: 14px 0 0; padding-left: clamp(0px, 3vw, 40px);
  font-size: 13px; color: #a89c85;
}
.video-note button {
  appearance: none; border: 0; padding: 0; margin: 0 0 0 0.6em;
  background: none; color: #d8ccb3; font: inherit; text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer;
}

/* ---------- 実験ノート（方眼紙。左に青緑の綴じ） ---------- */

.notebook {
  position: relative;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--paper-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--paper-line) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
  box-shadow: 0 0 0 2px #9c8260, 0 6px 0 #b9a47e, 0 30px 60px rgba(0, 0, 0, 0.55);
  padding: clamp(28px, 4vw, 52px) clamp(20px, 4vw, 56px) clamp(32px, 4vw, 56px) calc(clamp(20px, 4vw, 56px) + 18px);
}
.notebook::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 14px;
  background:
    repeating-linear-gradient(180deg, transparent 0 60px, var(--spine-tick) 60px 63px, transparent 63px 64px),
    var(--spine);
}

.notebook h2, .slip h2, .spec h2 {
  margin: 0 0 14px;
  font-size: clamp(26px, 3.2vw, 36px);
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.notebook p { margin: 0 0 1em; max-width: 38em; }

.section { position: relative; padding-top: clamp(56px, 8vw, 110px); }

/* ---------- 遊び方：札を選ぶと、つながる札が光る ---------- */

.howto-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}
.howto-text p { font-size: 16.5px; }
.howto-text .note { font-size: 13.5px; color: var(--ink-soft); }

.lab {
  position: relative;
  background: #1a130d;
  padding: 14px 14px 18px;
  box-shadow: 0 0 0 2px var(--outline);
}
.lab-panel {
  position: relative;
  min-height: 212px;
  padding: 16px 18px 18px 30px;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--paper-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--paper-line) 1px, transparent 1px);
  background-size: 16px 16px;
  box-shadow: 0 0 0 2px #9c8260;
}
.lab-panel::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8px;
  background: repeating-linear-gradient(180deg, transparent 0 34px, var(--spine-tick) 34px 36px, transparent 36px 38px), var(--spine);
}
.lab-panel .formula { margin: 0; font-size: 22px; font-weight: 600; min-height: 1.5em; }
.lab-panel dl { margin: 6px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 0 4px; font-size: 16px; line-height: 1.75; }
.lab-panel dt::after { content: "："; }
.lab-panel dd { margin: 0; letter-spacing: 0.06em; }
.lab-panel .preview {
  position: absolute; right: 20px; top: 12px;
  font-size: 30px; font-weight: 500; letter-spacing: 0.02em;
}
.lab-panel .hint { margin: 14px 0 0; font-size: 16px; }
.lab-panel .reason {
  position: absolute; right: 16px; bottom: 12px;
  margin: 0; padding: 4px 10px;
  font-size: 14px; color: var(--paper); background: #2a2320;
  box-shadow: 0 0 0 2px var(--brass-dark);
  opacity: 0; transition: opacity 120ms;
}
.lab-panel .reason.show { opacity: 1; }

.hand {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(4px, 1vw, 10px);
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.hand button {
  position: relative;
  display: block; width: 100%;
  padding: 0; border: 0; background: none; cursor: pointer;
  transform: translateY(0);
  transition: transform 110ms cubic-bezier(.2, .9, .3, 1.3);
  -webkit-tap-highlight-color: transparent;
}
.hand img { display: block; width: 100%; height: auto; aspect-ratio: 180 / 288; }
.hand button:hover { transform: translateY(-4px); }
.hand button:focus-visible { outline: 3px solid var(--glow); outline-offset: 3px; }
.hand button[aria-pressed="true"] { transform: translateY(-16px); }
.hand button[aria-pressed="true"]::after {
  content: ""; position: absolute; inset: -3px;
  box-shadow: 0 0 0 3px var(--teal), 0 0 0 5px var(--outline);
  pointer-events: none;
}
/* 弱い光＝まだ札が要る。強い光＝この1枚でちょうどできる（追補13 E-44。明るさ・枠の太さ・脈で分ける） */
.hand button[data-glow="weak"]::after {
  content: ""; position: absolute; inset: -2px;
  box-shadow: 0 0 0 2px var(--glow-soft), 0 0 14px 2px rgba(243, 215, 122, 0.25);
  pointer-events: none;
}
.hand button[data-glow="strong"]::after {
  content: ""; position: absolute; inset: -4px;
  box-shadow: 0 0 0 4px var(--glow), 0 0 22px 6px rgba(243, 215, 122, 0.55);
  pointer-events: none;
  animation: pulse 1.1s steps(6) infinite;
}
.hand button[data-glow="none"] img { filter: grayscale(0.7) brightness(0.62); }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px var(--glow), 0 0 30px 10px rgba(243, 215, 122, 0.75); } }

.lab-keys { display: flex; justify-content: flex-end; gap: 12px; margin-top: 14px; }

/* 反応した後に重なる札（ゲームの発見の札） */
.found {
  position: absolute; inset: 14px 14px auto 14px;
  min-height: 212px;
  display: grid; grid-template-columns: auto 1fr; gap: 6px 22px; align-items: center;
  padding: 18px 22px 18px 30px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 0 0 2px #9c8260, 0 18px 30px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  opacity: 0; transform: translateY(10px) scale(0.98); pointer-events: none;
  transition: opacity 160ms, transform 220ms cubic-bezier(.2, .9, .3, 1.2);
}
.found.show { opacity: 1; transform: none; pointer-events: auto; }
.found::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: var(--spine);
}
.found img { width: 128px; height: 96px; grid-row: span 4; }
.found .name { margin: 0; font-size: 15px; }
.found .ff { margin: 0; font-size: 34px; font-weight: 600; line-height: 1.2; }
.found .kind { margin: 0; font-size: 15px; }
.found .use { margin: 0; font-size: 16px; }
.found .next { position: absolute; right: 18px; bottom: 10px; margin: 0; font-size: 13px; color: var(--ink-soft); }
.found.no-image { grid-template-columns: 1fr; }
.found.no-image img { display: none; }

.stamp {
  position: absolute; right: 22px; top: 18px;
  width: 76px; height: 76px;
  display: grid; place-items: center;
  color: var(--stamp);
  font-size: 22px; font-weight: 800; letter-spacing: 0.02em;
  border: 4px solid var(--stamp);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 5px var(--stamp);
  transform: rotate(-14deg);
  opacity: 0.88;
}
.found.show .stamp { animation: stamp 260ms cubic-bezier(.3, 1.6, .5, 1) 120ms both; }
@keyframes stamp { from { transform: rotate(-14deg) scale(1.9); opacity: 0; } to { transform: rotate(-14deg) scale(1); opacity: 0.88; } }

/* ---------- 机に置いた動画と、横の紙片 ---------- */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}
.feature.flip { grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); }
.feature.flip .screen { order: 2; }

.slip {
  position: relative;
  color: var(--ink);
  background: var(--paper);
  padding: 26px 28px 28px;
  box-shadow: 0 0 0 2px #9c8260, 0 5px 0 #b9a47e, 0 20px 40px rgba(0, 0, 0, 0.5);
}
.slip p { margin: 0 0 0.9em; }
.slip p:last-child { margin-bottom: 0; }
.slip .tag {
  display: inline-block; margin: 0 0 12px; padding: 2px 10px;
  font-size: 14px; font-weight: 600; color: var(--paper); background: var(--slate-2);
}
.feature .slip { transform: rotate(-0.6deg); }
.feature.flip .slip { transform: rotate(0.5deg); margin-top: 40px; }

/* ---------- 図鑑 ---------- */

.codex-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.codex-head .count {
  margin: 0; padding: 2px 12px; font-size: 14px; color: var(--gold-ink); background: var(--gold);
}
.codex {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 48px;
  margin: 24px 0 0; padding: 0; list-style: none;
}
.codex li {
  display: grid; grid-template-columns: 128px 1fr; gap: 4px 20px; align-items: center;
  padding: 16px 0;
  border-top: 2px solid var(--paper-edge);
}
.codex li:nth-last-child(-n+2) { border-bottom: 2px solid var(--paper-edge); }
.codex img { width: 128px; height: 96px; grid-row: span 3; }
.codex .f { font-size: 22px; font-weight: 600; line-height: 1.3; }
.codex .n { font-size: 14px; color: var(--ink-soft); }
.codex .u { font-size: 15px; line-height: 1.65; }

/* ---------- 仕様 ---------- */

.spec {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: end;
}
/* ゲームの道具の棚（暗い青緑の板に真鍮の縁） */
.board {
  padding: clamp(24px, 3.5vw, 40px) clamp(20px, 3.5vw, 40px) clamp(22px, 3vw, 34px);
  background: var(--slate);
  box-shadow: 0 0 0 2px var(--outline), inset 0 -8px 0 var(--brass-dark), inset 0 -10px 0 var(--brass), 0 24px 50px rgba(0, 0, 0, 0.55);
}
.spec dl { margin: 0; display: grid; grid-template-columns: 6.5em 1fr; }
.spec dt, .spec dd { margin: 0; padding: 11px 0; border-top: 1px solid rgba(91, 115, 108, 0.45); }
.spec dt { color: #9fb3aa; font-size: 14px; padding-top: 13px; }
.spec dd { font-size: 16px; color: var(--paper); }
.spec .closing p { margin: 0 0 1em; max-width: 30em; }
.spec .closing .key.go { min-height: 60px; padding: 10px 26px 15px; font-size: 18px; margin-top: 8px; }

/* ---------- 足元 ---------- */

.foot {
  margin-top: clamp(72px, 10vw, 130px);
  padding: 28px 0 40px;
  background: rgba(10, 7, 4, 0.72);
  box-shadow: 0 -2px 0 var(--brass-dark);
  font-size: 14px; color: #b8ab92;
}
.foot .wrap { display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; align-items: center; }
.foot nav { display: flex; gap: 8px 22px; flex-wrap: wrap; }
.foot a { color: #d8ccb3; text-underline-offset: 3px; }
.foot p { margin: 0; }

/* ---------- 文書（サポート・プライバシー） ---------- */

.desk-top.short { background-size: max(100vw, 1100px) auto; }
.doc { padding-top: 12px; padding-bottom: 20px; }
.doc section h2 { margin-top: 1.8em; }
.doc .notebook { max-width: 860px; }
.doc h1 { margin: 0 0 8px; font-size: clamp(28px, 4vw, 40px); line-height: 1.3; font-weight: 800; }
.doc h2 { margin: 2em 0 0.4em; font-size: 20px; line-height: 1.5; font-weight: 700; }
.doc p { margin: 0 0 1em; }
.doc a { color: #1f4f55; text-underline-offset: 3px; }
.doc .meta { color: var(--ink-soft); font-size: 14px; }

/* ---------- 狭い画面 ---------- */

@media (max-width: 900px) {
  .howto-grid, .feature, .feature.flip, .spec { grid-template-columns: minmax(0, 1fr); }
  .feature.flip .screen { order: 0; }
  .feature .slip, .feature.flip .slip { transform: none; margin-top: 0; }
  .codex { grid-template-columns: minmax(0, 1fr); }
  .codex li:nth-last-child(2) { border-bottom: 0; }
}

@media (max-width: 700px) {
  body { font-size: 15.5px; }
  .bar { padding-top: 14px; padding-bottom: 12px; }
  .brand span { font-size: 15px; }
  .brand img { width: 30px; height: 30px; }
  .bar { flex-wrap: nowrap; }
  .bar nav { flex-wrap: nowrap; gap: 8px; }
  .bar nav .key { padding: 4px 10px 8px; font-size: 13.5px; min-height: 44px; white-space: nowrap; }
  .bar nav .hide-sm { display: none; }
  .screen.crop-m video { aspect-ratio: 1680 / 1170; }
  .plate-row { grid-template-columns: minmax(0, 1fr); margin-top: 8px; padding-left: 0; gap: 18px; }
  .plate { padding: 18px 18px 20px; }
  .buy .key.go { width: 100%; }
  .video-note { padding-left: 0; }
  .lab { padding: 10px 10px 14px; margin: 0 -6px; }
  .lab-panel { min-height: 196px; padding: 12px 12px 14px 22px; }
  .lab-panel .preview { font-size: 22px; right: 12px; }
  .lab-panel dl { font-size: 15px; }
  .found { inset: 10px 10px auto 10px; min-height: 196px; grid-template-columns: 1fr; padding: 14px 14px 30px 22px; }
  .found img { width: 96px; height: 72px; grid-row: auto; }
  .found .ff { font-size: 28px; }
  .stamp { width: 60px; height: 60px; font-size: 17px; right: 14px; top: 14px; bottom: auto; }
  .codex li { grid-template-columns: 96px 1fr; gap: 2px 14px; }
  .codex img { width: 96px; height: 72px; }
  .spec dl { grid-template-columns: 5.5em 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.slip .note, .notebook .note { font-size: 13.5px; color: var(--ink-soft); }
.closing .note-dark { font-size: 13.5px; color: #b8ab92; }
.en .stamp { font-size: 12px; letter-spacing: 0; }
.closing .icon-big { display: block; width: 112px; height: 112px; margin-bottom: 20px; box-shadow: 0 0 0 2px var(--outline), 0 16px 30px rgba(0, 0, 0, 0.5); }
.en .plate { max-width: 720px; }
.en .plate h1 { font-size: clamp(36px, 5.2vw, 64px); }
