/*
VOICE  : 아이 놀이책. 굵은 갈색 테두리 + 색종이 + 크레파스.
IDEA   : 딸내미 책상 위 색종이 놀이 — 버튼·그림이 테두리 굵은 종이 스티커처럼 붙어 있음.
PICTURE: 찾기 화면은 두 장의 종이 그림이 화면을 꽉 채움. 처음 화면은 색종이 카드 3장.
COLOUR : 따뜻한 종이색 바탕, 잉크 갈색, 색종이(노랑·주황·민트·연보라·분홍).
TYPE   : 주아(Jua) 하나, 크게.
*/
@font-face {
  font-family: 'Jua';
  src: url('../fonts/jua-sub.woff2') format('woff2');
  font-display: swap;
}
:root {
  --bg: #fff6e5;
  --ink: #3b2a20;
  --sub: #8a6a52;
  --paper: #fffdf8;
  --yellow: #ffd54a;
  --orange: #ff9a3c;
  --mint: #5fd0b0;
  --lilac: #a98bff;
  --pink: #ff7aa2;
  --green: #45c46a;
  --b: clamp(46px, 4.6vmin + 22px, 66px);
  --bw: 3px;
  --sh: 0 4px 0 var(--ink);
  --gap: clamp(8px, 1.6vmin, 14px);
  /* 알파벳은 교재·시험지와 같은 반듯한 인쇄체로 (a·g 모양 포함) */
  --abc-font: 'Avenir Next', 'Helvetica Neue', Arial, 'Roboto', sans-serif;
  font-family: 'Jua', 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; min-width: 0; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  background-image: radial-gradient(rgba(59, 42, 32, .07) 1.5px, transparent 1.7px);
  background-size: 22px 22px;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
svg.i { width: 62%; height: 62%; flex: none; }

.screen {
  position: fixed;
  inset: 0;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* 종이 스티커 버튼 */
.btn {
  background: var(--paper);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .08s, box-shadow .08s;
}
.btn:active, .tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.sq { width: var(--b); height: var(--b); flex: none; border-radius: 16px; }
.btn.sq.big { --b: clamp(66px, 11vmin, 90px); border-radius: 22px; }
.btn.chip { height: 48px; padding: 0 16px 0 10px; border-radius: 999px; gap: 6px; font-size: 19px; white-space: nowrap; }
.btn.chip svg.i { width: 32px; height: 32px; }
.btn.ok { background: var(--green); color: #fff; }
.btn.on { background: var(--yellow); transform: translateY(-3px); box-shadow: 0 7px 0 var(--ink); }
.btn:disabled { opacity: .4; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- 처음 화면 ---------- */
#home { justify-content: center; }
.home-top { position: absolute; top: max(12px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right)); display: flex; justify-content: space-between; align-items: center; z-index: 1; }
.home-top .btn.sq { --b: 50px; }
.hero { display: flex; flex-direction: column; align-items: center; gap: clamp(18px, 4vmin, 40px); }
.logo { text-align: center; display: flex; flex-direction: column; align-items: center; }
.logo h1 { margin: 0; font-weight: 400; font-size: clamp(54px, 11vmin, 96px); line-height: 1; letter-spacing: -1px; color: var(--ink); text-shadow: 0 5px 0 var(--yellow); }
.tape {
  position: relative;
  z-index: 1;
  margin-bottom: -6px;
  transform: rotate(-4deg);
  background: var(--pink);
  color: #fff;
  font-size: clamp(18px, 3.2vmin, 26px);
  padding: 2px 16px 4px;
  border: var(--bw) solid var(--ink);
  border-radius: 8px;
  white-space: nowrap;
}
.tiles { display: flex; gap: clamp(14px, 3vmin, 30px); justify-content: center; }
.tile {
  width: clamp(150px, 28vmin, 250px);
  aspect-ratio: 1 / 1.08;
  border: 4px solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 7px 0 var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: clamp(26px, 4.4vmin, 36px);
  color: var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.tile:nth-child(1) { transform: rotate(-3deg); }
.tile:nth-child(2) { transform: rotate(1.5deg) translateY(-6px); }
.tile:nth-child(3) { transform: rotate(-1deg); }
.tile .art { width: 62%; height: 58%; }
.tile b { font-weight: 400; background: var(--paper); border: var(--bw) solid var(--ink); border-radius: 999px; padding: 0 18px 2px; }
.c-orange { background: var(--orange); }
.c-mint { background: var(--mint); }
.c-lilac { background: var(--lilac); }
.c-pink { background: var(--pink); }
.tile:nth-child(4) { transform: rotate(2deg); }
.abc-art { display: flex; align-items: flex-end; justify-content: center; gap: 0; }
.abc-art img { height: 78%; }
.abc-art img:nth-child(1) { transform: rotate(-10deg); }
.abc-art img:nth-child(2) { height: 66%; transform: translateY(4px); }
.abc-art img:nth-child(3) { transform: rotate(8deg); }
.levels { display: flex; gap: 10px; }
.levels button {
  height: 52px;
  padding: 0 16px;
  border-radius: 999px;
  border: var(--bw) solid var(--ink);
  background: var(--paper);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  color: var(--sub);
  box-shadow: 0 3px 0 var(--ink);
}
.levels .dots { display: flex; gap: 3px; }
.levels i { width: 11px; height: 11px; border-radius: 50%; background: #e8d6bd; border: 2px solid #c9b293; }
.levels button.on { background: var(--yellow); color: var(--ink); transform: translateY(-2px); box-shadow: 0 5px 0 var(--ink); }
.levels button.on i { background: var(--pink); border-color: var(--ink); }

@media (orientation: portrait) {
  .tiles { flex-direction: column; gap: 16px; }
  .tile { width: min(82vw, 380px); aspect-ratio: auto; height: clamp(92px, 13.5vh, 140px); flex-direction: row; justify-content: flex-start; padding: 0 22px; gap: 14px; border-radius: 24px; }
  .tile .art { width: auto; height: 78%; aspect-ratio: 1; }
  .tile:nth-child(2) { transform: rotate(1deg); }
  .tiles { gap: 12px; }
  .tile { height: clamp(80px, 11.5vh, 130px); }
  .levels { gap: 6px; }
  .levels button { padding: 0 10px; font-size: 16px; height: 46px; gap: 5px; }
  .levels i { width: 8px; height: 8px; border-width: 1.5px; }
}

/* ---------- 상단 막대 ---------- */
.bar { display: flex; align-items: center; gap: var(--gap); flex: none; }
.bar h2 { margin: 0; flex: 1; text-align: center; font-weight: 400; font-size: clamp(24px, 4vmin, 32px); }
.bar-gap { flex: 1; }
.stage { position: relative; flex: 1; min-height: 0; }
.stage canvas, .pic {
  border: var(--bw) solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 5px 0 var(--ink);
  background: #fff;
  touch-action: none;
}
.stage > canvas { position: absolute; box-sizing: content-box; }

/* ---------- 그리기 ---------- */
#draw { flex-direction: row; }
#drawBar { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: var(--gap); padding: 2px 4px 8px; }
#drawBar .colors, #drawBar .tools { display: grid; grid-template-columns: repeat(2, var(--b)); gap: var(--gap); }
.swatch { width: var(--b); height: var(--b); border-radius: 50%; border: var(--bw) solid var(--ink); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18), 0 3px 0 var(--ink); transition: transform .1s; }
.swatch.on { transform: translateY(-4px) scale(1.08); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18), 0 0 0 4px var(--paper), 0 0 0 7px var(--ink); }
.sz { display: block; border-radius: 50%; background: var(--ink); }
.sz.s1 { width: 12px; height: 12px; }
.sz.s2 { width: 26px; height: 26px; }
.paper-chip { display: block; width: 56%; height: 56%; border-radius: 6px; border: var(--bw) solid var(--ink); transform: rotate(-6deg); }
#drawStage canvas { cursor: crosshair; }
@media (orientation: portrait) {
  #draw { flex-direction: column; }
  #drawBar { --b: min(50px, calc((100vw - 24px - 42px) / 8)); --gap: 6px; flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 4px 0 6px; }
  #drawBar .colors { grid-template-columns: repeat(8, var(--b)); order: -1; width: 100%; justify-content: center; }
  #drawBar .tools { grid-template-columns: repeat(6, var(--b)); }
}

/* ---------- 고르기 ---------- */
.grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(140px, 24vmin, 230px), 1fr));
  gap: clamp(14px, 2.4vmin, 22px);
  align-content: start;
  padding: 10px 6px 24px;
  -webkit-overflow-scrolling: touch;
}
.card {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  border: var(--bw) solid var(--ink);
  box-shadow: 0 5px 0 var(--ink);
  background: #fff;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.card:nth-child(3n+1) { transform: rotate(-1.2deg); }
.card:nth-child(3n+2) { transform: rotate(.8deg); }
.card:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.card canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.card.make { gap: 4px; font-size: 20px; align-content: center; }
.card.make svg { width: 46%; height: 52%; }
.card.make.c-orange { background: var(--orange); }
.card.make.c-lilac { background: var(--lilac); }
.card .del {
  position: absolute;
  top: 6px;
  right: 6px;
  height: 32px;
  min-width: 32px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--paper);
  border: 2px solid var(--ink);
  font-size: 15px;
  display: grid;
  place-items: center;
}
.card .del.armed { background: #e53935; color: #fff; }
.card .mine { position: absolute; left: 6px; top: 6px; background: var(--yellow); border: 2px solid var(--ink); border-radius: 999px; padding: 0 9px 1px; font-size: 14px; }

/* ---------- 찾기 ---------- */
.progress { flex: 1; display: flex; justify-content: center; }
.progress .slots { display: flex; gap: 4px; padding: 5px 12px; background: var(--paper); border: var(--bw) solid var(--ink); border-radius: 999px; box-shadow: var(--sh); }
.progress svg { width: clamp(30px, 5vmin, 42px); height: clamp(30px, 5vmin, 42px); filter: grayscale(1) opacity(.28); transition: filter .3s; }
.progress svg.got { filter: none; animation: popin .5s; }
@keyframes popin { 0% { transform: scale(.3); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }
.btn.hint { background: #fff3a6; }
.pic { position: absolute; overflow: hidden; }
.pic canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- 아빠 ---------- */
.edit-bar { flex-wrap: wrap; }
.seg { flex: 1; display: flex; justify-content: center; gap: 0; }
.seg button { height: 48px; padding: 0 14px 0 8px; display: inline-flex; align-items: center; gap: 4px; font-size: 18px; border: var(--bw) solid var(--ink); background: var(--paper); margin-left: calc(var(--bw) * -1); box-shadow: 0 4px 0 var(--ink); }
.seg button:first-child { border-radius: 999px 0 0 999px; margin-left: 0; }
.seg button:last-child { border-radius: 0 999px 999px 0; }
.seg button svg.i { width: 30px; height: 30px; }
.seg button.on { background: var(--yellow); }
.btn.chip.ok b { background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; min-width: 30px; height: 30px; display: grid; place-items: center; font-weight: 400; }
.edit-sub { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; flex: none; min-height: 50px; align-items: center; }
.edit-sub .swatch { --b: 42px; }
.edit-sub .stk { width: 50px; height: 50px; border-radius: 14px; background: var(--paper); border: var(--bw) solid var(--ink); box-shadow: 0 3px 0 var(--ink); display: grid; place-items: center; overflow: hidden; }
.edit-sub .stk canvas { width: 100%; height: 100%; }
.edit-sub .stk.on { background: var(--yellow); transform: translateY(-3px); }
.edit-tip { margin: 0; text-align: center; color: var(--sub); font-size: 16px; flex: none; }
@media (max-width: 600px) {
  .seg { order: 9; flex-basis: 100%; }
  .edit-bar .bar-gap { display: none; }
  .btn.chip { font-size: 17px; }
  .edit-bar > .btn.chip { margin-left: auto; }
}

/* ---------- 넘겨주기 ---------- */
#handoff { align-items: center; justify-content: center; }
.handoff { text-align: center; display: flex; flex-direction: column; align-items: center; }
.handoff .gift { width: clamp(120px, 26vmin, 190px); height: clamp(120px, 26vmin, 190px); animation: bob 1.4s ease-in-out infinite; }
.handoff h2 { font-weight: 400; font-size: clamp(40px, 8vmin, 64px); margin: 4px 0; }
.handoff p { font-size: clamp(22px, 4vmin, 30px); margin: 0 0 26px; color: var(--sub); }
.handoff p b { color: var(--pink); font-size: 1.5em; font-weight: 400; }
.btn.go { width: clamp(110px, 22vmin, 150px); height: clamp(110px, 22vmin, 150px); border-radius: 50%; border-width: 4px; box-shadow: 0 8px 0 var(--ink); }
@keyframes bob { 50% { transform: translateY(-12px) rotate(4deg); } }

/* ---------- 알파벳 (크레용 그림체: ChatGPT 로 그린 글자·종이·색연필 칸) ---------- */
.cray { background: #fdf6e3 url(../img/ui/bg.webp) center / cover no-repeat; color: #4a3226; }
.cray .bar { gap: 10px; }
/* 색연필로 칠한 칸 — 그림 테두리를 그대로 늘려 씀 */
.pap, .s-mint, .s-butter, .s-peach, .s-sky, .s-lav, .w-mint, .w-butter, .w-peach, .w-sky, .w-lav { box-sizing: border-box; border-style: solid; border-color: transparent; background: none; }
.pap { border-width: 22px; border-image: url(../img/ui/p-wide.webp) 90 fill / 22px stretch; }
.s-mint, .s-butter, .s-peach, .s-sky, .s-lav { border-width: 18px; }
.w-mint, .w-butter, .w-peach, .w-sky, .w-lav { border-width: 14px; }
.s-mint { border-image: url(../img/ui/s-mint.webp) 70 fill / 18px stretch; }
.s-butter { border-image: url(../img/ui/s-butter.webp) 70 fill / 18px stretch; }
.s-peach { border-image: url(../img/ui/s-peach.webp) 70 fill / 18px stretch; }
.s-sky { border-image: url(../img/ui/s-sky.webp) 70 fill / 18px stretch; }
.s-lav { border-image: url(../img/ui/s-lav.webp) 70 fill / 18px stretch; }
.w-mint { border-image: url(../img/ui/w-mint.webp) 70 fill / 14px stretch; }
.w-butter { border-image: url(../img/ui/w-butter.webp) 70 fill / 14px stretch; }
.w-peach { border-image: url(../img/ui/w-peach.webp) 70 fill / 14px stretch; }
.w-sky { border-image: url(../img/ui/w-sky.webp) 70 fill / 14px stretch; }
.w-lav { border-image: url(../img/ui/w-lav.webp) 70 fill / 14px stretch; }
.cray img { -webkit-user-drag: none; pointer-events: none; }
.cb-back { width: var(--b); height: var(--b); flex: none; display: grid; place-items: center; transition: transform .1s; }
.cb-back img { width: 92%; }
.cb-back:active, .ct:active, .ctext:active, .abc-go:active, .abc-ear:active { transform: scale(.94) rotate(-2deg); }
.cray-title { flex: 1; margin: 0; display: flex; justify-content: center; align-items: flex-end; gap: 2px; transform: rotate(-2deg); }
.cray-title img { height: clamp(46px, 8vmin, 72px); }
.abc-gap { flex: 0 0 var(--b); }

.abc-menu { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 2.4vmin, 22px); padding: 4px 0 16px; }
.abc-top { display: flex; align-items: center; justify-content: center; gap: clamp(16px, 4vmin, 40px); flex-wrap: wrap; }
.abc-case { display: flex; gap: 8px; }
.ct { height: clamp(64px, 11vmin, 86px); min-width: clamp(72px, 12vmin, 96px); padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; gap: 0; opacity: .5; filter: saturate(.6); transition: transform .12s, opacity .12s; }
.ct img { height: 78%; }
.ct.on { opacity: 1; filter: none; transform: rotate(-3deg) scale(1.1); }
.abc-case .ct:nth-child(2).on { transform: rotate(2deg) scale(1.1); }
.abc-go { width: clamp(190px, 32vmin, 260px); padding: 0 8px; height: clamp(130px, 22vmin, 190px); display: flex; align-items: center; justify-content: center; gap: 2px; font-size: clamp(26px, 4.6vmin, 40px); animation: wig 2.4s ease-in-out infinite; transition: transform .1s; }
.abc-go img { height: 100%; margin: -6px -4px -6px -10px; }
.abc-go b { font-weight: 400; white-space: nowrap; }
@keyframes wig { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg) translateY(-4px); } }

.abc-board { width: min(100%, 780px); padding: 4px 6px 6px; display: flex; flex-direction: column; gap: 8px; transform: rotate(-.4deg); }
.abc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 20px; }
.abc-head b { font-weight: 400; }
.abc-head b span { color: #e0413a; }
.abc-head > span { color: #8a7260; font-size: 15px; }
#abcGrid { display: flex; flex-direction: column; gap: 6px; }
.abc-row { display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px; }
/* 글자표: 아는 글자는 크레용 색 그대로, 아직은 연하게, 틀린 글자는 복숭아색 바탕 */
.lt { font-style: normal; aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; }
.lt img { height: 80%; width: auto; max-width: 96%; object-fit: contain; }
.lt.new img { filter: grayscale(1); opacity: .28; }
.lt.try { background: #fff1a8; box-shadow: inset 0 0 0 2px #e9cf6a; }
.lt.try img { opacity: .85; }
.lt.weak { background: #ffc9b5; box-shadow: inset 0 0 0 2px #e79a7d; }
.lt.weak img { animation: wig 1.8s ease-in-out infinite; }
.abc-legend { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; font-size: 15px; color: #8a7260; }
.abc-legend span { display: inline-flex; align-items: center; gap: 4px; }
.abc-legend .lt { width: 26px; height: 26px; border-radius: 7px; }
.abc-adult { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 2px dashed #d8c5ad; padding-top: 10px; }
.ctext { height: 58px; padding: 0 8px; font-size: 20px; display: inline-flex; align-items: center; transition: transform .1s; }
.ctext.big { height: clamp(66px, 11vmin, 86px); padding: 0 14px; font-size: clamp(24px, 4vmin, 32px); }
.abc-reset { color: #8a7260; font-size: 15px; padding: 8px 10px; border-radius: 999px; }
.abc-reset.armed { background: #e0413a; color: #fff; }

/* 놀이 화면 */
.cray .progress .slots { background: none; border: 0; box-shadow: none; padding: 0; gap: 2px; }
.cray .progress .slots img { width: clamp(26px, 4.6vmin, 40px); filter: grayscale(1) opacity(.35); }
.cray .progress .slots img.got { filter: none; animation: popin .5s; }
.abc-count { font-size: 26px; padding: 0 6px; }
.abc-ask { flex: none; display: flex; justify-content: center; align-items: center; gap: 18px; }
.abc-ear { position: relative; width: clamp(124px, 22vmin, 180px); height: clamp(118px, 21vmin, 170px); display: grid; place-items: center; animation: wig 2s ease-in-out infinite; transition: transform .1s; }
.abc-ear img { width: 118%; margin-top: -10%; }
/* 소리 나오는 물결 */
.abc-ear .wave { position: absolute; right: -26px; top: 50%; width: 22px; height: 40px; margin-top: -20px; border: 4px solid #4a3226; border-color: transparent #4a3226 transparent transparent; border-radius: 50%; opacity: .75; }
.abc-ear .wave::after { content: ''; position: absolute; inset: -10px -14px -10px auto; width: 30px; border: 4px solid #4a3226; border-color: transparent #4a3226 transparent transparent; border-radius: 50%; }
.abc-ear.talk .wave { animation: blink .5s 3; }
@keyframes blink { 50% { opacity: .1; } }
.abc-see { font-family: var(--abc-font); font-weight: 700; font-size: clamp(54px, 10vmin, 84px); line-height: 1; padding: 0 10px; }
.abc-cards { flex: 1; min-height: 0; display: grid; justify-content: center; align-content: center; gap: 16px; --cs: 120px; padding-bottom: 8px; }
.lcard { width: var(--cs); height: var(--cs); border-width: calc(var(--cs) * .1); border-image-width: calc(var(--cs) * .1); display: grid; place-items: center; transition: transform .12s, opacity .3s; }
.lcard img { height: calc(var(--cs) * .6); width: auto; max-width: calc(var(--cs) * .78); object-fit: contain; }
.lcard span { font-family: var(--abc-font); font-weight: 600; font-size: calc(var(--cs) * .56); line-height: 1; color: #3b2a20; }
.lcard:nth-child(odd) { transform: rotate(-2deg); }
.lcard:nth-child(even) { transform: rotate(1.5deg); }
.lcard:active { transform: scale(.94); }
.lcard.right { border-image-source: url(../img/ui/s-mint.webp); animation: popin .5s; }
.lcard.out { opacity: .25; }
.lcard.picked { border-image-source: url(../img/ui/s-butter.webp); }

.cray-ov { background: rgba(253, 246, 227, .86); }
.cray-win.win-card { background: none; border-radius: 0; box-shadow: none; border: 26px solid transparent; border-image: url(../img/ui/p-wide.webp) 90 fill / 26px stretch; color: #4a3226; padding: 6px 22px 10px; }
.cray-win .ct { opacity: 1; filter: none; }
.cray-win .win-next { color: #8a7260; margin: 2px 0 12px; }
.cray-win h2 { margin: 4px 0 2px; font-weight: 400; font-size: clamp(30px, 6vmin, 44px); }
.cray-stars { display: flex; justify-content: center; align-items: flex-end; gap: 2px; }
.cray-stars img { width: clamp(60px, 11vmin, 86px); animation: popin .6s backwards; transform: rotate(-8deg); }
.cray-stars img:nth-child(2) { width: clamp(78px, 14vmin, 110px); animation-delay: .15s; transform: none; }
.cray-stars img:nth-child(3) { animation-delay: .3s; transform: rotate(8deg); }
.cray-stars img.dim { filter: grayscale(1); opacity: .3; }
.cray-win .win-btns { align-items: center; }

/* ---------- 축하 ---------- */
.overlay { position: fixed; inset: 0; background: rgba(255, 246, 229, .88); display: grid; place-items: center; z-index: 10; padding: 16px; }
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.win-card { position: relative; text-align: center; background: var(--paper); border: 4px solid var(--ink); border-radius: 32px; padding: clamp(18px, 4vmin, 36px) clamp(22px, 6vmin, 56px); box-shadow: 0 10px 0 var(--ink); animation: popin .5s; transform: rotate(-1deg); }
.win-stars { display: flex; justify-content: center; align-items: flex-end; gap: 4px; }
.win-stars svg { width: clamp(56px, 11vmin, 84px); height: clamp(56px, 11vmin, 84px); animation: popin .6s backwards; }
.win-stars svg:nth-child(2) { width: clamp(72px, 14vmin, 108px); height: clamp(72px, 14vmin, 108px); animation-delay: .15s; }
.win-stars svg:nth-child(3) { animation-delay: .3s; }
.win-card h2 { font-weight: 400; font-size: clamp(40px, 8vmin, 64px); margin: 2px 0 6px; color: var(--pink); text-shadow: 0 3px 0 var(--ink); }
.win-next { display: flex; justify-content: center; gap: 6px; min-height: 22px; margin-bottom: 18px; align-items: center; color: var(--sub); font-size: 18px; }
.win-next i { width: 16px; height: 16px; border-radius: 50%; background: var(--pink); border: 2px solid var(--ink); display: inline-block; }
.win-btns { display: flex; gap: 16px; justify-content: center; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* =========================================================
   크레용 그림체 (앱 전체) — ChatGPT 로 그린 종이·색연필 칸·아이콘
   위의 종이 스티커 모양을 덮어씀
   ========================================================= */
:root { --ink: #5a3418; --sub: #8a7260; --sh: none; }
.screen { background: linear-gradient(rgba(253, 246, 227, .8), rgba(253, 246, 227, .8)), #fdf6e3 url(../img/ui/bg.webp) center / cover no-repeat; color: #4a3226; }
.screen.cray { background: #fdf6e3 url(../img/ui/bg.webp) center / cover no-repeat; }
img.i { width: 74%; height: 74%; object-fit: contain; flex: none; pointer-events: none; }
.screen img { -webkit-user-drag: none; }

/* 버튼: 종이 칸 */
.btn { background: none; box-shadow: none; border: 5px solid transparent; border-image: url(../img/ui/p-wide.webp) 90 fill / 12px stretch; transition: transform .1s; }
.btn.sq, .btn.sq.big { border-radius: 0; }
.btn:active, .tile:active { transform: scale(.94) rotate(-2deg); box-shadow: none; }
.btn.ok { background: none; color: #4a3226; border-image: url(../img/ui/s-mint.webp) 70 fill / 14px stretch; }
.btn.on, .btn.hint { background: none; transform: rotate(-3deg) scale(1.06); box-shadow: none; border-image: url(../img/ui/s-butter.webp) 70 fill / 14px stretch; }
.btn.hint { transform: none; }
.btn.chip { border-radius: 0; height: 54px; padding: 0 10px; border-image: url(../img/ui/w-butter.webp) 70 fill / 14px stretch; }
.btn.chip.ok { border-image: url(../img/ui/w-mint.webp) 70 fill / 14px stretch; }
.btn.chip img.i { width: 34px; height: 34px; }
.btn.chip.ok b { background: #fffaf0; border: 2px solid #8a6a52; color: #4a3226; }
.btn.go { width: clamp(120px, 22vmin, 160px); height: clamp(120px, 22vmin, 160px); border-radius: 0; box-shadow: none; animation: wig 2.4s ease-in-out infinite; }
.btn.go img.i { width: 70%; height: 70%; }
.cb-back img.i { width: 92%; height: 92%; }

/* 놀이 고르기·틀린그림 처음 */
#games, #home { justify-content: center; }
.kk-title { margin: 0; font-weight: 400; font-size: clamp(54px, 11vmin, 96px); line-height: 1; color: #4a3226; transform: rotate(-2deg); text-shadow: 0 4px 0 #fffaf0, 0 -4px 0 #fffaf0, 4px 0 0 #fffaf0, -4px 0 0 #fffaf0, 3px 3px 0 #fffaf0, -3px -3px 0 #fffaf0, 3px -3px 0 #fffaf0, -3px 3px 0 #fffaf0; }
#home .kk-title { color: #e0413a; }
.tile { border-style: solid; border-color: transparent; border-width: 22px; border-radius: 0; box-shadow: none; background: none; }
.tile .art { width: 70%; height: 62%; object-fit: contain; }
.tile b { background: none; border: 0; padding: 0; font-size: clamp(28px, 4.8vmin, 40px); text-shadow: 0 2px 0 #fffaf0, 0 -2px 0 #fffaf0, 2px 0 0 #fffaf0, -2px 0 0 #fffaf0; }
.games-tiles .tile { width: clamp(220px, 38vmin, 330px); }
.games-tiles .tile:nth-child(1) { transform: rotate(-3deg); }
.games-tiles .tile:nth-child(2) { transform: rotate(2.5deg) translateY(-8px); }
.games-tiles .abc-art img { height: 70%; }
#btnDad { height: 60px; gap: 4px; font-size: 20px; padding: 0 6px; }
#btnDad img.i { width: 40px; height: 40px; }
.levels { gap: 8px; }
.levels button { background: none; border-radius: 0; box-shadow: none; border: 12px solid transparent; border-image: url(../img/ui/w-butter.webp) 70 fill / 14px stretch; height: 60px; padding: 0 4px; color: #4a3226; opacity: .55; filter: saturate(.6); }
.levels button.on { background: none; box-shadow: none; opacity: 1; filter: none; transform: rotate(-2deg) scale(1.06); }
.levels i { border-color: #b89a7a; background: #fffaf0; }
.levels button.on i { background: #e0413a; border-color: #5a3418; }
@media (orientation: portrait) {
  .games-tiles { flex-direction: column; }
  .games-tiles .tile { width: min(82vw, 380px); height: clamp(120px, 20vh, 190px); }
  .tile { border-width: 18px; }
  .tile .art { height: 92%; width: auto; aspect-ratio: 1; }
  .levels button { padding: 0 2px; height: 52px; border-width: 10px; }
}

/* 그림 틀 */
.stage canvas, .pic { border-color: #6a3d1e; border-radius: 14px; box-shadow: 0 5px 0 rgba(106, 61, 30, .35); }
.card { border-color: #6a3d1e; box-shadow: 0 5px 0 rgba(106, 61, 30, .3); }
.card:active { box-shadow: 0 2px 0 rgba(106, 61, 30, .3); }
.card.make { border: 18px solid transparent; border-radius: 0; box-shadow: none; background: none; gap: 2px; font-size: 22px; }
.card.make.s-peach { border-image: url(../img/ui/s-peach.webp) 70 fill / 18px stretch; }
.card.make.s-lav { border-image: url(../img/ui/s-lav.webp) 70 fill / 18px stretch; }
.card.make img { width: 52%; height: 58%; object-fit: contain; }
.card .mine { background: #fff1a8; border-color: #8a6a52; }
.card .del { border-color: #8a6a52; }
.bar h2 { text-shadow: 0 2px 0 #fffaf0, 0 -2px 0 #fffaf0, 2px 0 0 #fffaf0, -2px 0 0 #fffaf0; }

/* 찾기 진행 별 */
.progress .slots { background: none; border: 6px solid transparent; border-image: url(../img/ui/p-wide.webp) 90 fill / 14px stretch; border-radius: 0; box-shadow: none; padding: 2px 10px; gap: 2px; }
.progress .slots img { width: clamp(30px, 5vmin, 42px); height: clamp(30px, 5vmin, 42px); filter: grayscale(1) opacity(.35); transition: filter .3s; }
.progress .slots img.got { filter: none; animation: popin .5s; }

/* 그리기 도구 */
.swatch { border-color: #5a3418; }
.swatch.on { box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18), 0 0 0 4px #fffaf0, 0 0 0 7px #5a3418; }
.sz { background: #5a3418; }

/* 아빠 문제 */
.seg { gap: 6px; }
.seg button { border: 10px solid transparent; border-radius: 0 !important; margin-left: 0; box-shadow: none; background: none; height: 56px; padding: 0 4px; border-image: url(../img/ui/w-butter.webp) 70 fill / 14px stretch; opacity: .6; }
.seg button.on { background: none; opacity: 1; transform: rotate(-2deg); border-image: url(../img/ui/w-mint.webp) 70 fill / 14px stretch; }
.seg button img.i { width: 32px; height: 32px; }
.edit-sub .stk { border-color: #8a6a52; box-shadow: none; }
.edit-sub .stk.on { background: #fff1a8; }

/* 넘겨주기 */
.handoff .gift { object-fit: contain; }
.handoff h2 { text-shadow: 0 3px 0 #fffaf0, 0 -3px 0 #fffaf0, 3px 0 0 #fffaf0, -3px 0 0 #fffaf0; }
.handoff p b { color: #e0413a; }

/* 축하 */
#win .win-btns .btn.sq.big { --b: clamp(70px, 12vmin, 92px); }
.win-next i { background: #e0413a; border-color: #5a3418; }
.kk-title .k1 { color: #e0413a; display: inline-block; transform: rotate(-6deg); }
.kk-title .k2 { color: #f39a2b; display: inline-block; transform: rotate(5deg) translateY(-6px); }
/* 고르기 칸: 높이가 정해진 목록 안에서 카드 줄이 눌리지 않게 */
.grid { grid-auto-rows: max-content; }
.levels button { white-space: nowrap; }
@media (orientation: portrait) and (max-width: 600px) {
  .levels button { flex-direction: column; justify-content: center; gap: 2px; height: 70px; min-width: 96px; font-size: 17px; line-height: 1; }
  .levels .dots { gap: 2px; }
}
@media (orientation: portrait) { .games-tiles { gap: 26px; } .games-tiles .tile b { font-size: 34px; } }

/* ---------- ABC 놀이 고르기 (4가지) ---------- */
.abc-menu > .abc-case { flex: none; }
.abc-modes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(12px, 2.4vmin, 22px); width: min(100%, 980px); }
.mode { border-style: solid; border-color: transparent; border-width: 18px; aspect-ratio: 1 / 1.05; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; transition: transform .1s; }
.mode:nth-child(odd) { transform: rotate(-1.5deg); }
.mode:nth-child(even) { transform: rotate(1.2deg) translateY(-4px); }
.mode:active { transform: scale(.94) rotate(-2deg); }
.mode .mart { display: flex; align-items: flex-end; justify-content: center; height: 52%; gap: 2px; }
.mode .mart img { height: 82%; }
.mode .mart img:nth-child(2) { transform: rotate(6deg); }
.mode b { font-weight: 400; font-size: clamp(19px, 3.2vmin, 28px); line-height: 1.1; text-align: center; white-space: nowrap; text-shadow: 0 2px 0 #fffaf0, 0 -2px 0 #fffaf0, 2px 0 0 #fffaf0, -2px 0 0 #fffaf0; }
.mode[data-mode="listen"] .mart img:first-child { height: 100%; }
.abc-menu > .abc-adult { width: min(100%, 780px); border: 18px solid transparent; border-image: url(../img/ui/p-wide.webp) 90 fill / 18px stretch; padding: 0 6px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.abc-adult .abc-head { flex: 1; min-width: 200px; }
@media (orientation: portrait) {
  .abc-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(100%, 520px); }
  .mode b { font-size: 20px; white-space: normal; }
}

/* 보고 찾는 놀이: 위에 글자 하나 */
.abc-show { display: grid; place-items: center; width: clamp(130px, 22vmin, 190px); height: clamp(130px, 22vmin, 190px); border-width: 18px; border-image-width: 18px; cursor: pointer; }
.abc-show img { height: 92%; max-width: 100%; object-fit: contain; }
.pop { animation: popin .5s; }

/* 알파벳 친구들 */
.abc-all { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 2vmin, 20px); padding-bottom: 10px; overflow-y: auto; }
.abc-big { flex: none; display: flex; align-items: flex-end; justify-content: center; gap: 10px; height: clamp(150px, 30vh, 270px); padding: 4px 28px; border-width: 22px; border-image-width: 22px; }
.abc-big img { height: 100%; object-fit: contain; }
.abc-big img + img { height: 100%; }
.abc-all .abc-board { transform: none; }
.abc-all .lt { cursor: pointer; transition: transform .1s; }
.abc-all .lt:active { transform: scale(.88); }
.tile { position: relative; }
.tile .age { position: absolute; top: -26px; right: -14px; font-style: normal; font-size: 18px; line-height: 1; padding: 0 2px; border-style: solid; border-color: transparent; border-width: 10px; transform: rotate(6deg); }

/* 첫 글자: 위에 낱말 그림을 크게 */
.abc-show.word { width: clamp(160px, 30vmin, 260px); height: clamp(160px, 30vmin, 260px); }
.abc-show.word img { height: 96%; }
@media (orientation: portrait) { .abc-modes .mode[data-mode="all"] { grid-column: span 2; aspect-ratio: auto; height: 150px; } }
.abc-big img.bw { height: 100%; margin-left: 14px; align-self: center; }
.games-tiles .tile b { white-space: nowrap; }
