:root {
  /* 화면 크기 배율: 휴대폰 1, 태블릿에서 키움 (아래 태블릿 부분 참고) */
  --k: 1;
  --bg: #fbf8f2;
  --card: #f6f2ea;
  --tile: #f8f6f1;
  --line: #ebe4d6;
  --ink: #5e4f3c;
  --muted: #b3a58f;
  --accent: #5fb97f;
  --red: #9b4d4d;
  --gold: #c4a676;
  --orange: #e3a25a;
  --good-bg: #e3f3e6;
  --good: #3f8a55;
  --bad-bg: #f8e3df;
  --bad: #c0564a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Jua', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
  touch-action: manipulation;
}
button:disabled { cursor: default; }

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 16px 16px 40px;
}

/* ---------- 홈 ---------- */
.home-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
}
.home-top h1 { margin: 0; font-size: 34px; font-weight: 400; }
.sub { margin: 6px 0 24px; color: var(--muted); font-size: 20px; }

.level-label { margin-bottom: 8px; color: #8a7a62; font-size: 18px; }
.level-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 24px;
  padding: 6px;
  border-radius: 22px;
  background: var(--card);
}
.seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 4px;
  border-radius: 16px;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.seg.on { background: #fff; color: var(--ink); box-shadow: 0 2px 0 var(--line); }
.seg-name { font-size: 21px; }

/* ---------- 오늘의 학습 ---------- */
.daily-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  margin-bottom: 28px;
  padding: 20px;
  text-align: left;
  border: 3px solid var(--gold);
  border-radius: 28px;
  background: linear-gradient(160deg, #fff8e8, #fdf0d8);
  transition: transform .12s;
}
.daily-card:active { transform: scale(.98); }
.daily-card.finished { border-color: var(--accent); background: linear-gradient(160deg, #f1faf2, #e3f3e6); }
.daily-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.daily-tag { font-size: 26px; }
.daily-date { color: #8a7a62; font-size: 17px; }
.daily-games { display: flex; flex-wrap: wrap; gap: 8px; }
.daily-chip { padding: 6px 12px; border-radius: 999px; background: var(--c); font-size: 16px; }
.daily-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.daily-info { color: #8a7a62; font-size: 17px; }
.daily-streak { color: var(--orange); }
.daily-go {
  flex: none;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 19px;
}
.daily-card.finished .daily-go { background: var(--good); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wk {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
}
.wk.today { background: rgba(255, 255, 255, .7); color: var(--ink); }
.wk-mark { font-size: 18px; line-height: 1.2; }

.round-chip {
  align-self: center;
  width: fit-content;
  margin: 18px auto -14px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--c, var(--card));
  font-size: 18px;
}
.rgame { margin-left: 10px; font-size: 18px; }

.game-list { display: flex; flex-direction: column; gap: 14px; }
.game-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 18px;
  text-align: left;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 24px;
  transition: transform .12s;
}
.game-card:active { transform: scale(.97); }
.gc-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: var(--c);
  font-size: 38px;
}
.gc-body { flex: 1; min-width: 0; }
.gc-title { font-size: 24px; }
.gc-desc { margin-top: 2px; color: var(--muted); font-size: 17px; }
.gc-skill {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--card);
  font-size: 14px;
}
.gc-best { flex: none; color: var(--accent); font-size: 17px; }

.parent-note {
  margin-top: 28px;
  padding: 16px 18px;
  border-radius: 20px;
  background: var(--card);
  color: #8a7a62;
  font-size: 16px;
  line-height: 1.6;
}

.pill-btn {
  padding: 8px 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-size: 17px;
}

/* ---------- 게임 상단 ---------- */
.topbar { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  flex: none;
  width: 52px;
  height: 52px;
  border: 2px solid var(--line);
  border-radius: 16px;
  font-size: 24px;
  color: var(--muted);
}
.counter { flex: none; color: var(--muted); font-size: 24px; }
.bar { flex: 1; height: 14px; border-radius: 999px; background: #efe9df; overflow: hidden; }
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7aa7d9, var(--accent));
  transition: width .3s;
}
.score { flex: none; color: var(--accent); font-size: 26px; }

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding-top: 24px;
}

.prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 26px;
  text-align: center;
}
.speak-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--card);
  font-size: 20px;
}

.btn-main {
  width: 100%;
  max-width: 420px;
  padding: 22px;
  border: 3px solid var(--gold);
  border-radius: 30px;
  background: #faf6ee;
  color: #6b5435;
  font-size: 28px;
  transition: transform .12s, opacity .2s;
}
.btn-main:active:not(:disabled) { transform: scale(.97); }
.btn-main:disabled { opacity: .4; }
.btn-main.alt { border-color: var(--line); background: #fff; }

/* ---------- 모양 기억하기 ---------- */
.mgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 7px;
  border: 3px solid #d8cfc0;
  border-radius: 14px;
  background: #e7e0d4;
}
.mgrid.big { width: min(88vw, calc(360px * var(--k))); gap: 8px; padding: 9px; border-radius: 18px; }
.mgrid.mini { width: 120px; }
.mgrid.mid { width: min(44vw, calc(210px * var(--k))); gap: 6px; padding: 7px; border-radius: 16px; }
.mgrid.mid .mcell { border-radius: 8px; }
.mcell {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--tile);
  transition: background .15s, transform .1s;
}
.mgrid.big .mcell { border-radius: 10px; }
.mcell.on { background: var(--red); }
.mcell:active:not(:disabled) { transform: scale(.92); }

.timer { width: min(88vw, calc(360px * var(--k))); height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.timer-fill { width: 100%; height: 100%; background: var(--orange); }
.timer.run .timer-fill { animation: shrink linear forwards; }
@keyframes shrink { from { width: 100%; } to { width: 0; } }

/* ---------- 선 따라 긋기 ---------- */
.dl-board { display: block; background: #fff; border-radius: 16px; }
.dl-board.mid { width: min(43vw, calc(220px * var(--k))); }
.dl-board.mini { width: 130px; }
.dl-frame { fill: none; stroke: #3d3a36; stroke-width: 3; }
.dl-point { fill: #1f1d1b; }
.dl-board.drawable { touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.dl-dot .dl-point { transform-box: fill-box; transform-origin: center; transition: transform .12s, fill .12s; }
.dl-dot.sel .dl-point { fill: var(--orange); transform: scale(1.7); }
.dl-line { stroke-width: 7; stroke-linecap: round; }
.dl-line.orig { stroke: #c9534a; }
.dl-line.mine { stroke: #4f5b8a; }
path.dl-line { fill: none; stroke-linejoin: round; }
.dl-line.live { stroke: #4f5b8a; opacity: .65; }
.draw-tip { margin-top: -12px; color: var(--muted); font-size: 17px; text-align: center; }
.btn-row { display: flex; gap: 12px; width: 100%; max-width: 420px; }
.btn-row .btn-main { flex: 1; padding: 18px; font-size: 24px; }
.btn-row .btn-main.alt { flex: 0 0 42%; white-space: nowrap; font-size: 21px; }

/* ---------- 규칙 찾기 ---------- */
.pgroups { display: grid; grid-template-columns: repeat(2, auto); gap: 14px; justify-content: center; }
.pgroup {
  display: flex;
  gap: 8px;
  padding: 10px;
  border: 2px dashed #e6dcc8;
  border-radius: 20px;
}
.tile {
  display: grid;
  place-items: center;
  width: var(--t, 64px);
  height: var(--t, 64px);
  border: 2px solid #efebe3;
  border-radius: calc(var(--t, 64px) * .26);
  background: var(--tile);
  font-size: calc(var(--t, 64px) * .78);
  line-height: 1;
}
.tile.blank { border: 3px dashed #d9b07c; background: #fdf3e8; color: var(--orange); }
.tile.good { border: 3px solid var(--good); background: var(--good-bg); }
.tile.bad { border: 3px solid var(--bad); background: var(--bad-bg); }
.tile.pop { animation: pop .35s; }

.choice-label {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  margin-bottom: -12px;
  color: #8a7a62;
  font-size: 21px;
  white-space: nowrap;
}
.choice-label::before,
.choice-label::after { content: ''; flex: 1; border-top: 2px dashed var(--line); }

.choices { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.choice { --t: var(--choice-t, clamp(calc(80px * var(--k)), 24vw, calc(108px * var(--k)))); transition: transform .12s, opacity .2s; }
.choice.used { opacity: 0; pointer-events: none; }
.choice:active { transform: scale(.92); }
.choices .choice { animation: pop .3s backwards; }
.choices .choice:nth-child(2) { animation-delay: .06s; }
.choices .choice:nth-child(3) { animation-delay: .12s; }

/* ---------- 몇 개일까 ---------- */
.count-board {
  position: relative;
  width: min(88vw, 60vh, calc(420px * var(--k)));
  aspect-ratio: 4 / 3;
  border: 2px solid var(--line);
  border-radius: 26px;
  background: var(--card);
}
.count-item {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: clamp(calc(56px * var(--k)), 17vw, calc(80px * var(--k)));
  line-height: 1;
}
.count-item > span { display: block; animation: pop .35s backwards; }

.num-choices { display: flex; gap: 18px; justify-content: center; }
.num-btn {
  width: min(27vw, calc(100px * var(--k)));
  height: min(27vw, calc(100px * var(--k)));
  border: 3px solid var(--gold);
  border-radius: 28px;
  background: #faf6ee;
  font-size: min(14vw, calc(54px * var(--k)));
  transition: transform .12s;
}
.num-btn:active { transform: scale(.92); }
.num-btn.good { border-color: var(--good); background: var(--good-bg); }
.num-btn.bad { border-color: var(--bad); background: var(--bad-bg); }

/* ---------- 다른 하나 찾기 ---------- */
.ogrid { display: grid; gap: 12px; width: min(90vw, calc(420px * var(--k))); }
.otile {
  aspect-ratio: 1;
  border: 2px solid #efebe3;
  border-radius: 22%;
  background: var(--tile);
  line-height: 1;
  transition: transform .12s;
  animation: pop .3s backwards;
}
.otile:active { transform: scale(.92); }
.otile.good { border: 3px solid var(--good); background: var(--good-bg); }
.otile.bad { border: 3px solid var(--bad); background: var(--bad-bg); }
.ogrid.mini { width: 140px; gap: 5px; }
.ogrid.mini .otile { animation: none; border-radius: 10px; }

/* ---------- 짝 맞추기 ---------- */
.card-grid { display: grid; gap: 10px; width: min(90vw, calc(420px * var(--k))); }
.card {
  position: relative;
  aspect-ratio: 1;
  border: 2px solid #c9b6e3;
  border-radius: 18px;
  background: linear-gradient(135deg, #d9c9ee, #bfa9dd);
  line-height: 1;
  transition: background .2s, transform .12s;
}
.card::before {
  content: '★';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: .6em;
  opacity: .7;
}
.card > span { display: block; opacity: 0; transform: scale(.3); transition: opacity .2s, transform .2s; }
.card.open { border-color: #efebe3; background: var(--tile); }
.card.open::before { opacity: 0; }
.card.open > span { opacity: 1; transform: none; }
.card.matched { border: 3px solid var(--good); background: var(--good-bg); }
.card:active:not(.open) { transform: scale(.94); }

/* ---------- 그림자 찾기 ---------- */
.shadow { display: block; filter: brightness(0); opacity: .78; }
.shadow-target { --t: clamp(calc(150px * var(--k)), 46vw, calc(200px * var(--k))); background: #fff; animation: pop .35s; }

/* ---------- 순서 맞추기 ---------- */
.order-slots { display: flex; gap: 10px; justify-content: center; }
.order-slots .slot { font-size: calc(var(--t) * .36); }
.order-slots .slot.filled { font-size: calc(var(--t) * .78); border-color: var(--gold); }
.order-face { display: block; line-height: 1; }
.order-review { display: flex; flex-direction: column; gap: 14px; }

/* ---------- 피드백 ---------- */
.feedback {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(251, 248, 242, .55);
  backdrop-filter: blur(2px);
  pointer-events: all;
}
.fb-icon { font-size: 120px; line-height: 1; animation: pop .4s; }
.fb-text { font-size: 34px; animation: pop .4s .05s backwards; }
.feedback.good .fb-text { color: var(--good); }
.feedback.bad .fb-text { color: var(--orange); }
.feedback.pass .fb-text { color: var(--muted); }

@keyframes pop {
  0% { transform: scale(.4); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

/* ---------- 결과 ---------- */
.result-hero {
  margin-top: 16px;
  padding: 28px 20px;
  border-radius: 30px;
  background: #fff;
  border: 2px solid var(--line);
  text-align: center;
}
.result-level { margin-bottom: 10px; color: var(--muted); font-size: 18px; }
.stars { display: flex; justify-content: center; gap: 8px; font-size: 54px; }
.star { animation: pop .4s backwards; }
.star:nth-child(2) { animation-delay: .15s; }
.star:nth-child(3) { animation-delay: .3s; }
.star.off { filter: grayscale(1); opacity: .25; }
.result-title { margin: 14px 0 4px; font-size: 32px; }
.result-score { color: var(--accent); font-size: 26px; }
.result-actions { display: flex; gap: 12px; margin-top: 22px; }
.result-actions .btn-main { padding: 16px; font-size: 22px; }

.records { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.rcard {
  padding: 18px 20px 24px;
  border: 2px solid var(--line);
  border-radius: 28px;
  background: var(--card);
}
.rcard-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.rnum { color: #8a7a62; font-size: 26px; }
.badge { padding: 6px 16px; border-radius: 999px; font-size: 20px; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.pass { background: #ece8e1; color: var(--muted); }

.compare { display: flex; justify-content: center; gap: 28px; }
.compare-col { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #8a7a62; font-size: 20px; }
.review-note { margin-top: 12px; text-align: center; color: #8a7a62; font-size: 19px; }
.review-items { text-align: center; font-size: 30px; letter-spacing: 2px; word-break: break-all; }
.review-center { display: flex; justify-content: center; }

/* ---------- 틀렸을 때 다시 해 보기 ---------- */
/* .choices .choice의 등장 애니메이션보다 뒤에 두어서 덮어씀 */
.stage .hint {
  position: relative;
  z-index: 1;
  border-color: var(--orange);
  animation: hint-pulse 1s ease-in-out infinite;
}
.stage .mcell.hint {
  background: #fde9cf;
  outline: 4px dashed var(--orange);
  outline-offset: -4px;
  animation: hint-blink 1s ease-in-out infinite;
}
.stage .tried { opacity: .3; }
@keyframes hint-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 4px rgba(227, 162, 90, .9); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 12px rgba(227, 162, 90, .3); }
}
@keyframes hint-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}
.dl-line.hint { stroke: var(--orange); stroke-dasharray: 4 14; opacity: .9; animation: hint-blink 1s ease-in-out infinite; }
.badge.retry { background: #fdeccf; color: #b7792f; }

/* ---------- 이름 듣고 찾기 · 기분 알기 ---------- */
.review-word { max-width: 150px; text-align: center; color: var(--ink); font-size: 22px; line-height: 1.4; }
.situation {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(88vw, calc(380px * var(--k)));
  padding: 18px 16px;
  border: 2px solid var(--line);
  border-radius: 26px;
  background: #fff;
  animation: pop .35s;
}
.situation-icon { font-size: clamp(calc(90px * var(--k)), 30vw, calc(130px * var(--k))); line-height: 1; }
.situation-text { font-size: 26px; text-align: center; line-height: 1.4; }

/* ---------- 시각 일정표 (오늘의 학습) ---------- */
.schedule {
  width: 100%;
  max-width: 440px;
  padding: 18px 16px;
  border: 2px solid var(--line);
  border-radius: 28px;
  background: #fff;
}
.schedule-title { margin-bottom: 12px; text-align: center; font-size: 26px; }
.schedule-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.schedule-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 3px solid transparent;
  border-radius: 22px;
  background: var(--card);
  transition: opacity .2s;
}
.schedule-item.now { border-color: var(--orange); background: var(--c); animation: pop .4s; }
.schedule-item.done { opacity: .45; }
.schedule-item.later { opacity: .8; }
.schedule-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  font-size: 20px;
}
.schedule-item.done .schedule-num { background: var(--good); color: #fff; }
.schedule-item.now .schedule-num { background: var(--orange); color: #fff; }
.schedule-icon { flex: none; font-size: 46px; line-height: 1; }
.schedule-name { flex: 1; display: flex; flex-direction: column; font-size: 22px; }
.schedule-name small { color: #8a7a62; font-size: 15px; }
.schedule-state { flex: none; color: #8a7a62; font-size: 16px; }
.schedule-item.now .schedule-state { color: var(--ink); }

.schedule-strip { display: flex; justify-content: center; gap: 8px; margin: 14px 0 -10px; }
.strip-step {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  min-width: 40px;
  padding: 0 10px;
  justify-content: center;
  border-radius: 999px;
  background: var(--card);
  font-size: 22px;
}
.strip-step.now { border: 2px solid var(--orange); background: var(--c); }
.strip-step.done { background: var(--good-bg); color: var(--good); font-size: 18px; }
.strip-step.later { opacity: .55; }
.strip-name { font-size: 16px; }

/* ---------- 생활 순서: 그림 아래 글자 ---------- */
.tile.captioned { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.tile.captioned .order-face { font-size: calc(var(--t) * .5); }
.order-caption { color: var(--ink); font-size: clamp(calc(12px * var(--k)), 3.6vw, calc(15px * var(--k))); line-height: 1.15; white-space: nowrap; }

/* ---------- 아래 메뉴 (오늘 / 놀이 / 기록 / 설정) ---------- */
.screen.home { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.tab-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  max-width: 560px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  border-top: 2px solid var(--line);
  background: rgba(255, 255, 255, .96);
  transform: translateX(-50%);
}
.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  border-radius: 16px;
  color: var(--muted);
  font-size: 16px;
}
.tab-icon { font-size: 26px; line-height: 1; filter: grayscale(.7); opacity: .7; }
.tab-btn.on { background: var(--card); color: var(--ink); }
.tab-btn.on .tab-icon { filter: none; opacity: 1; }

.more-games {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 18px 20px;
  border: 2px solid var(--line);
  border-radius: 22px;
  background: #fff;
  font-size: 21px;
}

/* ---------- 놀이 탭: 영역 ---------- */
.cat-tabs {
  display: flex;
  gap: 8px;
  margin: 0 -16px 18px;
  padding: 0 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex: none;
  padding: 10px 16px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #8a7a62;
  font-size: 18px;
}
.cat-tab.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.cat-section { margin-bottom: 26px; }
.cat-title { margin: 0; font-size: 24px; font-weight: 400; }
.cat-desc { margin: 2px 0 12px; color: var(--muted); font-size: 17px; }

/* ---------- 기록 · 설정 ---------- */
.panel {
  margin-bottom: 18px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 24px;
  background: #fff;
}
.panel-title { margin: 0 0 12px; font-size: 21px; font-weight: 400; }
.rec-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.rec-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--card);
  font-size: 18px;
}
.rec-list li > span:first-child { flex: 1; }
.rec-meta { color: #8a7a62; font-size: 15px; }
.rec-list b { font-weight: 400; color: var(--accent); }
.empty { margin: 0; color: var(--muted); font-size: 17px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.setting-name { margin-bottom: 8px; font-size: 20px; }
.setting-row .setting-name { margin-bottom: 0; }
.setting-desc { color: var(--muted); font-size: 15px; }
.switch {
  flex: none;
  min-width: 72px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--line);
  color: #8a7a62;
  font-size: 18px;
}
.switch.on { background: var(--accent); color: #fff; }
.guide-list { margin: 0; padding-left: 20px; color: #6f604b; font-size: 17px; line-height: 1.6; }
.guide-list li + li { margin-top: 6px; }

/* ---------- 기록 자세히 ---------- */
/* 결과 색: 처음에 맞힘 / 다시 해서 맞음 / 패스 (색약 구분 검사 통과, 숫자·범례 글자를 함께 표시) */
:root { --o-first: #3f8f5a; --o-retry: #e0913a; --o-pass: #8c8577; }
.range-seg { grid-template-columns: repeat(2, 1fr); }
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 6px;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: #fff;
}
.stat-tile b { font-weight: 400; font-size: 28px; color: var(--ink); }
.stat-tile span { color: #8a7a62; font-size: 15px; }

.alerts { display: flex; flex-direction: column; gap: 10px; }
.alert { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; }
.alert.hard { background: #fdf1e2; }
.alert.good { background: var(--good-bg); }
.alert-icon { flex: none; font-size: 30px; }
.alert-body { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 15px; color: #6f604b; }
.alert-body b { font-weight: 400; font-size: 19px; color: var(--ink); }
.alert-btn { flex: none; padding: 10px 14px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 16px; }

.obar-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 12px; color: #6f604b; font-size: 15px; }
.obar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.swatch.first, .obar-seg.first { background: var(--o-first); }
.swatch.retry, .obar-seg.retry { background: var(--o-retry); }
.swatch.pass, .obar-seg.pass { background: var(--o-pass); }
.obar-list { display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 0; list-style: none; }
.obar-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 18px; }
.obar-num { flex: none; color: #6f604b; font-size: 15px; }
.obar { display: flex; gap: 2px; height: 16px; border-radius: 4px; overflow: hidden; background: var(--card); }
.obar-seg { min-width: 6px; }
.obar-detail { margin-top: 4px; color: var(--muted); font-size: 13px; }
.not-played { margin: 14px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; }

.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head { text-align: center; color: var(--muted); font-size: 14px; }
.cal-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--card);
  color: #8a7a62;
  font-size: 14px;
}
.cal-cell.blank { background: none; }
.cal-cell.played { background: var(--good-bg); color: var(--good); }
.cal-cell.today { outline: 2px solid var(--ink); outline-offset: -2px; }
.cal-mark { font-size: 13px; line-height: 1; }
.cal-legend { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- 소개 · 사용 방법 ---------- */
.panel .more-games + .more-games { margin-top: 10px; }
.guide-top { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; }
.guide-top h1 { margin: 0; font-size: 26px; font-weight: 400; }
.guide .range-seg { margin-bottom: 18px; }
.guide .btn-main { display: block; margin: 8px auto 24px; }
.guide-hero {
  margin-bottom: 18px;
  padding: 24px 20px;
  border-radius: 28px;
  background: linear-gradient(160deg, #fff8e8, #e9f5ec);
  text-align: center;
}
.guide-hero-icon { font-size: 56px; line-height: 1; }
.guide-hero h2 { margin: 10px 0 8px; font-size: 26px; font-weight: 400; }
.guide-hero p { margin: 0; color: #6f604b; font-size: 18px; line-height: 1.65; }
.feature-list, .step-list { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; list-style: none; }
.feature-list li, .step-list li { display: flex; align-items: flex-start; gap: 12px; }
.feature-list li > div, .step-list li > div { display: flex; flex-direction: column; gap: 2px; }
.feature-list b, .step-list b { font-weight: 400; font-size: 19px; color: var(--ink); }
.feature-list span:not(.feature-icon), .step-list li > div span { color: #6f604b; font-size: 16px; line-height: 1.55; }
.feature-icon { flex: none; width: 36px; font-size: 28px; line-height: 1.2; text-align: center; }
.step-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 16px;
}
.guide-cat + .guide-cat { margin-top: 14px; }
.guide-cat-name { display: flex; flex-direction: column; font-size: 19px; }
.guide-cat-name small { color: var(--muted); font-size: 15px; }
.guide-cat-games { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.guide-cat-games span { padding: 5px 11px; border-radius: 999px; background: var(--c); font-size: 15px; }
.note-panel { background: #fffaf1; }
.guide-p { margin: 0 0 8px; color: #6f604b; font-size: 16px; }

/* ---------- 오늘 탭: 놀이 예시 ---------- */
.pick-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.pick-head h2 { margin: 0; font-size: 22px; font-weight: 400; }
.pick-all { padding: 6px 4px; color: #8a7a62; font-size: 17px; }
.pick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pick-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 22px;
  background: #fff;
  text-align: left;
  transition: transform .12s;
}
.pick-card:active { transform: scale(.97); }
.pick-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
  border-radius: 18px;
  background: var(--c);
  font-size: 34px;
}
.pick-card b { font-weight: 400; font-size: 19px; color: var(--ink); }
.pick-card span:last-child { color: #8a7a62; font-size: 14px; line-height: 1.4; }

/* ---------- 로고 (쑥쑥이) ---------- */
.home-top h1.logo { flex: 1; min-width: 0; margin: 0; line-height: 0; }
.logo svg { display: block; width: 100%; max-width: 250px; height: auto; }

/* ---------- 쑥쑥이 캐릭터 ---------- */
.mascot { display: inline-block; width: 64px; height: 64px; flex: none; }
.mascot svg { display: block; width: 100%; height: 100%; }
.mascot.bounce { animation: mascot-bounce .6s ease-out; }
@keyframes mascot-bounce {
  0% { transform: translateY(18px) scale(.6); opacity: 0; }
  55% { transform: translateY(-12px) scale(1.05); opacity: 1; }
  80% { transform: translateY(2px) scale(.98); }
  100% { transform: none; }
}
.feedback .fb-icon { animation: none; }
.feedback .mascot { width: calc(150px * var(--k)); height: calc(150px * var(--k)); }
.schedule-title { display: flex; align-items: center; justify-content: center; gap: 10px; }
.schedule-title .mascot { width: 60px; height: 60px; }
.bubble {
  position: relative;
  padding: 8px 14px;
  border-radius: 16px;
  background: var(--card);
  font-size: 21px;
}
.bubble::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  border: 8px solid transparent;
  border-right-color: var(--card);
  border-left: 0;
  transform: translateY(-50%);
}
.result-mascot { display: flex; justify-content: center; margin-bottom: 4px; }
.result-mascot .mascot { width: 110px; height: 110px; }
@media (prefers-reduced-motion: reduce) {
  .mascot.bounce { animation: none; }
}

.sound-test { margin-bottom: 8px; }
.sound-test:disabled { opacity: .45; }
.sound-help { margin: 0 0 16px; line-height: 1.5; }

/* ---------- 태블릿: 여백 줄이고 크게 ---------- */
@media (min-width: 700px) {
  :root { --k: 1.25; }
  #app { max-width: 920px; padding: 24px 32px 40px; }
  .tab-bar { max-width: 920px; }
  .tab-btn { font-size: 18px; }
  .tab-icon { font-size: 30px; }
  .home-top h1 { font-size: 40px; }
  .logo svg { max-width: 320px; }
  .sub { font-size: 22px; }
  .game-list { display: grid; grid-template-columns: repeat(2, 1fr); }
  .pick-grid { grid-template-columns: repeat(4, 1fr); }
  .stage { gap: 26px; padding-top: 28px; }
  .prompt { font-size: 32px; }
  .speak-btn { width: 52px; height: 52px; font-size: 24px; }
  .choice-label { max-width: 620px; font-size: 24px; }
  .choices { gap: 16px; }
  .btn-main, .btn-row { max-width: 560px; }
  .compare { gap: 40px; }
  .fb-text { font-size: 42px; }
  .records { display: grid; grid-template-columns: repeat(2, 1fr); }
}
/* 세로로 긴 태블릿(세로 모드)은 더 크게 */
@media (min-width: 700px) and (min-height: 860px) {
  :root { --k: 1.45; }
}

/* ---------- 어디에 있을까? (공간 개념) ---------- */
.space-scene { width: min(90vw, 52vh, calc(400px * var(--k))); max-width: 100%; padding: 8px; border: 2px solid var(--line); border-radius: 26px; background: #fff; animation: pop .35s; }
.space-scene svg { display: block; width: 100%; height: auto; }
.space-scene.mini { width: 180px; padding: 4px; border-radius: 16px; animation: none; }
.space-review { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tile.choice.place { font-size: calc(var(--t) * .26); }
.place-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; line-height: 1; }
.place-btn b { font-weight: 400; font-size: 1.9em; }

/* ---------- 실사 사진 ---------- */
img.photo { display: block; object-fit: cover; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.tile img.photo { width: 86%; height: 86%; border-radius: 18%; }
.shadow-target img.photo { width: 90%; height: 90%; }
.count-item img.photo { width: 1.15em; height: 1.15em; border-radius: 22%; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.review-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.review-items img.photo { width: 30px; height: 30px; border-radius: 8px; }
.card > span:has(img.photo) { display: grid; place-items: center; width: 100%; height: 100%; }
.card img.photo { width: 84%; height: 84%; border-radius: 16%; }
.otile { display: grid; place-items: center; }
.otile img.photo { width: 84%; height: 84%; border-radius: 18%; }
.order-face img.photo { width: calc(var(--t) * .8); height: calc(var(--t) * .8); border-radius: 18%; }
.answer-note { display: flex; align-items: center; justify-content: center; gap: 6px; }
.answer-note img.photo { width: 36px; height: 36px; border-radius: 8px; }

/* ---------- 세로가 짧은 휴대폰 (아이폰 SE 등): 간격을 줄여 한 화면에 들어오게 ---------- */
@media (max-height: 700px) {
  .stage { gap: 14px; padding-top: 14px; }
  .prompt { font-size: 22px; }
  .speak-btn { width: 36px; height: 36px; font-size: 18px; }
  .choice-label { margin-bottom: -6px; font-size: 18px; }
  .round-chip { margin: 10px auto -8px; font-size: 16px; }
  .schedule-strip { margin: 10px 0 -6px; }
  .schedule { padding: 12px; }
  .schedule-title { font-size: 21px; }
  .schedule-title .mascot { width: 46px; height: 46px; }
  .bubble { font-size: 18px; padding: 6px 12px; }
  .schedule-list { gap: 6px; }
  .schedule-item { padding: 6px 12px; }
  .schedule-icon { font-size: 34px; }
  .schedule-name { font-size: 19px; }
  .stage > .btn-main { padding: 14px; font-size: 24px; }
}
@media (max-height: 600px) {
  .stage { gap: 10px; padding-top: 8px; }
  .space-scene { width: min(90vw, 46vh); }
  .pgroups { --t: min(30vw, 15vh) !important; }
  .choices .choice { --t: min(var(--choice-t, 80px), 14vh); }
}

/* ---------- 폭이 아주 좁은 휴대폰 (320px 대) ---------- */
@media (max-width: 360px) {
  .daily-top { flex-wrap: wrap; row-gap: 2px; }
  .daily-tag { font-size: 22px; }
  .daily-date { font-size: 15px; }
  .schedule-state { display: none; }
  .schedule-item.now { box-shadow: 0 0 0 2px var(--orange); }
  .strip-step { padding: 0 8px; gap: 4px; font-size: 19px; }
  .strip-name { font-size: 13px; white-space: nowrap; }
  .home-top h1.logo .logo svg, .logo svg { max-width: 200px; }
}

/* ---------- 설정: 목소리 ---------- */
.voice-box { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 2px dashed var(--line); }
.voice-box .setting-name { margin-bottom: 0; }
.voice-select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
}
.voice-label { margin-top: 4px; }
.voice-seg { margin-bottom: 4px; }
.voice-seg .seg { padding: 10px 4px; }
.voice-seg .seg-name { font-size: 18px; }
.voice-box .more-games:disabled { opacity: .45; }
