/* ===== 똑똑 여우 학습놀이 — 7살용 인터랙티브 스타일 ===== */
:root {
  --yellow: #ffb703;
  --orange: #fb8500;
  --blue: #4cc9f0;
  --green: #80ed99;
  --green-d: #38b000;
  --pink: #ff70a6;
  --purple: #9b5de5;
  --red: #ef476f;
  --cream: #fff8e7;
  --ink: #3a2e2e;
  --shadow: 0 6px 0 rgba(0,0,0,.12), 0 10px 20px rgba(0,0,0,.12);
  font-family: 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(circle at 20% 10%, #fff3c4 0, var(--cream) 45%) fixed;
  color: var(--ink);
  overflow-x: hidden;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}
.hidden { display: none !important; }

/* ---------- 상단바 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; gap: 10px;
  background: linear-gradient(180deg, #fff, #fff8e7);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.icon-btn {
  border: none; background: #fff; border-radius: 50%;
  width: 48px; height: 48px; font-size: 24px; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .1s;
}
.icon-btn:active { transform: scale(.9); }
.stars-count {
  font-size: 22px; font-weight: 800; color: var(--orange);
  background: #fff; padding: 6px 16px; border-radius: 30px; box-shadow: var(--shadow);
}

/* ---------- 무대 ---------- */
.stage {
  max-width: 720px; margin: 0 auto; padding: 16px 18px 40px;
  min-height: 100dvh; display: flex; flex-direction: column;
}

/* ---------- 홈 화면 ---------- */
.home-title {
  text-align: center; margin: 18px 0 8px;
  font-size: clamp(28px, 8vw, 44px); font-weight: 900; color: var(--orange);
  text-shadow: 2px 2px 0 #fff, 4px 4px 0 rgba(251,133,0,.2);
}
.home-fox { font-size: clamp(70px, 22vw, 120px); text-align: center; animation: float 3s ease-in-out infinite; }
.home-sub { text-align: center; font-size: 18px; color: var(--ink); opacity: .7; margin-bottom: 20px; }

.subject-grid { display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 10px; }
@media (min-width: 520px) { .subject-grid { grid-template-columns: 1fr 1fr 1fr; } }

.subject-card {
  border: none; border-radius: 28px; padding: 26px 18px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: #fff; font-weight: 900; box-shadow: var(--shadow);
  transition: transform .12s; position: relative; overflow: hidden;
}
.subject-card:active { transform: scale(.95) translateY(2px); }
.subject-card .emoji { font-size: 64px; animation: wiggle 2.5s ease-in-out infinite; }
.subject-card .name { font-size: 30px; }
.subject-card .desc { font-size: 15px; font-weight: 600; opacity: .95; }
.card-korean { background: linear-gradient(160deg, #ff70a6, #ff9770); }
.card-hanja  { background: linear-gradient(160deg, #9b5de5, #5e60ce); }
.card-math   { background: linear-gradient(160deg, #4cc9f0, #38b000); }

/* ---------- 활동 선택 메뉴 ---------- */
.menu-head { text-align: center; margin: 6px 0 18px; }
.menu-head .big { font-size: 34px; font-weight: 900; }
.activity-list { display: grid; gap: 14px; }
.activity-btn {
  border: none; border-radius: 22px; background: #fff; cursor: pointer;
  padding: 18px 20px; display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow); transition: transform .1s;
  font-size: 22px; font-weight: 800; color: var(--ink); text-align: left;
}
.activity-btn:active { transform: scale(.97); }
.activity-btn .a-emoji { font-size: 38px; }
.activity-btn .a-meta { display: flex; flex-direction: column; }
.activity-btn .a-sub { font-size: 14px; font-weight: 600; opacity: .6; }
.activity-btn .a-go { margin-left: auto; font-size: 28px; color: var(--orange); }

/* ---------- 퀴즈 화면 ---------- */
.quiz-wrap { flex: 1; display: flex; flex-direction: column; }
.progress-bar { height: 14px; background: #fff; border-radius: 20px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(0,0,0,.08); margin-bottom: 18px; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--green-d)); border-radius: 20px; transition: width .4s; }

.question-card {
  background: #fff; border-radius: 28px; padding: 26px 20px; text-align: center;
  box-shadow: var(--shadow); margin-bottom: 22px;
}
.q-prompt { font-size: 22px; font-weight: 800; margin-bottom: 12px; color: var(--ink); }
.q-big {
  font-size: clamp(56px, 18vw, 96px); font-weight: 900; line-height: 1.1;
  margin: 10px 0; letter-spacing: 2px;
}
.q-emoji-row { font-size: clamp(34px, 9vw, 52px); line-height: 1.4; word-break: break-all; }
.q-speak { margin-top: 8px; background: var(--blue); color: #fff; border: none; border-radius: 30px; padding: 10px 22px; font-size: 18px; font-weight: 800; cursor: pointer; box-shadow: var(--shadow); }
.q-speak:active { transform: scale(.94); }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choice-btn {
  border: none; border-radius: 22px; background: #fff; cursor: pointer;
  padding: 22px 12px; font-size: 38px; font-weight: 900; color: var(--ink);
  box-shadow: var(--shadow); transition: transform .1s, background .2s;
  min-height: 90px;
}
.choice-btn:active { transform: scale(.95); }
.choice-btn.correct { background: var(--green); color: #fff; animation: pop .4s; }
.choice-btn.wrong { background: var(--red); color: #fff; animation: shake .4s; }
.choice-btn:disabled { cursor: default; }

/* ---------- 따라쓰기 (canvas) ---------- */
.trace-stage { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.trace-box { position: relative; background: #fff; border-radius: 28px; box-shadow: var(--shadow); touch-action: none; }
.trace-guide { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 200px; font-weight: 900; color: #ececec; pointer-events: none; }
.trace-canvas { position: relative; display: block; border-radius: 28px; }
.trace-tools { display: flex; gap: 12px; }
.tool-btn { border: none; border-radius: 20px; padding: 12px 22px; font-size: 18px; font-weight: 800; cursor: pointer; box-shadow: var(--shadow); color: #fff; }
.tool-clear { background: var(--orange); }
.tool-next { background: var(--green-d); }

/* ---------- 카드 매칭 ---------- */
.match-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 480px){ .match-grid { grid-template-columns: repeat(3, 1fr); } }
.match-card { aspect-ratio: 3/4; border-radius: 18px; border: none; cursor: pointer;
  background: linear-gradient(160deg, var(--purple), #5e60ce); color: #fff;
  font-size: 34px; font-weight: 900; box-shadow: var(--shadow); transition: transform .15s; }
.match-card:active { transform: scale(.95); }
.match-card.flipped { background: #fff; color: var(--ink); }
.match-card.done { background: var(--green); color: #fff; opacity: .85; }

/* ---------- 결과 화면 ---------- */
.result-screen { text-align: center; padding-top: 30px; }
.result-fox { font-size: 110px; animation: bounce 1s infinite; }
.result-title { font-size: 38px; font-weight: 900; color: var(--orange); margin: 8px 0; }
.result-stars { font-size: 50px; letter-spacing: 6px; margin: 10px 0; }
.result-msg { font-size: 20px; opacity: .8; margin-bottom: 24px; }
.big-btn {
  border: none; border-radius: 26px; padding: 18px 30px; font-size: 22px; font-weight: 900;
  color: #fff; background: linear-gradient(160deg, var(--green), var(--green-d));
  box-shadow: var(--shadow); cursor: pointer; margin: 8px; transition: transform .1s;
}
.big-btn:active { transform: scale(.95); }
.big-btn.alt { background: linear-gradient(160deg, var(--blue), #3a86ff); }

/* 스티커 모음 */
.sticker-shelf { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.sticker { font-size: 34px; animation: pop .4s; }

/* ---------- 여우 마스코트 말풍선 ---------- */
.mascot { position: fixed; bottom: 16px; right: 16px; z-index: 40; display: flex; align-items: flex-end; gap: 6px; pointer-events: none; }
.mascot-fox { font-size: 56px; animation: bounce 1s; }
.mascot-bubble {
  background: #fff; border-radius: 20px; padding: 12px 16px; font-size: 18px; font-weight: 800;
  box-shadow: var(--shadow); max-width: 200px; position: relative;
}
.mascot-bubble::after { content: ''; position: absolute; right: -8px; bottom: 16px; border: 8px solid transparent; border-left-color: #fff; }

/* ---------- 색종이 ---------- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* ---------- 애니메이션 ---------- */
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-16px)} }
@keyframes wiggle { 0%,100%{transform:rotate(-6deg)} 50%{transform:rotate(6deg)} }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-18px)} }
@keyframes pop { 0%{transform:scale(.6)} 60%{transform:scale(1.15)} 100%{transform:scale(1)} }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(6px)} }
@keyframes slidein { from{opacity:0; transform:translateY(20px)} to{opacity:1; transform:translateY(0)} }
.screen-in { animation: slidein .35s ease-out; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
