/* ============================================================
   キャッチ

   いちばん大事な 決めごと:
     あそび場（.field）は たて・よこ どちらの 向きでも
     つねに 同じ たて長の 形（3:4）に する。

     形が 同じなら、
       ・かごが 端から端まで 動く 距離（かご何個ぶんか）
       ・いちどに 見えている ものの 数
       ・ものと かごの 大きさの 比
     が そろうので、向きを 変えても むずかしさが 変わらない。

     お題の パネルは あまった ところに 置く。
     たて向きは 上、よこ向きは 左。あそび場は 動かさない
   ============================================================ */
body{
  font-family:"Hiragino Maru Gothic ProN","Hiragino Sans",sans-serif;
  background:#f4ead6;
  color:#4a3f2f;
  overflow:hidden;
}
img{display:block; width:100%; height:100%; object-fit:contain; pointer-events:none}


/* 丸い もどるボタン */
.iconbtn{
  flex:none;
  width:44px; height:44px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background:#fffdf6; color:#4a3f2f;
  border:3px solid #1c1c1c; box-shadow:0 4px 0 #1c1c1c;
  text-decoration:none; cursor:pointer;
}
.iconbtn:active{transform:translateY(4px); box-shadow:0 0 0 #1c1c1c}


/* ============ はじめる モーダル ============ */
.lead b{color:#c25f14}

/* ================== あそぶ画面 ================== */
/* よこ向き（横のほうが 長い）は お題を 左の 列に する。
   こうすると あそび場の たて幅を いっぱいに 使える */
@media (min-aspect-ratio:1/1){
  .wrap{flex-direction:row}
}

@media (min-aspect-ratio:1/1){
  .hud{
    flex-direction:column; flex-wrap:nowrap; justify-content:flex-start;
    width:clamp(160px,27vw,240px);
    gap:clamp(8px,1.6vh,16px);
  }
}

/* あそびながら むずかしさを 変える プルダウン。
   さわるのは 大人なので 小さくてよい。色は 選んだ 段に そろえる */
.lvsel{
  padding:6px 10px; border-radius:13px;
  background:#e07b28; color:#fff;
  border:3px solid #1c1c1c;
  font-family:inherit; font-size:clamp(11px,1.6vh,14px); font-weight:800;
  cursor:pointer;
  -webkit-appearance:none; appearance:none;
  /* 右に 小さな ▼。矢印を 消すと どこを 押すのか 分からなくなる */
  background-image:linear-gradient(45deg, transparent 50%, #fff 50%),
                   linear-gradient(135deg, #fff 50%, transparent 50%);
  background-position:calc(100% - 14px) 52%, calc(100% - 9px) 52%;
  background-size:5px 5px, 5px 5px;
  background-repeat:no-repeat;
  padding-right:26px;
}
.lvsel.s2{background-color:#e07b28}
.lvsel.s3{background-color:#c2412a}

/* お題は つねに いちばん下（たて向きでは 2行目、よこ向きでは 2段目）*/
.ask{order:3}
@media (min-aspect-ratio:1/1){
  /* よこ向きは 列に なるので、もどるボタンと むずかしさが 折り返せるように する。
     折り返せないと もどるボタンが 画面の 外へ 押し出される */
  .bar{width:100%; flex-wrap:wrap; justify-content:center}
  .ask{order:0}
}

/* ---- お題 ---- */
.ask{
  flex:1 1 100%; min-width:0;
  display:flex; align-items:center; gap:clamp(6px,1.4vw,14px);
  padding:clamp(6px,1.2vh,12px) clamp(8px,1.6vw,14px);
  background:#fffdf6; border:4px solid #1c1c1c; border-radius:18px;
}
@media (min-aspect-ratio:1/1){
  .ask{flex:none; width:100%; flex-wrap:wrap; justify-content:center}
}

/* たのんでいる こいぬ。顔だけを まるく 切り抜く（common/celebrate.js の 顔バッジと 同じ やりかた）*/
.pup{
  flex:none;
  width:clamp(42px,7vh,66px); height:clamp(42px,7vh,66px);
  border-radius:50%; overflow:hidden;
  background:#fff; border:3px solid #1c1c1c;
}
.pup img{
  width:208%; height:208%;
  margin-left:-54%; margin-top:-8%;
  object-fit:contain;
}
/* ほしい もの。お題は これ 1つだけ 大きく 見せる */
.want{
  flex:none;
  width:clamp(40px,6.6vh,62px); height:clamp(40px,6.6vh,62px);
}

/* 空きマス。とるたび 左から 1つずつ うまる */
.slots{
  flex:1 1 auto; min-width:0;
  display:flex; flex-wrap:wrap; align-content:center;
  gap:clamp(3px,.7vh,6px);
}
.slot{
  width:clamp(20px,3.4vh,32px); height:clamp(20px,3.4vh,32px);
  border-radius:50%;
  border:2.5px dashed #c9b48c; background:#f4ead6;
  display:flex; align-items:center; justify-content:center;
  padding:2px;
}
.slot img{opacity:0; transform:scale(.4)}
.slot.on{border-style:solid; border-color:#e07b28; background:#fff5e6}
.slot.on img{opacity:1; transform:scale(1); transition:transform .18s cubic-bezier(.2,1.6,.4,1), opacity .12s}

.field{
  position:relative; overflow:hidden;
  /* 実際の 大きさは app.js の measure() が 入れる。
     CSS だけで 3:4 を 保とうとすると、幅で 頭打ちに なったとき
     height:100% が 勝って 形が くずれる（実測で 0.715 に なった）。
     ここの aspect-ratio は 最初の 1コマ用の 保険 */
  aspect-ratio:3 / 4;
  max-width:100%; max-height:100%;
  border:4px solid #1c1c1c; border-radius:20px;
  background:linear-gradient(#bfe4f7 0%, #dff1fb 62%, #eaf7e2 100%);
  touch-action:none;   /* 指で かごを 動かすので スクロールさせない */
}
.ground{
  position:absolute; left:0; right:0; bottom:0;
  height:9%;
  background:#8ec96a;
  border-top:4px solid #5f9c40;
}
.items{position:absolute; inset:0}

/* 落ちてくる もの。位置は app.js が transform で 動かす */
.drop{
  position:absolute; left:0; top:0;
  will-change:transform;
  /* drop-shadow は 使わない。
     毎コマ 位置が 変わる ものに かけると、その たびに ぼかしを 引き直すので
     実機で 重い。影が なくても 空の 上では じゅうぶん 見える */
}
.drop img{width:100%; height:100%}
/* とれた ときの はじけ */
.drop.pop{transition:transform .18s ease-out, opacity .18s ease-out; opacity:0}

/* ---- しばらく さわらないと 止まる ----
   画面を 白く かぶせて、まん中で 指の絵を ゆっくり 光らせる。
   字は 読めないので、この絵だけで「さわって」を 伝える。
   指の じゃまに ならないよう pointer-events は 通す */
.pausecover{
  position:absolute; inset:0; z-index:5;
  display:flex; align-items:center; justify-content:center;
  background:rgba(244,234,214,.72);
  pointer-events:none;
}
.pausebox{
  width:34%; max-width:120px; aspect-ratio:1;
  display:flex; align-items:center; justify-content:center;
  border-radius:50%;
  background:#fffdf6; border:4px solid #1c1c1c; box-shadow:0 6px 0 #1c1c1c;
  animation:tap 1.6s ease-in-out infinite;
}
@keyframes tap{
  0%,100%{transform:scale(1)}
  50%{transform:scale(1.12)}
}

.basket{
  position:absolute; left:0; top:0;
  will-change:transform;
  /* かごも 指に ついて 毎コマ 動くので、ぼかしは かけない。
     かごの 絵じたいに こい ふちが ついているので 埋もれない */
}
/* まちがった ものを とったとき。かごが ぶるっと ふるえる */
@keyframes shake{
  0%,100%{margin-left:0}
  20%{margin-left:-10px} 40%{margin-left:9px}
  60%{margin-left:-7px}  80%{margin-left:5px}
}
.basket.miss{animation:shake .42s}
.field.miss{animation:shake .42s}


/* ---- できた！ ---- */
.cover{
  position:fixed; inset:0; z-index:20;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:clamp(10px,2vh,20px);
  background:rgba(244,234,214,.94);
  padding:24px;
}
.cover > *{position:relative; z-index:1}
.winbadge{
  width:clamp(90px,18vh,150px); height:clamp(90px,18vh,150px);
  border-radius:50%; overflow:hidden;
  background:#fff; border:5px solid #1c1c1c; box-shadow:0 6px 0 #1c1c1c;
}
.winbadge img{width:208%; height:208%; margin-left:-54%; margin-top:-8%}

.winbtns{display:flex; gap:12px; flex-wrap:wrap; justify-content:center}
.go{
  padding:14px 26px;
  background:#e07b28; color:#fff;
  border:4px solid #1c1c1c; border-radius:18px; box-shadow:0 6px 0 #1c1c1c;
  font-family:inherit; font-size:clamp(16px,2.4vh,22px); font-weight:800; cursor:pointer;
}
/* はじめる。ここしか 押す ところが ないので 大きく 出す */
.go.start{
  padding:clamp(14px,2.6vh,24px) clamp(36px,9vw,72px);
  font-size:clamp(22px,3.6vh,32px); letter-spacing:.1em;
}
.go:active{transform:translateY(6px); box-shadow:0 0 0 #1c1c1c}

