/* =============================================
   リセット・基本設定
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Hiragino Maru Gothic Pro", "メイリオ", "Rounded Mplus 1c", sans-serif;
  background: linear-gradient(145deg, #fde8f0 0%, #e8f0fd 50%, #fdf8e8 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 背景の水玉 */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,180,200,0.35) 2px, transparent 2px),
    radial-gradient(circle, rgba(180,200,255,0.30) 1.5px, transparent 1.5px),
    radial-gradient(circle, rgba(255,220,160,0.30) 1px,   transparent 1px);
  background-size: 70px 70px, 50px 50px, 90px 90px;
  background-position: 5px 5px, 25px 35px, 50px 15px;
  animation: bgMove 25s linear infinite;
  z-index: -1;
}
@keyframes bgMove {
  to { background-position: 75px 75px, 75px 85px, 140px 105px; }
}

/* =============================================
   画面管理
   ============================================= */
.screen {
  display: none;
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 660px;
  min-height: 100vh;
  padding: 20px 16px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.screen.active {
  display: flex;
  animation: screenIn 0.35s ease;
}
@keyframes screenIn {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* =============================================
   ボタン共通
   ============================================= */
.btn {
  padding: 13px 36px;
  font-size: 1.05rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  letter-spacing: 0.07em;
  transition: transform 0.14s, box-shadow 0.14s;
  font-family: inherit;
}
.btn--primary {
  background: linear-gradient(135deg, #7ecef4, #b4a8f0);
  color: #fff;
  box-shadow: 0 5px 18px rgba(120,160,240,0.4);
}
.btn--primary:hover  { transform: translateY(-3px) scale(1.04); box-shadow: 0 8px 24px rgba(120,160,240,0.5); }
.btn--primary:active { transform: scale(0.97); }
.btn--sub {
  background: #fff;
  color: #90b8d8;
  border: 2px solid #b8d8f0;
}
.btn--sub:hover { background: #f0f8ff; transform: translateY(-2px); }

/* =============================================
   シナモロール画像 共通
   ============================================= */
.cinna-img {
  display: block;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

/* 画像＋オーバーレイをまとめるラッパー */
.cinna-img-wrap {
  position: relative;
  display: inline-block;
}

/* =============================================
   スタート画面
   ============================================= */
.start-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.cinna-stage {
  position: relative;
  display: flex;
  justify-content: center;
}

/* スタート画像：大きくふわふわ浮かぶ */
.cinna-img--start {
  width: 180px;
  height: auto;
  animation: floatStart 3.2s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(100,150,220,0.25));
}
@keyframes floatStart {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-14px); }
}

.start-bubble {
  position: absolute;
  top: 8px; right: -16px;
  background: #fff;
  border: 2px solid #b8d8f0;
  border-radius: 18px 18px 18px 4px;
  padding: 7px 13px;
  font-size: 0.88rem;
  color: #6090b8;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(100,160,220,0.18);
  animation: bubblePop 0.4s cubic-bezier(0.34,1.56,0.64,1) 0.5s both;
}
@keyframes bubblePop {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

.title {
  font-size: 1.65rem;
  color: #5080b8;
  text-align: center;
  line-height: 1.5;
  text-shadow: 1px 2px 0 rgba(140,180,240,0.35);
  letter-spacing: 0.05em;
}
.start-rule {
  font-size: 0.92rem;
  color: #7090a8;
  text-align: center;
  line-height: 1.9;
  background: rgba(255,255,255,0.6);
  padding: 10px 20px;
  border-radius: 14px;
  border: 1.5px solid #d0e8f8;
}

/* =============================================
   ゲーム画面：ステータスバー
   ============================================= */
#screen-game { justify-content: flex-start; padding-top: 16px; gap: 10px; }

.status-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.75);
  border-radius: 16px;
  padding: 8px 16px;
  border: 1.5px solid #d8ecf8;
  box-shadow: 0 2px 10px rgba(100,160,220,0.1);
}
.miss-area, .correct-area { display: flex; align-items: center; gap: 8px; }
.status-label { font-size: 0.78rem; color: #90b0c8; font-weight: bold; letter-spacing: 0.06em; }
.hearts, .ingredients { display: flex; gap: 3px; }

.heart { font-size: 1.3rem; transition: transform 0.2s; }
.heart--off { filter: grayscale(1) opacity(0.5); }
.heart--shake { animation: heartShake 0.4s ease; }
@keyframes heartShake {
  0%,100% { transform: scale(1); }
  30%      { transform: scale(1.5) rotate(-10deg); }
  60%      { transform: scale(0.8) rotate(5deg); }
}

.ing { font-size: 1.3rem; }
.ing--filled { animation: ingPop 0.35s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes ingPop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* =============================================
   ゲーム画面：キッチン
   ============================================= */
.kitchen {
  width: 100%;
  height: 200px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.kitchen__shelf {
  position: absolute;
  top: 8px; left: 5%; width: 90%;
  height: 13px;
  background: #d4a888;
  border-radius: 5px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
  display: flex;
  align-items: flex-end;
  padding: 0 20px;
  justify-content: space-between;
}
.deco-item { font-size: 1.4rem; margin-bottom: 14px; }
.kitchen__counter {
  position: absolute;
  bottom: 0; width: 100%;
  height: 58px;
  background: linear-gradient(180deg, #e8d0b4 0%, #d4b890 100%);
  border-radius: 12px 12px 0 0;
  border-top: 3px solid #c8a880;
}

/* 鍋 — カウンターの左よりに固定 */
.pot { position: absolute; bottom: 54px; left: 28%; transform: translateX(-50%); z-index: 2; }
.pot__body {
  width: 72px; height: 58px;
  background: linear-gradient(180deg, #6090c4, #4070a4);
  border-radius: 9px 9px 18px 18px;
  position: relative;
  border: 2.5px solid #3060a0;
  box-shadow: 0 4px 10px rgba(50,80,140,0.28);
}
.pot__lid {
  position: absolute;
  top: -12px; left: -4px;
  width: 80px; height: 16px;
  background: #4878b4;
  border-radius: 8px;
  border: 2px solid #3060a0;
}
.pot__lid::after {
  content: "";
  position: absolute;
  top: -7px; left: 50%; transform: translateX(-50%);
  width: 12px; height: 9px;
  background: #c8a870;
  border-radius: 4px 4px 0 0;
}
.pot__handle { position: absolute; width: 16px; height: 9px; background: #4878b4; border-radius: 50%; top: 18px; border: 2px solid #3060a0; }
.pot__handle--l { left: -14px; }
.pot__handle--r { right: -14px; }

/* 湯気（小） */
.pot__steam {
  position: absolute;
  top: -42px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 6px;
  opacity: 0; transition: opacity 0.4s;
  pointer-events: none;
}
.pot__steam.active { opacity: 1; }
.pot__steam span { font-size: 1rem; color: #a0c4e0; }
.pot__steam span:nth-child(1) { animation: steamUp 1.1s ease-in-out infinite 0s; }
.pot__steam span:nth-child(2) { animation: steamUp 1.1s ease-in-out infinite 0.35s; }
.pot__steam span:nth-child(3) { animation: steamUp 1.1s ease-in-out infinite 0.7s; }
@keyframes steamUp {
  0%   { opacity: 0; transform: translateY(0); }
  35%  { opacity: 0.9; }
  100% { opacity: 0; transform: translateY(-22px); }
}

/* =============================================
   ゲーム画面：シナモロール画像（料理中）
   ============================================= */
/* シナモロール — カウンター右側、鍋と重ならない位置 */
.cinna-wrap {
  position: absolute;
  right: 5%;
  bottom: 58px;   /* カウンター上面に足が乗る高さ */
  z-index: 4;     /* 鍋(z-index:2)より確実に前面 */
}

/* 料理中の画像 */
.cinna-img--cook {
  width: 110px;
  height: auto;
  filter: drop-shadow(0 4px 10px rgba(100,140,220,0.2));
}

/* 料理中：ラッパーごとバウンス */
#cinna-cook.cooking {
  animation: cookBounce 0.5s ease-in-out infinite alternate;
}
@keyframes cookBounce {
  from { transform: translateY(0) rotate(-3deg); }
  to   { transform: translateY(-8px) rotate(3deg); }
}

/* 正解ジャンプ */
#cinna-cook.cheer {
  animation: cheer 0.4s ease-in-out 2;
}
@keyframes cheer {
  0%   { transform: translateY(0); }
  35%  { transform: translateY(-24px) rotate(7deg); }
  65%  { transform: translateY(-8px) rotate(-4deg); }
  100% { transform: translateY(0); }
}

/* エプロン オーバーレイ */
.overlay-apron {
  position: absolute;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  width: 54px; height: 40px;
  background: #ffb6c8;
  border-radius: 8px 8px 16px 16px;
  border: 1.5px solid #f090b0;
  z-index: 4;
  pointer-events: none;
}
.overlay-apron::before {
  content: "";
  position: absolute;
  top: -8px; left: 50%; transform: translateX(-50%);
  width: 22px; height: 14px;
  background: #ffb6c8;
  border: 1.5px solid #f090b0;
  border-radius: 50%;
}
.overlay-apron--big {
  width: 64px; height: 48px;
  bottom: 14px;
}
.overlay-apron--big::before { width: 26px; height: 17px; }

/* おたま オーバーレイ */
.overlay-ladle {
  position: absolute;
  bottom: 14px; right: -6px;
  width: 8px; height: 34px;
  background: #c8a870;
  border-radius: 4px;
  z-index: 5;
  transform-origin: bottom center;
  pointer-events: none;
}
.overlay-ladle::after {
  content: "";
  position: absolute;
  top: -12px; left: 50%; transform: translateX(-50%);
  width: 18px; height: 13px;
  background: #c8a870;
  border-radius: 50%;
}
.overlay-ladle.stir { animation: stir 0.55s ease-in-out infinite alternate; }
@keyframes stir {
  from { transform: rotate(-22deg); }
  to   { transform: rotate(22deg); }
}
.overlay-ladle--up { transform: rotate(-45deg); bottom: 20px; right: -4px; }

/* =============================================
   ゲーム画面：タイピングパネル
   ============================================= */
.type-panel {
  width: 100%;
  background: rgba(255,255,255,0.9);
  border-radius: 20px;
  padding: 18px 22px 16px;
  box-shadow: 0 6px 22px rgba(100,150,220,0.13);
  border: 2px solid #d4ecf8;
}
.word-box { text-align: center; margin-bottom: 12px; }
.word-jp   { font-size: 1.95rem; color: #385878; font-weight: bold; letter-spacing: 0.08em; margin-bottom: 3px; }
.word-kana { font-size: 0.95rem; color: #80b0cc; letter-spacing: 0.12em; margin-bottom: 7px; }
.word-roman { font-family: "Courier New", monospace; font-size: 1.45rem; letter-spacing: 0.06em; min-height: 1.8em; }
.roman-done { color: #70c88a; }
.roman-rest { color: #b0c8e0; }

#type-input {
  width: 100%;
  padding: 11px 16px;
  font-size: 1.15rem;
  border: 2.5px solid #b4d8f0;
  border-radius: 12px;
  outline: none;
  text-align: center;
  font-family: "Courier New", monospace;
  background: #f4faff;
  color: #4080a8;
  letter-spacing: 0.1em;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 10px;
}
#type-input:focus { border-color: #7ec8f0; box-shadow: 0 0 0 4px rgba(126,200,240,0.18); }
#type-input.shake {
  animation: inputShake 0.32s ease;
  border-color: #ff9aaa;
  box-shadow: 0 0 0 4px rgba(255,140,160,0.2);
}
@keyframes inputShake {
  0%,100% { transform: translateX(0); }
  22%  { transform: translateX(-7px); }
  44%  { transform: translateX(7px); }
  66%  { transform: translateX(-4px); }
  88%  { transform: translateX(4px); }
}

.prog-wrap { width: 100%; height: 9px; background: #e0eef8; border-radius: 9px; overflow: hidden; }
.prog-bar  { height: 100%; background: linear-gradient(90deg, #7ecef0, #98e0b0); border-radius: 9px; width: 0%; transition: width 0.1s linear; }

/* エフェクト */
.effect-correct, .effect-miss {
  position: fixed;
  top: 48%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
  padding: 13px 32px;
  border-radius: 18px;
  pointer-events: none;
  z-index: 200;
  display: none;
}
.effect-correct { background: rgba(255,255,255,0.92); border: 2px solid #a0e0b8; color: #50b878; box-shadow: 0 6px 24px rgba(80,180,120,0.25); }
.effect-miss    { background: rgba(255,255,255,0.92); border: 2px solid #f0b0c0; color: #e06070; box-shadow: 0 6px 24px rgba(220,80,100,0.2); }
.effect--show { display: block; animation: effectPop 0.9s ease forwards; }
.effect--hide { display: none; }
@keyframes effectPop {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(0.5); }
  18%  { opacity: 1; transform: translate(-50%,-50%) scale(1.15); }
  38%  { transform: translate(-50%,-50%) scale(0.95); }
  55%  { transform: translate(-50%,-50%) scale(1.03); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1); }
}

/* =============================================
   料理シーン
   ============================================= */
.cooking-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; width: 100%; }
.cooking-title { font-size: 1.9rem; color: #5080b8; animation: titlePop 0.5s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes titlePop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.big-kitchen {
  position: relative;
  width: 100%; height: 220px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

/* 大きい鍋 */
.big-pot { position: absolute; bottom: 20px; left: 50%; transform: translateX(-160%); z-index: 2; }
.big-pot__body {
  width: 110px; height: 90px;
  background: linear-gradient(180deg, #6090c4, #4070a4);
  border-radius: 12px 12px 26px 26px;
  position: relative;
  border: 3px solid #3060a0;
  box-shadow: 0 6px 18px rgba(50,80,140,0.3);
}
.big-pot__lid {
  position: absolute;
  top: -16px; left: -5px;
  width: 120px; height: 20px;
  background: #4878b4;
  border-radius: 10px;
  border: 2.5px solid #3060a0;
}
.big-pot__lid::after {
  content: "";
  position: absolute;
  top: -9px; left: 50%; transform: translateX(-50%);
  width: 16px; height: 12px;
  background: #c8a870;
  border-radius: 5px 5px 0 0;
}
.big-pot__lid.rattle { animation: lidRattle 0.45s ease-in-out infinite; }
@keyframes lidRattle {
  0%,100% { transform: translateX(0) rotate(0deg); }
  25%      { transform: translateX(-3px) rotate(-2deg); }
  75%      { transform: translateX(3px) rotate(2deg); }
}
.big-pot__handle { position: absolute; width: 22px; height: 12px; background: #4878b4; border-radius: 50%; top: 26px; border: 2.5px solid #3060a0; }
.big-pot__handle--l { left: -20px; }
.big-pot__handle--r { right: -20px; }

.big-pot__steam {
  position: absolute;
  top: -58px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 9px;
  opacity: 0; transition: opacity 0.5s;
  pointer-events: none;
}
.big-pot__steam.active { opacity: 1; }
.big-pot__steam span { font-size: 1.4rem; color: #a0c4e0; }
.big-pot__steam span:nth-child(1) { animation: steamUp 1.3s ease-in-out infinite 0s; }
.big-pot__steam span:nth-child(2) { animation: steamUp 1.3s ease-in-out infinite 0.32s; }
.big-pot__steam span:nth-child(3) { animation: steamUp 1.3s ease-in-out infinite 0.64s; }
.big-pot__steam span:nth-child(4) { animation: steamUp 1.3s ease-in-out infinite 0.96s; }

/* 集めた材料 */
.collected-items { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.collected-emoji { font-size: 2rem; animation: ingFloat 2.5s ease-in-out infinite; }
.collected-emoji:nth-child(1) { animation-delay: 0s; }
.collected-emoji:nth-child(2) { animation-delay: 0.4s; }
.collected-emoji:nth-child(3) { animation-delay: 0.8s; }
.collected-emoji:nth-child(4) { animation-delay: 1.2s; }
@keyframes ingFloat {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

/* 料理シーン：シナモロール画像（喜び） */
.cinna-img-wrap--happy {
  position: absolute;
  right: 6%; bottom: 10px;
  z-index: 3;
  animation: happyFloat 2s ease-in-out infinite;
}
@keyframes happyFloat {
  0%,100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-14px) rotate(4deg); }
}
.cinna-img-wrap--happy.jump { animation: jumpHappy 0.45s ease-in-out 3; }
@keyframes jumpHappy {
  0%,100% { transform: translateY(0); }
  40%      { transform: translateY(-28px) rotate(8deg); }
  70%      { transform: translateY(-9px) rotate(-4deg); }
}
.cinna-img--happy {
  width: 120px;
  height: auto;
  filter: drop-shadow(0 6px 14px rgba(100,140,220,0.22));
}

/* 完成料理 */
.dish-reveal {
  opacity: 0;
  transform: scale(0.5) rotate(-10deg);
  transition: opacity 0.6s cubic-bezier(0.34,1.56,0.64,1), transform 0.6s cubic-bezier(0.34,1.56,0.64,1);
}
.dish-reveal.reveal { opacity: 1; transform: scale(1) rotate(0deg); }
.dish-emoji { font-size: 5rem; line-height: 1; }
.dish-name  { font-size: 1.3rem; color: #4878a8; font-weight: bold; margin-top: 6px; }
.cook-msg   { font-size: 1rem; color: #6090b0; background: rgba(200,230,255,0.4); padding: 8px 22px; border-radius: 18px; border: 1.5px solid #b4d8f0; }
.cooking-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* =============================================
   ゲームオーバー画面
   ============================================= */
.gameover-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }

/* しょんぼりシナモロール画像 */
.cinna-img-wrap--sad {
  position: relative;
  display: inline-block;
  animation: sadSway 2.5s ease-in-out infinite;
}
@keyframes sadSway {
  0%,100% { transform: rotate(-4deg) translateY(0); }
  50%      { transform: rotate(4deg) translateY(-5px); }
}
.cinna-img--sad {
  width: 130px;
  height: auto;
  filter: grayscale(0.25) drop-shadow(0 4px 12px rgba(160,120,140,0.25));
}

/* 涙 */
.tear {
  position: absolute;
  font-size: 1.1rem;
  animation: tearDrop 1.8s ease-in-out infinite;
}
.tear--l { bottom: 30px; left: 14px;  animation-delay: 0s; }
.tear--r { bottom: 30px; right: 14px; animation-delay: 0.9s; }
@keyframes tearDrop {
  0%   { opacity: 0; transform: translateY(-4px); }
  30%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(14px); }
}

.gameover-title { font-size: 1.8rem; color: #d06080; animation: titlePop 0.4s cubic-bezier(0.34,1.56,0.64,1); }
.gameover-msg   { font-size: 0.95rem; color: #7090a8; line-height: 1.8; }

.go-score-wrap { display: flex; gap: 20px; }
.go-score-item { display: flex; align-items: baseline; gap: 5px; background: rgba(255,255,255,0.7); padding: 8px 18px; border-radius: 14px; border: 1.5px solid #d4e8f8; }
.go-score-label { font-size: 0.8rem; color: #90b0c8; }
.go-score-val   { font-size: 1.8rem; font-weight: bold; color: #5080b8; }
.go-score-unit  { font-size: 0.8rem; color: #90b0c8; }
.go-ingredients { min-height: 40px; }
.go-ing-label   { font-size: 0.85rem; color: #90b0c8; margin-bottom: 6px; }
.go-ing-row     { display: flex; gap: 8px; justify-content: center; }
.go-ing-emoji   { font-size: 2rem; animation: ingFloat 2s ease-in-out infinite; }
.go-buttons     { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* =============================================
   クリア画像オーバーレイ
   ============================================= */
.clear-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  cursor: pointer;
  animation: clearFadeIn 0.5s ease;
}
.clear-overlay.hidden {
  display: none;
}
@keyframes clearFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.clear-img {
  max-width: 90vw;
  max-height: 78vh;
  border-radius: 18px;
  box-shadow: 0 0 60px rgba(255, 220, 100, 0.5), 0 0 120px rgba(255, 180, 60, 0.3);
  animation: clearImgPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
  object-fit: contain;
}
@keyframes clearImgPop {
  from { transform: scale(0.6) rotate(-4deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg);    opacity: 1; }
}
.clear-skip {
  margin-top: 20px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.08em;
  animation: blink 1.4s ease-in-out infinite;
}
@keyframes blink {
  0%,100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* =============================================
   レスポンシブ
   ============================================= */
@media (max-width: 480px) {
  .title         { font-size: 1.3rem; }
  .cinna-img--start { width: 140px; }
  .cinna-img--cook  { width: 86px; }
  .cinna-img--happy { width: 96px; }
  .cinna-img--sad   { width: 110px; }
  .word-jp       { font-size: 1.55rem; }
  .word-roman    { font-size: 1.1rem; }
  .kitchen       { height: 165px; }
  .big-kitchen   { height: 180px; }
  .cinna-wrap    { right: 2%; }
  .cinna-img-wrap--happy { right: 2%; }
}
