@charset "UTF-8";
/* ==========================================================================
   しいたけねこを探せ！ — game.css
   サイト本体の style.css を読み込んだうえで、このファイルを重ねています
   （色や文字は style.css のCSS変数をそのまま使っています）
   ========================================================================== */

.game-page { background: var(--color-bg); }

/* ==========================================================================
   見出し
   ========================================================================== */
.ghead {
  position: relative;
  padding: calc(var(--header-h) + 34px) 0 8px;
  text-align: center;
  background: radial-gradient(130% 78% at 50% 0%, var(--color-bg-deep) 0%, var(--color-bg-sub) 50%, var(--color-bg) 100%);
}
.ghead__title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.4vw, 14px);
  font-size: clamp(26px, 6vw, 52px);
  font-weight: 700;
  color: var(--color-brown);
  letter-spacing: .02em;
  line-height: 1.3;
  text-shadow: 3px 3px 0 var(--color-white);
}
.ghead__title em { font-style: normal; color: #6d8f4e; }
.ghead__cat {
  width: clamp(44px, 8vw, 74px);
  height: auto;
  transform-origin: 50% 100%;
  animation: catBreatheTilt 9s ease-in-out infinite;
}
.ghead__lead {
  margin-top: 10px;
  font-size: clamp(13px, 1.7vw, 16px);
  color: #6b584b;
}
.ghead__lead strong { color: var(--color-brown); }

/* 木の立て札（画像は使わずCSSで） */
.ghead__sign {
  display: none;
  position: absolute;
  top: calc(var(--header-h) + 30px);
  padding: 12px 18px;
  background: #f3e3c6;
  border: 2px solid #d9bf95;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.9;
  color: #7a6144;
  box-shadow: 0 3px 0 #d9bf95;
}
.ghead__sign--l { left: 2%; transform: rotate(-3deg); }
.ghead__sign--r { right: 2%; transform: rotate(3deg); }

/* ==========================================================================
   ゲームのカード
   ========================================================================== */
.gwrap { padding: clamp(14px, 2.5vw, 26px) 0 clamp(48px, 7vw, 80px); }
.gcard {
  background: var(--color-white);
  border: 3px solid var(--color-main);
  border-radius: clamp(20px, 3vw, 30px);
  padding: clamp(12px, 2vw, 20px);
  box-shadow: var(--shadow-md);
}

/* 上のバー */
.gbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.gbar__item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  background: var(--color-bg-sub);
  border-radius: var(--radius-pill);
}
.gbar__item--time { background: var(--color-bg-deep); }
.gbar__item--level { margin-left: auto; }
.gbar__icon { width: 30px; height: auto; }
.gbar__clock {
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  border: 2.5px solid var(--color-accent);
  position: relative;
}
.gbar__clock::before,
.gbar__clock::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 2px;
  background: var(--color-accent);
  border-radius: 2px;
  transform-origin: 50% 100%;
}
.gbar__clock::before { height: 6px; transform: translateX(-50%) rotate(40deg); }
.gbar__clock::after  { height: 4px; transform: translateX(-50%) rotate(-70deg); }
.gbar__body { display: grid; line-height: 1.25; }
.gbar__label { font-size: 10.5px; font-weight: 700; color: #8a7666; letter-spacing: .04em; }
.gbar__value { font-size: 15px; font-weight: 700; color: var(--color-brown); }
.gbar__value strong { font-size: 22px; color: var(--color-accent); }
.gbar__value small { font-size: 11px; margin-left: 2px; }
.gbar__actions { display: flex; gap: 8px; }

/* のこり5秒から、時間を強調する */
.gbar__item--time.is-hurry { background: #ffe0c6; animation: gHurry 1s ease-in-out infinite; }
.gbar__item--time.is-hurry .gbar__value strong { color: #d4622f; }
@keyframes gHurry {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

.gtheme {
  margin: 0 0 10px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-accent);
}

/* ボタン */
.gbtn[hidden] { display: none; }   /* hidden を確実に効かせる */
.gbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 700;
  transition: transform .22s var(--ease-out), background-color .22s, box-shadow .22s, opacity .2s;
}
.gbtn small { font-size: 10.5px; opacity: .8; }
.gbtn--sub {
  background: #6d8f4e;
  color: var(--color-white);
  box-shadow: 0 4px 0 #56733c;
}
.gbtn--sub:hover { background: #7da05a; }
.gbtn--ghost {
  background: var(--color-white);
  color: var(--color-brown);
  border: 2px solid var(--color-main);
}
.gbtn--ghost:hover { background: var(--color-bg-deep); }
.gbtn--ghost:disabled { opacity: .4; pointer-events: none; }
.gbtn--main {
  min-height: 58px;
  padding: 14px 40px;
  font-size: clamp(16px, 2.2vw, 19px);
  background: var(--color-brown);
  color: var(--color-white);
  box-shadow: 0 6px 0 #5f3d28, var(--shadow-md);
}
.gbtn--main:hover { background: #8b5c3d; }
.gbtn:hover { transform: translateY(-2px); }
.gbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 #5f3d28; }
.gbtn__paw {
  width: 22px;
  height: 22px;
  flex: none;
  fill: currentColor;
}

/* ==========================================================================
   森（ゲーム画面）
   ========================================================================== */
.stage {
  position: relative;
  border-radius: clamp(14px, 2vw, 22px);
  overflow: hidden;
  background: var(--color-bg-sub);
  cursor: crosshair;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
/* 森の絵と、その上に重なるものを入れる箱（絵とぴったり同じ大きさ） */
.stage__inner {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
}

.stage__photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;   /* 前景レイヤーとぴったり重なるように、切り抜かない */
  -webkit-user-drag: none;
  pointer-events: none;
}
.stage.is-shake { animation: gShake .3s var(--ease-out); }
@keyframes gShake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

/* 前景レイヤー：しいたけねこの手前に重なる葉っぱやきのこ */
.stage__front {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;   /* 前景ごしでも しいたけねこを押せます */
  z-index: 3;
}
.stage__front[hidden] { display: none; }

/* 正解の場所（見えないボタン。前景より手前に置いて押せるようにする） */
.marks { position: absolute; inset: 0; z-index: 4; }
.mark {
  position: absolute;
  transform: translate(-50%, -50%);
  /* スマホでも指で押せるように、当たり判定に最低の大きさを持たせる
     （大きくしすぎると「ねこの隣を押しても当たる」ので38pxにしています） */
  min-width: 38px;
  min-height: 38px;
}
.mark__hit {
  position: absolute;
  inset: 0;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}
.mark.is-found .mark__hit { pointer-events: none; cursor: default; }

/* 居場所を知らせる輪 */
.mark__ring {
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 3px rgba(232, 168, 91, .95), 0 0 24px 6px rgba(255, 236, 170, .9);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.mark.is-found .mark__ring {
  opacity: 1;
  border-color: #cfe8a8;
  box-shadow: 0 0 0 3px rgba(109, 143, 78, .95), 0 0 22px 6px rgba(190, 226, 150, .85);
  animation: gFound .7s var(--ease-bounce);
}
.mark.is-show .mark__ring { opacity: 1; }
.mark.is-hint .mark__ring { opacity: 1; animation: gRing 1.4s ease-out; }

@keyframes gRing {
  0%   { opacity: 0; transform: scale(2.1); }
  35%  { opacity: 1; transform: scale(1); }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes gFound {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ==========================================================================
   演出
   ========================================================================== */
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }

.bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 7px 15px;
  background: var(--color-white);
  border: 2px solid var(--color-main);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-brown);
  white-space: nowrap;
  animation: gPop .95s var(--ease-out) forwards;
}
.bubble.is-good {
  background: #6d8f4e;
  border-color: #56733c;
  color: #fff;
  font-size: clamp(15px, 2.4vw, 20px);
  padding: 9px 22px;
}
@keyframes gPop {
  0%   { opacity: 0; transform: translate(-50%, -80%) scale(.7); }
  22%  { opacity: 1; transform: translate(-50%, -110%) scale(1.04); }
  70%  { opacity: 1; transform: translate(-50%, -115%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(.96); }
}

.cross {
  position: absolute;
  width: 30px; height: 30px;
  transform: translate(-50%, -50%);
  animation: gCross .65s var(--ease-out) forwards;
}
.cross::before, .cross::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 26px; height: 4px;
  margin: -2px 0 0 -13px;
  border-radius: 3px;
  background: #d4622f;
}
.cross::before { transform: rotate(45deg); }
.cross::after  { transform: rotate(-45deg); }
@keyframes gCross {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
  25%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

.spark {
  position: absolute;
  width: 11px; height: 11px;
  transform: translate(-50%, -50%);
  animation: gSpark 1.05s var(--ease-out) forwards;
}
.spark--leaf { background: #d98b3a; border-radius: 60% 0 60% 0; }
.spark--star { background: var(--color-main); clip-path: polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%); }
.spark--dot  { background: #8fae63; border-radius: 50%; width: 8px; height: 8px; }
@keyframes gSpark {
  0%   { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateY(0) scale(.4); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(var(--d) * -1)) scale(1); }
}

.confetti {
  position: absolute;
  top: -14px;
  width: 9px; height: 13px;
  border-radius: 2px;
  animation: gFall 2.9s linear forwards;
}
.confetti--0 { background: var(--color-main); }
.confetti--1 { background: #d98b3a; border-radius: 60% 0 60% 0; }
.confetti--2 { background: #8fae63; }
.confetti--3 { background: #e8a85b; border-radius: 50%; }
@keyframes gFall {
  0%   { opacity: 0; transform: translateY(0) rotate(0); }
  10%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(560px) rotate(540deg); }
}

/* ==========================================================================
   かぶせる画面（タイトル・クリア・ざんねん）
   ========================================================================== */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  /* 画面が小さいときは、はみ出したぶんをスクロールできるようにする
     （これが無いと、スマホでスタートボタンが画面の外に出て押せなくなります） */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
  z-index: 5;
  background: rgba(255, 253, 247, .82);
  opacity: 0;
  transition: opacity .3s var(--ease-out);
}
.overlay[hidden] { display: none; }
.overlay.is-on { opacity: 1; }
.overlay.is-final { background: rgba(255, 249, 232, .93); }

.panel {
  max-width: 460px;
  max-height: 100%;
  overflow-y: auto;
  padding: clamp(12px, 3vw, 28px) clamp(14px, 3.5vw, 34px);
  background: var(--color-white);
  border: 3px solid var(--color-main);
  border-radius: clamp(18px, 2.6vw, 26px);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.panel__cat { width: clamp(72px, 13vw, 110px); height: auto; margin: 0 auto 8px; }
.panel__cat--float { animation: float 4.6s ease-in-out infinite; }
.panel__cat--hop { animation: catHopOnce .9s var(--ease-bounce); }
.panel__cat--big { width: clamp(110px, 20vw, 170px); animation: catHopOnce 1s var(--ease-bounce); }
.panel__label {
  font-size: clamp(19px, 3.2vw, 27px);
  font-weight: 700;
  color: #6d8f4e;
  letter-spacing: .03em;
}
.panel__label--sad { color: #c07a4a; }
.panel__lead {
  margin-top: 6px;
  font-size: clamp(14px, 2vw, 17px);
  font-weight: 700;
  line-height: 1.85;
  color: var(--color-brown);
}
.panel__note {
  margin-top: 10px;
  font-size: clamp(11.5px, 1.5vw, 13px);
  line-height: 1.9;
  color: #7a6552;
}
.panel .gbtn { margin-top: 16px; }
.br-pc { display: none; }

.ghelp {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: #8a7666;
}
.gback { margin-top: clamp(24px, 4vw, 38px); text-align: center; }

/* ==========================================================================
   画面の大きさ別
   ========================================================================== */
@media (max-width: 600px) {
  /* 小さい画面では、かぶせる画面をコンパクトにする */
  .panel { padding: 10px 14px; border-width: 2px; border-radius: 16px; }
  .panel__cat { width: 52px; margin-bottom: 2px; }
  .panel__cat--big { width: 74px; }
  .panel__label { font-size: 17px; }
  .panel__lead { font-size: 13px; line-height: 1.6; margin-top: 3px; }
  .panel__note { font-size: 10.5px; line-height: 1.6; margin-top: 5px; }
  .panel .gbtn { margin-top: 9px; min-height: 46px; padding: 10px 22px; font-size: 14.5px; }

  .gbar { gap: 6px; }
  .gbar__item { padding: 7px 11px; gap: 7px; flex: 1 1 auto; }
  .gbar__item--level { margin-left: 0; }
  .gbar__actions { width: 100%; }
  .gbar__actions .gbtn { flex: 1; }
  .gbar__icon { width: 24px; }
  .gbar__value { font-size: 13.5px; }
  .gbar__value strong { font-size: 19px; }
  /* 森は「全部が見えている」ことが大事なので、切り抜かずにそのまま出す */
  .stage__photo { aspect-ratio: 4 / 3; object-fit: contain; }

  /* クリア画面などがきちんと収まるように、ゲーム枠に高さの余裕をもたせる
     （森の絵は切り抜かず、上下にすこし余白が入ります） */
  .stage {
    min-height: 352px;
    display: flex;
    align-items: center;
    background: var(--color-bg-sub);
  }
  .stage__inner { width: 100%; }

  /* 内訳は1行にまとめて、縦を短くする */
  .pt { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; padding: 7px 10px; }
  .pt__row { display: inline-flex; gap: 4px; font-size: 11px; line-height: 1.6; }
  .pt__row--sum { width: 100%; justify-content: center; margin-top: 2px; padding-top: 4px; }
  .pt__row--sum dd { font-size: 14px; }
}

@media (min-width: 1100px) {
  .ghead__sign { display: block; }
}

/* ==========================================================================
   動きを減らす設定
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .ghead__cat, .panel__cat, .panel__cat--float, .panel__cat--hop, .panel__cat--big,
  .gbar__item--time.is-hurry { animation: none !important; }
  .stage.is-shake { animation: none !important; }
  .bubble, .cross { animation: gStay 1s forwards; }
  @keyframes gStay { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
}

/* ==========================================================================
   ポイント表示
   ========================================================================== */
.gbar__item--score { background: #eef4e4; }
.gbar__item--score .gbar__value strong { color: #6d8f4e; }

/* クリア画面の内訳 */
.pt {
  margin: 10px 0 0;
  padding: 10px 14px;
  background: var(--color-bg-sub);
  border-radius: 14px;
  text-align: left;
}
.pt__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 12.5px;
  line-height: 2;
  color: #6b584b;
}
.pt__row dt, .pt__row dd { margin: 0; }
.pt__row dd { font-weight: 700; color: var(--color-brown); }
.pt__row--minus dd { color: #c0603a; }
.pt__row--sum {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 2px dotted var(--color-line);
  font-size: 14px;
}
.pt__row--sum dt { font-weight: 700; color: var(--color-brown); }
.pt__row--sum dd { color: #6d8f4e; font-size: 17px; }

/* 全クリアの大きな点数 */
.panel__score {
  margin-top: 6px;
  line-height: 1.1;
  color: #6d8f4e;
}
.panel__score strong {
  font-size: clamp(34px, 7vw, 54px);
  letter-spacing: .02em;
}
.panel__score small {
  margin-left: 6px;
  font-size: clamp(12px, 1.8vw, 15px);
  font-weight: 700;
}
.panel__rank {
  margin-top: 8px;
  display: inline-block;
  padding: 5px 16px;
  border-radius: var(--radius-pill);
  background: var(--color-bg-deep);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-brown);
}
.panel__btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.panel__btns .gbtn { margin-top: 0; }

.gbtn--share {
  min-height: 58px;
  padding: 14px 26px;
  font-size: clamp(14px, 2vw, 16px);
  background: #6d8f4e;
  color: var(--color-white);
  box-shadow: 0 6px 0 #56733c;
}
.gbtn--share:hover { background: #7da05a; }

/* 「コピーしました」などのお知らせ（ステージの下に出す） */
.toast {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 6;
  transform: translate(-50%, 8px);
  max-width: calc(100% - 24px);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--color-brown);
  color: var(--color-white);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s var(--ease-out);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 600px) {
  .pt { padding: 7px 11px; margin-top: 7px; }
  .pt__row { font-size: 11.5px; line-height: 1.8; }
  .pt__row--sum { font-size: 12.5px; }
  .pt__row--sum dd { font-size: 15px; }
  .panel__rank { font-size: 11.5px; padding: 4px 12px; margin-top: 5px; }

  /* 全ステージクリアの画面は中身が多いので、さらに詰める */
  .panel--final .panel__cat--big { width: 58px; }
  .panel--final .panel__score strong { font-size: 30px; }
  .panel--final .panel__score small { font-size: 11px; }
  .panel--final .panel__lead { font-size: 12.5px; margin-top: 2px; }
  .panel--final .panel__btns { margin-top: 8px; }
  .panel__btns { gap: 6px; margin-top: 9px; }
  .panel__btns .gbtn, .gbtn--share { min-height: 46px; padding: 10px 18px; font-size: 13.5px; }
}
