/* ぴったんこハム☆ハム ONLINE
 *
 * 見た目の考え方:「シール」。カードのハムスターが白いふちのシールのように描かれているので、
 * ボタン・アイコン・チップ・枠も、白いふちと下に落ちる影で、紙に貼ったシールのように見せる。
 * 地はカードの裏面と同じうすいピンク。色はロゴの赤・水色・オレンジと、カードの赤・青・黄・紫。
 *
 * 並び: 色と書体 → 基本の部品(ボタン・入力・札)→ カード・アイコン・チップ → トップ・入室前
 *       → ルーム(上部バー・ロビー・対戦・答え合わせ)→ 重ねて出す画面 → サウンド → オープニング → 動きを減らす設定
 */

:root {
  /* 地と文字 */
  --paper: #ffe9ec; /* 地(カードの裏面のピンク) */
  --paper-deep: #ffd6dc; /* 少し濃いピンク(模様・区切り) */
  --mat: #fffaf0; /* 場(クリーム色のマット) */
  --white: #ffffff;
  --ink: #4a3428; /* 文字(ひまわりの種の茶色) */
  --ink-soft: #8c6f60; /* 補助の文字 */
  --line: #f0cdd0; /* 線 */

  /* ロゴの色 */
  --rose: #e8315b; /* ロゴの赤。いちばん押してほしいボタン */
  /* 自分が出したカードの枠。カードの色(赤・青・黄・猫の紫)と被らない緑 */
  --mine: #2dbb4e;
  --mine-deep: #1e9a3c;
  --mine-glow: rgba(45, 187, 78, 0.42);
  --rose-deep: #b91f43;
  --sky: #36a4e2; /* ロゴの水色。その次のボタン・CPU */
  --sky-deep: #1d79b0;
  --peach: #f6a46c; /* ロゴのオレンジ */
  --peach-soft: #ffe6d0;

  /* カードの色 */
  --red: #da3432;
  --blue: #05a0e6;
  --yellow: #ffe500;
  --cat: #7d2e8c; /* 猫カードの紫。ミス */
  --leaf: #5fae35; /* 説明書の見出しの緑。「できた」 */

  /* CPU の強さの色(よわい = 緑・ふつう = オレンジ・つよい = 赤) */
  --lv-easy: #4fa82e;
  --lv-normal: #f08a1c;
  --lv-hard: #d8343c;

  /* ルールの色(あそび方 = 基本ルールは水色・チャレンジルールは朱色、ミスチップ = 猫の紫、勝ちになる点数 = ひまわりの金) */
  --r-basic: #2f97d6;
  --r-challenge: #d9541e;
  --r-miss: #8a3a9a;
  --r-goal: #e8a300;
  --r-easy: #2e9d6a;
  --r-team: #c8467e;
  /* ペア戦のチーム(さくら・ミント) */
  --team-0: #e2558e;
  --team-1: #12a59b;

  /* 席の色(ひまわりの種チップの5色: 赤・青・黄・緑・紫) */
  --seat-0: #e0453f;
  --seat-1: #2d9fe0;
  --seat-2: #f2b600;
  --seat-3: #58b947;
  --seat-4: #9654c4;

  --font-pop: "Mochiy Pop One", "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  --font-body: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Yu Gothic", "Meiryo", sans-serif;

  --drop: rgba(74, 52, 40, 0.14); /* シールの下に落ちる影 */
  --radius: 22px;

  /* カードの大きさ(画面ごとに上書きする) */
  --pile-w: clamp(84px, min(12.5vw, 17.5vh), 148px);
  --hand-w: clamp(62px, min(8vw, 12.5vh), 102px);
}

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

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

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--paper);
  /* カードの裏面のような、うすいハートの散らし模様 */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='%23ffdde2'%3E%3Cpath d='M30 38c-5-9-18-4-14 6 2 6 9 10 14 15 5-5 12-9 14-15 4-10-9-15-14-6z'/%3E%3Cpath d='M128 112c-3.5-6-12-3-9.5 4 1.5 4 6 7 9.5 10 3.5-3 8-6 9.5-10 2.5-7-6-10-9.5-4z'/%3E%3Ccircle cx='96' cy='30' r='4'/%3E%3Ccircle cx='48' cy='132' r='5'/%3E%3Ccircle cx='160' cy='62' r='3'/%3E%3C/g%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}

/* 日本語の文は、文節の切れ目で折り返す(対応しているブラウザだけ) */
p,
li,
h2,
h3 {
  word-break: auto-phrase;
  line-break: strict;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: default;
}

a {
  color: var(--sky-deep);
}

:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
  border-radius: 8px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 数字はポップ体で */
.num {
  font-family: var(--font-pop);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.loading {
  padding: 30vh 24px 0;
  text-align: center;
  font-weight: 700;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- 基本の部品 */

/* シール(白い面 + 下に落ちる影) */
.sticker {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 6px 0 var(--drop);
}

/* 見出し(ポップ体) */
.pop-title {
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: 1.3rem;
  line-height: 1.35;
  letter-spacing: 0.02em;
}

.pop-title small {
  margin-left: 0.6em;
  font-family: var(--font-pop);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.btn {
  --bg: var(--white);
  --edge: var(--drop);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 48px;
  padding: 0.5em 1.35em;
  border: 0;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: 0 5px 0 var(--edge);
  color: var(--ink);
  font-weight: 900;
  font-size: 1rem;
  line-height: 1.3;
  letter-spacing: 0.03em;
  text-decoration: none;
  transition: transform 0.08s, box-shadow 0.08s;
}

.btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--edge);
}

.btn:disabled {
  opacity: 0.45;
}

.btn-main {
  --bg: var(--rose);
  --edge: var(--rose-deep);
  color: #fff;
}

.btn-sky {
  --bg: var(--sky);
  --edge: var(--sky-deep);
  color: #fff;
}

.btn-line {
  --bg: var(--white);
  box-shadow: inset 0 0 0 2.5px var(--ink), 0 5px 0 var(--drop);
}

.btn-line:active:not(:disabled) {
  box-shadow: inset 0 0 0 2.5px var(--ink), 0 2px 0 var(--drop);
}

.btn-big {
  min-height: 58px;
  padding-inline: 2.2em;
  font-size: 1.15rem;
}

.btn-small {
  min-height: 40px;
  padding-inline: 1.1em;
  font-size: 0.9rem;
}

.btn-link {
  padding: 0.2em 0.1em;
  border: 0;
  background: none;
  color: var(--sky-deep);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.btn-mini {
  min-height: 36px;
  padding: 0.2em 0.9em;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--line);
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

.btn-cpu {
  --lv: var(--sky);
  background: color-mix(in srgb, var(--lv) 12%, #fff);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--lv) 45%, #fff);
  color: color-mix(in srgb, var(--lv) 80%, #000);
}

.btn-cpu:hover {
  background: var(--lv);
  box-shadow: none;
  color: #fff;
}

/* CPU の強さの色。ふち・札・ボタンに使う */
.lv-easy {
  --lv: var(--lv-easy);
}

.lv-normal {
  --lv: var(--lv-normal);
}

.lv-hard {
  --lv: var(--lv-hard);
}

/* ぴったりストップの「ハムスターの数」(かんたん・ふつう・むずかしい・ゲキむず) */
.lv-hams-easy {
  --lv: var(--lv-easy);
}

.lv-hams {
  --lv: var(--sky-deep);
}

.lv-hams-hard {
  --lv: var(--lv-normal);
}

.lv-hams-max {
  --lv: #8a2bb8;
}

.lv-tag {
  display: inline-block;
  margin-left: 0.4em;
  padding: 0 0.5em;
  border-radius: 999px;
  background: var(--lv);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1.6;
  vertical-align: 0.12em;
}

/* 入力欄 */
.fld {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.fld-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.fld input {
  width: 100%;
  min-height: 48px;
  padding: 0.3em 0.9em;
  border: 2.5px solid var(--line);
  border-radius: 16px;
  background: #fffdf8;
  font-weight: 700;
  font-size: 1.05rem;
}

.fld input:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 4px rgba(54, 164, 226, 0.2);
}

.fld input::placeholder {
  color: #c9b2a8;
  font-weight: 500;
}

/* 小さな札(ホスト・あなた・CPU など) */
.tag {
  display: inline-block;
  margin-left: 0.5em;
  padding: 0.05em 0.6em;
  border-radius: 999px;
  background: var(--peach-soft);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.6;
  vertical-align: 0.12em;
  white-space: nowrap;
}

.tag-you {
  background: var(--rose);
  color: #fff;
}

.tag-cpu {
  background: var(--lv, var(--sky));
  color: #fff;
}

.tag-off {
  background: #e7dcd6;
  color: var(--ink-soft);
}

.tag-win {
  background: var(--yellow);
}

/* 色の丸(お題の色) */
.dots {
  display: inline-flex;
  gap: 4px;
  vertical-align: -0.12em;
}

.dot {
  width: 1.05em;
  height: 1.05em;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 0 var(--drop);
}

.dot-r {
  background: var(--red);
}

.dot-b {
  background: var(--blue);
}

.dot-y {
  background: var(--yellow);
}

/* 切り替えボタン(ルール設定) */
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--paper);
}

.seg-btn {
  min-height: 38px;
  padding: 0.25em 1em;
  border: 0;
  border-radius: 999px;
  background: none;
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.seg-btn.on {
  background: var(--ink);
  color: #fff;
}

.seg-static {
  color: var(--ink-soft);
}

.seg-static.on {
  color: #fff;
}

/* ルールの色: 選んだルール・むずかしさごとに色を変える(c-ルール-値 で --c が決まる)
   ロビーの切り替えボタン・ルールの印・ゲーム中の上部の札で、同じ色を使う */
.c-game-cards { --c: #e0457b; }
.c-game-count { --c: #14a19c; }
.c-level-easy { --c: var(--lv-easy); }
.c-level-normal { --c: var(--lv-normal); }
.c-level-hard { --c: var(--lv-hard); }
.c-mode-basic { --c: var(--r-basic); }
.c-mode-challenge { --c: var(--r-challenge); }
.c-miss-true { --c: var(--r-miss); }
.c-miss-false { --c: #8c8f99; }
.c-goal-5 { --c: var(--r-goal); --c-ink: var(--ink); }
.c-goal-3 { --c: #5b7fd6; }
.c-easy-false,
.c-team-false { --c: #8c8f99; }
.c-easy-true { --c: var(--r-easy); }
.c-team-true { --c: var(--r-team); }

/* 切り替えの枠は、選んでいる方の色。ボタンの文字は、それぞれの色 */
.seg[class*=" c-"] {
  background: color-mix(in srgb, var(--c) 10%, #fff);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 35%, #fff);
}

.seg[class*=" c-"] .seg-btn[class*=" c-"] {
  color: color-mix(in srgb, var(--c) 78%, #000);
}

.seg[class*=" c-"] .seg-btn[class*=" c-"].on {
  background: var(--c);
  color: var(--c-ink, #fff);
}

/* ゲーム中の上部バーに出す、いまのルールの札 */
.bar-rules {
  display: inline-flex;
  gap: 4px;
}

.rchip {
  padding: 0.1em 0.7em;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1.6;
  white-space: nowrap;
  color: #fff;
}

.rchip[class*=" c-"] {
  background: var(--c);
  color: var(--c-ink, #fff);
}

/* 絞り込みの丸ボタン */
.pill {
  min-height: 38px;
  padding: 0.2em 1em;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  font-weight: 700;
  font-size: 0.9rem;
}

.pill.on {
  background: var(--ink);
  color: #fff;
}

/* ---------------------------------------------------------------- カード・アイコン・チップ */

.card {
  position: relative;
  display: inline-block;
  aspect-ratio: 420 / 622;
  border-radius: 8% / 5.4%;
  background: #fff;
  box-shadow: 0 0 0 3px #fff, 0 5px 0 3px var(--drop);
  overflow: hidden;
  flex: none;
  user-select: none;
  -webkit-user-select: none;
}

.card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  pointer-events: none;
}

.card[data-act] {
  cursor: pointer;
}

.card.mini {
  width: 74px;
}

/* アイコン(角の丸い四角。ハムスターの耳や足が切れないように、丸にはしない) */
.ava {
  display: inline-block;
  flex: none;
  width: 44px;
  aspect-ratio: 1;
  border-radius: 30%;
  background: #fff;
  box-shadow: 0 0 0 3px #fff, 0 3px 0 3px var(--drop);
  overflow: hidden;
}

.ava img {
  display: block;
  width: 100%;
  height: 100%;
}

.ava-s {
  width: 26px;
  box-shadow: 0 0 0 2px #fff, 0 2px 0 2px var(--drop);
}

.ava-l {
  width: 60px;
}

.ava-xl {
  width: 96px;
  box-shadow: 0 0 0 5px #fff, 0 5px 0 5px var(--drop);
}

/* CPU は強さの色のふち */
.ava-cpu {
  box-shadow: 0 0 0 3px var(--lv, var(--sky)), 0 3px 0 3px var(--drop);
}

/* アイコンを選ぶボタン */
.ava-pick {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  flex: none;
  line-height: 0;
}

.ava-pick-note {
  position: absolute;
  right: -8px;
  bottom: -8px;
  padding: 0.15em 0.6em;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1.5;
  white-space: nowrap;
}

/* チップ */
.chip {
  display: inline-block;
  flex: none;
  width: 28px;
  height: auto;
  vertical-align: middle;
  filter: drop-shadow(0 2px 0 var(--drop));
}

.chip-seed {
  width: 18px;
  color: var(--seat-0);
}

.chip-seed.seat-1 {
  color: var(--seat-1);
}

.chip-seed.seat-2 {
  color: var(--seat-2);
}

.chip-seed.seat-3 {
  color: var(--seat-3);
}

.chip-seed.seat-4 {
  color: var(--seat-4);
}

/* まだ取っていない種チップは、うすい線だけ */
.chip-seed:not(.on) {
  opacity: 0.22;
  filter: grayscale(1);
}

.seeds {
  display: inline-flex;
  gap: 3px;
  line-height: 0;
}

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

.home {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  column-gap: 36px;
  max-width: 1140px;
  margin: 0 auto;
  padding: 18px 28px 56px;
}

#home-top {
  grid-column: 1;
}

/* トップの右側: カードの扇と、その下にハムスターあつめ */
.home-side {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  min-width: 0;
}

#home-intro,
#home-movie,
#home-rest {
  grid-column: 1 / -1;
}

.home-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin: 0 56px 10px -10px;
}

.nav-link {
  min-height: 40px;
  padding: 0.2em 0.9em;
  border: 0;
  border-radius: 999px;
  background: none;
  font-weight: 700;
  font-size: 0.92rem;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.7);
}

.nav-lang {
  box-shadow: inset 0 0 0 2px var(--line);
  background: rgba(255, 255, 255, 0.6);
}

.hero-logo {
  position: relative;
  width: min(100%, 460px);
  line-height: 0;
}

.hero-logo img {
  width: 100%;
  height: auto;
}

/* 「オンライン対戦」の札(ロゴの右下に斜めに貼る) */
.hero-online {
  position: absolute;
  right: -2%;
  bottom: 2%;
  padding: 0.35em 0.9em;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: 0 0 0 4px #fff, 0 4px 0 4px var(--drop);
  color: #fff;
  font-family: var(--font-pop);
  font-size: clamp(0.85rem, 2.2vw, 1.05rem);
  line-height: 1.3;
  transform: rotate(-5deg);
  white-space: nowrap;
}

.hero-tag {
  margin-top: 14px;
  font-family: var(--font-pop);
  font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.hero-tag b {
  font-weight: 400;
}

.hero-tag i {
  margin: 0 0.3em;
  font-style: normal;
  color: var(--ink-soft);
  font-size: 0.8em;
}

.tag-ham {
  color: #e8782c;
}

.tag-speed {
  color: var(--sky-deep);
}

.tag-count {
  color: var(--rose);
}

.hero-lead {
  max-width: 30em;
  margin-top: 8px;
  font-weight: 700;
}

/* 入室フォーム */
.entry {
  display: grid;
  gap: 16px;
  max-width: 480px;
  margin-top: 22px;
  padding: 22px;
}

.entry-you {
  display: flex;
  align-items: flex-end;
  gap: 18px;
}

.entry-you .fld {
  flex: 1;
}

.entry-go {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.entry-go .btn {
  padding-inline: 0.6em;
}

/* ボタンが1つだけのときは、横いっぱいに */
.entry-go .btn:only-child {
  grid-column: 1 / -1;
}

/* はじめてガイドへの入口 */
.entry-guide {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 12px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.btn-guide {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0.2em 1em 0.2em 0.4em;
  font-size: 0.92rem;
}

.btn-guide .ava {
  width: 28px;
}

.entry-guide-note {
  flex-basis: 100%;
  font-size: 0.76rem;
  font-weight: 500;
}

.entry-join {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding-top: 16px;
  border-top: 3px dotted var(--line);
}

.entry-join .fld {
  flex: 1;
}

.entry-join input {
  font-family: var(--font-pop);
  font-weight: 400;
  letter-spacing: 0.3em;
}

/* カードの扇 */
.hero-cards {
  text-align: center;
}

.fan {
  --w: clamp(120px, 15vw, 172px);
  position: relative;
  height: calc(var(--w) * 2.35);
  margin-top: 8px;
}

.fan-card {
  position: absolute;
  left: 50%;
  top: 46%;
  width: var(--w);
  transform: translate(-50%, -50%) translate(var(--x), var(--y)) rotate(var(--r));
  animation: fan-deal 0.6s cubic-bezier(0.2, 1.2, 0.4, 1) both;
  animation-delay: var(--d, 0s);
  transition: transform 0.15s;
}

.fan-card[data-act]:hover {
  transform: translate(-50%, -50%) translate(var(--x), calc(var(--y) - 14px)) rotate(var(--r));
}

.fan-1 {
  --x: -118%;
  --y: 14%;
  --r: -22deg;
  --d: 0.05s;
}

.fan-2 {
  --x: -62%;
  --y: -4%;
  --r: -11deg;
  --d: 0.12s;
}

.fan-title {
  --x: 0%;
  --y: -8%;
  --r: 0deg;
  --d: 0.3s;
  width: calc(var(--w) * 1.22);
  aspect-ratio: 720 / 1027;
  z-index: 2;
  border-radius: 7% / 5%;
}

.fan-3 {
  --x: 62%;
  --y: -4%;
  --r: 11deg;
  --d: 0.19s;
}

.fan-4 {
  --x: 118%;
  --y: 14%;
  --r: 22deg;
  --d: 0.26s;
}

@keyframes fan-deal {
  from {
    transform: translate(-50%, -50%) translate(0, 30%) rotate(0deg) scale(0.6);
    opacity: 0;
  }
}

/* 扇のすそを、ハムスターあつめの枠のうしろに少しかくす */
.home-side .fan {
  --w: clamp(100px, 10vw, 128px);
  margin-bottom: calc(var(--w) * -0.42);
}

/* 1ゲームの流れ */
.steps {
  margin-top: 56px;
}

.steps > .pop-title {
  font-size: 1.6rem;
  text-align: center;
}

.step-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
  margin-top: 22px;
  counter-reset: step;
}

.step {
  position: relative;
  counter-increment: step;
}

.step h3 {
  display: flex;
  align-items: center;
  gap: 0.55em;
  margin-top: 16px;
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: 1.12rem;
  line-height: 1.4;
}

/* 手順の番号は、カードの3色(赤・青・黄) */
.step h3::before {
  content: counter(step);
  flex: none;
  display: grid;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 3px 0 var(--drop);
  background: var(--red);
  color: #fff;
  font-size: 0.95em;
}

.step:nth-child(2) h3::before {
  background: var(--blue);
}

.step:nth-child(3) h3::before {
  background: var(--yellow);
  color: var(--ink);
}

.step p {
  margin-top: 6px;
  font-size: 0.95rem;
}

.step-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 150px;
  border-radius: var(--radius);
  background: var(--mat);
  box-shadow: 0 6px 0 var(--drop);
}

.tilt-l {
  transform: rotate(-6deg);
}

.tilt-r {
  transform: rotate(7deg);
}

.step-stack .lay-over {
  margin-left: -44px;
  transform: translateY(-8px) rotate(7deg);
}

.step-bubble,
.ans-bubble {
  display: grid;
  place-items: center;
  min-width: 58px;
  height: 58px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 3px var(--ink), 0 4px 0 var(--drop);
  font-family: var(--font-pop);
  font-size: 1.5rem;
}

.step-bubble .dots {
  font-size: 1.1rem;
}

.ans-hit {
  background: var(--rose);
  box-shadow: inset 0 0 0 3px #fff, 0 0 0 3px var(--rose), 0 6px 0 2px var(--drop);
  color: #fff;
  transform: scale(1.12) rotate(-6deg);
}

.step-sun {
  width: 56px;
}

.step-seed {
  width: 34px;
}

.steps-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 46em;
  margin: 30px auto 0;
  font-size: 0.95rem;
}

.note-chip {
  width: 40px;
  margin-top: 2px;
}

.steps-more {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}

/* ルール解説動画 */
.movie {
  max-width: 760px;
  margin: 52px auto 0;
  padding: 22px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 6px 0 var(--drop);
}

.movie-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.movie-head h2 {
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: 1.3rem;
}

.movie-out {
  font-size: 0.9rem;
  font-weight: 700;
}

.movie-text {
  margin-top: 4px;
  font-size: 0.95rem;
}

.movie-frame {
  position: relative;
  margin-top: 14px;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  background: var(--ink);
  overflow: hidden;
}

.movie-frame iframe,
.movie-cover,
.movie-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.movie-cover {
  padding: 0;
  background: none;
}

.movie-cover img {
  object-fit: cover;
}

.movie-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 76px;
  transform: translate(-50%, -50%);
  color: var(--rose);
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.25));
}

/* 動画がまだ無いときは、低い枠だけ */
.movie-frame.is-empty {
  aspect-ratio: auto;
  height: 96px;
  background: var(--paper);
  box-shadow: inset 0 0 0 3px var(--line);
}

.movie-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--ink-soft);
}

.movie-under {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 10px;
  font-size: 0.88rem;
}

.home-foot {
  margin-top: 64px;
  padding-top: 22px;
  border-top: 3px dotted var(--line);
  text-align: center;
  font-size: 0.88rem;
}

.foot-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 22px;
}

.foot-copy {
  margin-top: 10px;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- 入室前・ルームに入れません */

.gate {
  display: grid;
  justify-items: center;
  gap: 18px;
  max-width: 520px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.gate-logo {
  width: min(70%, 300px);
  line-height: 0;
}

.gate-box {
  width: 100%;
  max-width: none;
  margin: 0;
}

.gate-room {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  font-weight: 700;
}

.gate-room b {
  font-size: 2.2rem;
  letter-spacing: 0.12em;
  color: var(--rose);
  line-height: 1.2;
}

.gate-who {
  font-size: 0.95rem;
}

.gate-note {
  padding: 0.5em 0.9em;
  border-radius: 14px;
  background: var(--peach-soft);
  font-weight: 700;
  font-size: 0.92rem;
}

.gate-back {
  text-align: center;
  font-size: 0.9rem;
}

.gate-gone {
  display: grid;
  gap: 14px;
  padding: 26px;
  text-align: center;
}

/* ---------------------------------------------------------------- ルーム: 上部バー */

.room {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 6px max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 0 var(--drop);
}

.bar-logo {
  flex: none;
  width: 88px;
  line-height: 0;
}

.bar-room {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
}

.bar-room b {
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.bar-round {
  padding: 0.1em 0.8em;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-pop);
  font-size: 0.85rem;
  white-space: nowrap;
}

.bar-space {
  flex: 1;
}

.bar-status {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--rose);
  white-space: nowrap;
}

.bar-btn {
  min-width: 40px;
  min-height: 40px;
  padding: 0 0.8em;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* メニュー: まとめずに、いつも全部出しておく。広い画面は1段、狭い画面は2段目に折り返す */
.bar {
  flex-wrap: wrap;
  row-gap: 6px;
}

.bar-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.bar-nav .bar-btn {
  min-width: 0;
  min-height: 36px;
  padding: 0 0.75em;
  font-size: 0.8rem;
}

.bar-nav .bar-btn:hover {
  background: var(--paper-deep);
}

.bar-lang {
  box-shadow: inset 0 0 0 2px var(--line);
}

.bar-abort {
  color: var(--r-challenge);
}

.bar-leave {
  color: var(--rose-deep);
}

@media (max-width: 1180px) {
  .bar-nav {
    order: 10;
    flex: 1 1 100%;
    justify-content: center;
  }
}

/* ---------------------------------------------------------------- ルーム: ロビー */

/* 広い画面: 左の列 = ルーム番号・ルール / 右の列 = おうち・席 */
.lobby {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 22px 26px;
  align-items: start;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.lobby-side,
.lobby-main {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.lobby-go {
  grid-column: 1 / -1;
}

.lobby-code {
  padding: 20px 22px 22px;
  text-align: center;
}

.code-label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.code-num {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 6px 0 10px;
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  line-height: 1;
}

/* ルーム番号の数字は、1つずつカードの色の札に */
.code-num span {
  display: grid;
  place-items: center;
  width: 1.25em;
  height: 1.5em;
  border-radius: 0.22em;
  box-shadow: 0 0 0 3px #fff, 0 5px 0 3px var(--drop);
  background: var(--red);
  color: #fff;
}

.code-num span:nth-child(2) {
  background: var(--blue);
}

.code-num span:nth-child(3) {
  background: var(--yellow);
  color: var(--ink);
}

.code-num span:nth-child(4) {
  background: var(--cat);
}

.code-hint {
  font-size: 0.88rem;
}

.code-share {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.lobby-seats .pop-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
}

.watchers {
  margin-left: auto;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.seat-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.seat-0 {
  --seat: var(--seat-0);
}

.seat-1 {
  --seat: var(--seat-1);
}

.seat-2 {
  --seat: var(--seat-2);
}

.seat-3 {
  --seat: var(--seat-3);
}

.seat-4 {
  --seat: var(--seat-4);
}

.seatrow {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 10px 14px 10px 10px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 5px 0 var(--drop);
}

.seatrow.me {
  box-shadow: inset 0 0 0 3px var(--rose), 0 5px 0 var(--drop);
}

.seatrow.off .ava {
  filter: grayscale(1);
  opacity: 0.6;
}

/* 席の番号(席の色 = ひまわりの種チップの色) */
.seat-no {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  align-self: stretch;
  border-radius: 12px;
  background: var(--seat);
  color: #fff;
  font-family: var(--font-pop);
  font-size: 0.95rem;
}

.seat-2 .seat-no {
  color: var(--ink);
}

.seatrow-main {
  flex: 1;
  min-width: 0;
}

.seatrow-name {
  font-weight: 900;
  font-size: 1.05rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.seatrow-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 4px;
  font-size: 0.82rem;
}

.seat-level select {
  min-height: 34px;
  padding: 0 0.6em;
  border: 2px solid var(--lv);
  border-radius: 999px;
  background: var(--lv);
  color: #fff;
  font-weight: 900;
}

.seat-level select option {
  background: #fff;
  color: var(--ink);
}

.seat-level-text {
  padding: 0 0.7em;
  border-radius: 999px;
  background: var(--lv);
  color: #fff;
  font-weight: 900;
}

.handi {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: var(--ink-soft);
}

.handi-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  font-weight: 900;
  line-height: 1;
}

.handi-btn:disabled {
  opacity: 0.35;
}

.handi-n {
  min-width: 4.6em;
  text-align: center;
}

.handi-static .handi-n {
  text-align: left;
  min-width: 0;
}

.handi-note {
  color: var(--rose-deep);
  font-weight: 700;
}

.seatrow.empty {
  background: rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 0 0 3px var(--line);
  min-height: 64px;
}

.seatrow.empty .seat-no {
  background: var(--line);
  color: var(--ink-soft);
}

.seatrow-empty {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-label {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.lobby-rules {
  display: grid;
  gap: 16px;
  padding: 20px 22px 22px;
}

.rules-who {
  margin-top: -10px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.rule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.rule-head h3 {
  display: flex;
  align-items: center;
  gap: 0.45em;
  font-size: 0.98rem;
  font-weight: 900;
}

.rule-mark {
  width: 0.8em;
  height: 0.8em;
  border-radius: 50%;
  background: var(--c, var(--ink));
  box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px color-mix(in srgb, var(--c, var(--ink)) 40%, #fff);
}

.rule-note {
  margin-top: 4px;
  font-size: 0.84rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

.lobby-go {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}

/* 「ゲームを始める」(ホスト)は、画面の下に貼り付けて、いつも押せるようにする */
.lobby-go.sticky {
  position: sticky;
  bottom: 0;
  z-index: 6;
  margin: 0 -20px -48px;
  padding: 22px 20px max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(255, 233, 236, 0), var(--paper) 42%);
}

.go-note {
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.go-wait {
  font-weight: 700;
}

/* ---------------------------------------------------------------- ルーム: 対戦 */

.table {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 14px max(14px, env(safe-area-inset-bottom));
}

/* プレイヤーの並び */
.seats {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.seat {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "top name" "top seeds" "hand hand" "extra extra";
  justify-items: start;
  align-content: start;
  column-gap: 12px;
  row-gap: 2px;
  min-width: 0;
  max-width: 240px;
  padding: 8px 12px 8px 10px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 4px 0 var(--drop);
  border-top: 6px solid var(--seat);
}

.seat-top {
  grid-area: top;
}

.seat-name {
  grid-area: name;
}

.seat > .seeds {
  grid-area: seeds;
}

.seat-extra {
  grid-area: extra;
}

.seat-hand {
  grid-area: hand;
}

.seat.me {
  box-shadow: inset 0 0 0 3px var(--rose), 0 4px 0 var(--drop);
}

.seat.off .ava {
  filter: grayscale(1);
  opacity: 0.6;
}

.seat-top {
  position: relative;
  display: flex;
  align-items: flex-end;
  align-self: center;
  gap: 8px;
}

.seat-parent {
  position: absolute;
  left: -12px;
  top: -8px;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: var(--peach);
  font-family: var(--font-pop);
  font-size: 0.68rem;
  line-height: 1;
}

/*
 * 残りの手札(カードの裏の絵を1列に並べる。人数が多いほど小さく)。
 * 席に入りきらないときは、5枚まで + 残りの数(「+3」など)にする(room.js の fitHands)。
 */
.seats {
  --bw: 30px;
}

.seats[data-n="3"] {
  --bw: 28px;
}

/* 2〜3人のときは席を広げて、手札の裏をぜんぶ並べられるように(10枚・9枚) */
.seats[data-n="2"] .seat {
  max-width: 360px;
}

.seats[data-n="3"] .seat {
  max-width: 310px;
}

.seats[data-n="4"] {
  --bw: 26px;
}

.seats[data-n="5"] {
  --bw: 24px;
}

.seat-hand {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 3px;
  width: 100%;
  min-width: 0;
  min-height: calc(var(--bw) * 1.48 + 8px);
  margin-top: 4px;
  padding: 2px 2px 4px;
  overflow: hidden;
}

.mini-back {
  flex: none;
  width: var(--bw);
  aspect-ratio: 420 / 622;
  border-radius: 3px;
  background: #ffd9de url("/cards/back.webp") center / cover;
  box-shadow: 0 0 0 1.5px #fff, 0 1.5px 0 1.5px var(--drop);
}

/* 6枚目からは少しすき間をあけて、5枚ずつ数えやすく */
.mini-back.g5 {
  margin-left: 5px;
}

.mini-back[hidden],
.hand-more[hidden] {
  display: none;
}

/* 入りきらなかった残りの枚数 */
.hand-more {
  flex: none;
  margin-left: 3px;
  font-size: calc(var(--bw) * 0.62);
  line-height: 1;
  white-space: nowrap;
}

.hand-none {
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--rose);
}

.seat-name {
  max-width: 100%;
  font-weight: 900;
  font-size: 0.84rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-you {
  margin-left: 0.4em;
  padding: 0 0.5em;
  border-radius: 999px;
  background: var(--rose);
  color: #fff;
  font-size: 0.66rem;
  vertical-align: 0.1em;
}

.seat-extra {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 6px;
  min-height: 20px;
}

.seat-miss .chip {
  width: 18px;
  margin-right: -4px;
}

.seat-state {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 0.6em;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1.7;
  white-space: nowrap;
}

.seat-state.busy {
  background: var(--paper);
  color: var(--ink-soft);
}

.seat-state.done {
  background: var(--leaf);
  color: #fff;
}

.seat-state.first {
  background: var(--yellow);
}

.seat-state.off {
  background: #e7dcd6;
  color: var(--ink-soft);
}

.seat-sun {
  width: 15px;
}

/* 場(クリーム色のマット) */
.field {
  position: relative;
  display: grid;
  place-items: center;
  min-height: calc(var(--pile-w) * 1.48 + 92px);
  padding: 16px 10px 12px;
  border-radius: 28px;
  background: var(--mat);
  box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 7px #f6e6c8, 0 6px 0 var(--drop);
}

.field-row {
  display: grid;
  grid-template-columns: auto auto auto auto;
  align-items: start;
  justify-content: center;
  gap: clamp(8px, 2.6vw, 34px);
}

/* お題 */
.theme {
  display: grid;
  justify-items: center;
  gap: 6px;
  width: max(calc(var(--pile-w) * 0.86), 5.2em);
}

.theme-label {
  white-space: nowrap;
  padding: 0.05em 0.9em;
  border-radius: 999px;
  background: var(--rose);
  color: #fff;
  font-family: var(--font-pop);
  font-size: 0.82rem;
  line-height: 1.6;
}

.theme-card {
  width: calc(var(--pile-w) * 0.72);
  transform: rotate(-4deg);
  animation: theme-in 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

@keyframes theme-in {
  from {
    transform: rotate(-14deg) scale(0.5);
    opacity: 0;
  }
}

.theme-text {
  display: grid;
  justify-items: center;
  gap: 2px;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
}

/* 場札 */
.pile-wrap {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.pile {
  position: relative;
  width: var(--pile-w);
  aspect-ratio: 420 / 622;
  padding: 0;
  border: 0;
  border-radius: 8% / 5.4%;
  background: none;
  line-height: 0;
  transition: transform 0.1s;
}

.pile .card {
  position: absolute;
  inset: 0;
  width: 100%;
}

/* カードを置く場所(まだ何も無いとき) */
.pile-slot {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 6px;
  border: 3px dashed #e3cfa8;
  border-radius: inherit;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.pile.target .pile-slot {
  border-color: var(--rose);
  background: #fff2f4;
  color: var(--rose-deep);
  animation: target-pulse 1s ease-in-out infinite;
}

@keyframes target-pulse {
  50% {
    box-shadow: 0 0 0 8px rgba(232, 49, 91, 0.16);
  }
}

/* ドラッグ中: 置ける場札をうすく囲む(カードの色と被らない茶色) */
.pile.drop-zone .pile-top,
.pile.drop-zone .pile-slot {
  box-shadow: 0 0 0 3px #fff, 0 0 0 7px rgba(74, 52, 40, 0.22);
}

/* いちばん上が自分のカード: 枠を光らせる(この上には出せない) */
.pile .pile-top.mine {
  box-shadow: 0 0 0 3px #fff, 0 0 0 6.5px var(--mine), 0 0 18px 7px var(--mine-glow);
}

/* 出した瞬間だけ、少し大きく光る */
.pile .pile-top.drop.mine {
  animation:
    card-drop 0.24s cubic-bezier(0.2, 1.4, 0.5, 1) both,
    mine-flash 0.8s ease-out 0.1s;
}

@keyframes mine-flash {
  from {
    box-shadow: 0 0 0 3px #fff, 0 0 0 10px var(--mine), 0 0 32px 16px var(--mine-glow);
  }
}

.pile-by.mine .ava {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4.5px var(--mine);
}

.pile-mine {
  position: absolute;
  left: -6px;
  bottom: -9px;
  z-index: 3;
  padding: 0 0.65em;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--mine-deep);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.6;
  white-space: nowrap;
  pointer-events: none;
}

/* ドラッグ中のカードが上にある場札 */
.pile.over {
  transform: scale(1.06);
}

.pile.over .pile-top,
.pile.over .pile-slot {
  box-shadow: 0 0 0 3px #fff, 0 0 0 8px var(--ink);
}

/* 重なっているカードの厚み */
.pile-layers {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #fff;
  box-shadow: 0 0 0 3px #fff, 0 0 0 4.5px #e9d9c5;
  transform: translate(calc(var(--layers) * 1.3px), calc(var(--layers) * 1.7px));
}

.pile-top {
  transform: rotate(var(--tilt, 0deg));
}

/* 新しく出たカードが、上から置かれる */
.pile-top.drop {
  animation: card-drop 0.24s cubic-bezier(0.2, 1.4, 0.5, 1) both;
}

@keyframes card-drop {
  from {
    transform: translateY(-34px) rotate(calc(var(--tilt, 0deg) + 10deg)) scale(1.22);
    opacity: 0.3;
  }
}

.pile-down {
  animation: card-drop 0.24s cubic-bezier(0.2, 1.4, 0.5, 1) both;
}

/* 誰が出したカードか */
.pile-by {
  position: absolute;
  right: -8px;
  bottom: -8px;
  line-height: 0;
}

.pile-top.called {
  filter: saturate(0.6) brightness(0.92);
}

.pile-stamp,
.stamp {
  display: inline-block;
  padding: 0.1em 0.6em;
  border: 3px solid currentColor;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--cat);
  font-family: var(--font-pop);
  line-height: 1.4;
  white-space: nowrap;
}

.pile-stamp {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: clamp(1rem, 2.6vw, 1.5rem);
  transform: translate(-50%, -50%) rotate(-14deg);
  animation: stamp-in 0.25s cubic-bezier(0.2, 1.6, 0.5, 1) both;
}

@keyframes stamp-in {
  from {
    transform: translate(-50%, -50%) rotate(-14deg) scale(2.2);
    opacity: 0;
  }
}

/* ミスの指摘ボタン */
.btn-miss {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  padding: 0 0.95em 0 0.5em;
  border: 0;
  border-radius: 999px;
  background: var(--cat);
  box-shadow: 0 4px 0 #57196a;
  color: #fff;
  font-family: var(--font-pop);
  font-size: 0.88rem;
  transition: transform 0.08s, box-shadow 0.08s, opacity 0.15s;
}

.btn-miss:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #57196a;
}

.btn-miss:disabled {
  visibility: hidden;
}

.btn-miss.blocked {
  opacity: 0.4;
}

.btn-miss-chip {
  width: 24px;
  filter: none;
}

/* 真ん中: 一等賞チップと、残りのミスチップ */
.center {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  align-self: center;
  min-width: calc(var(--pile-w) * 0.62);
}

.sun {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  line-height: 0;
}

.sun .chip-sun {
  width: calc(var(--pile-w) * 0.6);
  filter: drop-shadow(0 4px 0 var(--drop));
}

.sun:disabled .chip-sun {
  opacity: 0.9;
}

/* 手札を出し切った: 押せる */
.sun.go .chip-sun {
  animation: sun-go 0.5s ease-in-out infinite alternate;
}

@keyframes sun-go {
  from {
    transform: scale(1) rotate(-6deg);
    filter: drop-shadow(0 4px 0 var(--drop)) drop-shadow(0 0 0 rgba(255, 200, 0, 0));
  }
  to {
    transform: scale(1.14) rotate(6deg);
    filter: drop-shadow(0 4px 0 var(--drop)) drop-shadow(0 0 14px rgba(255, 190, 0, 0.9));
  }
}

.sun-go {
  padding: 0.15em 0.8em;
  border-radius: 999px;
  background: var(--rose);
  color: #fff;
  font-family: var(--font-pop);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: nowrap;
}

.sun.taken .chip-sun {
  opacity: 0.45;
}

.sun-who {
  position: absolute;
  right: -6px;
  bottom: -6px;
}

.miss-left {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  max-width: calc(var(--pile-w) * 0.8);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.miss-left .chip {
  width: clamp(18px, 2.6vw, 26px);
}

/* 場の上に出す大きな文字 */
.field-over {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.big-count {
  font-family: var(--font-pop);
  font-size: clamp(110px, 26vw, 200px);
  line-height: 1;
  color: var(--rose);
  -webkit-text-stroke: 10px #fff;
  paint-order: stroke fill;
  filter: drop-shadow(0 8px 0 var(--drop));
  animation: count-pop 0.9s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}

.big-count[data-n="2"] {
  color: var(--blue);
}

.big-count[data-n="1"] {
  color: #f2b600;
}

@keyframes count-pop {
  0% {
    transform: scale(2.2);
    opacity: 0;
  }
  35% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.9);
    opacity: 0.85;
  }
}

.big-text {
  display: grid;
  justify-items: center;
  gap: 2px;
  max-width: 92%;
  padding: 12px 28px 14px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 0 0 5px var(--ink), 0 8px 0 5px var(--drop);
  text-align: center;
  animation: big-in 0.22s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}

.big-text b {
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: clamp(1.8rem, 6vw, 3rem);
  line-height: 1.25;
}

.big-text span {
  font-weight: 700;
  font-size: 0.95rem;
}

.big-text.go b {
  color: var(--rose);
  font-size: clamp(2.4rem, 9vw, 4.2rem);
}

.big-text.stop {
  box-shadow: 0 0 0 5px var(--rose), 0 8px 0 5px var(--drop);
}

.big-text.stop b {
  color: var(--rose);
}

.big-text.miss {
  box-shadow: 0 0 0 5px var(--cat), 0 8px 0 5px var(--drop);
}

.big-text.miss b {
  color: var(--cat);
}

@keyframes big-in {
  from {
    transform: scale(0.6) rotate(-4deg);
    opacity: 0;
  }
}

/* 手札 */
.mine {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.hint {
  min-height: 1.6em;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.5;
}

.hint.warn {
  color: var(--rose-deep);
}

.hint.call {
  color: var(--rose);
  font-family: var(--font-pop);
  font-weight: 400;
}

#t-hand {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 10px;
}

.hand {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 16px 4px 6px;
}

.hand-card {
  width: var(--hand-w);
  transition: transform 0.1s;
}

.hand-card[data-act] {
  touch-action: none;
  -webkit-touch-callout: none;
  cursor: grab;
}

@media (hover: hover) {
  .hand-card[data-act]:hover {
    transform: translateY(-6px);
  }
}

.hand-card.sel {
  transform: translateY(-16px);
  box-shadow: 0 0 0 3px #fff, 0 0 0 7px var(--rose), 0 16px 0 3px var(--drop);
}

.hand-card.pending {
  opacity: 0.22;
  pointer-events: none;
}

.hand-card.idle {
  filter: saturate(0.85);
}

.hand.shake {
  animation: shake 0.3s;
}

@keyframes shake {
  25% {
    transform: translateX(-7px);
  }
  50% {
    transform: translateX(6px);
  }
  75% {
    transform: translateX(-4px);
  }
}

.hand-empty,
.watching {
  font-weight: 700;
  text-align: center;
}

.mypick {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.mypick .card {
  width: 46px;
}

/* ドラッグ中のカード */
.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 90;
  pointer-events: none;
  box-shadow: 0 0 0 3px #fff, 0 16px 0 3px rgba(74, 52, 40, 0.18);
}

/* ドラッグ中は、手札に残っている方をうすくする */
body.dragging .hand-card.sel {
  opacity: 0.3;
  transform: none;
  box-shadow: 0 0 0 3px #fff, 0 5px 0 3px var(--drop);
}

body.dragging {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

/* 答える段階: 場を小さくして、数字のボタンを画面に収める */
.table[data-stage="guess"] {
  --pile-w: clamp(58px, min(9vw, 11vh), 100px);
}

.table[data-stage="guess"] .btn-miss,
.table[data-stage="guess"] .miss-left {
  display: none;
}

.table[data-stage="guess"] .field {
  min-height: calc(var(--pile-w) * 1.48 + 44px);
}

.guess {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(100%, 560px);
  padding: 18px 20px 20px;
  text-align: center;
}

.guess .pop-title {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5em;
}

.guess-note,
.guess-wait {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.clock {
  margin-left: 0.8em;
  font-family: var(--font-pop);
  color: var(--ink);
  white-space: nowrap;
}

.clock.hurry {
  color: var(--rose);
}

.guess-pad {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-top: 2px;
}

.guess-display,
.guess-mine {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.2em;
  font-weight: 900;
}

.guess-display b,
.guess-mine b {
  min-width: 1.5em;
  font-size: 3.4rem;
  line-height: 1.1;
  color: var(--rose);
  text-align: center;
}

.guess-display.empty b {
  color: var(--line);
}

.keys {
  display: grid;
  grid-template-columns: repeat(3, 68px);
  gap: 8px;
}

.key {
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--peach-soft);
  box-shadow: 0 4px 0 #f2c8a4;
  font-family: var(--font-pop);
  font-size: 1.3rem;
  transition: transform 0.06s, box-shadow 0.06s;
}

.key:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #f2c8a4;
}

.key-del {
  background: var(--paper);
  box-shadow: 0 4px 0 var(--line);
  font-family: var(--font-body);
  font-weight: 900;
}

.key-ok {
  background: var(--rose);
  box-shadow: 0 4px 0 var(--rose-deep);
  color: #fff;
  font-size: 0.95rem;
}

.key-ok:disabled {
  opacity: 0.4;
}

/* ---------------------------------------------------------------- ルーム: 答え合わせと結果 */

.result {
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 16px 0;
}

.res-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 5vw, 56px);
}

.res-theme {
  display: grid;
  justify-items: center;
  gap: 6px;
  --pile-w: 124px;
}

.res-theme .theme-card {
  animation: none;
}

.res-count {
  display: grid;
  justify-items: center;
  min-width: 190px;
}

.res-count-label {
  padding: 0.05em 1em;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-pop);
  font-size: 0.9rem;
}

.revealed .res-count-label {
  background: var(--rose);
}

.res-count-num {
  display: flex;
  align-items: baseline;
  gap: 0.15em;
  font-weight: 900;
  font-size: 1.3rem;
}

.res-count-num b {
  display: inline-block;
  font-size: clamp(4.4rem, 15vw, 7rem);
  line-height: 1.1;
  color: var(--ink);
}

.revealed .res-count-num b {
  color: var(--rose);
  -webkit-text-stroke: 8px #fff;
  paint-order: stroke fill;
  filter: drop-shadow(0 6px 0 var(--drop));
}

.res-count-num b.bump {
  animation: bump 0.2s cubic-bezier(0.2, 1.6, 0.5, 1);
}

.revealed .res-count-num b.bump {
  animation: reveal-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes bump {
  from {
    transform: scale(1.3);
  }
}

@keyframes reveal-pop {
  from {
    transform: scale(2) rotate(-8deg);
  }
}

.res-count-note {
  min-height: 1.6em;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-soft);
}

/* みんなの答え */
.ans-list {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 10px;
}

.ans {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 112px;
  padding: 10px 6px 12px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 4px 0 var(--drop);
  border-top: 6px solid var(--seat);
}

.ans.me {
  box-shadow: inset 0 0 0 3px var(--rose), 0 4px 0 var(--drop);
}

.ans-name {
  max-width: 100%;
  font-size: 0.8rem;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 答えの札(伏せてあり、いっせいにめくれる) */
.ans-card {
  position: relative;
  width: 60px;
  height: 60px;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.3, 1.3, 0.5, 1);
}

.answers-open .ans-card {
  transform: rotateY(180deg);
}

.ans-back,
.ans-front {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 16px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  font-family: var(--font-pop);
  font-size: 1.9rem;
  line-height: 1;
}

.ans-back {
  background: var(--paper-deep);
  color: #fff;
}

.ans-front {
  background: var(--mat);
  box-shadow: inset 0 0 0 3px var(--ink);
  transform: rotateY(180deg);
}

.revealed .ans.pit .ans-front {
  background: var(--rose);
  box-shadow: inset 0 0 0 3px #fff, 0 0 0 3px var(--rose);
  color: #fff;
}

.revealed .ans.near .ans-front {
  background: var(--yellow);
}

.stamp {
  position: absolute;
  left: 50%;
  bottom: -12px;
  font-size: 0.78rem;
  transform: translateX(-50%) rotate(-5deg) scale(0);
  transition: transform 0.3s cubic-bezier(0.2, 1.7, 0.4, 1) 0.15s;
}

.stamp-pit {
  color: var(--rose);
}

.stamp-near {
  color: #a87400;
}

.revealed .stamp {
  transform: translateX(-50%) rotate(-5deg) scale(1);
}

/* 場に出たカード(数える) */
.res-cards {
  display: grid;
  gap: 14px;
  padding: 16px 14px;
  border-radius: 24px;
  background: var(--mat);
  box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 7px #f6e6c8, 0 6px 0 var(--drop);
}

.rc-row h3 {
  margin-bottom: 8px;
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--ink-soft);
  text-align: center;
}

.rc-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 8px;
}

.rc {
  position: relative;
  width: clamp(42px, 6.4vw, 66px);
  line-height: 0;
  transition: transform 0.15s, opacity 0.2s, filter 0.2s;
  opacity: 0.4;
  filter: grayscale(0.7);
}

.rc-card {
  width: 100%;
  box-shadow: 0 0 0 2px #fff, 0 3px 0 2px var(--drop);
}

.rc.counted {
  opacity: 1;
  filter: none;
}

/* 自分が出したカード */
.rc.mine .rc-card {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4.5px var(--mine), 0 3px 0 4.5px var(--drop);
}

.rc.mine.counted .rc-card {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4.5px var(--mine), 0 0 12px 5px var(--mine-glow);
}

.rc-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.rc-note-mark {
  width: 12px;
  height: 16px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 0 0 1.5px #fff, 0 0 0 3.5px var(--mine);
}

/* 数に入らなかったカードは、少しうすく */
.rc.counted.rc-zero {
  opacity: 0.62;
  filter: grayscale(0.35);
}

.rc.now {
  transform: scale(1.18) translateY(-4px);
  z-index: 2;
}

.rc-badge {
  position: absolute;
  right: -7px;
  top: -9px;
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 5px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: var(--rose);
  color: #fff;
  font-size: 0.78rem;
  line-height: 1;
  transform: scale(0);
  transition: transform 0.2s cubic-bezier(0.2, 1.8, 0.4, 1);
}

.rc.counted .rc-badge {
  transform: scale(1);
}

.rc-zero .rc-badge {
  background: #b9a79d;
}

.rc-minus .rc-badge {
  background: var(--cat);
}

.rc-miss {
  position: absolute;
  left: 50%;
  bottom: -8px;
  padding: 0.1em 0.5em;
  border-radius: 999px;
  background: var(--cat);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.5;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* 得点 */
.res-scores {
  visibility: hidden;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s;
}

.scored .res-scores {
  visibility: visible;
  opacity: 1;
  transform: none;
}

.res-scores .pop-title {
  text-align: center;
}

.sc-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.sc {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 12px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 4px 0 var(--drop);
  border-left: 8px solid var(--seat);
}

.sc.me {
  box-shadow: inset 0 0 0 3px var(--rose), 0 4px 0 var(--drop);
}

.sc.win {
  background: #fffbe0;
}

.sc-main {
  flex: 1;
  min-width: 0;
}

.sc-name {
  font-weight: 900;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.sc-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-top: 3px;
}

.part {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 0.7em;
  border-radius: 999px;
  background: var(--peach-soft);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.8;
  white-space: nowrap;
}

.part-pit {
  background: var(--rose);
  color: #fff;
}

.part-near {
  background: var(--yellow);
}

.part-miss {
  background: #ead7ef;
  color: #5b1b69;
}

.part-none {
  background: none;
  padding: 0;
  color: var(--ink-soft);
  font-weight: 700;
}

.part-chip {
  width: 15px;
  filter: none;
}

.sc-gain {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--rose);
}

.sc-gain.zero {
  color: var(--line);
}

.sc .chip-seed {
  width: 20px;
}

/* いま増えた種チップ */
.scored .chip-seed.fresh {
  animation: seed-pop 0.5s cubic-bezier(0.2, 1.8, 0.4, 1) 0.2s both;
}

@keyframes seed-pop {
  from {
    transform: scale(0) rotate(-40deg);
  }
}

/* 勝者 */
.res-win {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 24px 20px 22px;
  text-align: center;
  background: #fffbe0;
  box-shadow: 0 0 0 5px var(--yellow), 0 8px 0 5px var(--drop);
  animation: big-in 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.win-avas {
  display: flex;
  gap: 18px;
}

.win-avas .ava {
  animation: win-hop 0.6s ease-in-out infinite alternate;
}

.win-avas .ava:nth-child(2) {
  animation-delay: 0.15s;
}

.win-avas .ava:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes win-hop {
  to {
    transform: translateY(-10px) rotate(4deg);
  }
}

.win-title {
  margin-top: 10px;
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: clamp(1.7rem, 6vw, 2.6rem);
  line-height: 1.3;
  color: var(--rose);
}

.win-sub {
  font-weight: 700;
}

.win-seeds {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  margin-top: 6px;
}

.win-seeds .chip-seed {
  width: 26px;
}

.win-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 14px;
}

/* 下に貼り付く操作欄 */
.res-actions {
  position: sticky;
  bottom: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 -16px;
  padding: 14px 16px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(255, 233, 236, 0), var(--paper) 34%);
  text-align: center;
}

.res-actions:empty {
  display: none;
}

/* ---------------------------------------------------------------- 重ねて出す画面 */

#layer-modal.open {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(74, 52, 40, 0.5);
}

.modal {
  position: relative;
  width: min(100%, 560px);
  max-height: min(88dvh, 900px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 26px 24px 24px;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 0 0 5px var(--paper-deep), 0 10px 0 5px rgba(74, 52, 40, 0.2);
}

.modal-wide {
  width: min(100%, 860px);
}

.modal-x {
  position: sticky;
  top: 0;
  float: right;
  z-index: 3;
  width: 44px;
  height: 44px;
  margin: -12px -10px 0 8px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
}

.modal-title {
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.35;
}

.modal-lead {
  margin-top: 6px;
  font-size: 0.95rem;
}

/* できること一覧(features.js) */
.feat-group {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 3px dotted var(--line);
}

.feat-group h3 {
  margin: 0;
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: 1.12rem;
  color: var(--rose);
}

.feat-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 10px;
  padding: 0;
  list-style: none;
}

.feat {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px 12px 10px;
  border-radius: 16px;
  background: #fffaf7;
  box-shadow: inset 0 0 0 2px #f6e3df;
}

.feat-ava {
  flex: none;
}

.feat-body {
  min-width: 0;
}

.feat-name {
  margin: 0;
  padding-top: 2px;
  font-size: 0.98rem;
  font-weight: 900;
  line-height: 1.4;
}

.feat-text {
  margin: 3px 0 0;
  font-size: 0.84rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

.feat-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}

.feat-acts .btn {
  min-height: 36px;
  padding: 0.15em 1.1em;
  font-size: 0.86rem;
}

@media (max-width: 640px) {
  .feat-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .feat .ava-m {
    width: 40px;
  }
}

/* カードの拡大 */
.zoom {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 22px;
  clear: both;
}

.zoom-card {
  width: min(52vw, 230px);
}

.zoom-info {
  flex: 1;
  min-width: 200px;
  display: grid;
  gap: 10px;
}

.zoom-colors {
  font-size: 1.4rem;
}

/* カード一覧 */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.cardgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 16px 14px;
  margin-top: 18px;
  padding: 4px;
}

.grid-card {
  width: 100%;
  transition: transform 0.1s;
}

.grid-card:hover {
  transform: translateY(-4px) rotate(-2deg);
}

/* 遊び方 */
.rule {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 3px dotted var(--line);
}

.rule h3 {
  display: flex;
  align-items: center;
  gap: 0.45em;
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: 1.12rem;
}

.rule ul {
  margin-top: 8px;
  display: grid;
  gap: 5px;
}

.rule li {
  position: relative;
  padding-left: 1.15em;
  font-size: 0.95rem;
  line-height: 1.65;
}

.rule li::before {
  content: "";
  position: absolute;
  left: 0.15em;
  top: 0.62em;
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: var(--peach);
}

.rule-art {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 4px;
}

.rule-art .card {
  width: 58px;
}

.rule-arrow,
.rule-ok {
  font-family: var(--font-pop);
  font-size: 1.5rem;
  color: var(--ink-soft);
}

.rule-ok {
  color: var(--leaf);
}

.rule-chip {
  width: 30px;
}

.chip-seed.rule-chip {
  width: 20px;
}

.score-table {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
  font-size: 0.93rem;
}

.score-table th,
.score-table td {
  padding: 9px 6px;
  border-bottom: 2px solid var(--paper);
  text-align: left;
  vertical-align: middle;
}

.score-table th {
  font-weight: 700;
}

.score-table small {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.score-table td {
  width: 4.6em;
  font-family: var(--font-pop);
  font-size: 1.15rem;
  color: var(--rose);
  text-align: right;
  white-space: nowrap;
}

.rules-manual {
  margin-top: 24px;
  text-align: center;
}

/* 説明書の画像 */
.manual-scroll {
  margin-top: 14px;
  overflow-x: auto;
  border-radius: 14px;
  box-shadow: inset 0 0 0 2px var(--line);
  -webkit-overflow-scrolling: touch;
}

.manual-scroll img {
  display: block;
  width: 1900px;
  max-width: none;
  height: auto;
}

/* アイコン選択 */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 14px 10px;
  margin-top: 18px;
  padding: 4px;
}

.icon-cell {
  display: grid;
  place-items: center;
  padding: 6px;
  border: 0;
  border-radius: 20px;
  background: none;
}

.icon-cell:hover {
  background: var(--paper);
}

.icon-cell.on {
  background: var(--rose);
}

/* 進行ログ */
.log-list {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  font-size: 0.92rem;
}

.log-list li {
  padding: 5px 12px;
  border-radius: 12px;
}

.log-round {
  margin-top: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.log-win {
  background: var(--yellow);
  font-weight: 900;
}

.log-miss {
  background: #f1e2f4;
}

.log-score {
  background: var(--peach-soft);
}

/* クレジット */
.credits-lead {
  margin-top: 8px;
}

.credits h3 {
  margin-top: 18px;
  font-family: var(--font-pop);
  font-weight: 400;
}

.credit-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.credit {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--paper);
}

.credit-what span {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.credit-who a {
  margin-left: 0.8em;
}

.credits-foot {
  margin-top: 22px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* お知らせ */
#layer-toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 80;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(92vw, 520px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 0.7em 1.3em;
  border-radius: 18px;
  background: var(--ink);
  box-shadow: 0 0 0 3px #fff, 0 5px 0 3px var(--drop);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
  animation: toast-in 0.22s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  transition: opacity 0.4s, transform 0.4s;
}

.toast-error {
  background: var(--rose-deep);
}

.toast-mini {
  padding: 0.45em 1.1em;
  background: var(--cat);
  font-size: 0.9rem;
}

.toast.out {
  opacity: 0;
  transform: translateY(8px);
}

@keyframes toast-in {
  from {
    transform: translateY(14px) scale(0.9);
    opacity: 0;
  }
}

/* ---------------------------------------------------------------- サウンド */

.snd-btn {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 0 var(--drop);
  color: var(--ink);
}

.snd-btn svg {
  width: 24px;
}

.bar-snd {
  width: 40px;
  height: 40px;
  background: var(--paper);
  box-shadow: none;
}

.snd-fab {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  top: 14px;
  z-index: 30;
}

/* ブラウザが音を止めているあいだ(最初に押すまで)は、ゆっくり光る */
.snd-wait {
  animation: snd-wait 1.4s ease-in-out infinite;
}

@keyframes snd-wait {
  50% {
    box-shadow: 0 4px 0 var(--drop), 0 0 0 8px rgba(232, 49, 91, 0.22);
  }
}

.snd-hint {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  padding: 0.4em 0.9em;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  transform: translateY(-50%);
}

#layer-sound.open {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

.snd-panel {
  position: fixed;
  width: 280px;
  padding: 16px 18px 18px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 0 0 4px var(--paper-deep), 0 8px 0 4px var(--drop);
  pointer-events: auto;
}

.snd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.snd-head h2 {
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: 1.1rem;
}

.snd-mute {
  min-height: 36px;
  padding: 0 1em;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  font-weight: 700;
  font-size: 0.82rem;
}

.snd-mute.on {
  background: var(--rose);
  color: #fff;
}

.snd-row {
  display: grid;
  grid-template-columns: 4.2em 1fr 2.4em;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  font-size: 0.88rem;
  font-weight: 700;
}

.snd-row input[type="range"] {
  width: 100%;
  accent-color: var(--rose);
}

.snd-val {
  font-family: var(--font-pop);
  text-align: right;
}

.snd-now {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 3px dotted var(--line);
  font-size: 0.82rem;
}

.snd-now-label {
  margin-right: 0.6em;
  padding: 0 0.6em;
  border-radius: 999px;
  background: var(--peach-soft);
  font-weight: 900;
}

.snd-now-by {
  margin-left: 0.6em;
  color: var(--ink-soft);
}

.snd-note {
  margin-top: 8px;
  font-size: 0.76rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- ミニゲーム「ぴったりストップ」(stopgame.js) */

body.sg-on {
  overflow: hidden;
}

.sg {
  position: fixed;
  inset: 0;
  z-index: 95;
  overflow-y: auto;
  background: var(--paper);
}

.sg-box {
  display: flex;
  flex-direction: column;
  max-width: 640px;
  min-height: 100%;
  margin: 0 auto;
  padding: 58px 16px max(28px, env(safe-area-inset-bottom));
}

.sg-x {
  position: fixed;
  right: 14px;
  top: 12px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
}

/* ---- えらぶ画面 */

.sg-title {
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  color: var(--rose);
  text-align: center;
}

.sg-lead {
  max-width: 30em;
  margin: 10px auto 0;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.7;
  text-align: center;
}

.sg-levels {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

/* 「ハムスターの数」と「ハムスターの色」の見出し */
.sg-group {
  margin-top: 26px;
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: 1.15rem;
}

.sg-group-note {
  margin-top: 4px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-soft);
}

/* ゲキむずは、ボタンも特別に */
.sg-level.lv-hams-max {
  background: linear-gradient(100deg, #fff 55%, #f6e9ff);
}

.lv-hams-max .sg-stars {
  color: #b14ae0;
}

.sg-level {
  display: grid;
  grid-template-columns: 9em minmax(0, 1fr);
  grid-template-areas: "name note" "name rec";
  align-items: center;
  gap: 2px 14px;
  padding: 14px 18px;
  border: 0;
  border-left: 10px solid var(--lv);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 5px 0 var(--drop);
  color: var(--ink);
  text-align: left;
  transition: transform 0.1s;
}

.sg-level:hover {
  transform: translateY(-2px);
}

.sg-level b {
  grid-area: name;
  display: grid;
  gap: 2px;
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: 1.08rem;
  line-height: 1.3;
  color: var(--lv);
}

.sg-stars {
  font-family: var(--font-body, sans-serif);
  font-style: normal;
  font-size: 0.86rem;
  letter-spacing: 1px;
  color: #f2b705;
}

.sg-stars s {
  text-decoration: none;
  color: #ecdcd5;
}

.sg-level span {
  grid-area: note;
  font-weight: 700;
  font-size: 0.92rem;
}

.sg-level small {
  grid-area: rec;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-soft);
}

/* ---- 遊ぶ画面 */

.sg-play,
.sg-reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.sg-mission {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 8px;
  font-size: clamp(1rem, 4.4vw, 1.3rem);
  font-weight: 900;
  text-align: center;
}

.sg-mission b.num {
  font-size: 1.6em;
  line-height: 1;
  color: var(--rose);
}

.sg-mission.small {
  font-size: 0.95rem;
}

.sg-mission .dots {
  margin-right: 2px;
}

.sg-level-tag {
  padding: 0.1em 0.7em;
  border-radius: 999px;
  background: var(--lv);
  color: #fff;
  font-size: 0.72rem;
}

.sg-table {
  display: grid;
  place-items: center;
  width: 100%;
  padding: 26px 0;
  border-radius: 26px;
  background: var(--mat);
  box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 7px #f6e6c8, 0 6px 0 var(--drop);
}

.sg-pile {
  position: relative;
  width: min(42vw, 30vh, 200px);
  aspect-ratio: 420 / 622;
  border: 3px dashed #e3cfa8;
  border-radius: 8% / 5.4%;
}

.sg-pile[data-n] {
  border-color: transparent;
}

.sg-card {
  position: absolute;
  inset: 0;
  width: 100%;
  transform: rotate(var(--tilt, 0deg));
  animation: card-drop 0.22s cubic-bezier(0.2, 1.4, 0.5, 1) both;
}

/* 3・2・1 */
.sg-count {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-pop);
  font-size: 4rem;
  color: var(--rose);
}

.sg-count.pop {
  animation: sg-pop 0.6s ease-out both;
}

@keyframes sg-pop {
  from {
    opacity: 0;
    transform: scale(1.8);
  }
  30% {
    opacity: 1;
    transform: scale(1);
  }
}

.sg-sub {
  margin-top: -8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

/* 「ハムスターの数」: ハムスターが顔を出す野原 */
.sg-field {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 26px;
  background:
    radial-gradient(circle at 12% 82%, #fff3a8 0 6px, transparent 7px),
    radial-gradient(circle at 88% 18%, #ffd1dc 0 6px, transparent 7px),
    radial-gradient(circle at 70% 88%, #fff 0 5px, transparent 6px),
    radial-gradient(circle at 30% 14%, #fff 0 5px, transparent 6px),
    linear-gradient(#d9f2c0, #b7e39b);
  box-shadow: inset 0 0 0 4px #fff, inset 0 -18px 0 rgba(120, 180, 90, 0.18), 0 6px 0 var(--drop);
}

.sg-ham {
  position: absolute;
  width: 16%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  animation: sg-ham-in 0.3s cubic-bezier(0.2, 1.6, 0.5, 1) both;
}

.sg-ham img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scaleX(var(--flip, 1));
  filter: drop-shadow(0 4px 0 rgba(80, 120, 60, 0.22));
}

.sg-ham.out {
  animation: sg-ham-out 0.34s ease-in both;
}

/* ゲキむず: 野原のます目が多いので、ハムスターを小さく */
.sg-field.dense .sg-ham {
  width: 12.5%;
}

@keyframes sg-ham-in {
  from {
    opacity: 0;
    transform: translate(-50%, 10%) scale(0.4);
  }
}

@keyframes sg-ham-out {
  to {
    opacity: 0;
    transform: translate(-50%, -110%) scale(0.7);
  }
}

/* ストップのボタン(大きな押しボタン) */
.sg-stop {
  width: min(78vw, 300px);
  min-height: 86px;
  margin-top: 6px;
  border: 0;
  border-radius: 999px;
  background: var(--rose);
  box-shadow: 0 0 0 5px #fff, 0 9px 0 5px var(--rose-deep);
  color: #fff;
  font-family: var(--font-pop);
  font-size: clamp(1.6rem, 7vw, 2.1rem);
  transition: transform 0.06s, box-shadow 0.06s;
  touch-action: manipulation;
}

.sg-stop:active:not(:disabled),
.sg-stop.pressed {
  transform: translateY(7px);
  box-shadow: 0 0 0 5px #fff, 0 2px 0 5px var(--rose-deep);
}

.sg-stop:disabled {
  opacity: 0.45;
}

.sg-keys {
  font-size: 0.74rem;
  color: var(--ink-soft);
}

@media (hover: none) {
  .sg-keys {
    display: none;
  }
}

/* ---- 答え合わせ */

.sg-head {
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: clamp(1.7rem, 8vw, 2.6rem);
  line-height: 1.2;
  text-align: center;
  color: var(--ink-soft);
}

.sg-reveal.ok .sg-head {
  color: var(--rose);
  animation: sg-pop 0.7s ease-out both;
}

.sg-reveal.near .sg-head {
  color: var(--lv-normal);
}

.sg-at {
  font-weight: 700;
}

.sg-at b {
  font-size: 1.6rem;
}

.sg-at span {
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.sg-streak {
  padding: 0.2em 1em;
  border-radius: 999px;
  background: #ffd726;
  font-weight: 900;
}

.sg-cells {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px 8px;
  width: 100%;
  margin-top: 6px;
  padding: 18px 10px 24px;
  border-radius: 22px;
  background: var(--mat);
  box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 7px #f6e6c8;
}

.sg-cell {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  width: clamp(40px, 11vw, 58px);
  line-height: 1;
}

.sg-mini {
  width: 100%;
  box-shadow: 0 0 0 2px #fff, 0 3px 0 2px var(--drop);
}

.sg-badge {
  position: absolute;
  right: -7px;
  top: -9px;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--rose);
  color: #fff;
  font-size: 0.74rem;
}

.sg-cell.zero .sg-badge {
  background: #b9a79d;
}

.sg-cell.minus .sg-badge {
  background: var(--cat);
}

.sg-total {
  font-size: 0.95rem;
}

/* 「ハムスターの数」: いっしょに出てきた子をまとめて */
.sg-cell.sg-wave {
  width: auto;
}

.sg-wave-hams {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 1px;
  width: 78px;
  min-height: 70px;
  padding: 5px 3px;
  border-radius: 14px;
  background: #e8f6da;
  box-shadow: 0 0 0 2px #fff, 0 3px 0 2px var(--drop);
}

.sg-wave-hams img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.sg-cell.hit .sg-wave-hams {
  box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--mine), 0 0 12px 5px var(--mine-glow);
}

.sg-cell.stop .sg-wave-hams {
  box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--ink);
}

/* ストップしたあとに出るはずだったカード */
.sg-cell.later {
  opacity: 0.4;
  filter: grayscale(0.6);
}

/* ここでぴったり(緑の枠) */
.sg-cell.hit .sg-mini {
  box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--mine), 0 0 12px 5px var(--mine-glow);
}

.sg-cell.hit .sg-total {
  color: var(--mine-deep);
}

/* ストップしたところ(茶色の枠) */
.sg-cell.stop .sg-mini {
  box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--ink);
}

.sg-flag {
  position: absolute;
  left: 50%;
  bottom: -16px;
  padding: 0.1em 0.5em;
  border-radius: 999px;
  background: var(--mine-deep);
  color: #fff;
  font-size: 0.6rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.5;
  white-space: nowrap;
  transform: translateX(-50%);
}

.sg-flag.stop {
  background: var(--ink);
}

.sg-legend {
  font-size: 0.74rem;
  color: var(--ink-soft);
}

.sg-acts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 6px;
}

/* ---- トップの入口 */

.sg-entry {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  max-width: 480px;
  margin-top: 18px;
  padding: 18px 20px;
}

.sg-entry-art {
  position: relative;
  height: 104px;
}

.sg-entry-art .card.sg-entry-card {
  position: absolute;
  top: 6px;
  width: 58px;
}

.sg-entry-card.c0 {
  left: 0;
  transform: rotate(-10deg);
}

.sg-entry-card.c1 {
  left: 30px;
  top: 2px;
  transform: rotate(2deg);
}

.sg-entry-card.c2 {
  left: 60px;
  transform: rotate(12deg);
}

.sg-entry-stop {
  position: absolute;
  left: 50%;
  bottom: -4px;
  z-index: 2;
  padding: 0.15em 0.8em;
  border-radius: 999px;
  background: var(--rose);
  box-shadow: 0 0 0 3px #fff, 0 4px 0 3px var(--rose-deep);
  color: #fff;
  font-family: var(--font-pop);
  font-size: 0.86rem;
  white-space: nowrap;
  transform: translateX(-50%) rotate(-4deg);
}

.sg-entry-text {
  display: grid;
  justify-items: start;
  gap: 6px;
  text-align: left;
}

.sg-entry-title {
  font-size: 1rem;
  font-weight: 900;
}

.sg-entry-text p {
  font-size: 0.84rem;
  line-height: 1.6;
}

.sg-entry-rec {
  font-weight: 700;
  color: var(--mine-deep);
}

.sg-entry .btn {
  min-height: 40px;
  padding: 0.2em 1.6em;
}

@media (max-width: 640px) {
  /* スマホは、名前と★を上に、説明をその下に */
  .sg-level {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "name" "note" "rec";
    gap: 3px;
    padding: 12px 14px;
  }

  .sg-level b {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 1.02rem;
  }

  .sg-field {
    aspect-ratio: 4 / 3;
  }

  .sg-ham {
    width: 18%;
  }

  .sg-field.dense .sg-ham {
    width: 14%;
  }

  .sg-wave-hams {
    width: 66px;
    min-height: 60px;
  }

  .sg-wave-hams img {
    width: 29px;
    height: 29px;
  }

  .sg-entry {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 12px;
    padding: 16px;
  }

  .sg-entry-art .card.sg-entry-card {
    width: 48px;
  }

  .sg-entry-card.c1 {
    left: 26px;
  }

  .sg-entry-card.c2 {
    left: 52px;
  }
}

/* ---------------------------------------------------------------- はじめてガイド(coach.js) */

.coach-layer {
  position: fixed;
  left: 50%;
  top: 64px;
  z-index: 70;
  width: min(620px, calc(100vw - 16px));
  transform: translateX(-50%);
  pointer-events: none;
}

.coach-layer[hidden] {
  display: none;
}

/* 答え合わせの画面: 下の「つぎのラウンドへ」の上に出す */
.coach-layer.at-bottom {
  top: auto;
  bottom: 96px;
}

.coach {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px 12px 12px;
  border-radius: 20px;
  background: #fffdf5;
  box-shadow: 0 0 0 3px #ffd726, 0 8px 0 rgba(74, 52, 40, 0.14), 0 14px 30px rgba(74, 52, 40, 0.18);
  pointer-events: auto;
  animation: coach-in 0.28s cubic-bezier(0.2, 1.4, 0.5, 1) both;
}

@keyframes coach-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
}

.coach-ava {
  flex: none;
  animation: coach-bob 1.6s ease-in-out infinite;
}

@keyframes coach-bob {
  50% {
    transform: translateY(-3px) rotate(-3deg);
  }
}

.coach-body {
  flex: 1;
  min-width: 0;
}

.coach-name {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.coach-name b {
  font-size: 0.8rem;
  color: var(--ink);
}

.coach-text {
  margin-top: 2px;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.6;
}

.coach-text .dots {
  margin-right: 2px;
  vertical-align: -1px;
}

.coach-acts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.coach-acts .btn {
  min-height: 40px;
  padding: 0.2em 1.2em;
  font-size: 0.92rem;
}

.coach-quit {
  position: absolute;
  right: 12px;
  top: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* 説明している場所(黄色い輪がゆっくり光る) */
.coach-spot {
  outline: 4px solid #ffd726;
  outline-offset: 5px;
  border-radius: 14px;
  animation: coach-spot 1.1s ease-in-out infinite;
}

@keyframes coach-spot {
  50% {
    outline-color: rgba(255, 215, 38, 0.35);
    outline-offset: 9px;
  }
}

/* 吹き出しは席の上に重ねる(ガイドのあいだは、席は見えなくてもよい) */
@media (max-width: 640px) {
  .coach-layer {
    top: 58px;
  }

  .coach-layer.at-bottom {
    bottom: 118px;
  }

  .coach {
    gap: 8px;
    padding: 10px 10px 10px 8px;
  }

  .coach .ava-m {
    width: 38px;
  }

  .coach-text {
    font-size: 0.84rem;
    line-height: 1.55;
  }
}

/* ---------------------------------------------------------------- オープニング */
/*
 * ゲームの箱(3D)が置かれていて、ふたがカタカタ。押すとふたが飛んで、ハムスターが飛び出す(intro.js)。
 * 時間は intro.js の REVEAL_AT(うしろのトップが見えはじめる)・DONE_AT(ぜんぶ終わる)と合わせる。
 */

body.intro-on {
  overflow: hidden;
}

.intro {
  /* 箱の大きさ(床に置いた本体の幅・奥行き・高さ、ふたのへりの高さ) */
  --bw: min(48vw, 30vh, 240px);
  --bl: calc(var(--bw) * 1.426);
  --h: calc(var(--bw) * 0.32);
  --lh: calc(var(--bw) * 0.15);
  position: fixed;
  inset: 0;
  z-index: 100;
  cursor: pointer;
}

.intro-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 46%, #fff6f3 0%, var(--paper) 62%);
}

.intro-main {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
}

.intro-stage {
  display: grid;
  place-items: center;
  width: calc(var(--bw) * 1.7);
  height: calc(var(--bl) * 1.05);
  perspective: 1100px;
  perspective-origin: 50% 20%;
}

.ibox {
  position: relative;
  width: var(--bw);
  height: var(--bl);
  transform-style: preserve-3d;
  transform: rotateX(54deg) rotateZ(-14deg);
  animation: box-wobble 1.6s ease-in-out infinite;
}

.ibox i,
.ibox div {
  position: absolute;
  display: block;
}

/* 床の影 */
.ib-shadow {
  inset: -7%;
  border-radius: 22px;
  background: rgba(150, 70, 80, 0.28);
  filter: blur(12px);
  transform: translateZ(-2px);
}

/* 本体: 中の底と、4つの壁 */
.ib-base {
  inset: 0;
  transform-style: preserve-3d;
}

.ib-floor {
  inset: 0;
  border-radius: 3px;
  background: radial-gradient(circle at 50% 40%, #e98b98, #c9566b);
  transform: translateZ(1px);
}

.ib-wall {
  background: #f7b8c0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.7) 18%, transparent 20%);
  background-size: calc(var(--h) * 0.5) calc(var(--h) * 0.5);
}

.ib-front {
  left: 0;
  top: calc(var(--bl) - var(--h));
  width: var(--bw);
  height: var(--h);
  transform-origin: 50% 100%;
  transform: rotateX(-90deg);
}

.ib-back {
  left: 0;
  top: 0;
  width: var(--bw);
  height: var(--h);
  transform-origin: 50% 0;
  transform: rotateX(90deg);
  filter: brightness(0.86);
}

.ib-left {
  left: 0;
  top: 0;
  width: var(--h);
  height: var(--bl);
  transform-origin: 0 50%;
  transform: rotateY(-90deg);
  filter: brightness(0.8);
}

.ib-right {
  left: calc(var(--bw) - var(--h));
  top: 0;
  width: var(--h);
  height: var(--bl);
  transform-origin: 100% 50%;
  transform: rotateY(90deg);
  filter: brightness(0.93);
}

/* ふた: 表にカードの表紙の絵、まわりにへり */
.ib-lid {
  inset: calc(var(--bw) * -0.03);
  transform-style: preserve-3d;
  transform: translateZ(var(--h));
  animation: lid-rattle 1.6s ease-in-out infinite;
}

.ib-top {
  inset: 0;
  overflow: hidden;
  border-radius: 4px;
  background: #f8c9c6;
  box-shadow: inset 0 0 0 3px #fff;
}

.ib-top img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ib-band {
  display: grid;
  place-items: center;
  background: var(--rose);
}

/* 手前のへり: ふたの手前のふちから下へ垂らす(表が手前を向くように) */
.ib-band-front {
  left: 0;
  top: 100%;
  width: 100%;
  height: var(--lh);
  transform-origin: 50% 0;
  transform: rotateX(-90deg);
}

.ib-band-front b {
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: calc(var(--lh) * 0.46);
  line-height: 1;
  color: #fff;
  white-space: nowrap;
}

.ib-band-back {
  left: 0;
  top: 0;
  width: 100%;
  height: var(--lh);
  transform-origin: 50% 0;
  transform: rotateX(-90deg);
  filter: brightness(0.85);
}

.ib-band-left {
  left: 0;
  top: 0;
  width: var(--lh);
  height: 100%;
  transform-origin: 0 50%;
  transform: rotateY(90deg);
  filter: brightness(0.78);
}

.ib-band-right {
  left: calc(100% - var(--lh));
  top: 0;
  width: var(--lh);
  height: 100%;
  transform-origin: 100% 50%;
  transform: rotateY(-90deg);
  filter: brightness(0.9);
}

/* 待っているあいだ: 中でハムスターがごそごそして、ふたがカタカタ持ち上がる */
@keyframes lid-rattle {
  0%,
  55%,
  100% {
    transform: translateZ(var(--h));
  }
  62% {
    transform: translateZ(calc(var(--h) + var(--bw) * 0.07)) rotateX(-3deg) rotateY(2deg);
  }
  68% {
    transform: translateZ(var(--h));
  }
  74% {
    transform: translateZ(calc(var(--h) + var(--bw) * 0.04)) rotateY(-2deg);
  }
  80% {
    transform: translateZ(var(--h));
  }
}

@keyframes box-wobble {
  0%,
  55%,
  86%,
  100% {
    transform: rotateX(54deg) rotateZ(-14deg);
  }
  64% {
    transform: rotateX(54deg) rotateZ(-16deg);
  }
  72% {
    transform: rotateX(54deg) rotateZ(-12deg);
  }
  79% {
    transform: rotateX(54deg) rotateZ(-15deg);
  }
}

/* すき間から出るハート */
.intro-heart {
  position: absolute;
  width: 18px;
  height: 17px;
  margin: -8px 0 0 -9px;
  animation: heart-up 1.4s ease-out both;
}

.intro-heart svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: #ff7d96;
  stroke: #fff;
  stroke-width: 2;
}

@keyframes heart-up {
  0% {
    opacity: 0;
    transform: translate(0, 6px) scale(0.4);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), -70px) scale(1.1);
  }
}

.intro-btn {
  min-height: 52px;
  padding: 0.4em 1.6em;
  border: 0;
  border-radius: 999px;
  background: var(--rose);
  box-shadow: 0 0 0 4px #fff, 0 5px 0 4px var(--rose-deep);
  color: #fff;
  font-family: var(--font-pop);
  font-size: 1.1rem;
  animation: intro-wait 0.9s ease-in-out infinite alternate;
}

@keyframes intro-wait {
  to {
    transform: translateY(-5px);
  }
}

/* ---- 押したあと */

.intro.opening {
  cursor: default;
}

.intro.opening .intro-btn {
  animation: none;
  opacity: 0;
  transition: opacity 0.15s;
}

/* 箱がぎゅっと縮んでから、ふたがポンッ */
.intro.opening .ibox {
  animation: box-pop 0.55s ease-out both;
}

@keyframes box-pop {
  0% {
    transform: rotateX(54deg) rotateZ(-14deg);
  }
  16% {
    transform: rotateX(54deg) rotateZ(-14deg) scale3d(1.05, 1.05, 0.78);
  }
  40% {
    transform: rotateX(54deg) rotateZ(-14deg) scale3d(0.97, 0.97, 1.1);
  }
  100% {
    transform: rotateX(54deg) rotateZ(-14deg);
  }
}

/* ふた: まっすぐ上へポンッと持ち上がって、すぐにくるっと回りながら右奥へ飛んでいく(ハムスターの通り道をあける) */
.intro.opening .ib-lid {
  animation: lid-fly 0.85s 0.06s both;
}

@keyframes lid-fly {
  0% {
    transform: translateZ(var(--h));
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.4, 1);
  }
  18% {
    transform: translateZ(calc(var(--h) + var(--bw) * 0.6)) rotateX(-10deg) rotateY(6deg);
    animation-timing-function: cubic-bezier(0.35, 0.25, 0.7, 0.9);
  }
  100% {
    transform: translate3d(calc(var(--bw) * 3.8), calc(var(--bw) * -4), calc(var(--h) + var(--bw) * 1.1)) rotateX(-40deg) rotateY(44deg) rotateZ(40deg);
  }
}

/* 飛び出すハムスター: 横はまっすぐ、縦は上がって落ちる(放物線のように) */
.intro-hams {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ham-fly {
  position: absolute;
  left: var(--x0);
  top: var(--y0);
  width: var(--s);
  height: var(--s);
  margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  animation: ham-x var(--dur) cubic-bezier(0.3, 0.55, 0.6, 1) var(--delay) both;
}

.ham-fly i {
  display: block;
  width: 100%;
  height: 100%;
  animation: ham-y var(--dur) var(--delay) both;
}

.ham-fly img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scaleX(var(--flip));
  filter: drop-shadow(0 4px 0 rgba(150, 70, 80, 0.16));
}

@keyframes ham-x {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(var(--dx));
  }
}

@keyframes ham-y {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.3) rotate(0deg);
    animation-timing-function: cubic-bezier(0.2, 0.75, 0.45, 1);
  }
  6% {
    opacity: 1;
  }
  36% {
    transform: translateY(calc(var(--up) * -1)) scale(1) rotate(calc(var(--rot) * 0.35));
    animation-timing-function: cubic-bezier(0.55, 0, 0.9, 0.5);
  }
  100% {
    opacity: 1;
    transform: translateY(var(--fall)) scale(1) rotate(var(--rot));
  }
}

/* うしろのトップを見せる(ハムスターは、まだ飛んでいる) */
.intro.reveal {
  pointer-events: none;
}

.intro.reveal .intro-bg,
.intro.reveal .intro-main {
  opacity: 0;
  transition: opacity 0.55s ease-in;
}

.intro.reveal .intro-main {
  transform: scale(0.92) translateY(30px);
  transition:
    opacity 0.45s ease-in,
    transform 0.45s ease-in;
}

/* ---------------------------------------------------------------- ロビー: ハムスターのおうち */

.garden {
  --s: 78px; /* 顔を出す場所の大きさ */
  padding: 16px 18px 18px;
  overflow: hidden;
}

.garden-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2px 12px;
}

.garden-me {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.garden-lead {
  margin-top: 2px;
  font-size: 0.86rem;
  line-height: 1.5;
}

/* 野原 */
.garden-field {
  position: relative;
  height: calc(var(--s) * 2.75);
  margin-top: 10px;
  border-radius: 20px 20px 6px 6px;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.5) 0 3px, transparent 4px) 0 0 / 46px 38px,
    linear-gradient(#d9f2b8, #bfe596 55%, #aedd80);
  box-shadow: inset 0 0 0 4px #fff;
  overflow: hidden;
  touch-action: manipulation;
}

/* 顔を出す場所(左下を基準に置き、下の辺が地面) */
.spot {
  position: absolute;
  width: var(--s);
  height: var(--s);
  transform: translate(-50%, -100%);
}

.deco {
  position: absolute;
  left: -14%;
  width: 128%;
  height: auto;
  pointer-events: none;
}

.deco-back {
  bottom: 2%;
  z-index: 0;
}

.deco-front {
  bottom: -2%;
  z-index: 2;
}

.spot-grass .deco-front,
.spot-bush .deco-front {
  bottom: -6%;
}

/* ハムスターが顔を出す窓(この下の辺より下は見えない = 茂みや巣穴の中) */
.peek {
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: 24%;
  height: 112%;
  z-index: 1;
  overflow: hidden;
}

.spot-hole .peek {
  bottom: 30%;
}

.wild {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 0;
  padding: 0;
  border: 0;
  background: none;
  line-height: 0;
  cursor: pointer;
  transform: translateY(105%);
  transition: transform 0.16s cubic-bezier(0.2, 1.4, 0.5, 1);
  -webkit-tap-highlight-color: transparent;
}

.wild img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 2px 0 rgba(74, 52, 40, 0.18));
  pointer-events: none;
}

.wild.up {
  transform: translateY(14%);
}

.wild:disabled {
  cursor: default;
}

.wild.gone,
.wild.taken {
  transform: translateY(105%);
  transition-duration: 0.22s;
}

.wild.taken {
  opacity: 0;
  transition: none;
}

/* つかんだ瞬間(返事を待つあいだ)に、ぎゅっとつぶれる */
.wild.grabbed {
  transform: translateY(20%) scale(1.08, 0.86);
  transition-duration: 0.08s;
}

.wild.miss {
  animation: wild-miss 0.3s;
}

@keyframes wild-miss {
  25% {
    margin-left: -6px;
  }
  75% {
    margin-left: 6px;
  }
}

/* 猫: シャーッ */
.wild.hiss {
  animation: hiss 0.5s;
  transform: translateY(6%) scale(1.15);
}

@keyframes hiss {
  0%,
  100% {
    rotate: 0deg;
  }
  20% {
    rotate: -8deg;
  }
  40% {
    rotate: 8deg;
  }
  60% {
    rotate: -6deg;
  }
  80% {
    rotate: 4deg;
  }
}

/* 飛んでいくハムスター(つかまえて、おうちへ) */
.flyer {
  position: fixed;
  z-index: 70;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 3px 0 rgba(74, 52, 40, 0.2));
}

/* おうち(席に着いた人のハムスター) */
.garden-house {
  position: relative;
  margin-top: -4px;
  padding: 14px 8px 8px;
  border-radius: 6px 6px 18px 18px;
  background:
    repeating-linear-gradient(90deg, transparent 0 34px, rgba(255, 255, 255, 0.35) 34px 36px),
    linear-gradient(#ffe2c7, #ffd3ad);
  box-shadow: inset 0 0 0 4px #fff;
}

.pens {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  min-height: 116px;
}

.pen {
  position: relative;
  flex: 0 1 132px;
  min-width: 0;
  display: grid;
  justify-items: center;
  padding-top: 26px;
}

/* つかまえたハムスター(持ち主のうしろに、こんもり) */
.pen-pile {
  position: absolute;
  left: 50%;
  top: 0;
  width: 112px;
  height: 66px;
  transform: translateX(-50%);
}

.pile-ham {
  position: absolute;
  width: 30px;
  height: auto;
  filter: drop-shadow(0 1.5px 0 rgba(74, 52, 40, 0.16));
}

/* 12匹までの置き場所(新しい子ほど手前) */
.pile-ham.p0 { left: 10px; top: 26px; z-index: 12; }
.pile-ham.p1 { left: 72px; top: 26px; z-index: 11; }
.pile-ham.p2 { left: 0; top: 10px; z-index: 10; }
.pile-ham.p3 { left: 82px; top: 8px; z-index: 9; }
.pile-ham.p4 { left: 22px; top: 2px; z-index: 8; }
.pile-ham.p5 { left: 60px; top: 0; z-index: 7; }
.pile-ham.p6 { left: 41px; top: -6px; z-index: 6; }
.pile-ham.p7 { left: -6px; top: 32px; z-index: 5; }
.pile-ham.p8 { left: 88px; top: 34px; z-index: 4; }
.pile-ham.p9 { left: 30px; top: -14px; z-index: 3; }
.pile-ham.p10 { left: 54px; top: -14px; z-index: 2; }
.pile-ham.p11 { left: 6px; top: -8px; z-index: 1; }

/* いまつかまえた子が、少し遅れて着地する(飛んでくるのを待つ) */
.pile-ham.land {
  animation: land 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) 0.45s both;
}

@keyframes land {
  from {
    transform: translateY(-14px) scale(0);
  }
}

.pen-owner {
  position: relative;
  z-index: 20;
  width: 58px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 3px 0 rgba(74, 52, 40, 0.18));
}

.pen.cpu .pen-owner {
  transform: rotate(-8deg);
  filter: drop-shadow(0 3px 0 rgba(74, 52, 40, 0.18)) saturate(0.85);
}

.pen-zzz {
  position: absolute;
  z-index: 21;
  right: calc(50% - 44px);
  top: 18px;
  font-family: var(--font-pop);
  font-size: 0.8rem;
  line-height: 1;
  color: var(--sky-deep);
}

.pen-zzz i,
.pen-zzz b {
  font-style: normal;
  font-weight: 400;
  position: relative;
  font-size: 1.15em;
  top: -0.4em;
}

.pen-zzz b {
  font-size: 1.35em;
  top: -0.9em;
}

.pen-name {
  max-width: 100%;
  margin-top: 2px;
  padding: 0 0.6em;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 -3px 0 var(--seat);
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pen.me .pen-name {
  background: var(--rose);
  box-shadow: none;
  color: #fff;
}

.pen-you {
  display: none;
}

.pen-count {
  font-family: var(--font-pop);
  font-size: 0.82rem;
  line-height: 1.4;
}

.pen.cpu .pen-count {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.pen-count.bump {
  animation: bump 0.25s cubic-bezier(0.2, 1.6, 0.5, 1) 0.45s;
}

/* 席に着いた人のハムスターが、走ってくる */
.pen.arrive .pen-owner {
  animation: run-in 0.9s cubic-bezier(0.3, 0.8, 0.4, 1) both;
}

.pen.arrive .pen-name,
.pen.arrive .pen-count {
  animation: fade-in 0.3s 0.6s both;
}

@keyframes run-in {
  0% {
    transform: translateX(-160px) translateY(0);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  30% {
    transform: translateX(-100px) translateY(-14px);
  }
  45% {
    transform: translateX(-60px) translateY(0);
  }
  60% {
    transform: translateX(-28px) translateY(-10px);
  }
  75% {
    transform: translateX(-6px) translateY(0);
  }
  88% {
    transform: translateY(-5px);
  }
  100% {
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* 席を立った人のハムスターは、帰っていく */
.pen.leave {
  pointer-events: none;
  animation: run-out 0.5s ease-in both;
}

@keyframes run-out {
  to {
    transform: translateX(120px);
    opacity: 0;
  }
}

/* 空いている席 */
.pen-empty-wrap {
  display: flex;
  gap: 6px;
}

.pen-empty {
  width: 40px;
  height: 40px;
  margin-bottom: 30px;
  border-radius: 50%;
  border: 3px dashed rgba(184, 120, 70, 0.35);
}

/* ---------------------------------------------------------------- ロビー: みんなで育てるひまわり */

.garden-blooms:not(:empty) {
  padding: 0.15em 0.85em;
  border-radius: 999px;
  background: #fff1b8;
  box-shadow: inset 0 0 0 2px #fff;
  font-size: 0.78rem;
  font-weight: 900;
  color: #8a5a00;
}

.garden-hint {
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.garden-hint:empty {
  display: none;
}

.sun-field {
  height: calc(var(--s) * 3);
}

.sun-field .spot {
  pointer-events: none;
}

/* ひまわり(育つと茎がのび、葉がふえ、つぼみ → 満開) */
.flower {
  --g: 0;
  --head: calc(var(--s) * 1.2);
  position: absolute;
  left: 44%;
  bottom: 6px;
  z-index: 3;
  width: calc(var(--s) * 1.6);
  height: calc(100% - 10px);
  transform: translateX(-50%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.flower-soil {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: calc(var(--s) * 1.25);
  height: calc(var(--s) * 0.3);
  transform: translateX(-50%);
  border-radius: 50% 50% 44% 44% / 80% 80% 20% 20%;
  background: radial-gradient(circle at 30% 30%, #a77447 0 3px, transparent 4px) 0 0 / 14px 9px, #8d5d36;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.14), 0 2px 0 rgba(255, 255, 255, 0.5);
}

.flower-stem {
  position: absolute;
  left: 50%;
  bottom: calc(var(--s) * 0.18);
  width: 9px;
  margin-left: -4.5px;
  height: calc(6% + var(--g) * 58%);
  border-radius: 6px;
  background: linear-gradient(90deg, #4f9a33, #7cc552 45%, #4f9a33);
  transition: height 0.45s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.flower[data-stage="0"] .flower-stem {
  opacity: 0;
}

/* 芽(育ちはじめ) */
.flower-sprout {
  position: absolute;
  left: 50%;
  bottom: calc(var(--s) * 0.2);
  width: 30px;
  height: 18px;
  transform: translateX(-50%) scale(0);
  transform-origin: 50% 100%;
  transition: transform 0.3s;
}

.flower[data-stage="0"] .flower-sprout {
  transform: translateX(-50%) scale(1);
}

.flower-sprout i {
  position: absolute;
  bottom: 0;
  width: 15px;
  height: 10px;
  background: #79c24f;
  border: 1.5px solid #4f9a33;
}

.flower-sprout i:first-child {
  left: 0;
  border-radius: 100% 0 100% 0;
  transform: rotate(-24deg);
  transform-origin: 100% 100%;
}

.flower-sprout i:last-child {
  right: 0;
  border-radius: 0 100% 0 100%;
  transform: rotate(24deg);
  transform-origin: 0 100%;
}

.leaf {
  position: absolute;
  width: calc(var(--s) * 0.42);
  height: calc(var(--s) * 0.2);
  background: linear-gradient(#86cf5b, #63b13f);
  border: 1.5px solid #4f9a33;
  transform: scale(0);
  transition: transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1);
}

/* 左の葉・右の葉 */
.leaf-1,
.leaf-3 {
  right: 100%;
  border-radius: 100% 0 100% 0;
  transform-origin: 100% 50%;
  rotate: 16deg;
}

.leaf-2,
.leaf-4 {
  left: 100%;
  border-radius: 0 100% 0 100%;
  transform-origin: 0 50%;
  rotate: -16deg;
}

.leaf-1 {
  bottom: 14%;
}

.leaf-2 {
  bottom: 34%;
}

.leaf-3 {
  bottom: 52%;
}

.leaf-4 {
  bottom: 66%;
}

.flower:not([data-stage="0"]) .leaf-1,
.flower:is([data-stage="2"], [data-stage="3"], [data-stage="4"], [data-stage="5"]) .leaf-2,
.flower:is([data-stage="3"], [data-stage="4"], [data-stage="5"]) .leaf-3,
.flower:is([data-stage="4"], [data-stage="5"]) .leaf-4 {
  transform: scale(1);
}

.flower-top {
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 0;
  height: 0;
}

.flower-bud,
.flower-head {
  position: absolute;
  left: 0;
  bottom: 0;
  height: auto;
  transition: transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.flower-bud {
  width: calc(var(--s) * 0.5);
  transform: translate(-50%, 30%) scale(0);
  transform-origin: 50% 100%;
}

.flower[data-stage="3"] .flower-bud {
  transform: translate(-50%, 30%) scale(0.75);
}

/* つぼみがひらきかけ(黄色い花びらがのぞく) */
.flower[data-stage="4"] .flower-bud {
  --tips: 1;
  transform: translate(-50%, 30%) scale(1.05);
}

.flower-head {
  width: var(--head);
  transform: translate(-50%, 42%) scale(0) rotate(-90deg);
  filter: drop-shadow(0 3px 0 rgba(74, 52, 40, 0.18));
}

.flower[data-stage="5"] .flower-head {
  transform: translate(-50%, 42%) scale(1) rotate(0deg);
}

.flower[data-stage="5"] .flower-bud {
  transform: translate(-50%, 30%) scale(0);
}

/* 水を飲んだ */
.flower.drink .flower-stem {
  animation: drink 0.35s;
}

@keyframes drink {
  40% {
    transform: scaleX(1.25) scaleY(0.96);
  }
}

/* 満開になった瞬間 */
.flower.open .flower-head {
  animation: bloom-open 1.1s cubic-bezier(0.3, 1.4, 0.5, 1);
}

@keyframes bloom-open {
  0% {
    transform: translate(-50%, 42%) scale(0) rotate(-120deg);
  }
  55% {
    transform: translate(-50%, 42%) scale(1.25) rotate(10deg);
  }
  100% {
    transform: translate(-50%, 42%) scale(1) rotate(0deg);
  }
}

.sun-field.party .flower-head {
  animation: sway 0.6s ease-in-out 0.9s 3 alternate;
}

@keyframes sway {
  from {
    transform: translate(-50%, 42%) rotate(-8deg);
  }
  to {
    transform: translate(-50%, 42%) rotate(8deg);
  }
}

/* じょうろ */
.wcan-btn {
  position: absolute;
  left: 70%;
  bottom: 8px;
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 4px 6px 2px;
  border: 0;
  border-radius: 16px;
  background: none;
  cursor: pointer;
  transform: translateX(-50%);
  -webkit-tap-highlight-color: transparent;
}

.wcan {
  width: calc(var(--s) * 0.95);
  height: auto;
  transform-origin: 20% 90%;
  filter: drop-shadow(0 3px 0 rgba(29, 121, 176, 0.25));
  transition: transform 0.15s;
}

.wcan-btn:hover .wcan {
  transform: rotate(-8deg);
}

.wcan-btn.pour .wcan {
  animation: pour 0.45s;
}

@keyframes pour {
  35% {
    transform: rotate(-30deg) translateX(-6px);
  }
}

.wcan-btn span {
  padding: 0.1em 0.8em;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 0 rgba(29, 121, 176, 0.25);
  font-size: 0.74rem;
  font-weight: 900;
  color: var(--sky-deep);
  white-space: nowrap;
}

.wcan-btn:disabled {
  cursor: default;
}

.wcan-btn:disabled .wcan {
  opacity: 0.55;
}

.wcan-btn:disabled span {
  color: #b07a00;
}

/* 満開まであと何回 */
.flower-left {
  position: absolute;
  left: 10px;
  top: 9px;
  z-index: 4;
  padding: 0.1em 0.75em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  font-size: 0.74rem;
  font-weight: 900;
}

.flower-left.done {
  background: #ffd726;
  color: var(--ink);
  animation: bump 0.3s cubic-bezier(0.2, 1.6, 0.5, 1);
}

/* 水の粒と、お祝いの花びら(ひまわりの真上から) */
.drops {
  position: absolute;
  left: 44%;
  top: 0;
  z-index: 5;
  width: 0;
  height: 100%;
  pointer-events: none;
}

.water-drop {
  position: absolute;
  left: var(--x);
  top: 2%;
  width: 9px;
  height: 13px;
  margin-left: -4.5px;
  border-radius: 50% 50% 50% 50% / 64% 64% 36% 36%;
  background: linear-gradient(#bfe6fb, #4daee8);
  box-shadow: inset 0 0 0 1.5px rgba(29, 121, 176, 0.4);
  animation: water-drop 0.62s ease-in var(--d) both;
}

.water-drop.soft {
  width: 7px;
  height: 10px;
  opacity: 0.8;
}

@keyframes water-drop {
  from {
    top: -4%;
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  to {
    top: 78%;
    opacity: 0;
  }
}

.petal {
  position: absolute;
  left: 0;
  top: 30%;
  width: 11px;
  height: 17px;
  margin-left: -5.5px;
  border-radius: 50%;
  background: #ffd22e;
  box-shadow: inset 0 0 0 1px #e8a000;
  animation: petal 2.1s cubic-bezier(0.2, 0.7, 0.4, 1) var(--d) both;
}

@keyframes petal {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(0.3);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  35% {
    transform: translate(calc(var(--x) * 0.55), -50px) rotate(calc(var(--r) * 0.4));
  }
  100% {
    transform: translate(var(--x), 150px) rotate(var(--r));
    opacity: 0;
  }
}

/* おうち自慢: 集めた子の数と、ずかん */
.pen-book {
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink-soft);
}

/* 入ってきた人の子たちが、あとからぞろぞろやってくる */
.pen.arrive .pile-ham {
  animation: tag-along 0.45s cubic-bezier(0.3, 1.4, 0.5, 1) both;
  animation-delay: calc(0.75s + var(--k, 0) * 80ms);
}

@keyframes tag-along {
  0% {
    transform: translateX(-70px) translateY(0);
    opacity: 0;
  }
  50% {
    transform: translateX(-24px) translateY(-10px);
    opacity: 1;
  }
  100% {
    transform: none;
  }
}

/* 水をあげた人の子が、ぴょん */
.pen.hop .pen-owner {
  animation: hop 0.42s cubic-bezier(0.3, 1.5, 0.5, 1);
}

@keyframes hop {
  40% {
    transform: translateY(-12px);
  }
}

/* 満開のお祝い: みんなで跳ねる */
.pens.party .pen-owner {
  animation: party-jump 0.5s ease-in-out 0.3s 4;
}

.pens.party .pile-ham {
  animation: party-jump 0.5s ease-in-out calc(0.35s + var(--k, 0) * 40ms) 4;
}

.pens.party .pen.cpu .pen-owner {
  animation: none;
}

@keyframes party-jump {
  0%,
  100% {
    transform: none;
  }
  45% {
    transform: translateY(-14px) rotate(-6deg);
  }
}

/* ---------------------------------------------------------------- トップ: ハムスターあつめ */

/* 野原・おうちの見た目は、ロビーのハムスターのおうち(.garden)と同じ */
.catch {
  --s: 70px;
  position: relative;
  z-index: 3;
}

.catch-head {
  align-items: center;
}

.catch-book {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 0.2em;
  min-height: 38px;
  padding: 0.25em 0.95em;
  border: 0;
  border-radius: 999px;
  background: var(--peach-soft);
  box-shadow: inset 0 0 0 2px #fff, 0 3px 0 rgba(74, 52, 40, 0.12);
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
}

.catch-book:hover {
  background: #ffdcbf;
}

.catch-book-label {
  margin-right: 0.3em;
}

.catch-book b {
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--rose);
}

/* ずかんに新しい子が入ったときの印 */
.catch-new {
  position: absolute;
  right: -8px;
  top: -12px;
  padding: 0 0.5em;
  border-radius: 999px;
  background: var(--rose);
  box-shadow: 0 0 0 2px #fff;
  color: #fff;
  font-style: normal;
  font-size: 0.64rem;
  font-weight: 900;
  line-height: 1.7;
  opacity: 0;
  pointer-events: none;
}

.catch-book.fresh .catch-new {
  animation: new-pop 1.9s 0.45s both;
}

@keyframes new-pop {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-14deg);
  }
  12% {
    opacity: 1;
    transform: scale(1.2) rotate(8deg);
  }
  22%,
  82% {
    opacity: 1;
    transform: scale(1) rotate(8deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.85) rotate(8deg);
  }
}

.catch-house .pens {
  min-height: 110px;
}

.catch-house .pen {
  flex-basis: 170px;
}

/* つかまえた子の名前が、その場に少しだけ出る */
.name-tag {
  position: fixed;
  z-index: 71;
  padding: 0 0.55em;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 0 rgba(74, 52, 40, 0.15);
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--rose-deep);
  white-space: nowrap;
  pointer-events: none;
  animation: name-tag 1s ease-out both;
}

@keyframes name-tag {
  from {
    transform: translate(-50%, -60%);
    opacity: 0;
  }
  20% {
    transform: translate(-50%, -110%);
    opacity: 1;
  }
  75% {
    opacity: 1;
  }
  to {
    transform: translate(-50%, -170%);
    opacity: 0;
  }
}

/* ずかんに登録! */
.dex-pop {
  position: absolute;
  left: 50%;
  top: 10px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px 6px 8px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 3px #ffd726, 0 4px 0 rgba(74, 52, 40, 0.18);
  opacity: 0;
  transform: translate(-50%, -16px) scale(0.9);
  pointer-events: none;
  white-space: nowrap;
}

.dex-pop.show {
  animation: dex-pop 2.6s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}

@keyframes dex-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -16px) scale(0.9);
  }
  12%,
  85% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -8px) scale(0.96);
  }
}

.dex-pop img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.dex-pop-text {
  display: grid;
  line-height: 1.25;
}

.dex-pop-text small {
  font-size: 0.68rem;
  font-weight: 900;
  color: #b07a00;
}

.dex-pop-text b {
  font-size: 0.95rem;
  font-weight: 900;
}

.dex-pop-text i {
  margin-right: 0.4em;
  font-style: normal;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

/* ずかん */
.book-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 16px;
}

.book-stats > div {
  flex: 1 1 150px;
  padding: 8px 14px 6px;
  border-radius: 14px;
  background: var(--mat);
  box-shadow: inset 0 0 0 2px var(--line);
}

.book-stats dt {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.book-stats dd {
  margin: 0;
  font-family: var(--font-pop);
  font-size: 1.45rem;
  line-height: 1.3;
}

.book-stats small {
  font-size: 0.68em;
  color: var(--ink-soft);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.book-cell {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 100%;
  padding: 18px 4px 7px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--line);
  font: inherit;
  color: inherit;
}

.book-no {
  position: absolute;
  left: 6px;
  top: 5px;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 900;
  color: var(--ink-soft);
}

/* 設定の色(カードの色): 青 = オス・赤 = メス・黄色 = お調子者 */
.kind-b {
  --kc: #1f8fd1;
  --kt: #fff;
}

.kind-r {
  --kc: #e0453f;
  --kt: #fff;
}

.kind-y {
  --kc: #f2c400;
  --kt: var(--ink);
}

.book-no {
  padding: 0 0.45em;
  border-radius: 999px;
  background: var(--kc);
  color: var(--kt);
  line-height: 1.6;
}

.book-cell:not(.got) .book-no {
  opacity: 0.55;
}

.kind-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  font-weight: 700;
}

.kind-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

.kind-dot {
  width: 0.85em;
  height: 0.85em;
  border-radius: 50%;
  background: var(--kc);
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px color-mix(in srgb, var(--kc) 45%, #fff);
}

.kind-tag {
  margin-left: 0.6em;
  padding: 0.05em 0.7em;
  border-radius: 999px;
  background: var(--kc);
  color: var(--kt);
  font-size: 0.74rem;
  font-weight: 900;
}

/* まだの子は、かげだけ */
.book-cell img {
  width: 66%;
  aspect-ratio: 1;
  height: auto;
  object-fit: contain;
  filter: brightness(0) opacity(0.12);
}

.book-name {
  max-width: 100%;
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(74, 52, 40, 0.35);
}

.book-cell.got {
  background: #fff6e4;
  box-shadow: inset 0 0 0 2px #f5d7a3;
  cursor: pointer;
  transition: transform 0.12s;
}

.book-cell.got:hover {
  transform: translateY(-3px);
}

.book-cell.got img {
  filter: drop-shadow(0 2px 0 rgba(74, 52, 40, 0.16));
}

.book-cell.got .book-name {
  color: var(--ink);
}

/* ずかんの1匹のページ */
.modal-dex {
  width: min(100%, 600px);
}

.dex-one {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.dex-one-art {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 52%, transparent 53%),
    repeating-conic-gradient(#ffe6d0 0 15deg, #fff3e6 15deg 30deg);
  box-shadow: inset 0 0 0 4px #fff, 0 0 0 3px #f5d7a3;
}

.dex-one-art img {
  width: 74%;
  height: auto;
  filter: drop-shadow(0 3px 0 rgba(74, 52, 40, 0.16));
}

.dex-one-no {
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--ink-soft);
}

.dex-one-note {
  margin-top: 6px;
  word-break: auto-phrase;
  font-size: 0.95rem;
  line-height: 1.7;
}

.dex-one-stats {
  margin-bottom: 0;
}

/* 家族 */
.dex-family {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 2px dashed var(--line);
}

.dex-family h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  font-size: 0.95rem;
  font-weight: 900;
}

.dex-family h3 span {
  font-size: 0.86rem;
  font-weight: 700;
}

.dex-family h3 small {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.fam-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.fam-list li > button,
.fam-list li.fam-me,
.fam-list li.fam-unknown {
  align-content: start;
  display: grid;
  justify-items: center;
  gap: 1px;
  width: 100%;
  padding: 8px 4px 6px;
  border-radius: 14px;
}

.fam-list li > button {
  border: 0;
  background: #fff6e4;
  box-shadow: inset 0 0 0 2px #f5d7a3;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: transform 0.12s;
}

.fam-list li > button:hover {
  transform: translateY(-2px);
}

.fam-list li.fam-me {
  background: #fff1b8;
  box-shadow: inset 0 0 0 2px #ffd726;
}

.fam-list li.fam-unknown {
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--line);
}

.fam-list img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.fam-list li.fam-unknown img {
  filter: brightness(0) opacity(0.12);
}

.fam-role {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.3;
}

.fam-name {
  font-size: 0.8rem;
  font-weight: 900;
}

.fam-list li.fam-unknown .fam-name {
  color: rgba(74, 52, 40, 0.35);
}

/* せまい画面では縦に並べる(閉じるボタンの横で幅がせまくならないよう、グリッドにしない) */
@media (max-width: 520px) {
  .dex-one {
    display: block;
    text-align: center;
  }

  .dex-one-art {
    width: 170px;
    margin: 0 auto 12px;
  }
}

/* ---------------------------------------------------------------- ペア戦・称号・はば・スタンプ・成績 */

/* チームの札と、チームの色の縁 */
.team-tag {
  display: inline-block;
  margin-left: 0.5em;
  padding: 0.05em 0.65em;
  border-radius: 999px;
  background: var(--tc);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1.6;
  vertical-align: 0.12em;
  white-space: nowrap;
}

.team-0,
.in-team-0 {
  --tc: var(--team-0);
}

.team-1,
.in-team-1 {
  --tc: var(--team-1);
}

.seatrow[class*="in-team-"] {
  box-shadow: inset 5px 0 0 var(--tc);
}

.seat[class*="in-team-"] {
  outline: 3px solid color-mix(in srgb, var(--tc) 70%, transparent);
  outline-offset: -3px;
}

.seat-team {
  display: block;
  width: fit-content;
  margin: 2px auto 0;
}

/* 称号 */
.title-tag {
  display: inline-block;
  max-width: 100%;
  padding: 0 0.6em;
  border-radius: 6px;
  background: linear-gradient(#fff6c9, #ffe58a);
  box-shadow: inset 0 0 0 1.5px #e8b800;
  color: #6b4b00;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 称号の背景のハムスター: 右はしに、少しはみ出して置く */
.title-tag.has-ham {
  padding-right: 2em;
  background:
    var(--ttl-ham) right -0.15em top 0.05em / auto 140% no-repeat,
    linear-gradient(#fff6c9, #ffe58a);
}

.seatrow-title {
  margin-top: 1px;
}

.pen-title {
  margin-top: 2px;
  font-size: 0.6rem;
}

/* やさしいルール: 答えのはば */
.width-pick {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 2px;
}

.width-btn {
  display: grid;
  min-width: 88px;
  padding: 4px 12px;
  border: 0;
  border-radius: 14px;
  background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--line);
  color: var(--ink);
  line-height: 1.3;
  cursor: pointer;
}

.width-btn b {
  font-size: 1rem;
  font-weight: 900;
}

.width-btn small {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.width-btn.on {
  background: var(--r-easy);
  box-shadow: none;
  color: #fff;
}

.width-btn.on small {
  color: #e6fff3;
}

.guess-w {
  font-style: normal;
  font-family: var(--font-pop);
  font-size: 1.6rem;
  color: var(--r-easy);
}

.guess-display {
  flex-wrap: wrap;
}

.guess-range {
  flex-basis: 100%;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: center;
}

/* 結果: はば・あたり・チーム */
.ans-front small {
  margin-left: 1px;
  font-size: 0.55em;
  color: var(--r-easy);
}

.revealed .ans.hit .ans-front {
  background: #d9f5e6;
  box-shadow: inset 0 0 0 3px var(--r-easy);
}

.stamp-hit {
  color: var(--r-easy);
}

.ans-team {
  margin: 0;
  font-size: 0.62rem;
}

.ans-used {
  font-size: 0.62rem;
  font-weight: 900;
  color: var(--ink-soft);
}

.revealed .ans.unused {
  opacity: 0.6;
}

.sc-team {
  border-left-color: var(--tc);
}

.sc-avas {
  display: flex;
}

.sc-avas > * + * {
  margin-left: -12px;
}

.sc-members {
  margin-left: 0.5em;
  font-size: 0.86rem;
}

/* スタンプ: 画面の右下の丸いボタンと、その上に出るパレット */
.stamp-dock {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  /* --lift: 卓の画面で、手札などに重ならないように持ち上げる分(stamps.js の placeStampDock) */
  bottom: calc(18px + env(safe-area-inset-bottom) + var(--lift, 0px));
  transition: bottom 0.2s ease-out;
  /* 下に貼り付けたボタンの帯(6)より上、重ねて出す画面(50)より下 */
  z-index: 45;
  animation: stamp-dock-in 0.45s cubic-bezier(0.2, 1.5, 0.5, 1) both;
}

@keyframes stamp-dock-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.7);
  }
}

.stamp-wrap {
  position: relative;
  display: block;
}

.stamp-fab {
  position: relative;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #ffd726;
  box-shadow: 0 0 0 4px #fff, 0 6px 0 4px #e0b100, 0 12px 22px rgba(74, 52, 40, 0.24);
  cursor: pointer;
  transition: transform 0.12s;
}

.stamp-fab:hover {
  transform: translateY(-3px);
}

.stamp-fab:active {
  transform: translateY(2px);
}

.stamp-fab[aria-expanded="true"] {
  background: #fff1a6;
}

.stamp-fab img {
  width: 52px;
  height: 52px;
  margin-top: -10px;
  object-fit: contain;
}

.stamp-fab-label {
  position: absolute;
  left: 50%;
  bottom: -9px;
  padding: 0.1em 0.65em;
  border-radius: 999px;
  background: var(--rose);
  box-shadow: 0 0 0 2px #fff;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.5;
  white-space: nowrap;
  transform: translateX(-50%);
}

.stamp-pal {
  position: absolute;
  right: -4px;
  bottom: calc(100% + 22px);
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 76px);
  gap: 6px;
  padding: 10px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 0 0 3px var(--paper-deep), 0 8px 0 3px var(--drop), 0 14px 28px rgba(74, 52, 40, 0.18);
  animation: coach-in 0.22s cubic-bezier(0.2, 1.4, 0.5, 1) both;
}

.stamp-opt {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 2px 5px;
  border: 0;
  border-radius: 14px;
  background: var(--paper);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.3;
  cursor: pointer;
}

.stamp-opt:hover {
  background: var(--peach-soft);
}

.stamp-opt img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

/* 届いたスタンプ(席の上の吹き出し / 右上にまとめて) */
.stamp-bubble {
  position: fixed;
  z-index: 75;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 3px #ffd726, 0 5px 0 var(--drop);
  font-size: 0.9rem;
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -110%);
  animation: stamp-pop 2.8s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}

.stamp-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: #fff;
  box-shadow: 3px 3px 0 #ffd726;
  transform: translateX(-50%) rotate(45deg);
}

.stamp-bubble img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

@keyframes stamp-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -70%) scale(0.5);
  }
  10%,
  85% {
    opacity: 1;
    transform: translate(-50%, -110%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -130%) scale(0.95);
  }
}

/* 上にすき間がないときは、席の下から上を指す */
.stamp-bubble.below {
  transform: translate(-50%, 14px);
  animation-name: stamp-pop-below;
}

.stamp-bubble.below::after {
  top: -7px;
  bottom: auto;
  box-shadow: -3px -3px 0 #ffd726;
}

@keyframes stamp-pop-below {
  0% {
    opacity: 0;
    transform: translate(-50%, -10%) scale(0.5);
  }
  10%,
  85% {
    opacity: 1;
    transform: translate(-50%, 14px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 4px) scale(0.95);
  }
}

.stamp-stack {
  position: fixed;
  right: 14px;
  top: 76px;
  z-index: 75;
  display: grid;
  justify-items: end;
  gap: 8px;
  pointer-events: none;
}

.stamp-bubble.in-stack {
  position: static;
  transform: none;
  animation-name: stamp-slide;
}

.stamp-bubble.in-stack::after {
  display: none;
}

.stamp-who {
  margin: 0 2px 0 6px;
  font-size: 0.74rem;
  color: var(--ink-soft);
}

@keyframes stamp-slide {
  0% {
    opacity: 0;
    transform: translateX(30px);
  }
  10%,
  85% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
  }
}

/* 成績と称号 */
.st-h {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 18px 0 8px;
  font-size: 1rem;
  font-weight: 900;
}

.st-h small {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.st-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin: 0;
}

.st-tile {
  padding: 8px 12px 6px;
  border-radius: 14px;
  background: var(--mat);
  box-shadow: inset 0 0 0 2px var(--line);
}

.st-tile dt {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.st-tile dd {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: 0;
  font-family: var(--font-pop);
  font-size: 1.4rem;
  line-height: 1.3;
}

.st-tile small {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.st-themes {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.st-theme {
  display: grid;
  grid-template-columns: 4em minmax(0, 1fr) 7em;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 0.86rem;
}

.st-bar {
  height: 12px;
  border-radius: 999px;
  background: var(--paper);
  overflow: hidden;
}

.st-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--thc);
}

.th-r {
  --thc: #e0453f;
}

.th-b {
  --thc: #1f8fd1;
}

.th-y {
  --thc: #f2c400;
}

.th-two {
  --thc: #9a6ad0;
}

.th-three {
  --thc: var(--rose);
}

.st-theme-num {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.st-theme-num small {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.st-note {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.ttl-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.ttl {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  gap: 2px;
  align-content: start;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--line);
}

/* 称号の背景のハムスター(まだの称号は、うすいシルエット) */
.ttl-ham {
  position: absolute;
  right: -8px;
  bottom: -10px;
  z-index: -1;
  width: 74px;
  height: auto;
  opacity: 0.85;
  transform: rotate(-8deg);
  pointer-events: none;
}

.ttl:not(.got) .ttl-ham {
  filter: grayscale(1) brightness(0.6);
  opacity: 0.12;
}

.ttl-name,
.ttl-how {
  padding-right: 46px;
}

.ttl.got {
  background: #fffbe8;
  box-shadow: inset 0 0 0 2px #f2d36b;
}

.ttl.on {
  box-shadow: inset 0 0 0 3px #e8b800;
}

.ttl-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-weight: 900;
}

.ttl:not(.got) .ttl-name {
  color: rgba(74, 52, 40, 0.4);
}

.ttl-on {
  padding: 0 0.6em;
  border-radius: 999px;
  background: #e8b800;
  color: #fff;
  font-size: 0.66rem;
  line-height: 1.7;
}

.ttl-how {
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.ttl-act {
  margin-top: 4px;
}

.ttl-prog {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.st-reset {
  margin-top: 18px;
  text-align: right;
}

@media (max-width: 640px) {
  .stamp-dock {
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(14px + env(safe-area-inset-bottom) + var(--lift, 0px));
  }

  .stamp-fab {
    width: 58px;
    height: 58px;
  }

  .stamp-fab img {
    width: 44px;
    height: 44px;
  }

  .stamp-pal {
    grid-template-columns: repeat(4, 70px);
    gap: 5px;
    padding: 8px;
  }

  .st-theme {
    grid-template-columns: 3.4em minmax(0, 1fr) 6.2em;
  }

  /* スマホでも称号は2列にして、スクロールを短く */
  .ttl-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .ttl {
    padding: 8px 9px;
  }

  .ttl-name {
    font-size: 0.86rem;
    gap: 4px;
  }

  .ttl-how {
    font-size: 0.7rem;
  }

  .ttl-ham {
    width: 58px;
    right: -8px;
    bottom: -8px;
  }

  .ttl-name,
  .ttl-how {
    padding-right: 30px;
  }
}

/* ---------------------------------------------------------------- 画面の幅ごとの調整 */

@media (max-width: 900px) {
  .home {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px 18px 48px;
  }

  .home-side {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
    max-width: 520px;
    margin: 26px auto 0;
  }

  .hero-logo {
    margin-inline: auto;
  }

  .hero-tag,
  .hero-lead {
    text-align: center;
    margin-inline: auto;
  }

  .entry {
    margin-inline: auto;
  }

  .home-side .fan {
    --w: clamp(84px, 22vw, 124px);
  }

  .step-list {
    grid-template-columns: minmax(0, 1fr);
    max-width: 460px;
    margin-inline: auto;
  }

  /* 狭い画面: ルーム番号 → おうち → 席 → ルール の順に1列 */
  .lobby {
    grid-template-columns: minmax(0, 1fr);
    max-width: 600px;
  }

  .lobby-side,
  .lobby-main {
    display: contents;
  }

  .lobby-code {
    order: 1;
  }

  .garden {
    order: 2;
  }

  .lobby-seats {
    order: 3;
  }

  .lobby-rules {
    order: 4;
  }

  .lobby-go {
    order: 5;
  }
}

@media (max-width: 1000px) {
  .bar-rules {
    display: none;
  }
}

@media (max-width: 640px) {
  :root {
    --pile-w: clamp(78px, 24vw, 112px);
    /* 手札は1列に5枚(10枚のときは2列) */
    --hand-w: min(calc((100vw - 28px - 4 * 8px) / 5), 84px);
  }

  .bar {
    gap: 6px;
    min-height: 52px;
  }

  .bar-logo {
    width: 64px;
  }

  .bar-room-label {
    display: none;
  }

  /* スマホ: 4列にそろえて、2段に収める */
  .bar-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .bar-nav .bar-btn {
    min-height: 32px;
    padding: 0 0.3em;
    font-size: 0.74rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .table {
    gap: 8px;
    padding: 8px 8px max(10px, env(safe-area-inset-bottom));
  }

  .seats {
    gap: 5px;
  }

  /* 狭い画面では、席を縦長に */
  .seat {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "top" "name" "seeds" "hand" "extra";
    justify-items: center;
    align-content: start;
    row-gap: 2px;
    padding: 8px 3px 6px;
    border-radius: 14px;
  }

  .seat-extra {
    justify-content: center;
  }

  .seat .ava-m {
    width: 34px;
  }

  .seat-top {
    gap: 4px;
  }

  .seats {
    --bw: 24px;
  }

  .seats[data-n="3"] {
    --bw: 21px;
  }

  .seats[data-n="4"] {
    --bw: 18px;
  }

  .seats[data-n="5"] {
    --bw: 16px;
  }

  /* せまいので、カードの裏を少しずつ重ねて並べる(手に持ったカードのように) */
  .seat-hand {
    justify-content: center;
    gap: 0;
    margin-top: 2px;
  }

  .mini-back {
    border-radius: 2px;
    box-shadow: 0 0 0 1px #fff, 0 1px 0 1px var(--drop);
  }

  .mini-back + .mini-back {
    margin-left: calc(var(--bw) * -0.38);
  }

  .mini-back.g5 {
    margin-left: calc(var(--bw) * -0.38 + 4px);
  }

  .hand-more {
    margin-left: 2px;
    font-size: max(11px, calc(var(--bw) * 0.7));
  }

  .lv-tag {
    display: none;
  }

  .bar-rules {
    display: none;
  }

  .garden {
    --s: 62px;
    padding: 14px 12px 14px;
  }

  .garden-field {
    height: calc(var(--s) * 2.85);
  }

  /* トップのおうちは1人分なので、小さくしない */
  .catch-house .pen {
    flex-basis: 170px;
  }

  .catch-house .pen-pile {
    width: 112px;
    top: 0;
    transform: translateX(-50%);
  }

  .catch-house .pen-owner {
    width: 58px;
    height: 52px;
  }

  .catch-house .pen-name {
    font-size: 0.74rem;
  }

  .pens {
    gap: 2px;
    min-height: 104px;
  }

  .pen {
    flex-basis: 72px;
  }

  .pen-pile {
    width: 76px;
    transform: translateX(-50%) scale(0.7);
    transform-origin: 50% 100%;
    top: 12px;
  }

  .pen-owner {
    width: 46px;
    height: 42px;
  }

  .pen-name {
    font-size: 0.66rem;
    padding: 0 0.45em;
  }

  .pen-empty {
    width: 26px;
    height: 26px;
  }

  .pen-empty-wrap {
    gap: 3px;
  }

  .seat-name {
    font-size: 0.72rem;
  }

  .seat-you {
    display: none;
  }

  .seat .chip-seed {
    width: 11px;
  }

  .seat .seeds {
    gap: 1.5px;
  }

  .seat-state {
    font-size: 0.62rem;
    padding: 0 0.45em;
  }

  .field {
    padding: 14px 4px 10px;
    border-radius: 22px;
  }

  .theme {
    width: max(calc(var(--pile-w) * 0.8), 5.2em);
  }

  .theme-card {
    width: calc(var(--pile-w) * 0.66);
  }

  .theme-text {
    font-size: 0.68rem;
  }

  .center {
    min-width: 0;
  }

  .sun .chip-sun {
    width: calc(var(--pile-w) * 0.56);
  }

  .hand {
    gap: 8px;
    padding: 14px 0 4px;
  }

  .hint {
    font-size: 0.78rem;
  }

  .keys {
    grid-template-columns: repeat(3, minmax(64px, 84px));
    gap: 6px;
  }

  .key {
    height: 46px;
  }

  .guess {
    gap: 4px;
    padding: 14px 14px 16px;
  }

  .guess-display b,
  .guess-mine b {
    font-size: 3rem;
  }

  .lobby-go.sticky {
    margin-inline: -20px;
  }

  .ans {
    width: 96px;
  }

  .sc {
    flex-wrap: wrap;
    padding: 10px 12px;
  }

  .sc .seeds {
    width: 100%;
    justify-content: flex-end;
  }

  .modal {
    padding: 22px 16px 18px;
  }

  .cardgrid {
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 14px 10px;
  }

  .entry {
    padding: 18px 16px;
  }

  .entry-go {
    grid-template-columns: 1fr;
  }

  .snd-hint {
    display: none;
  }
}

@media (max-width: 380px) {
  .bar-round {
    display: none;
  }
}

/* 背の低い画面(スマホの横向きなど)では、場を少し詰める */
@media (max-height: 620px) and (min-width: 641px) {
  :root {
    --pile-w: clamp(70px, 15vh, 110px);
    --hand-w: clamp(52px, 11vh, 80px);
  }
}

/* ---------------------------------------------------------------- おうちの模様がえ(deco.js) */

/* かべ紙。--wall を、おうち(トップ)・ロビーの席のおうち・見本に敷く。暗いかべ紙は、文字を白に */
.wall-plank {
  --wall: repeating-linear-gradient(90deg, transparent 0 34px, rgba(255, 255, 255, 0.35) 34px 36px), linear-gradient(#ffe2c7, #ffd3ad);
}
.wall-dot {
  --wall: radial-gradient(circle, #fff 0 3.2px, transparent 3.9px) 0 0 / 22px 22px, radial-gradient(circle, #fff 0 3.2px, transparent 3.9px) 11px 11px / 22px 22px, linear-gradient(#ffd9e2, #ffc9d6);
}
.wall-mint {
  --wall: repeating-linear-gradient(0deg, rgba(92, 196, 150, 0.22) 0 12px, transparent 12px 24px), repeating-linear-gradient(90deg, rgba(92, 196, 150, 0.22) 0 12px, transparent 12px 24px), #effaf4;
}
.wall-sky {
  --wall: repeating-linear-gradient(90deg, #d9f0fc 0 15px, #fff 15px 17px, #c4e6f9 17px 32px, #fff 32px 34px);
}
.wall-sun {
  --wall: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='%23ffd726' stroke='%23f0b400' stroke-width='.8'%3E%3Cellipse cx='20.6' cy='14.0' rx='3.9' ry='2.2' transform='rotate(0 20.6 14.0)'/%3E%3Cellipse cx='19.4' cy='17.9' rx='3.9' ry='2.2' transform='rotate(36 19.4 17.9)'/%3E%3Cellipse cx='16.1' cy='20.3' rx='3.9' ry='2.2' transform='rotate(72 16.1 20.3)'/%3E%3Cellipse cx='11.9' cy='20.3' rx='3.9' ry='2.2' transform='rotate(108 11.9 20.3)'/%3E%3Cellipse cx='8.6' cy='17.9' rx='3.9' ry='2.2' transform='rotate(144 8.6 17.9)'/%3E%3Cellipse cx='7.4' cy='14.0' rx='3.9' ry='2.2' transform='rotate(180 7.4 14.0)'/%3E%3Cellipse cx='8.6' cy='10.1' rx='3.9' ry='2.2' transform='rotate(216 8.6 10.1)'/%3E%3Cellipse cx='11.9' cy='7.7' rx='3.9' ry='2.2' transform='rotate(252 11.9 7.7)'/%3E%3Cellipse cx='16.1' cy='7.7' rx='3.9' ry='2.2' transform='rotate(288 16.1 7.7)'/%3E%3Cellipse cx='19.4' cy='10.1' rx='3.9' ry='2.2' transform='rotate(324 19.4 10.1)'/%3E%3C/g%3E%3Ccircle cx='14' cy='14' r='3.9' fill='%238a5427'/%3E%3Cg fill='%23ffd726' stroke='%23f0b400' stroke-width='.8'%3E%3Cellipse cx='47.2' cy='42.0' rx='3.0' ry='1.8' transform='rotate(0 47.2 42.0)'/%3E%3Cellipse cx='46.2' cy='45.1' rx='3.0' ry='1.8' transform='rotate(36 46.2 45.1)'/%3E%3Cellipse cx='43.6' cy='47.0' rx='3.0' ry='1.8' transform='rotate(72 43.6 47.0)'/%3E%3Cellipse cx='40.4' cy='47.0' rx='3.0' ry='1.8' transform='rotate(108 40.4 47.0)'/%3E%3Cellipse cx='37.8' cy='45.1' rx='3.0' ry='1.8' transform='rotate(144 37.8 45.1)'/%3E%3Cellipse cx='36.8' cy='42.0' rx='3.0' ry='1.8' transform='rotate(180 36.8 42.0)'/%3E%3Cellipse cx='37.8' cy='38.9' rx='3.0' ry='1.8' transform='rotate(216 37.8 38.9)'/%3E%3Cellipse cx='40.4' cy='37.0' rx='3.0' ry='1.8' transform='rotate(252 40.4 37.0)'/%3E%3Cellipse cx='43.6' cy='37.0' rx='3.0' ry='1.8' transform='rotate(288 43.6 37.0)'/%3E%3Cellipse cx='46.2' cy='38.9' rx='3.0' ry='1.8' transform='rotate(324 46.2 38.9)'/%3E%3C/g%3E%3Ccircle cx='42' cy='42' r='3.0' fill='%238a5427'/%3E%3Cg fill='%2386c95f'%3E%3Cellipse cx='40' cy='16' rx='4' ry='2' transform='rotate(-30 40 16)'/%3E%3Cellipse cx='16' cy='42' rx='3.5' ry='1.8' transform='rotate(25 16 42)'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 56px 56px, linear-gradient(#fff7cf, #ffeca6);
}
.wall-heart {
  --wall: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cg fill='%23ff9db4'%3E%3Cpath d='M11 18c-5-3-9-6-8-10 1-3 5-4 8-1 3-3 7-2 8 1 1 4-3 7-8 10z'/%3E%3Cpath d='M33 40c-4-2.4-7-4.8-6.4-8 .8-2.4 4-3.2 6.4-.8 2.4-2.4 5.6-1.6 6.4.8.6 3.2-2.4 5.6-6.4 8z'/%3E%3C/g%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='33' cy='10' r='2'/%3E%3Ccircle cx='9' cy='34' r='1.6'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 44px 44px, linear-gradient(#ffe6ec, #ffd6e0);
}
.wall-cookie {
  --wall: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Crect x='1.5' y='1.5' width='33' height='33' rx='7' fill='%23f6dcb2' stroke='%23e2b77c' stroke-width='1.5'/%3E%3Cg fill='%237a4a1e'%3E%3Ccircle cx='11' cy='12' r='2'/%3E%3Ccircle cx='24' cy='9' r='1.6'/%3E%3Ccircle cx='20' cy='21' r='2.2'/%3E%3Ccircle cx='9' cy='26' r='1.5'/%3E%3Ccircle cx='27' cy='27' r='1.8'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 36px 36px, #fbeacd;
}
.wall-night {
  --wall: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='%23ffe680'%3E%3Cpath d='M16 8l2.4 5 5.4.6-4 3.7 1.1 5.3L16 20l-4.9 2.6 1.1-5.3-4-3.7 5.4-.6z'/%3E%3Cpath d='M52 42l1.6 3.4 3.7.4-2.7 2.5.7 3.6L52 50.2l-3.3 1.7.7-3.6-2.7-2.5 3.7-.4z'/%3E%3C/g%3E%3Cg fill='%23ffffff' opacity='.85'%3E%3Ccircle cx='46' cy='14' r='1.4'/%3E%3Ccircle cx='60' cy='26' r='1'/%3E%3Ccircle cx='28' cy='40' r='1.2'/%3E%3Ccircle cx='12' cy='56' r='1.5'/%3E%3Ccircle cx='36' cy='64' r='1'/%3E%3Ccircle cx='66' cy='60' r='1.2'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 72px 72px, linear-gradient(#2c3a6e, #4a5b96);
  --wall-ink: #fff;
}
.wall-royal {
  --wall: repeating-linear-gradient(45deg, transparent 0 14px, rgba(255, 214, 90, 0.55) 14px 16px), repeating-linear-gradient(-45deg, transparent 0 14px, rgba(255, 214, 90, 0.55) 14px 16px), linear-gradient(#cf4159, #a92b45);
  --wall-ink: #fff;
}

.wall-paws {
  --wall: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill='%23ffb0c2' transform='rotate(-18 16 20)'%3E%3Cellipse cx='16' cy='20' rx='6.1' ry='5.0'/%3E%3Cellipse cx='9.2' cy='13.9' rx='3.5' ry='4.4'/%3E%3Cellipse cx='13.8' cy='10.1' rx='3.5' ry='4.4'/%3E%3Cellipse cx='18.2' cy='10.1' rx='3.5' ry='4.4'/%3E%3Cellipse cx='22.8' cy='13.9' rx='3.5' ry='4.4'/%3E%3C/g%3E%3Cg fill='%23f6c79a' transform='rotate(16 44 48)'%3E%3Cellipse cx='44' cy='48' rx='5.0' ry='4.0'/%3E%3Cellipse cx='38.4' cy='43.0' rx='2.9' ry='3.6'/%3E%3Cellipse cx='42.2' cy='39.9' rx='2.9' ry='3.6'/%3E%3Cellipse cx='45.8' cy='39.9' rx='2.9' ry='3.6'/%3E%3Cellipse cx='49.6' cy='43.0' rx='2.9' ry='3.6'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 60px 60px, linear-gradient(#fffaf2, #fff0e4);
}

.wall-snow {
  --wall: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='76' height='76' viewBox='0 0 76 76'%3E%3Cg stroke='%23ffffff' stroke-width='1.4' stroke-linecap='round'%3E%3Cline x1='18.0' y1='20.0' x2='26.0' y2='20.0'/%3E%3Cline x1='18.0' y1='20.0' x2='22.0' y2='26.9'/%3E%3Cline x1='18.0' y1='20.0' x2='14.0' y2='26.9'/%3E%3Cline x1='18.0' y1='20.0' x2='10.0' y2='20.0'/%3E%3Cline x1='18.0' y1='20.0' x2='14.0' y2='13.1'/%3E%3Cline x1='18.0' y1='20.0' x2='22.0' y2='13.1'/%3E%3Cline x1='22.4' y1='20.0' x2='24.2' y2='21.5'/%3E%3Cline x1='20.2' y1='23.8' x2='19.8' y2='26.2'/%3E%3Cline x1='15.8' y1='23.8' x2='13.5' y2='24.6'/%3E%3Cline x1='13.6' y1='20.0' x2='11.8' y2='18.5'/%3E%3Cline x1='15.8' y1='16.2' x2='16.2' y2='13.8'/%3E%3Cline x1='20.2' y1='16.2' x2='22.5' y2='15.4'/%3E%3C/g%3E%3Cg stroke='%23ffffff' stroke-width='1.4' stroke-linecap='round'%3E%3Cline x1='56.0' y1='54.0' x2='62.0' y2='54.0'/%3E%3Cline x1='56.0' y1='54.0' x2='59.0' y2='59.2'/%3E%3Cline x1='56.0' y1='54.0' x2='53.0' y2='59.2'/%3E%3Cline x1='56.0' y1='54.0' x2='50.0' y2='54.0'/%3E%3Cline x1='56.0' y1='54.0' x2='53.0' y2='48.8'/%3E%3Cline x1='56.0' y1='54.0' x2='59.0' y2='48.8'/%3E%3Cline x1='59.3' y1='54.0' x2='60.7' y2='55.2'/%3E%3Cline x1='57.6' y1='56.9' x2='57.3' y2='58.6'/%3E%3Cline x1='54.4' y1='56.9' x2='52.7' y2='57.5'/%3E%3Cline x1='52.7' y1='54.0' x2='51.3' y2='52.8'/%3E%3Cline x1='54.4' y1='51.1' x2='54.7' y2='49.4'/%3E%3Cline x1='57.6' y1='51.1' x2='59.3' y2='50.5'/%3E%3C/g%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='50' cy='14' r='2'/%3E%3Ccircle cx='64' cy='30' r='1.4'/%3E%3Ccircle cx='30' cy='44' r='1.8'/%3E%3Ccircle cx='12' cy='60' r='2.2'/%3E%3Ccircle cx='38' cy='68' r='1.3'/%3E%3Ccircle cx='70' cy='70' r='1.6'/%3E%3Ccircle cx='6' cy='38' r='1.2'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 76px 76px, linear-gradient(#2f4078, #5368a6);
  --wall-ink: #fff;
}

.garden-house.walled,
.pen.walled,
.dc-sw.walled {
  background: var(--wall);
}

/* おうちの中の、ハムスターのうしろの層(ラグ・かざり) */
.catch-house,
.pen {
  isolation: isolate;
}

.house-deco,
.dc-layer,
.dc-front {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* かざりは、集めた子の山(z-index 1〜12)より手前、持ち主(20)よりうしろ */
.dc-front {
  z-index: 15;
}

.house-deco .dc-layer,
.house-deco .dc-front {
  z-index: auto;
}

.dc-rug,
.dc-item {
  position: absolute;
  line-height: 0;
}

.dc-rug-art,
.dc-item-art {
  display: block;
  width: 100%;
  height: auto;
}

/* かざりは、シールのように白いふちと影 */
.dc-item-art {
  filter: drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff) drop-shadow(0 1.5px 0 #fff) drop-shadow(0 -1.5px 0 #fff)
    drop-shadow(0 3px 0 rgba(74, 52, 40, 0.18));
}

.dc-rug-art {
  filter: drop-shadow(0 2px 0 rgba(74, 52, 40, 0.12));
}

/* トップのおうち(と、模様がえの窓の見本) */
.catch-house .dc-rug {
  left: 50%;
  top: 70px;
  width: 200px;
  transform: translateX(-50%);
}

.catch-house .dc-item {
  bottom: 12px;
  width: 78px;
}

.catch-house .dc-left {
  left: 6%;
}

.catch-house .dc-right {
  right: 6%;
}

.walled .pen-count,
.walled .pen-book {
  color: var(--wall-ink, var(--ink));
}

.house-tools {
  position: absolute;
  z-index: 3;
  right: 10px;
  top: 10px;
}

/* ロビーの席のおうち: かべ紙を選んだ人は、自分の部屋の床を敷く */
.pen.walled {
  margin-top: 14px;
  padding-top: 40px;
  padding-bottom: 6px;
  border-radius: 16px;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.9), 0 2px 0 rgba(74, 52, 40, 0.08);
}

.pen.walled .pen-pile {
  top: 12px;
}

.pen .dc-rug {
  left: 50%;
  top: 50px;
  width: 118px;
  transform: translateX(-50%);
}

.pen.walled .dc-rug {
  top: 64px;
}

/* かざりは、持ち主のハムスターの両わき(下の名札や数とは重ならない) */
.pen .dc-item {
  top: 50px;
  width: 34px;
}

.pen.walled .dc-item {
  top: 64px;
}

.pen .dc-left {
  left: 3px;
}

.pen .dc-right {
  right: 3px;
}

/* 模様がえのボタン */
.dc-open {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  min-height: 36px;
  padding: 0.2em 0.85em 0.2em 0.65em;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 rgba(74, 52, 40, 0.12);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
}

.dc-open:hover {
  background: #fff5f7;
}

.dc-open svg {
  width: 18px;
  height: 18px;
  color: var(--ink);
}

.dc-new-dot {
  position: absolute;
  right: -8px;
  top: -11px;
  padding: 0 0.5em;
  border-radius: 999px;
  background: var(--rose);
  box-shadow: 0 0 0 2px #fff;
  color: #fff;
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.7;
}

.garden-tools {
  margin-left: auto;
  align-self: center;
}

.garden-tools:empty {
  display: none;
}

/* 模様がえの窓(見本と分類は、下の一覧をスクロールしても上に残す) */
.dc-sticky {
  position: sticky;
  top: -26px;
  z-index: 2;
  margin: 0 -24px;
  padding: 12px 24px 10px;
  background: #fff;
  box-shadow: 0 6px 6px -6px rgba(74, 52, 40, 0.18);
}

.dc-stage {
  margin-bottom: 12px;
}

.dc-preview {
  margin-top: 0;
  border-radius: 18px;
}

.dc-preview .pens {
  min-height: 132px;
}

.dc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dc-tab {
  min-height: 40px;
  padding: 0.3em 1em;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
}

.dc-tab.on {
  background: var(--ink);
  color: #fff;
}

.dc-count {
  margin: 10px 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.dc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dc-opt {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 5px;
  width: 100%;
  height: 100%;
  padding: 8px 8px 10px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--line);
  font: inherit;
  color: var(--ink);
  text-align: center;
  cursor: pointer;
}

.dc-opt:hover:not(.locked) {
  background: #fff7f9;
}

.dc-opt.on {
  background: #fff3f6;
  box-shadow: inset 0 0 0 3px var(--rose);
}

.dc-opt.on::after {
  content: "";
  position: absolute;
  right: -6px;
  top: -6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--rose) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px no-repeat;
  box-shadow: 0 0 0 2px #fff;
}

.dc-opt.locked {
  background: #fbf7f5;
  cursor: default;
}

.dc-sw {
  display: grid;
  place-items: center;
  width: 100%;
  height: 66px;
  border-radius: 11px;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.dc-sw-rug,
.dc-sw-item {
  background: linear-gradient(#ffe8d3, #ffd9b8);
}

.dc-sw-rug .dc-rug-art {
  width: 88%;
}

.dc-sw-item .dc-item-art {
  width: 52px;
}

.dc-opt.locked .dc-sw {
  filter: grayscale(0.9) opacity(0.45);
}

.dc-none {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px dashed rgba(140, 111, 96, 0.5);
}

.dc-lock {
  position: absolute;
  left: 50%;
  top: 29px;
  width: 28px;
  height: 28px;
  transform: translateX(-50%);
}

.dc-name {
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1.35;
}

.dc-need {
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink-soft);
}

.dc-bar {
  width: 86%;
  height: 6px;
  border-radius: 999px;
  background: var(--paper);
  overflow: hidden;
}

.dc-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--peach);
}

.dc-prog {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.dc-new {
  position: absolute;
  left: -6px;
  top: -8px;
  padding: 0 0.5em;
  border-radius: 999px;
  background: var(--rose);
  box-shadow: 0 0 0 2px #fff;
  color: #fff;
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.7;
}

.dc-foot {
  margin-top: 18px;
  text-align: center;
}

@media (max-width: 640px) {
  .catch-house .dc-item {
    width: 62px;
    bottom: 10px;
  }

  .catch-house .dc-left {
    left: 3%;
  }

  .catch-house .dc-right {
    right: 3%;
  }

  .catch-house .dc-rug {
    width: 180px;
  }

  /* スマホのロビーは、おうちを3つずつ並べる(5人でも、名前と数がつぶれないように) */
  .pens {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .pen {
    flex: 0 1 calc(33.333% - 4px);
  }

  .pen-pile {
    width: 112px;
    transform: translateX(-50%) scale(0.8);
  }

  .pen .dc-rug {
    width: 90px;
    top: 52px;
  }

  .pen .dc-item {
    width: 26px;
    top: 48px;
  }

  .pen.walled .dc-item {
    top: 56px;
  }

  .pen.walled {
    padding-top: 34px;
  }

  .pen.walled .pen-pile {
    top: 18px;
  }

  .pen.walled .dc-rug {
    top: 60px;
  }

  .dc-grid {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 8px;
  }

  .dc-sticky {
    top: -22px;
    margin: 0 -16px;
    padding: 10px 16px 8px;
  }

  .dc-preview .pens {
    min-height: 104px;
  }

  .dc-stage {
    margin-bottom: 8px;
  }

  .dc-tab {
    padding: 0.3em 0.8em;
    font-size: 0.8rem;
  }

  .house-tools {
    right: 8px;
    top: 8px;
  }
}


/* ---------------------------------------------------------------- 自分の画像のアイコン(faceui.js) */

.ava-face img {
  object-fit: cover;
}

/* おうちの持ち主が自分の画像のときは、丸いシール */
.pen .pen-owner.face {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 0 0 3px #fff;
  filter: drop-shadow(0 3px 0 rgba(74, 52, 40, 0.18));
}

/* アイコンを選ぶ窓: 自分の画像 */
.icon-own {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 18px;
  background: var(--paper);
}

.icon-make {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  min-height: 44px;
  padding: 0.35em 1.1em 0.35em 0.8em;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 rgba(74, 52, 40, 0.12);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
}

.icon-make:hover {
  background: #fff5f7;
}

.icon-make svg {
  width: 22px;
  height: 22px;
}

/* 画像からアイコンを作る窓 */
.face-crop {
  position: relative;
  width: min(280px, 100%);
  aspect-ratio: 1;
  margin: 16px auto 0;
  border-radius: 20px;
  overflow: hidden;
  background: repeating-conic-gradient(#f3ece8 0 25%, #fff 0 50%) 0 0 / 20px 20px;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.face-crop:active {
  cursor: grabbing;
}

.face-crop:focus-visible {
  outline: 3px solid var(--sky-deep);
  outline-offset: 3px;
}

.face-crop img {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  pointer-events: none;
}

/* 丸の外は白くうすく、丸のふちは点線 */
.face-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(255, 255, 255, 0.72);
  outline: 3px dashed #fff;
  outline-offset: -3px;
  pointer-events: none;
}

.face-zoom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.face-zoom input {
  width: min(220px, 60%);
  accent-color: var(--rose);
}

.face-out {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--paper);
}

.face-out canvas {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 30%;
  box-shadow: 0 0 0 3px #fff, 0 3px 0 3px var(--drop);
}

.face-note {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.6;
  color: var(--ink-soft);
}

.face-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

/* ---------------------------------------------------------------- まいにちスタンプ(daily.js) */

.nav-daily {
  position: relative;
}

.nav-daily.fresh::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 0 2px #fff;
}

.ds-msg {
  margin: 12px 0 0;
  font-weight: 900;
  color: var(--ink-soft);
}

.ds-msg.fresh {
  color: var(--rose);
}

/* スタンプカード: クリーム色の紙に、ピンクの帯 */
.ds-card {
  margin-top: 12px;
  border-radius: 20px;
  overflow: hidden;
  background: radial-gradient(circle, rgba(232, 49, 91, 0.06) 1.2px, transparent 1.6px) 0 0 / 14px 14px, #fffaf1;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px #f3d6c8, 0 6px 0 5px var(--drop);
}

.ds-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 18px 7px;
  background: repeating-linear-gradient(-45deg, #ff7b95 0 10px, #ff8aa1 10px 20px);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.ds-head b {
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: 1.05rem;
}

.ds-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 86px));
  justify-content: center;
  gap: 26px 22px;
  margin: 0;
  padding: 20px 18px 26px;
  list-style: none;
}

.ds-slot {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2.5px dashed #e8cfc2;
  background: rgba(255, 255, 255, 0.75);
}

.ds-slot.gift {
  border-color: #f0b400;
  background: #fffbe6;
}

.ds-n {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.05rem;
  font-weight: 900;
  color: #e3cabd;
}

.ds-slot.gift .ds-n {
  top: auto;
  bottom: -2px;
  font-size: 0.72rem;
  padding: 0 0.45em;
  border-radius: 999px;
  background: #f0b400;
  color: #fff;
  transform: translateX(-50%);
}

.ds-slot.on .ds-n {
  display: none;
}

.ds-gift {
  width: 54%;
  height: 54%;
}

/* 押したスタンプ: 赤いインク。少しずつ傾ける */
.ds-stamp {
  width: 92%;
  height: 92%;
  color: #e8315b;
  opacity: 0.9;
  transform: rotate(var(--r, 0deg));
}

.ds-date {
  position: absolute;
  left: 50%;
  bottom: -18px;
  transform: translateX(-50%);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
}

.ds-slot.on {
  border-style: solid;
  border-color: transparent;
  background: none;
}

/* きょう押したスタンプ: 上から「ぽんっ」 */
.ds-slot.now .ds-stamp {
  animation: ds-press 0.5s 0.45s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}

.ds-slot.now::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 3px solid rgba(232, 49, 91, 0.45);
  opacity: 0;
  animation: ds-ring 0.6s 0.62s ease-out both;
  pointer-events: none;
}

@keyframes ds-press {
  0% {
    opacity: 0;
    transform: rotate(calc(var(--r, 0deg) - 24deg)) scale(2.2);
  }
  60% {
    opacity: 0.95;
    transform: rotate(var(--r, 0deg)) scale(0.88);
  }
  100% {
    opacity: 0.9;
    transform: rotate(var(--r, 0deg)) scale(1);
  }
}

@keyframes ds-ring {
  0% {
    opacity: 1;
    transform: scale(0.8);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

.ds-got {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 26px;
  padding: 12px 16px;
  border-radius: 16px;
  background: #fffbe6;
  box-shadow: inset 0 0 0 2px #f6dc85;
  font-weight: 900;
}

.ds-got .ds-gift {
  width: 34px;
  height: 34px;
  flex: none;
}

.ds-got p {
  flex: 1 1 200px;
  display: grid;
  line-height: 1.5;
}

.ds-got small {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.ds-total {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  margin-top: 26px;
  font-weight: 900;
}

.ds-got + .ds-total {
  margin-top: 14px;
}

.ds-total span {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.ds-sub {
  margin-top: 18px;
  font-size: 0.95rem;
}

.ds-rewards {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.ds-rewards li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--paper);
}

.ds-day {
  flex: none;
  min-width: 3.4em;
  padding: 0.1em 0.5em;
  border-radius: 999px;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 900;
  text-align: center;
}

.ds-what {
  flex: 1;
  display: grid;
  line-height: 1.35;
}

.ds-what small {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.ds-state {
  flex: none;
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--ink-soft);
}

.ds-rewards li.got {
  background: #fff3f6;
}

.ds-rewards li.got .ds-state {
  color: var(--rose);
}

.ds-foot {
  margin-top: 18px;
  text-align: center;
}

/* 月がわりのプレゼント */
.ds-month {
  margin-top: 22px;
  padding: 14px 16px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fff6e8, #ffeef2);
  box-shadow: inset 0 0 0 2px #f7dcc4;
}

.ds-month .ds-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  margin-top: 0;
}

.ds-month-n {
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--rose);
}

.ds-month-note {
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.6;
  color: var(--ink-soft);
}

.ds-gifts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.ds-gifts li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border-radius: 14px;
  background: #fff;
}

.ds-gifts .dc-sw {
  flex: none;
  width: 64px;
  height: 52px;
}

.ds-gifts .dc-sw-item .dc-item-art {
  width: 44px;
}

.ds-gifts li.got .ds-state {
  color: var(--rose);
}

.ds-gifts li.now {
  box-shadow: inset 0 0 0 3px #f6c94c;
  animation: ds-gift 0.6s 0.9s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}

@keyframes ds-gift {
  from {
    transform: scale(0.92);
  }
}

@media (max-width: 640px) {
  .ds-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 18px 7px;
    padding: 14px 12px 20px;
  }

  .ds-n {
    font-size: 0.9rem;
  }

  .ds-date {
    font-size: 0.6rem;
    bottom: -16px;
  }

  .ds-head {
    padding: 7px 14px 6px;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  /* 吹き出しは動かさずに出して、時間がたったら消す(消すのは JS) */
  .stamp-bubble {
    animation: none !important;
  }
}

/* トップの「すぐにわかる紹介動画」(サイトに置いた動画ファイル) */
.intro-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--ink);
  object-fit: contain;
}

.intro-cover {
  z-index: 1;
  cursor: pointer;
}

.intro-cover:hover .movie-play,
.intro-cover:focus-visible .movie-play {
  transform: translate(-50%, -50%) scale(1.08);
}

.movie-intro + .movie,
#home-intro:not(:empty) + #home-movie .movie {
  margin-top: 28px;
}

/* ---------------------------------------------------------------- ぴったんこの演出(画面いっぱい・花ふぶき) */
.pit-fx {
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow: hidden;
  pointer-events: none;
  animation: pit-fx-out 0.45s ease-in 2.5s both;
}

.pit-fx-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 46%, rgba(255, 250, 220, 0.92) 0, rgba(255, 236, 160, 0.55) 26%, rgba(255, 214, 226, 0.25) 55%, rgba(255, 214, 226, 0) 75%);
  animation: pit-glow 0.5s ease-out both;
}

.pit-fx-center {
  position: absolute;
  left: 50%;
  top: 46%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4vmin;
  transform: translate(-50%, -50%);
  width: 100%;
}

.pit-fx-word {
  font-family: var(--font-pop);
  font-size: clamp(52px, 15vw, 220px);
  line-height: 1;
  white-space: nowrap;
  color: var(--rose);
  -webkit-text-stroke: clamp(4px, 0.9vw, 12px) #fff;
  paint-order: stroke fill;
  text-shadow: 0 0.06em 0 #ffd22e, 0 0.12em 0.3em rgba(185, 31, 67, 0.35);
  animation: pit-word 0.75s cubic-bezier(0.2, 1.6, 0.4, 1) both, pit-wiggle 1.2s ease-in-out 0.8s 2;
}

.pit-fx-who {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 22px 8px 10px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(185, 31, 67, 0.22);
  font-family: var(--font-pop);
  font-size: clamp(16px, 2.4vw, 30px);
  color: var(--ink);
  animation: pit-who 0.5s ease-out 0.35s both;
}

.pit-fx-who {
  box-sizing: border-box;
  max-width: min(92vw, 960px);
}

.pit-fx-who > span {
  min-width: 0;
  text-align: center;
}

.pit-fx-who .ava {
  flex: none;
}

.pit-fx-who .ava + .ava {
  margin-left: -18px;
}

@media (max-width: 640px) {
  .pit-fx-who {
    gap: 6px;
    padding: 6px 14px 6px 6px;
    font-size: clamp(13px, 3.8vw, 18px);
  }

  .pit-fx-who .ava + .ava {
    margin-left: -12px;
  }
}

/* 花びら: 外側(i)が落ちる・飛ぶ、内側(b)がひらひら回る */
.pit-fx .fb {
  position: absolute;
  left: var(--x);
  top: -6vh;
  width: calc(clamp(13px, 2vmin, 28px) * var(--s));
  height: calc(clamp(10px, 1.5vmin, 21px) * var(--s));
  animation: pit-fall var(--dur) cubic-bezier(0.35, 0.1, 0.6, 1) var(--d) both;
  will-change: transform;
}

.pit-fx .fb b {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 80% 0 70% 0;
  background: var(--c);
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.06);
  animation: pit-flutter 0.9s ease-in-out infinite alternate;
}

.pit-fx .fb:nth-child(3n) b {
  animation-duration: 0.7s;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}

.pit-fx .fb:nth-child(4n + 1) b {
  animation-duration: 1.1s;
  animation-direction: alternate-reverse;
}

.pit-fx .fb.burst {
  left: 50%;
  top: 46%;
  animation: pit-burst 1.9s cubic-bezier(0.15, 0.75, 0.4, 1) var(--d) both;
}

@keyframes pit-fx-out {
  to {
    opacity: 0;
  }
}

@keyframes pit-glow {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pit-word {
  0% {
    opacity: 0;
    transform: scale(0.2) rotate(-12deg);
  }
  60% {
    opacity: 1;
    transform: scale(1.12) rotate(3deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes pit-wiggle {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  25% {
    transform: scale(1.04) rotate(-2deg);
  }
  75% {
    transform: scale(1.04) rotate(2deg);
  }
}

@keyframes pit-who {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pit-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  8% {
    opacity: 1;
  }
  50% {
    transform: translate3d(calc(var(--dx) * 0.6), 55vh, 0) rotate(calc(var(--r) * 0.5));
  }
  100% {
    opacity: 1;
    transform: translate3d(var(--dx), 112vh, 0) rotate(var(--r));
  }
}

@keyframes pit-burst {
  0% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(0.3) rotate(0deg);
  }
  10% {
    opacity: 1;
  }
  45% {
    transform: translate3d(calc(-50% + var(--bx)), calc(-50% + var(--by)), 0) scale(1) rotate(calc(var(--r) * 0.5));
  }
  100% {
    opacity: 0;
    transform: translate3d(calc(-50% + var(--bx) * 1.15), calc(-50% + var(--by) + 32vh), 0) scale(0.9) rotate(var(--r));
  }
}

@keyframes pit-flutter {
  from {
    transform: rotateX(0deg) rotateY(0deg) rotate(0deg);
  }
  to {
    transform: rotateX(70deg) rotateY(40deg) rotate(25deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pit-fx {
    display: none;
  }
}
