/* 🍪 쿠키 달리기 꾸미기 */

body {
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: linear-gradient(180deg, #ffd6e8, #ffb7d5 40%, #ff9ec3);
  min-height: 100vh;
  margin: 0;
  color: #4a2a1a;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.달리기앱 {
  max-width: 1000px;
  margin: 0 auto;
  padding: 12px 12px 30px;
  text-align: center;
}

/* ---- 머리 ---- */
.달리기머리 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.달리기머리 h1 {
  font-size: 28px;
  margin: 0;
  color: #fff;
  text-shadow: 2px 2px 0 #c0397a, 0 4px 10px rgba(0,0,0,0.25);
  flex: 1;
}
.점수칸 {
  background: rgba(255,255,255,0.75);
  border-radius: 16px;
  padding: 5px 12px;
  min-width: 64px;
  box-shadow: 0 3px 0 rgba(192,57,122,0.25);
}
.점수칸 small { display: block; font-size: 12px; color: #9a4c6e; }
.점수칸 strong { font-size: 22px; color: #6b2d45; }
.점수칸.최고 strong { color: #d9831a; }

/* ---- 체력 ---- */
.체력줄 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px auto 8px;
  max-width: 960px;
}
.체력이름 { font-weight: bold; color: #fff; text-shadow: 1px 1px 0 #c0397a; white-space: nowrap; }
.체력틀 {
  flex: 1;
  height: 16px;
  background: rgba(0,0,0,0.3);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.5);
}
.체력 {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff5c7a, #ff9a5c, #ffd23c);
  border-radius: 999px;
  transition: width 0.1s linear;
}
.체력.위험 { animation: 깜빡 0.4s infinite alternate; }
@keyframes 깜빡 { from { filter: brightness(1); } to { filter: brightness(1.6); } }
.특기표시 { font-size: 14px; color: #fff; text-shadow: 1px 1px 0 #c0397a; white-space: nowrap; min-width: 90px; text-align: right; }

/* ---- 무대 ---- */
.무대 {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(120,30,70,0.45), 0 0 0 4px #fff;
  background: #8fd3ff;
}
#캔버스 { display: block; width: 100%; height: auto; }

/* 덮개 창 */
.덮개 {
  position: absolute;
  inset: 0;
  background: rgba(60, 20, 50, 0.72);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  overflow-y: auto;
}
.덮개[hidden] { display: none; }
.덮개 h2 { margin: 0 0 6px; font-size: 32px; text-shadow: 2px 2px 0 #c0397a; }
.덮개 p { margin: 4px 0; font-size: 15px; line-height: 1.45; }
.설명 { color: #ffe4f0; }
.키안내 { color: #ffd6e8; font-size: 13px; }
.끝점수줄 strong { font-size: 52px; color: #ffd23c; text-shadow: 2px 2px 0 #c0397a; }
.끝통계 { color: #ffe4f0; }
.끝최고 { color: #ffd23c; font-weight: bold; min-height: 22px; }
.끝버튼들 { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* 쿠키 고르기 */
.고르기머리 {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-top: 8px;
  font-weight: bold;
}
.고른이름 { color: #ffd23c; }
.쿠키고르기 {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 100%;
  padding: 8px 4px;
  scrollbar-width: thin;
}
.쿠키칩 {
  flex: 0 0 auto;
  width: 92px;
  border: 3px solid transparent;
  border-radius: 16px;
  background: rgba(255,255,255,0.92);
  color: #4a2a1a;
  padding: 6px 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: transform 0.12s;
  touch-action: manipulation;
}
.쿠키칩:hover { transform: translateY(-3px); }
.쿠키칩.골랐음 { border-color: #ffd23c; background: #fff3c4; transform: translateY(-4px) scale(1.05); }
.쿠키칩 canvas { display: block; width: 64px; height: 64px; margin: 0 auto 4px; }
.쿠키칩 .이름 { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.쿠키칩 .뱃지 { display: block; font-size: 10px; color: #9a4c6e; }
.쿠키특기 { color: #ffd23c; font-weight: bold; min-height: 20px; }

.큰버튼 {
  margin-top: 10px;
  font-size: 20px;
  font-weight: bold;
  padding: 12px 30px;
  border: none;
  border-radius: 999px;
  background: #ffd23c;
  color: #5a3b00;
  cursor: pointer;
  box-shadow: 0 5px 0 #d9a300;
}
.큰버튼.연한 { background: #fff; color: #c0397a; box-shadow: 0 5px 0 #e0b0c8; }
.큰버튼:active { transform: translateY(4px); box-shadow: none; }

/* ---- 조작 버튼 ---- */
.버튼줄 {
  display: flex;
  gap: 12px;
  margin: 14px auto 0;
  max-width: 960px;
}
.조작버튼 {
  flex: 1;
  font-size: 22px;
  font-weight: bold;
  padding: 20px 0;
  border: none;
  border-radius: 18px;
  background: rgba(255,255,255,0.92);
  color: #c0397a;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(120,30,70,0.35);
  touch-action: none;
}
.조작버튼.점프 { flex: 2; background: #ffd23c; color: #5a3b00; box-shadow: 0 6px 0 #d9a300; }
.조작버튼:active { transform: translateY(5px); box-shadow: none; }

@media (min-width: 800px) {
  .버튼줄 { display: none; }   /* 넓은 화면(키보드)에서는 버튼 숨김 */
}
@media (max-width: 600px) {
  .달리기머리 h1 { font-size: 20px; flex-basis: 100%; order: -1; }
  .점수칸 { flex: 1; min-width: 0; padding: 4px 6px; }
  .점수칸 strong { font-size: 16px; }
  .덮개 h2 { font-size: 22px; }
  .덮개 p { font-size: 12px; }
  .설명, .키안내 { display: none; }
  .쿠키칩 { width: 72px; }
  .쿠키칩 canvas { width: 48px; height: 48px; }
  .큰버튼 { font-size: 16px; padding: 9px 20px; }
}
