* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #bfe6ff;
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Meiryo", sans-serif;
  color: #333;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#stage {
  display: block;
  width: 100%;
  height: 100%;
}

#hud {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.hud-box {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 18px;
  font-weight: bold;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.6);
}

.overlay[hidden], #hud[hidden] { display: none; }

h1 { font-size: 44px; color: #e8590c; }
h2 { font-size: 32px; }
p { font-size: 20px; line-height: 1.6; }
.big { font-size: 48px; font-weight: bold; color: #e8590c; }
.hint { font-size: 14px; color: #666; }

.btn {
  font: inherit;
  font-size: 24px;
  font-weight: bold;
  color: #fff;
  background: #f76707;
  border: none;
  border-radius: 999px;
  padding: 14px 48px;
  box-shadow: 0 5px 0 #c2410c;
  cursor: pointer;
}

.btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #c2410c;
}

/* ---------- デザイン案A「八百屋の店先」 ---------- */
.shop {
  --red: #e8463a;
  --wood: #b5651d;
  --paper: #fff8ec;
  --ink: #7a2e0e;
  --ink-soft: #5c3a1e;
  justify-content: flex-start;
  gap: 18px;
  padding: 150px 20px 20px;
  background: var(--paper);
  color: var(--ink-soft);
  font-weight: 700;
}

/* 赤白の日よけテント（下のふちは波形） */
.awning {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 96px;
  background: repeating-linear-gradient(90deg, var(--red) 0 30px, #fff 30px 60px);
}
.awning::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -15px;
  height: 15px;
  background: inherit;
  -webkit-mask: radial-gradient(circle at 15px 0, #000 14.5px, transparent 15px) 0 0 / 30px 15px repeat-x;
  mask: radial-gradient(circle at 15px 0, #000 14.5px, transparent 15px) 0 0 / 30px 15px repeat-x;
}

/* 木の看板 */
.sign {
  position: relative;
  width: min(320px, 86vw);
  padding: 12px;
  border-radius: 18px;
  background: var(--wood);
  box-shadow: 0 6px 12px rgba(122, 46, 14, 0.25);
}
.sign-in {
  padding: 26px 8px;
  border-radius: 12px;
  background: #f6d7a7;
}
.shop h1 {
  font-size: clamp(38px, 12vw, 54px);
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
}
.tag {
  position: absolute;
  top: -28px;
  left: -10px;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  transform: rotate(-12deg);
}

.shop .lead { font-size: 20px; line-height: 1.5; }
.shop .btn { font-weight: 900; font-size: 28px; padding: 16px 56px; }

/* 黒板のヒント */
.chalk {
  padding: 10px 18px;
  border: 5px solid #8b5a2b;
  border-radius: 8px;
  background: #2f4f3a;
  color: #fff;
  font-size: 14px;
}

/* 木箱とくだもの */
.crate {
  /* 中央寄せは transform を使わない（GSAPの動きが transform を上書きするため） */
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: min(310px, 82vw);
  margin: 0 auto;
}
.fruits { display: flex; justify-content: center; margin-bottom: -26px; }
.fruits i {
  position: relative;
  width: 68px;
  height: 68px;
  margin: 0 -2px;
  border-radius: 50%;
}
.fruits i::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 16px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
}
.f-apple { background: #e03131; }
.f-orange { background: #fd7e14; transform: translateY(-8px); }
.f-lemon { background: #ffd43b; border-radius: 50% / 42% !important; }
.f-melon { background: #82c91e; transform: translateY(-4px); }
.box {
  display: grid;
  place-items: center;
  height: 96px;
  border-radius: 6px 6px 0 0;
  background:
    linear-gradient(#a8622a 0 0) 0 20px / 100% 10px no-repeat,
    linear-gradient(#a8622a 0 0) 0 60px / 100% 10px no-repeat,
    #c97b3a;
}
.box span {
  padding: 4px 14px;
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

/* 結果：値札 */
.shop h2 { font-size: 30px; font-weight: 900; color: var(--ink); }
.price {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 260px;
  padding: 18px 40px 16px 0;
  background: #ffd43b;
  clip-path: polygon(0 0, 82% 0, 100% 50%, 82% 100%, 0 100%);
  transform: rotate(-6deg);
  filter: drop-shadow(0 6px 6px rgba(122, 46, 14, 0.25));
}
.price .hole {
  position: absolute;
  right: 22px;
  top: 50%;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  border-radius: 50%;
  background: var(--paper);
}
.price .score { font-size: 88px; font-weight: 900; line-height: 1; color: #c92a2a; }
.price .unit { font-size: 22px; font-weight: 900; color: var(--ink); }
.stamp {
  position: absolute;
  top: 300px;
  right: max(16px, calc(50% - 185px));
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 5px solid var(--red);
  border-radius: 50%;
  color: var(--red);
  font-size: 20px;
  font-weight: 900;
  transform: rotate(12deg);
}
.stamp[hidden] { display: none; }
.btn-sub {
  background: #fff;
  color: #f76707;
  border: 4px solid #f76707;
  box-shadow: none;
  font-size: 22px !important;
  padding: 12px 40px !important;
}
.btn[hidden] { display: none; }

/* 画面が低いとき（横向きスマホなど）は詰める */
@media (max-height: 700px) {
  .shop { padding-top: 120px; gap: 12px; }
  .crate { display: none; }
}

/* ---------- 気持ちよさの演出 ---------- */
.hud-box { display: inline-block; }
.hud-box.hurry { background: #ff6b6b; color: #fff; }

.pop {
  position: fixed;
  transform: translate(-50%, -50%);
  font-size: 26px;
  font-weight: 900;
  color: #f76707;
  text-shadow: 0 2px 0 #fff, 0 0 8px #fff;
  pointer-events: none;
  white-space: nowrap;
}

.spark {
  position: fixed;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #ffd43b;
  box-shadow: 0 0 8px #ffd43b;
  pointer-events: none;
}

.mute {
  position: fixed;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  font-size: 20px;
  cursor: pointer;
}
