/* ── 마을(홈) ──────────────────────────── */

#village { gap: 10px; }

/* ── 진도 패널 ──────────────────────────
   비어 있던 위쪽을 "얼마나 왔나"로 채운다. 눌러서 달력으로. */
.panel {
  width: min(100%, 560px);
  margin: 6px auto 0;
  flex: none;
  font: inherit;
  text-align: left;
  background: var(--sheet-firm);
  border-radius: 24px;
  padding: 14px 16px 13px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 8px 20px -12px rgba(150, 80, 120, .5);
  transition: transform .08s ease;
}
.p-days, .p-wish {
  border: none; background: none; padding: 0; font: inherit; cursor: pointer;
  display: flex; text-align: left;
}
.p-days { flex-direction: column; align-items: stretch; gap: 8px; }
.p-days:active, .p-wish:active { transform: translateY(1px); }
.p-wish {
  align-items: center; gap: 8px; margin-top: 2px; padding-top: 9px;
  border-top: 1px solid rgba(74, 46, 66, .08);
}

.p-head { display: flex; align-items: baseline; justify-content: space-between; }
.p-month { font-size: 17px; font-weight: 800; color: var(--deep); }
.p-streak { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }

.p-week, .p-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.p-week i { font-style: normal; font-size: 10px; font-weight: 700; color: var(--ink-soft);
            text-align: center; opacity: .65; }
.p-week, .p-grid { gap: 5px; }
.p-grid i {
  aspect-ratio: 1; border-radius: 13px; background: rgba(74, 46, 66, .07);
  display: grid; place-items: center;
}
.p-grid i.today { box-shadow: inset 0 0 0 2.5px var(--pink); }
.p-grid i.done { background: rgba(255, 255, 255, .55); }
.p-grid i svg { width: 78%; height: 78%; display: block; }
.p-grid i b { font-size: 13px; font-weight: 700; color: var(--ink-soft); opacity: .6; }
.p-grid i.today b { color: var(--deep); opacity: 1; }

.p-ticket { width: 17px; height: 17px; fill: var(--pink); flex: none; }
.p-hearts { flex: 1; display: flex; align-items: center; gap: 4px; }
.p-hearts i { display: block; flex: 0 1 19px; height: 18px; }
.p-hearts svg { width: 100%; height: 100%; display: block; fill: rgba(74, 46, 66, .13); }
.p-hearts i.on svg { fill: url(#tkHeart); filter: drop-shadow(0 1px 1.5px rgba(214, 64, 112, .3)); }
.p-left { font-size: 12px; font-weight: 700; color: var(--ink-soft); white-space: nowrap;
          font-variant-numeric: tabular-nums; }
/* 아직 소원을 안 적었으면 숫자 대신 부르는 말이 된다 */
.p-left.is-call { color: var(--pink); }

/* 마을은 액자에 담긴 장면처럼 — 떠 있는 그림이 아니라 창 너머의 세계 */
.v-stage {
  position: relative;
  width: min(100%, 560px);
  aspect-ratio: 300 / 285;
  margin: 10px auto 0;
  flex: none;
  border-radius: 26px;
  overflow: hidden;
  box-shadow: 0 2px 0 rgba(255, 255, 255, .5) inset, 0 14px 30px -16px rgba(120, 70, 110, .55);
}

.v-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; flex: none; padding-top: 14px; }
.today { font-size: 15px; font-weight: 700; color: var(--ink-soft); }
#startBtn { width: min(100%, 320px); padding: 19px 0; font-size: 20px; }

.toast {
  position: absolute; left: 50%; top: 4px; transform: translate(-50%, -8px);
  background: var(--sheet-firm); color: var(--deep);
  font-size: 14px; padding: 9px 18px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 6px 16px -8px rgba(150, 80, 120, .5);
  opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ── 게임 ──────────────────────────────── */

#game { gap: 10px; }

.hud { display: flex; align-items: center; gap: 12px; flex: none; height: 34px; }
#hearts { display: flex; gap: 5px; }
#hearts svg { width: 26px; height: 26px; fill: #FF6B93; transition: opacity .3s, transform .3s; }
#hearts svg.is-lost { opacity: .22; transform: scale(.76); }

#progressCount {
  font-size: 14px; font-weight: 700; color: var(--ink-soft);
  font-variant-numeric: tabular-nums; min-width: 48px; text-align: right;
}

.timer { flex: 1; height: 12px; border-radius: 999px; background: rgba(255, 255, 255, .6); overflow: hidden; }
.timer i { display: block; height: 100%; width: 100%; border-radius: 999px; background: var(--pink); }
.timer i.is-warn { background: #FF9A3D; animation: pulse .9s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

.g-stage { position: relative; flex: 1; width: 100%; min-height: 0; display: grid; }
#game .buddy { grid-area: 1 / 1; width: 100%; }
#game .buddy svg { max-height: min(38vh, 320px); }

.speech {
  grid-area: 1 / 1; align-self: start; justify-self: center; margin-top: 2px;
  background: #fff; color: var(--deep); font-size: 17px; padding: 9px 18px;
  border-radius: 999px; box-shadow: 0 4px 0 rgba(222, 74, 133, .18);
  opacity: 0; transform: scale(.7); pointer-events: none; white-space: nowrap;
  transition: opacity .16s, transform .16s cubic-bezier(.3, 1.6, .5, 1);
}
.speech.is-on { opacity: 1; transform: scale(1); }

#question {
  flex: none; text-align: center; color: var(--deep);
  font-size: clamp(38px, 12vw, 62px); font-weight: 800; letter-spacing: .01em;
  padding-block: 4px 12px;
}

#choices { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  font: inherit; font-weight: 800; color: var(--deep);
  background: #fff; border: none; border-radius: var(--r-card);
  box-shadow: 0 4px 0 rgba(222, 74, 133, .16);
  padding: clamp(16px, 3.4vh, 26px) 0;
  font-size: clamp(26px, 7.5vw, 40px);
  cursor: pointer;
  transition: transform .07s ease, box-shadow .07s ease, background .2s, color .2s;
}
.choice:active { transform: translateY(4px); box-shadow: none; }
.choice:disabled { cursor: default; }
.choice.is-answer { background: #64C68A; color: #fff; box-shadow: 0 4px 0 #4AA36C; }
.choice.is-wrong { background: #FF8A9B; color: #fff; box-shadow: 0 4px 0 #DB6377; }

/* ── 결과 ──────────────────────────────── */

#result { align-items: center; justify-content: center; gap: 14px; text-align: center; }
#result .buddy { width: min(56vw, 230px); height: min(30vh, 250px); }
#resultTitle { font-size: clamp(26px, 7.5vw, 38px); }
#resultStars { display: flex; gap: 5px; font-size: 25px; line-height: 1; }
#resultStars i { font-style: normal; color: rgba(74, 46, 66, .16); }
#resultStars i.on { color: #FFC94D; text-shadow: 0 1px 0 #E0AE33; }
#resultStars:empty, #resultStamp:empty { display: none; }
#resultStamp svg { filter: drop-shadow(0 3px 4px rgba(150,80,120,.25)); }
#resultStamp svg { width: 58px; height: 58px; display: block; }
.stamp-pop { display: inline-block; animation: stamp .45s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes stamp {
  0% { transform: scale(2.2) rotate(-14deg); opacity: 0; }
  60% { transform: scale(.9) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
.score { display: flex; flex-direction: column; gap: 2px; }
.score b { font-size: 26px; font-weight: 800; color: var(--deep); font-variant-numeric: tabular-nums; }
.score span { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
#resultVillageBtn { width: min(100%, 300px); padding: 18px 0; font-size: 19px; }
.more { display: flex; gap: 8px; }
.more .btn { padding: 11px 18px; font-size: 14px; }

/* ── 서브 화면 공통 ─────────────────────── */

.sc-body { flex: 1; width: 100%; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.sc-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sc-empty { text-align: center; font-size: 15px; color: var(--ink-soft); padding: 40px 0; }
.sc-foot { text-align: center; font-size: 13px; font-weight: 700; color: var(--ink-soft); padding-top: 4px; }
.sc-cta { flex: none; display: flex; justify-content: center; padding-top: 8px; }
.sc-cta .btn { width: min(100%, 300px); padding: 17px 0; font-size: 18px; }

/* ── 달력 ──────────────────────────────── */

#calendar .sc-body { align-items: center; justify-content: flex-start; padding-top: 18px; }
.cal-week, .cal-grid { width: min(100%, 380px); display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-week { gap: 2px; font-size: 12px; color: var(--ink-soft); text-align: center; }
.cal-grid { gap: 4px; }

.cal-cell {
  aspect-ratio: 1; border-radius: 13px; background: rgba(255, 255, 255, .42);
  display: grid; place-items: center; position: relative;
}
.cal-cell.is-empty { background: none; }
.cal-cell.is-today { box-shadow: inset 0 0 0 2.5px var(--pink); }
.cal-num { font-size: 12px; color: var(--ink-soft); }
.cal-cell.is-done { background: var(--sheet-firm); }
.cal-cell.is-done .cal-num { position: absolute; top: 3px; left: 6px; font-size: 10px; opacity: .5; }
.cal-stamp { position: absolute; inset: 14% 12% 6%; }
.cal-stamp svg { width: 100%; height: 100%; display: block; }

/* ── 틀린 문제 ─────────────────────────── */

.rv-item { display: flex; flex-direction: column; margin-bottom: 8px; }
.rv-card {
  width: 100%; border: none; cursor: pointer; font: inherit; text-align: left;
  background: var(--sheet); border-radius: var(--r-card); padding: 15px 18px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.rv-card.is-open { border-radius: var(--r-card) var(--r-card) 0 0; }
.rv-q { font-size: 22px; font-weight: 800; color: var(--deep); }
.rv-count { font-size: 13px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }

.rv-table { background: rgba(255, 255, 255, .4); border-radius: 0 0 var(--r-card) var(--r-card); padding: 4px 18px 16px; }
.rv-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.rv-rows span { font-size: 15px; font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.rv-rows .is-here { color: var(--deep); font-weight: 800; }

/* ── 설정 ──────────────────────────────── */

.st-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--sheet); border-radius: var(--r-card); padding: 12px 16px; margin-bottom: 8px;
}
.st-text { display: flex; flex-direction: column; }
.st-label { font-size: 15px; font-weight: 800; }
.st-value { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.st-stepper { display: flex; gap: 6px; }
.st-stepper .ico { width: 36px; height: 36px; font-size: 19px; background: rgba(255, 255, 255, .9); }

.st-toggle {
  width: 52px; height: 31px; border-radius: 999px; border: none; cursor: pointer;
  background: rgba(74, 46, 66, .18); padding: 3px; display: flex; transition: background .2s;
}
.st-toggle i { width: 25px; height: 25px; border-radius: 50%; background: #fff; transition: transform .2s; }
.st-toggle.is-on { background: #64C68A; }
.st-toggle.is-on i { transform: translateX(21px); }

.st-select {
  font: inherit; font-size: 14px; font-weight: 700; color: var(--deep);
  background: #fff; border: none; border-radius: 12px; padding: 9px 12px; cursor: pointer;
}

.st-block {
  background: var(--sheet); border-radius: var(--r-card); padding: 15px 16px; margin-bottom: 8px;
  display: flex; flex-direction: column; gap: 9px;
}
.st-help { font-size: 13px; font-weight: 600; color: var(--ink-soft); line-height: 1.55; }
.st-name { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.st-name span { font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.st-name input {
  font: inherit; font-size: 15px; font-weight: 700; color: var(--ink); text-align: right;
  background: #fff; border: none; border-radius: 11px; padding: 9px 12px; width: 118px;
}
.st-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.st-buttons .btn { padding: 11px 16px; font-size: 14px; background: rgba(255, 255, 255, .9); }
.st-buttons .danger { color: #C0392B; }

.st-note {
  flex: none; text-align: center; font-size: 13.5px; font-weight: 700; color: #2E8B7E;
  background: var(--sheet-firm); padding: 11px 18px; border-radius: 999px; margin-top: 8px;
}
.st-note.is-bad { color: #C0392B; }


/* ── 소원권 화면 ────────────────────────── */

.wish-body {
  align-items: center; justify-content: center; gap: 14px;
}
#wishStage { width: 100%; display: grid; place-items: center; }
.wish-older { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.wish-cta { flex-direction: column; gap: 8px; align-items: center; }
.wish-cta .btn { width: min(100%, 300px); padding: 16px 0; font-size: 17px; }

/* 소원권이 7일마다 쌓이므로 넘겨볼 수 있게 한다 */
.wish-older { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.wish-tab {
  border: none; cursor: pointer; font: inherit;
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em;
  color: var(--ink-soft); background: rgba(255, 255, 255, .5);
  padding: 7px 11px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.wish-tab.is-on { color: var(--deep); background: var(--sheet-firm); box-shadow: 0 2px 0 rgba(222, 74, 133, .18); }
/* 아직 안 쓴 소원권이 있으면 탭에서 바로 보이게 */
.wish-tab.is-ready { color: var(--deep); box-shadow: inset 0 0 0 1.5px rgba(222, 74, 133, .3); }
.wish-tab.is-used { text-decoration: line-through; opacity: .6; box-shadow: none; }
