/* ============================================================
   心野まるっとラボ — デザインの土台（2026-10 改装版）
   ------------------------------------------------------------
   トップ・ゲームラボ・攻略ノート・アプリ置き場・404 が使います。
   ※ 各アプリの中のページは、いままでどおり /style.css を使います
     （有料アプリの見た目を変えないため。こちらとは別のファイルです）

   色は illustration-guide.md §2 に準拠：
   クリーム／ベージュ／木の茶色／淡い緑／柔らかな空色／
   暖かな黄色／淡いピンク／紺色のアクセント ＋ 判子の朱
   ============================================================ */

/* ---------- 1. トークン（朝） ---------- */
:root {
  --wood:      #6b4f3a;
  --wood-d:    #4a3426;
  --wood-dd:   #2c1f17;
  --wood-l:    #a07d5d;
  --honey:     #d9a35b;
  --green:     #9fb894;
  --green-d:   #5f7d57;
  --sky:       #a9c9dd;
  --sky-d:     #4f7d99;
  --sun:       #f2c879;
  --sun-d:     #c9963a;
  --pink:      #f0c3c0;
  --pink-d:    #c97a75;
  --navy:      #2e3a55;
  --shu:       #c4553b;   /* 判子の朱 */
  --cheese:    #f6d36b;

  --bg:          #fbf6ec;
  --bg-panel:    #fffdf8;
  --bg-sunken:   #f5ecdc;
  --bg-kraft:    #efe1c6;
  --fg:          #3c3128;
  --fg-soft:     #6f6155;
  --line:        #e2d6c1;
  --line-strong: #cdbb9c;
  --accent:      #6b4f3a;
  --accent-soft: #f0e2c9;
  --on-accent:   #fffdf8;
  --paper-rule:  rgba(79, 125, 153, .16);
  --paper-margin: rgba(196, 85, 59, .28);
  --shadow:      0 2px 4px rgba(107, 79, 58, .05), 0 10px 30px rgba(107, 79, 58, .08);
  --shadow-lift: 0 4px 8px rgba(107, 79, 58, .08), 0 22px 48px rgba(107, 79, 58, .14);
  --shadow-paper: 0 1px 1px rgba(60, 49, 40, .08), 0 6px 14px rgba(60, 49, 40, .10);

  /* 研究棟（ログハウス）の部屋。朝でも少し暗い室内 */
  --room:        #4a3527;
  --room-2:      #3a2a1f;
  --room-ink:    #f8eedd;
  --room-ink-soft: #dcc8aa;
  --room-line:   rgba(248, 238, 221, .16);
  --lamp:        #ffd48a;
  --lamp-glow:   rgba(255, 196, 120, .30);

  --radius:   18px;
  --radius-s: 12px;
  --radius-l: 28px;

  --serif: "Shippori Mincho B1", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", serif;
  --sans:  "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  --hand:  "Klee One", "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;

  --wrap: 1120px;
  --header-h: 64px;
  color-scheme: light;
}

/* ---------- 2. トークン（夜） ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #1c2231;
    --bg-panel:    #232b3c;
    --bg-sunken:   #171d2a;
    --bg-kraft:    #2a3043;
    --fg:          #ede4d6;
    --fg-soft:     #aca090;
    --line:        #37415a;
    --line-strong: #4a5674;
    --accent:      #f2c879;
    --accent-soft: #2f3a52;
    --on-accent:   #23252b;
    --paper-rule:  rgba(169, 201, 221, .10);
    --paper-margin: rgba(240, 195, 192, .22);
    --shadow:      0 2px 4px rgba(0, 0, 0, .22), 0 10px 30px rgba(0, 0, 0, .32);
    --shadow-lift: 0 4px 8px rgba(0, 0, 0, .28), 0 22px 48px rgba(0, 0, 0, .44);
    --shadow-paper: 0 1px 1px rgba(0, 0, 0, .3), 0 6px 14px rgba(0, 0, 0, .3);
    --room:        #2b1f18;
    --room-2:      #1f1611;
    --lamp-glow:   rgba(255, 190, 110, .36);
    --shu:         #e0735a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg:          #1c2231;
  --bg-panel:    #232b3c;
  --bg-sunken:   #171d2a;
  --bg-kraft:    #2a3043;
  --fg:          #ede4d6;
  --fg-soft:     #aca090;
  --line:        #37415a;
  --line-strong: #4a5674;
  --accent:      #f2c879;
  --accent-soft: #2f3a52;
  --on-accent:   #23252b;
  --paper-rule:  rgba(169, 201, 221, .10);
  --paper-margin: rgba(240, 195, 192, .22);
  --shadow:      0 2px 4px rgba(0, 0, 0, .22), 0 10px 30px rgba(0, 0, 0, .32);
  --shadow-lift: 0 4px 8px rgba(0, 0, 0, .28), 0 22px 48px rgba(0, 0, 0, .44);
  --shadow-paper: 0 1px 1px rgba(0, 0, 0, .3), 0 6px 14px rgba(0, 0, 0, .3);
  --room:        #2b1f18;
  --room-2:      #1f1611;
  --lamp-glow:   rgba(255, 190, 110, .36);
  --shu:         #e0735a;
  color-scheme: dark;
}

/* ---------- 3. ベース ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 12% -10%, rgba(242, 200, 121, .16), transparent 60%),
    radial-gradient(900px 480px at 92% 4%, rgba(169, 201, 221, .18), transparent 60%);
  background-attachment: fixed, fixed;
  background-repeat: no-repeat, no-repeat;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.95;
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* キャラクターの壁紙（朝はしっかり、夜はうんと薄く） */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image: url("/assets/pattern.png");
  background-repeat: repeat;
  background-size: 220px 220px;
  opacity: .22;
}
:root[data-theme="dark"] body::after { opacity: .06; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body::after { opacity: .06; } }
/* 和紙の粒子 */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/><feColorMatrix type='saturate' values='0'/></filter><rect width='180' height='180' filter='url(%23n)'/></svg>");
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.5; letter-spacing: .04em; margin: 0; }
p { margin: 0 0 1.1em; }
figure { margin: 0; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--sun) 55%, transparent); }

:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
.wrap--narrow { --wrap: 720px; }
.wrap--wide { --wrap: 1280px; }
.center { text-align: center; }
.muted { color: var(--fg-soft); }
.small { font-size: .84rem; line-height: 1.8; }
.hand { font-family: var(--hand); letter-spacing: .03em; }
.vh {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 4. ヘッダー ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header__in {
  display: flex; align-items: center; gap: .9rem;
  min-height: var(--header-h);
}
.brand {
  display: flex; align-items: center; gap: .55rem;
  font-family: var(--serif); font-weight: 600; font-size: 1.04rem; letter-spacing: .07em;
  text-decoration: none; white-space: nowrap; margin-right: auto;
}
.brand__mark {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 1.05rem;
  background: radial-gradient(circle at 35% 30%, #fff8e8, var(--accent-soft));
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 -2px 0 rgba(107, 79, 58, .10);
}
.brand__sub { display: block; font-family: var(--sans); font-weight: 400; font-size: .62rem; letter-spacing: .26em; color: var(--fg-soft); line-height: 1.2; }
.brand__text { display: flex; flex-direction: column; line-height: 1.35; }

/* min-width:0 がないと、狭い画面でヘッダーごと横にはみ出す */
.nav { display: flex; align-items: center; gap: .1rem; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  position: relative;
  padding: .42rem .72rem; border-radius: 999px;
  font-size: .86rem; text-decoration: none; color: var(--fg-soft);
  white-space: nowrap; transition: background .2s, color .2s;
}
.nav a:hover, .nav a[aria-current="page"] { background: var(--accent-soft); color: var(--fg); }
.nav a.nav__games {
  color: var(--fg); font-weight: 500;
  background: color-mix(in srgb, var(--sun) 30%, transparent);
  border: 1px solid color-mix(in srgb, var(--sun-d) 40%, transparent);
  padding-right: .55rem;
}
.nav a.nav__games:hover, .nav a.nav__games[aria-current="page"] { background: color-mix(in srgb, var(--sun) 55%, transparent); }
.nav__new {
  display: inline-block; margin-left: .35rem; vertical-align: .08em;
  font-size: .58rem; letter-spacing: .08em; line-height: 1;
  padding: .22rem .38rem .2rem; border-radius: 4px;
  color: #fff; background: var(--shu);
}

.theme-toggle {
  flex: none;
  border: 1px solid var(--line); background: var(--bg-panel); color: var(--fg);
  border-radius: 999px; padding: .4rem .82rem;
  font-family: var(--sans); font-size: .8rem; cursor: pointer;
  transition: background .2s, transform .2s;
}
.theme-toggle:hover { background: var(--accent-soft); transform: translateY(-1px); }

/* 狭い画面：1段目＝ロゴと朝夜、2段目＝ナビ（横スクロール） */
@media (max-width: 760px) {
  :root { --header-h: 104px; }
  .site-header__in { flex-wrap: wrap; row-gap: .1rem; padding-top: .45rem; }
  .brand { font-size: .96rem; }
  .brand__mark { width: 30px; height: 30px; font-size: .95rem; }
  .nav { order: 3; flex: 1 1 100%; margin: 0 -1rem; padding: .1rem 1rem .5rem; }
  .theme-toggle { font-size: .74rem; padding: .32rem .66rem; }
}

/* ---------- 5. セクション ---------- */
.section { padding: clamp(3.4rem, 8vw, 6rem) 0; position: relative; }
.section--tight { padding: clamp(2.2rem, 5vw, 3.4rem) 0; }
.section--sunken { background: color-mix(in srgb, var(--bg-sunken) 72%, transparent); }
.section--kraft { background: color-mix(in srgb, var(--bg-kraft) 70%, transparent); }

/* 見出しのかたまり：英字ラベル → 明朝の見出し → リード */
.sec-head { margin-bottom: clamp(1.8rem, 4vw, 2.8rem); }
.sec-head--center { text-align: center; }
.sec-head--center .sec-head__lead { margin-inline: auto; }
.sec-head__en {
  display: inline-flex; align-items: center; gap: .6rem;
  font-size: .72rem; letter-spacing: .32em; color: var(--fg-soft); margin-bottom: .55rem;
  text-transform: uppercase;
}
.sec-head__en::before {
  content: ""; width: 22px; height: 2px; border-radius: 2px; background: var(--shu); opacity: .8;
}
.sec-head__title { font-size: clamp(1.55rem, 3.8vw, 2.25rem); line-height: 1.45; margin-bottom: .6rem; }
.sec-head__lead { max-width: 40em; color: var(--fg-soft); margin: 0; }

/* 旧ページの部品（売り場の部品が使う）。見た目は sec-head とそろえる */
.section__label { display: inline-block; margin-bottom: .5rem; font-size: .72rem; letter-spacing: .3em; color: var(--fg-soft); }
.section__title { font-size: clamp(1.5rem, 3.6vw, 2.05rem); margin-bottom: .5rem; }
.section__lead { max-width: 40em; color: var(--fg-soft); margin-bottom: 2.4rem; }

/* ---------- 6. グリッド ---------- */
.grid { display: grid; gap: 1.2rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 252px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.stack > * + * { margin-top: 1rem; }
.cluster { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------- 7. ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .74rem 1.5rem; border-radius: 999px;
  font-family: var(--sans); font-size: .93rem; font-weight: 500; line-height: 1.4; text-decoration: none;
  border: 1px solid var(--accent); background: var(--accent);
  color: var(--on-accent); cursor: pointer;
  transition: transform .2s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.btn--ghost { background: transparent; color: var(--fg); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--accent-soft); }
.btn--sm { padding: .5rem 1rem; font-size: .84rem; }
/* ゲーム用の、押しごたえのあるボタン */
.btn--play {
  background: var(--sun); border-color: #b9842c; color: #3b2a12; font-weight: 700;
  box-shadow: 0 4px 0 #b9842c, 0 8px 18px rgba(185, 132, 44, .28);
  letter-spacing: .06em;
}
.btn--play:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #b9842c, 0 12px 24px rgba(185, 132, 44, .32); }
.btn--play:active { transform: translateY(3px); box-shadow: 0 1px 0 #b9842c, 0 3px 8px rgba(185, 132, 44, .25); }
.btn--shu { background: var(--shu); border-color: var(--shu); color: #fff; }
/* 暗い部屋の上で使う、明かりのボタン */
.btn--lamp {
  background: color-mix(in srgb, var(--lamp) 92%, #fff); border-color: var(--lamp); color: #3b2a12; font-weight: 700;
  box-shadow: 0 0 0 4px rgba(255, 212, 138, .14), 0 10px 30px rgba(255, 190, 110, .30);
}
.btn--lamp:hover { box-shadow: 0 0 0 6px rgba(255, 212, 138, .2), 0 14px 36px rgba(255, 190, 110, .4); }
.btn--on-room { background: transparent; border-color: var(--room-line); color: var(--room-ink); }
.btn--on-room:hover { background: rgba(255, 255, 255, .08); }
.btn-row { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }
.btn-row--center { justify-content: center; }

/* ---------- 8. カード ---------- */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  box-shadow: var(--shadow);
  transition: transform .25s, box-shadow .25s;
}
a.card { text-decoration: none; display: block; }
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card__img {
  display: block;
  width: calc(100% + 3.2rem);
  margin: -1.5rem -1.6rem 1.2rem;
  border-radius: var(--radius) var(--radius) 0 0;
  object-fit: cover;
  background: var(--bg-sunken);
}
.card__img--wide   { aspect-ratio: 3 / 2; }
.card__img--square { aspect-ratio: 1 / 1; }
.card__eyebrow { font-size: .74rem; letter-spacing: .18em; color: var(--fg-soft); margin-bottom: .45rem; }
.card__title { font-size: 1.1rem; margin-bottom: .55rem; }
.card__body { font-size: .92rem; color: var(--fg-soft); margin: 0; }
.card__foot { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .74rem; line-height: 1.5; padding: .2rem .62rem; border-radius: 999px;
  background: var(--bg-sunken); border: 1px solid var(--line); color: var(--fg-soft);
}
.chip--free   { background: color-mix(in srgb, var(--green) 26%, var(--bg-panel)); }
.chip--paid   { background: color-mix(in srgb, var(--sun) 30%, var(--bg-panel)); }
.chip--member { background: color-mix(in srgb, var(--pink) 34%, var(--bg-panel)); }
.chip--hot    { background: color-mix(in srgb, var(--shu) 16%, var(--bg-panel)); color: var(--fg); border-color: color-mix(in srgb, var(--shu) 40%, var(--line)); }

/* ---------- 9. ラボの小道具 ---------- */

/* 判子。<span class="stamp">公開中</span> */
.stamp {
  --stamp: var(--shu);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700; font-size: .78rem; letter-spacing: .14em; line-height: 1;
  color: var(--stamp);
  padding: .42rem .55rem .38rem .7rem;
  border: 2px solid var(--stamp); border-radius: 6px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stamp) 35%, transparent);
  transform: rotate(-7deg);
  background: transparent;
  white-space: nowrap;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='60'><filter id='r'><feTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -1.2 1.55'/></filter><rect width='120' height='60' filter='url(%23r)'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='60'><filter id='r'><feTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -1.2 1.55'/></filter><rect width='120' height='60' filter='url(%23r)'/></svg>");
  -webkit-mask-size: 120px 60px; mask-size: 120px 60px;
}
.stamp--green { --stamp: var(--green-d); }
.stamp--navy  { --stamp: var(--navy); }
.stamp--gold  { --stamp: var(--sun-d); }
.stamp--round { width: 4.4rem; height: 4.4rem; border-radius: 50%; padding: 0; font-size: .74rem; letter-spacing: .06em; text-align: center; line-height: 1.25; }
:root[data-theme="dark"] .stamp--navy { --stamp: var(--sky); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stamp--navy { --stamp: var(--sky); } }

/* マスキングテープ。写真やカードに .taped をつけると上に1枚 */
.taped { position: relative; }
.taped::before {
  content: ""; position: absolute; z-index: 3;
  top: -12px; left: 50%; width: 96px; height: 26px; margin-left: -48px;
  background: color-mix(in srgb, var(--sun) 62%, transparent);
  transform: rotate(-3deg);
  clip-path: polygon(3% 0, 97% 4%, 100% 50%, 96% 100%, 2% 96%, 0 52%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
  pointer-events: none;
}
.taped--pink::before  { background: color-mix(in srgb, var(--pink) 72%, transparent); }
.taped--green::before { background: color-mix(in srgb, var(--green) 62%, transparent); }
.taped--sky::before   { background: color-mix(in srgb, var(--sky) 66%, transparent); }
.taped--left::before  { left: 14%; transform: rotate(-8deg); }
.taped--right::before { left: auto; right: 12%; margin-left: 0; transform: rotate(6deg); }

/* 標本ラベル。<span class="tag-label"><b>No.</b>001</span> */
.tag-label {
  display: inline-flex; align-items: baseline; gap: .35rem;
  font-family: var(--serif); font-size: .74rem; letter-spacing: .12em; line-height: 1.3;
  padding: .3rem .6rem .26rem;
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  outline: 1px solid var(--line-strong); outline-offset: -4px;
  color: var(--fg-soft);
}
.tag-label b { font-weight: 700; color: var(--fg); letter-spacing: .04em; }

/* 付箋 */
.memo {
  --memo: #fbe9a7;
  position: relative;
  background: var(--memo); color: #3c3128;
  padding: 1rem 1.1rem .9rem;
  font-family: var(--hand); font-size: .95rem; line-height: 1.8;
  box-shadow: var(--shadow-paper);
  transform: rotate(-1.2deg);
  border-radius: 2px 2px 14px 2px;
}
.memo--pink  { --memo: #f8d6d2; }
.memo--sky   { --memo: #d4e6f1; }
.memo--green { --memo: #dbe8d2; }
.memo p:last-child { margin-bottom: 0; }

/* 研究ノートの紙（罫線つき） */
.notebook {
  position: relative;
  background-color: var(--bg-panel);
  background-image:
    linear-gradient(90deg, transparent 2.6rem, var(--paper-margin) 2.6rem, var(--paper-margin) calc(2.6rem + 1px), transparent calc(2.6rem + 1px)),
    repeating-linear-gradient(180deg, transparent 0 calc(2rem - 1px), var(--paper-rule) calc(2rem - 1px) 2rem);
  background-position: 0 0, 0 .85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-paper);
  padding: 1.6rem 1.5rem 1.6rem 3.6rem;
  line-height: 2rem;
}
.notebook--grid {
  background-image:
    repeating-linear-gradient(0deg, transparent 0 23px, var(--paper-rule) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, var(--paper-rule) 23px 24px);
  background-position: 0 0, 0 0;
  padding: 1.5rem;
  line-height: 1.9;
}
@media (max-width: 560px) { .notebook { padding-left: 2.6rem; background-image:
    linear-gradient(90deg, transparent 1.7rem, var(--paper-margin) 1.7rem, var(--paper-margin) calc(1.7rem + 1px), transparent calc(1.7rem + 1px)),
    repeating-linear-gradient(180deg, transparent 0 calc(2rem - 1px), var(--paper-rule) calc(2rem - 1px) 2rem); } }

/* 木の表札 */
.plaque {
  display: inline-block;
  padding: .55rem 1.3rem .5rem;
  font-family: var(--serif); font-weight: 700; letter-spacing: .2em;
  color: #f8eedd;
  background:
    repeating-linear-gradient(92deg, rgba(255, 255, 255, .04) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, #7a5a40, #5b412e);
  border-radius: 8px;
  border: 1px solid #3f2c1f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), inset 0 -2px 0 rgba(0, 0, 0, .25), 0 6px 14px rgba(60, 40, 25, .25);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .35);
}

/* キャラクターのひとこと（吹き出し）
   <div class="talk talk--fumimaru">
     <img class="talk__face" src="/assets/fumimaru.png" alt="">
     <div class="talk__bubble"><b class="talk__name">ふみまる🐹</b><p>……</p></div>
   </div>                                                                */
.talk { display: grid; grid-template-columns: 56px 1fr; gap: .8rem; align-items: start; }
.talk + .talk { margin-top: .9rem; }
.talk--r { grid-template-columns: 1fr 56px; }
.talk--r .talk__face { order: 2; }
.talk__face {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover; object-position: center 20%;
  background: var(--accent-soft); border: 2px solid var(--bg-panel);
  box-shadow: 0 0 0 1px var(--line-strong), var(--shadow);
}
.talk__face--emoji { display: grid; place-items: center; font-size: 1.7rem; }
.talk__bubble {
  --tb: var(--bg-panel);
  position: relative;
  background: var(--tb);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: .7rem 1rem .75rem;
  box-shadow: var(--shadow-paper);
  font-size: .94rem; line-height: 1.85;
}
.talk__bubble::before {
  content: ""; position: absolute; top: 18px; left: -7px; width: 12px; height: 12px;
  background: var(--tb); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}
.talk--r .talk__bubble::before { left: auto; right: -7px; transform: rotate(-135deg); }
.talk__bubble p { margin: 0; }
.talk__name { display: block; font-size: .74rem; font-weight: 700; letter-spacing: .08em; color: var(--fg-soft); margin-bottom: .1rem; }
.talk--fumimaru .talk__bubble { --tb: color-mix(in srgb, var(--sun) 18%, var(--bg-panel)); }
.talk--misomaru .talk__bubble { --tb: color-mix(in srgb, var(--pink) 18%, var(--bg-panel)); }
.talk--keika    .talk__bubble { --tb: color-mix(in srgb, var(--green) 16%, var(--bg-panel)); }
@media (max-width: 480px) {
  .talk, .talk--r { grid-template-columns: 44px 1fr; }
  .talk--r .talk__face { order: 0; }
  .talk--r .talk__bubble::before { left: -7px; right: auto; transform: rotate(45deg); }
  .talk__face { width: 44px; height: 44px; }
}

/* 新着の小さな札 */
.new-badge {
  display: inline-block; font-size: .62rem; letter-spacing: .1em; line-height: 1;
  padding: .26rem .45rem .24rem; border-radius: 4px; color: #fff; background: var(--shu);
  vertical-align: .15em;
}

/* ---------- 10. 研究棟の部屋（ログハウスの壁＋ランプの灯り） ----------
   <section class="room"> … </section>                                  */
.room {
  position: relative; isolation: isolate;
  color: var(--room-ink);
  background-color: var(--room);
  background-image:
    radial-gradient(520px 300px at 16% 0%, var(--lamp-glow), transparent 70%),
    radial-gradient(520px 300px at 84% 0%, var(--lamp-glow), transparent 70%),
    repeating-linear-gradient(180deg,
      rgba(255, 236, 206, .07) 0 2px,
      rgba(255, 236, 206, .02) 2px 18px,
      rgba(0, 0, 0, .08) 18px 38px,
      rgba(0, 0, 0, .34) 38px 42px,
      rgba(0, 0, 0, .12) 42px 44px);
  overflow: hidden;
}
/* 木目の粒子 */
.room::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .18;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='120'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.004 0.18' numOctaves='3' seed='7'/><feColorMatrix values='0 0 0 0 .2  0 0 0 0 .12  0 0 0 0 .06  0 0 0 .9 0'/></filter><rect width='400' height='120' filter='url(%23g)'/></svg>");
  mix-blend-mode: multiply;
}
/* 床に落ちる、部屋の影 */
.room::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 40%; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .22));
}
.room .sec-head__en { color: var(--room-ink-soft); }
.room .sec-head__lead, .room .muted { color: var(--room-ink-soft); }
.room .chip { background: rgba(255, 255, 255, .07); border-color: var(--room-line); color: var(--room-ink-soft); }
.room .chip--hot { background: color-mix(in srgb, var(--shu) 40%, transparent); color: #fff; border-color: transparent; }

/* 吊りランプ（飾り）。<span class="lamp" aria-hidden="true"></span> を部屋の中に */
.lamp {
  position: absolute; top: 0; width: 2px; height: 70px; background: rgba(0, 0, 0, .45); z-index: 1; pointer-events: none;
}
.lamp::after {
  content: ""; position: absolute; left: 50%; top: 66px; width: 46px; height: 26px; margin-left: -23px;
  border-radius: 46px 46px 8px 8px;
  background: linear-gradient(180deg, #6d4e33, #3d2a1c);
  box-shadow: 0 18px 40px 18px rgba(255, 200, 120, .22), 0 26px 0 -8px var(--lamp);
}
@keyframes lampFlicker {
  0%, 100% { opacity: 1; } 42% { opacity: 1; } 44% { opacity: .78; } 46% { opacity: 1; } 71% { opacity: .92; } 73% { opacity: 1; }
}
.lamp { animation: lampFlicker 7s infinite; }

/* ---------- 11. ゲームの札（ゲームラボとトップで共通） ----------
   <a class="gcard" href="…"> 画像・判子・名前・ひとこと・記録 </a>       */
.gcard {
  position: relative; display: flex; flex-direction: column;
  background: #fffaf0; color: #3c3128;
  border-radius: 14px; overflow: visible;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .12), 0 14px 34px rgba(0, 0, 0, .28);
  text-decoration: none;
  transition: transform .3s cubic-bezier(.2, .9, .3, 1.3), box-shadow .3s;
}
.gcard:hover { transform: translateY(-6px) rotate(-.6deg); box-shadow: 0 2px 0 rgba(0, 0, 0, .12), 0 24px 48px rgba(0, 0, 0, .34); }
:root[data-theme="dark"] .gcard { background: #f6efe2; }
.gcard__media { position: relative; margin: 10px 10px 0; border-radius: 9px; overflow: hidden; background: #e9dcc5; }
.gcard__media img { width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; transition: transform .6s; }
.gcard:hover .gcard__media img { transform: scale(1.04); }
.gcard__stamp { position: absolute; z-index: 2; top: -10px; right: 14px; }
.gcard__body { padding: .9rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.gcard__no { font-family: var(--serif); font-size: .7rem; letter-spacing: .2em; color: #8a7562; }
.gcard__title { font-family: var(--sans); font-weight: 900; font-size: 1.22rem; line-height: 1.35; letter-spacing: .03em; color: #2c1f17; }
.gcard__catch { font-size: .86rem; color: #6f6155; margin: 0; line-height: 1.7; }
.gcard__rec {
  margin-top: auto; padding-top: .55rem; border-top: 1px dashed #d9c9ad;
  display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; font-size: .78rem; color: #6f6155;
}
.gcard__rec b { font-family: var(--sans); font-weight: 900; font-size: 1.02rem; color: #2c1f17; font-variant-numeric: tabular-nums; }

/* 記録の数字（ふつうの面で使う） */
.rec-val { font-family: var(--sans); font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* ---------- 12. 残り時間 ---------- */
.countdown { display: inline-flex; gap: .35rem; align-items: baseline; font-variant-numeric: tabular-nums; }
.countdown__n {
  display: inline-grid; place-items: center; min-width: 2.2em; padding: .15rem .35rem;
  font-family: var(--sans); font-weight: 900; font-size: 1.35rem; line-height: 1.3;
  background: rgba(0, 0, 0, .28); color: #fff; border-radius: 8px;
}
.countdown__u { font-size: .74rem; opacity: .85; margin-right: .2rem; }

/* ---------- 13. ふわっと出る ----------
   html に js クラスがあるときだけ隠す（スクリプトが動かない環境では最初から見える） */
.js [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .2, 1); transition-delay: var(--d, 0s); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js [data-reveal] { opacity: 1; transform: none; } }

/* ---------- 14. パンくず ---------- */
.crumbs { font-size: .78rem; color: var(--fg-soft); margin: 0 0 1.4rem; display: flex; flex-wrap: wrap; gap: .2rem .5rem; }
.crumbs a { color: var(--fg-soft); text-decoration: none; }
.crumbs a:hover { color: var(--fg); text-decoration: underline; }
.crumbs span[aria-hidden] { opacity: .6; }

/* ---------- 15. たたみ（ネタバレ・よくある質問） ---------- */
details.fold {
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--bg-panel); box-shadow: var(--shadow-paper);
}
details.fold + details.fold { margin-top: .7rem; }
details.fold > summary {
  list-style: none; cursor: pointer; padding: .9rem 2.6rem .9rem 1.1rem; position: relative;
  font-weight: 500;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after {
  content: "＋"; position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
  color: var(--fg-soft); transition: transform .2s;
}
details.fold[open] > summary::after { content: "－"; }
details.fold > .fold__body { padding: 0 1.1rem 1.1rem; color: var(--fg-soft); font-size: .93rem; }
details.fold--spoiler > summary { color: var(--shu); }
details.fold--spoiler > summary::before { content: "🔒 "; }
details.fold--spoiler[open] > summary::before { content: "🔓 "; }

/* ---------- 16. 表 ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.table-scroll table { min-width: 520px; }
th, td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--serif); font-weight: 600; color: var(--fg-soft); font-size: .82rem; letter-spacing: .1em; }

/* ---------- 17. ポートレート・研究員 ---------- */
.portrait { text-align: center; }
.portrait__frame {
  position: relative; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .55), transparent 55%), var(--accent-soft);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid; place-items: center; overflow: hidden;
}
.portrait__frame img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.portrait__frame .fallback { font-size: clamp(2.2rem, 6vw, 3.2rem); line-height: 1; }
.portrait__name { margin-top: .85rem; font-family: var(--serif); font-size: 1rem; }
.portrait__role { font-size: .78rem; color: var(--fg-soft); }
.deflist { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; font-size: .86rem; margin: 1rem 0 0; }
.deflist dt { color: var(--fg-soft); white-space: nowrap; }
.deflist dd { margin: 0; }

/* ---------- 18. 帯の画像・注記 ---------- */
.banner {
  margin: 0 0 clamp(1.8rem, 4vw, 2.6rem);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); background: var(--bg-panel);
}
.banner img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.note-box {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-panel); padding: 1.3rem 1.5rem;
  font-size: .9rem; color: var(--fg-soft); box-shadow: var(--shadow);
}
.note-box code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  background: var(--bg-sunken); padding: .1rem .4rem; border-radius: 5px; font-size: .92em;
}

/* ---------- 19. フッター ---------- */
.site-footer {
  position: relative;
  border-top: 1px solid var(--line);
  padding: 3.4rem 0 2.4rem;
  background: color-mix(in srgb, var(--bg-sunken) 70%, transparent);
}
.site-footer::before {
  /* 縁側の板のような、細い木の帯 */
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 6px;
  background: repeating-linear-gradient(90deg, var(--wood-l) 0 120px, var(--wood) 120px 122px);
  opacity: .5;
}
.footer-grid { display: flex; flex-wrap: wrap; gap: 1.8rem 3rem; justify-content: space-between; align-items: flex-start; margin-bottom: 1.8rem; }
.sign { font-size: .9rem; line-height: 2.1; margin: 0; }
.footer-cols { display: flex; flex-wrap: wrap; gap: 1.2rem 3rem; }
.footer-col h3 { font-family: var(--sans); font-size: .72rem; letter-spacing: .28em; color: var(--fg-soft); font-weight: 500; margin-bottom: .5rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; font-size: .88rem; line-height: 2.1; }
.footer-col a { color: var(--fg-soft); text-decoration: none; }
.footer-col a:hover { color: var(--fg); text-decoration: underline; }
.footer-links { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; font-size: .86rem; }
.footer-links a { color: var(--fg-soft); text-decoration: none; }
.footer-links a:hover { color: var(--fg); text-decoration: underline; }
.footer-copy { font-size: .78rem; color: var(--fg-soft); margin: 0; }

/* ============================================================
   20. アプリの売り場（shop.js が作る部品）
   ============================================================ */
.shop-hero {
  display: grid; grid-template-columns: 1.1fr 1fr; align-items: stretch;
  margin: 0 auto; max-width: 980px;
  text-align: left;
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lift);
  overflow: hidden; text-decoration: none; color: inherit;
  transition: transform .25s, box-shadow .25s;
}
.shop-hero:hover { transform: translateY(-3px); }
.shop-hero__media { background: var(--bg-sunken); }
.shop-hero__media img { width: 100%; height: 100%; min-height: 200px; object-fit: cover; display: block; }
.shop-hero__media .ph { height: 100%; min-height: 200px; display: grid; place-items: center; font-size: 3rem; }
.shop-hero__body { padding: clamp(1.4rem, 3vw, 2.1rem); display: flex; flex-direction: column; gap: .55rem; justify-content: center; }
.shop-hero__name { font-family: var(--serif); font-size: clamp(1.25rem, 3vw, 1.6rem); line-height: 1.5; }
.shop-hero__tag { color: var(--fg-soft); font-size: .95rem; margin: 0; }
@media (max-width: 760px) { .shop-hero { grid-template-columns: 1fr; } }

.price { font-family: var(--serif); font-size: 1.35rem; line-height: 1.3; }
.price small { font-family: var(--sans); font-size: .78rem; color: var(--fg-soft); margin-left: .5rem; }
.price--free { color: var(--accent); }

.rail-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.rail-head .section__title { margin-bottom: 0; }
.rail-head--center { flex-direction: column; align-items: center; text-align: center; gap: .7rem; }
.rail-nav { display: flex; gap: .4rem; flex: none; }
.rail-btn {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  border: 1px solid var(--line); background: var(--bg-panel); color: var(--fg);
  cursor: pointer; font-size: .95rem; line-height: 1;
  transition: background .2s, opacity .2s;
}
.rail-btn:hover:not([disabled]) { background: var(--accent-soft); }
.rail-btn[disabled] { opacity: .28; cursor: default; }
@media (max-width: 640px) { .rail-nav { display: none; } }
.rail {
  display: flex; gap: 1rem; overflow-x: auto; scroll-behavior: smooth;
  scroll-snap-type: x proximity; padding-bottom: 1rem; scrollbar-width: thin;
}
.rail > * { flex: 0 0 clamp(228px, 68vw, 288px); scroll-snap-align: start; }
.rail--few { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 288px)); overflow-x: visible; }

.pcard {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: inherit;
  transition: transform .25s, box-shadow .25s;
}
.pcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.pcard__media { position: relative; background: var(--bg-sunken); }
.pcard__media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.pcard__media .ph { aspect-ratio: 16 / 9; display: grid; place-items: center; font-size: 2.4rem; }
.pcard__badges { position: absolute; top: .6rem; left: .6rem; display: flex; gap: .3rem; }
.pcard__badges span { background: var(--accent); color: var(--on-accent); font-size: .7rem; letter-spacing: .06em; padding: .22rem .6rem; border-radius: 999px; }
.pcard__body { padding: 1rem 1.1rem 1.15rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.pcard__name { font-family: var(--serif); font-size: 1.02rem; line-height: 1.5; }
.pcard__tag { font-size: .86rem; color: var(--fg-soft); margin: 0; flex: 1; }
.pcard__foot { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-top: .5rem; }
.pcard__foot .price { font-size: 1.12rem; }
.pcard__sub {
  display: inline-flex; align-items: center; cursor: pointer;
  font-family: var(--sans); font-size: .84rem; line-height: 1;
  padding: .7rem 1.15rem; border-radius: 999px;
  border: 1px solid var(--line); background: transparent;
  color: var(--fg-soft); text-decoration: none; white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s;
}
.pcard__sub:hover, .pcard__sub:focus-visible { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--fg); }
.pcard__foot .pcard__sub { font-size: .74rem; padding: .42rem .75rem; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(208px, 1fr)); gap: 1rem; }
.cat-tile {
  display: flex; align-items: center; gap: .9rem; padding: 1.1rem 1.2rem;
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: inherit; transition: transform .2s, box-shadow .2s;
}
.cat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.cat-tile__icon { width: 46px; height: 46px; border-radius: 14px; flex: none; display: grid; place-items: center; font-size: 1.4rem; background: var(--accent-soft); border: 1px solid var(--line); }
.cat-tile__name { font-family: var(--serif); font-size: 1rem; }
.cat-tile__n { font-size: .78rem; color: var(--fg-soft); }

.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.rank-item {
  display: grid; grid-template-columns: auto 104px 1fr; gap: 1rem; align-items: center;
  padding: .9rem 1.2rem .9rem .9rem;
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: inherit; transition: box-shadow .2s, transform .2s;
}
.rank-item:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.rank-no { font-family: var(--serif); font-size: 1.45rem; color: var(--accent); min-width: 1.5em; text-align: center; }
.rank-thumb { width: 104px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-s); background: var(--bg-sunken); display: block; }
.rank-thumb--ph { display: grid; place-items: center; font-size: 1.5rem; }
.rank-body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.rank-name { font-family: var(--serif); font-size: 1.02rem; }
.rank-tag { font-size: .84rem; color: var(--fg-soft); margin: 0; }
.rank-body .price { font-size: 1.02rem; margin-top: .2rem; }
@media (max-width: 560px) { .rank-item { grid-template-columns: auto 1fr; padding: .9rem 1rem; } .rank-thumb { display: none; } }

/* アプリ置き場の一覧（script.js が作る） */
.app-card { display: flex; flex-direction: column; height: 100%; }
.app-card__icon { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; font-size: 1.6rem; background: var(--accent-soft); border: 1px solid var(--line); margin-bottom: .95rem; }
.app-card__body { flex: 1; }
.app-state { border: 1px dashed var(--line); border-radius: var(--radius); padding: 2.4rem 1.5rem; text-align: center; color: var(--fg-soft); }
.app-filter { margin: 0 0 1.2rem; font-size: .88rem; color: var(--fg-soft); background: var(--bg-sunken); border: 1px solid var(--line); border-radius: var(--radius-s); padding: .7rem 1rem; }
.app-filter b { color: var(--fg); font-weight: 600; }
.app-filter a { color: var(--fg-soft); }
.status-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--green); display: inline-block; }
.status-dot--wip { background: var(--sun); }

/* ---------- 21. 細い画面の調整 ---------- */
@media (max-width: 480px) {
  .countdown { flex-wrap: wrap; gap: .25rem; }
  .countdown__n { min-width: 1.9em; font-size: 1.1rem; padding: .1rem .25rem; }
  .countdown__u { font-size: .68rem; margin-right: .1rem; }
}
