@charset "UTF-8";
/* =========================================================
   ねこを にがせ（Cat on Escape）  ―  スタイル
   ・前作「ねこの ともだち」（tap-on-neko）の みため に そろえてある
   ・おおきい文字・おおきいボタン・たかいコントラスト
   ・ねこの みための きめては .cat__body--* だけ（顔の 画像に さしかえる ときも ここだけ）
   ========================================================= */

:root {
  /* いろ（前作と おなじ） */
  --c-text:        #1b1b1b;
  --c-bg:          #fff8ec;
  --c-header:      #2f5d3a;
  --c-header-text: #ffffff;
  --c-board-wall:  #ffe9c7;
  --c-board-floor: #d9a15b;
  --c-again:       #c65a00;   /* はじめから：オレンジ */
  --c-kind:        #1f7a3d;   /* ねこの かず：みどり */
  --c-close:       #444c55;
  --c-ok:          #1f7a3d;
  --c-accent:      #ffe36e;

  /* もじの おおきさ（画面の 幅に あわせて 自動で かわる） */
  --fs-message: clamp(18px, 4.4vw, 28px);
  --fs-button:  clamp(22px, 5.4vw, 34px);

  /* ばんめんの マスの おおきさ（main.js が 画面に あわせて 書きかえる） */
  --cell: 56px;

  /* アニメーションの ながさ（main.js の SWAP_MS / FALL_MS / RUN_MS と そろえる） */
  --swap-ms: 170ms;
  --fall-ms: 260ms;
  --run-ms:  900ms;
  --blast-ms: 420ms;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  font-weight: 700;
  line-height: 1.5;
  line-break: strict;
  word-break: normal;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;            /* ページは スクロールさせない */
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ========== ヘッダー ========== */
.header {
  flex: 0 0 auto;
  background: var(--c-header);
  color: var(--c-header-text);
  padding: 12px 16px 14px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .18);
}

.status {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status__label { font-size: clamp(18px, 4.2vw, 26px); }

.status__value {
  font-size: clamp(34px, 8vw, 54px);
  line-height: 1;
  color: var(--c-accent);
  font-variant-numeric: tabular-nums;
}

.status__level {
  font-size: clamp(16px, 3.8vw, 22px);
  background: #ffffff;
  color: var(--c-header);
  border-radius: 999px;
  padding: 4px 14px;
  white-space: nowrap;
}

/* つぎの レベルまでの バー（前作と おなじ かたち） */
.gauge {
  margin: 8px auto 0;
  max-width: 560px;
  height: 12px;
  background: rgba(255, 255, 255, .3);
  border: 3px solid #ffffff;
  border-radius: 999px;
  overflow: hidden;
}

.gauge__bar {
  height: 100%;
  width: 0%;
  background: var(--c-accent);
  transition: width .4s ease;
}

.quota {
  margin: 4px 0 0;
  text-align: center;
  font-size: clamp(12px, 3vw, 16px);
  color: #d7e6da;
}

.message {
  margin: 10px 0 0;
  text-align: center;
  font-size: var(--fs-message);
  background: #ffffff;
  color: var(--c-text);
  border-radius: 18px;
  padding: 10px 12px;
  min-height: 2.4em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== メインビュー：ねこの ばん ========== */
.board-area {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  /* かべと ゆか（前作の へやと おなじ かんじ） */
  background:
    linear-gradient(to bottom,
      var(--c-board-wall) 0%,
      var(--c-board-wall) 78%,
      var(--c-board-floor) 78%,
      var(--c-board-floor) 100%);
}

.board {
  position: absolute;
  box-sizing: content-box;   /* main.js が きめる 大きさは マスの ぶんだけ（わくは そと がわ） */
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  border: 6px solid var(--c-header);
  border-radius: 24px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 8px 0 rgba(0, 0, 0, .22);
}

/* マスの くぎり */
.board::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(47, 93, 58, .13) 2px, transparent 2px),
    linear-gradient(to bottom, rgba(47, 93, 58, .13) 2px, transparent 2px);
  background-size: var(--cell) var(--cell);
}

/* ========== ねこの かお 1つ ========== */
.cat {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--cell);
  height: var(--cell);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--fall-ms) cubic-bezier(.34, 1.25, .64, 1);
  will-change: transform;
}

.cat.is-swapping { transition-duration: var(--swap-ms); transition-timing-function: ease-out; }

/* えらんでいる ねこ（ふとい オレンジの わく） */
.cat.is-selected { z-index: 3; }
.cat.is-selected .cat__body { box-shadow: 0 0 0 5px var(--c-again); }

/* ねこの かお。マスいっぱいに 大きく みせる（顔だけの 絵なので 小さく ならない） */
.cat__body {
  width: 88%;
  height: 88%;
  border-radius: 50%;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  -webkit-user-drag: none;
  transition: box-shadow .12s ease;
}

/* ざんていの みため：くろ丸・しろ丸（顔の 画像が できるまで） */
.cat__body--kuro      { background-color: #23201d; border: 3px solid #100e0c; }
.cat__body--chashiro  { background-color: #fdfbf7; border: 3px solid #b9ab97; }
.cat__body--kijitora  { background-color: #9a9186; border: 3px solid #6f6960; }
.cat__body--hachiware { background-color: #fdfbf7; border: 8px solid #23201d; }
.cat__body--mike      { background-color: #23201d; border: 8px solid #fdfbf7; box-shadow: inset 0 0 0 2px #23201d, 0 0 0 2px #8d8378; }
.cat__body--shiro     { background-color: #fdfbf7; border: 3px solid #23201d; box-shadow: inset 0 0 0 6px #b9ab97; }

/* 画像が よみこめた ときは 丸の ぬりと わくを けす
   （よみこめない ときは 下の 丸の ままで あそべる） */
.cat__body--image {
  background-color: transparent !important;
  border: 0 !important;
  box-shadow: none;
}

/* 3×3の スプライトシートを つかう とき（CAT_TYPES の sheet: true）。
   9マスの うち 左上だけを みせる。 */
.cat__body--sheet {
  background-size: 300% 300%;
  background-position: 0% 0%;
}

/* ========== どうぐ（ねこじゃらし・けいとだま・すず） ========== */
.cat--item { z-index: 2; }

/* どうぐに なった マスは、ねこの かおを 出さずに どうぐだけを みせる */
.cat--item .cat__body { display: none; }

/* うしろの ひかり（どうぐが ここに ある という しるし） */
.cat--item::before {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(255, 227, 110, .95) 0%,
    rgba(255, 227, 110, .6) 56%,
    rgba(255, 227, 110, 0) 74%);
  animation: tool-pulse 1.8s ease-in-out infinite;
}

.cat--item.is-selected::before { box-shadow: 0 0 0 5px var(--c-again); }

@keyframes tool-pulse {
  0%, 100% { transform: scale(.92); opacity: .8; }
  50%      { transform: scale(1.06); opacity: 1; }
}

/* どうぐの 絵。ITEMS の image が よみこめない ときは 絵文字で 出る。 */
.cat__tool {
  position: absolute;
  inset: 6%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell) * .5);
  line-height: 1;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35));
  pointer-events: none;
}

.cat__tool--col { transform: rotate(-90deg); }   /* 絵文字の ねこじゃらしを たてに */

.cat__tool--image {
  color: transparent;                             /* 絵文字は かくす */
  transform: none;                                /* たて向きの絵は 画像そのものが たて向き */
}

/* にげて いく どうぐ（はしって いく すがた） */
.cat__body--tool {
  background-color: transparent !important;
  border: 0 !important;
  box-shadow: none;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60%;
}

/* ========== じゃまもの（いぬ・おおかみ） ========== */
.cat--blocker .cat__body { display: none; }

/* ねこと ひとめで ちがうように、マスの いろを 変える（じゃまものの マス） */
.cat--blocker::before {
  content: "";
  position: absolute;
  inset: 2%;
  border-radius: 18%;
  background: #c0503f;
  border: 3px solid #7f3126;
  box-shadow: inset 0 -6% 0 rgba(0, 0, 0, .18);
}

.cat__foe {
  position: absolute;
  inset: 4% 4% 20% 4%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell) * .44);
  line-height: 1;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4));
  pointer-events: none;
}

.cat__foe--image { color: transparent; }

/* のこりの たいりょく */
.cat__hp {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9%;
  display: flex;
  justify-content: center;
  gap: 6%;
  pointer-events: none;
}

.cat__hp i {
  width: 13%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: rgba(0, 0, 0, .28);
  border: 1px solid rgba(0, 0, 0, .35);
}

.cat__hp i.is-on { background: #ffe36e; }

/* むずかしさの がめんに ならべる みほん */
.cat-choice__foe {
  position: static;
  flex: 0 0 auto;
  width: clamp(20px, 5.4vw, 30px);
  height: clamp(20px, 5.4vw, 30px);
  inset: auto;
  font-size: clamp(16px, 4.4vw, 24px);
  background-color: #c0503f;
  border: 2px solid #7f3126;
  border-radius: 22%;
  filter: none;
}

/* どうぐが はたらいた ところの ひかり */
.blast {
  position: absolute;
  background: rgba(255, 227, 110, .92);
  border-radius: 4px;
  pointer-events: none;
  z-index: 5;
  /* transform は JS が いれる（ななめ）ので、ここでは opacity だけ うごかす */
  animation: blast var(--blast-ms) ease-out forwards;
}

@keyframes blast {
  0%   { opacity: .1; }
  25%  { opacity: .95; }
  100% { opacity: 0; }
}

/* そろわなかった ときの ぷるぷる */
.cat.is-nope .cat__body { animation: nope 220ms ease; }
@keyframes nope {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-14%); }
  60%      { transform: translateX(12%); }
}

/* ========== そろった ねこが 画面の 右へ はしって にげる ========== */
.runway {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 30;
}

.runner {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: run-right var(--run-ms) cubic-bezier(.4, .02, .7, .35) both;
}

/* 右の はしまで はしりぬける（--run は main.js が いれる） */
@keyframes run-right {
  0%   { transform: translateX(0) scaleX(1); }
  10%  { transform: translateX(-9%) scaleX(.86); }   /* びくっと ためる */
  20%  { transform: translateX(-5%) scaleX(1.06); }
  100% { transform: translateX(var(--run)) scaleX(1); }
}

/* はしる ときの たてゆれ。ばんの ねこと まぎれない よう、すこし 大きく＋かげを つける */
.runner .cat__body {
  width: 96%;
  height: 96%;
  filter: drop-shadow(0 7px 5px rgba(0, 0, 0, .38));
  animation: run-bob 190ms linear infinite;
}
@keyframes run-bob {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50%      { transform: translateY(-14%) rotate(6deg); }
}

/* ========== したの おおきな ボタン ========== */
.actions {
  flex: 0 0 auto;
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: #ffffff;
  border-top: 6px solid var(--c-header);
}

.btn {
  flex: 1 1 0;
  min-height: 88px;             /* タップ領域は 48px 以上 */
  padding: 8px 6px;
  border: 5px solid rgba(0, 0, 0, .28);
  border-radius: 24px;
  color: #ffffff;
  font-family: inherit;
  font-weight: 700;
  font-size: var(--fs-button);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  box-shadow: 0 8px 0 rgba(0, 0, 0, .25);
  transition: transform .08s ease, box-shadow .08s ease;
  touch-action: manipulation;
}

.btn:active { transform: translateY(6px); box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.btn:focus-visible { outline: 6px solid var(--c-accent); outline-offset: 3px; }

.btn__icon { font-size: 1.05em; line-height: 1; }
.btn__sub  { font-size: .56em; }

.btn--again { background: var(--c-again); }
.btn--kind  { background: var(--c-kind); }

.btn--close {
  background: var(--c-close);
  width: 100%;
  min-height: 72px;
  font-size: clamp(22px, 5.4vw, 30px);
}

/* ========== ねこの かずを えらぶ がめん ========== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  z-index: 40;
}

.modal[hidden] { display: none; }

.modal__panel {
  width: 100%;
  max-width: 620px;
  max-height: 98dvh;
  overflow-y: auto;
  background: var(--c-bg);
  border: 6px solid var(--c-header);
  border-radius: 24px;
  padding: 16px;
  animation: pop-in .25s ease both;
}

.modal__title {
  margin: 0 0 12px;
  text-align: center;
  font-size: clamp(22px, 5.2vw, 30px);
  background: var(--c-header);
  color: #ffffff;
  border-radius: 14px;
  padding: 8px;
}

.modal__note {
  margin: 12px 0;
  text-align: center;
  font-size: clamp(15px, 3.6vw, 20px);
  color: var(--c-header);
}

.cat-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* 3つの ときは、さいごの1つを よこいっぱいに ひろげる */
.cat-choice:last-child:nth-child(odd) { grid-column: 1 / -1; }

.cat-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 150px;
  padding: 12px 8px;
  background: #ffffff;
  color: var(--c-text);
  border: 5px solid var(--c-header);
  border-radius: 20px;
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(20px, 5vw, 28px);
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .2);
  touch-action: manipulation;
}

.cat-choice:active { transform: translateY(5px); box-shadow: 0 1px 0 rgba(0, 0, 0, .2); }
.cat-choice:focus-visible { outline: 6px solid var(--c-again); outline-offset: 3px; }

.cat-choice.is-current { background: #e7f4ea; border-color: var(--c-ok); }

.cat-choice__mark {
  position: absolute;
  top: 2px;
  right: 10px;
  color: var(--c-ok);
  font-size: 1.2em;
}

.cat-choice__sub { font-size: .66em; color: var(--c-header); }

.cat-choice__sample {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.cat-choice__sample .cat__body {
  flex: 0 0 auto;
  width: clamp(20px, 5.4vw, 30px);
  height: clamp(20px, 5.4vw, 30px);
}

/* ========== おおきな おしらせ（2れんさ！ など） ========== */
.bignews {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 26dvh;
  z-index: 50;
  pointer-events: none;
}

.bignews[hidden] { display: none; }

.bignews__text {
  margin: 0;
  padding: 14px 26px;
  text-align: center;
  font-size: clamp(36px, 10vw, 76px);
  color: #ffffff;
  background: var(--c-ok);
  border: 8px solid #ffffff;
  border-radius: 28px;
  box-shadow: 0 10px 0 rgba(0, 0, 0, .3);
  animation: bignews-in .5s ease both;
}

/* ========== アニメーション ========== */
@keyframes pop-in {
  0%   { transform: scale(.7); opacity: 0; }
  100% { transform: scale(1);  opacity: 1; }
}

@keyframes bignews-in {
  0%   { transform: scale(.4) rotate(-6deg); opacity: 0; }
  60%  { transform: scale(1.12) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ========== せの ひくい 画面 ========== */
@media (max-height: 700px) {
  .header { padding: 8px 14px 10px; }
  .message { margin-top: 8px; padding: 8px 10px; min-height: 2em; }
  .btn { min-height: 74px; }
  .btn--close { min-height: 64px; }
  .cat-choice { min-height: 128px; }
}

@media (max-height: 480px) {
  :root { --fs-message: 16px; --fs-button: 20px; }

  .quota { display: none; }        /* バーだけ のこす */
  .gauge { height: 8px; border-width: 2px; margin-top: 5px; }

  .header { padding: 6px 12px 8px; }
  .status { gap: 8px; }
  .status__label { font-size: 16px; }
  .status__value { font-size: 26px; }
  .status__level { font-size: 14px; padding: 2px 10px; }
  .message { margin-top: 6px; padding: 5px 8px; min-height: 1.6em; border-radius: 12px; }

  .board { border-width: 4px; border-radius: 16px; }

  .actions { padding: 8px; gap: 8px; border-top-width: 4px; }
  .btn { min-height: 56px; border-width: 4px; border-radius: 18px; }
  .btn__icon, .btn__sub { display: none; }

  .modal__panel { padding: 10px; }
  .modal__title { font-size: 18px; padding: 5px; margin-bottom: 8px; }
  .cat-choice { min-height: 96px; font-size: 17px; }
  .modal__note { margin: 8px 0; font-size: 14px; }
  .btn--close { min-height: 48px; font-size: 18px; }

  .bignews { padding-top: 18dvh; }
  .bignews__text { font-size: 34px; border-width: 5px; padding: 8px 18px; }
}

/* アニメーションが にがてな ひとの ために */
@media (prefers-reduced-motion: reduce) {
  .cat { transition-duration: 1ms; }
  * { animation-duration: .001s !important; animation-iteration-count: 1 !important; }
}
