/* 글꼴: 동글 (SIL OFL 1.1, fonts/OFL.txt). 앱에 쓰는 글자만 담아 앱 안에 넣었다 — tools/make-font.py */
@font-face {
  font-family: "Dongle";
  src: url("../fonts/dongle.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --wall: #FFF3DC;
  --ink: #3B2A20;
  --ink-soft: #7A604C;
  --surface: #FFFDF7;
  --surface-edge: #E6D4B0;
  --accent: #EC4A3F;
  --go: #2FA84F;
  --go-deep: #1D7535;
  --butter: #FFD338;
  --mat: #CFE7DC;
  --display: "Dongle", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--wall);
  color: var(--ink);
  font-family: var(--display);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
img { -webkit-user-drag: none; }

/* 도톰한 단추 (아래 그림자가 눌리면 쏙) */
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; border-radius: 18px;
  background: var(--surface); box-shadow: 0 5px 0 var(--surface-edge);
  font-size: 1.2rem; color: inherit; text-decoration: none; transition: transform .08s, box-shadow .08s;
}
.chip svg { width: 26px; height: 26px; flex: none; }
.chip:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--surface-edge); }
.chip.primary { background: var(--go); color: #fff; box-shadow: 0 5px 0 var(--go-deep); }
.chip.primary:active { box-shadow: 0 1px 0 var(--go-deep); }
.round {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface); box-shadow: 0 5px 0 var(--surface-edge); color: var(--ink);
}
.round svg { width: 30px; height: 30px; }
.round:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--surface-edge); }
.round.sm { width: 46px; height: 46px; }
.round.sm svg { width: 24px; height: 24px; }

/* ── 처음 화면 ─────────────────────────────────────── */
#home {
  min-height: 100%;
  padding: calc(12px + var(--safe-t)) calc(16px + var(--safe-r)) calc(28px + var(--safe-b)) calc(16px + var(--safe-l));
  background:
    linear-gradient(rgba(232, 180, 90, .13) 1.5px, transparent 1.5px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(232, 180, 90, .13) 1.5px, transparent 1.5px) 0 0 / 28px 28px,
    var(--wall);
}
.home-bar { display: flex; justify-content: flex-end; gap: 10px; max-width: 980px; margin: 0 auto; }
.home-bar .chip { min-height: 44px; padding: 0 14px; font-size: 1rem; white-space: nowrap; }
@media (max-width: 440px) {
  .home-bar { gap: 8px; }
  .home-bar .chip { padding: 0 10px; gap: 5px; font-size: .95rem; }
  #soundBtn span { display: none; } /* 폰: 소리 단추는 그림만 */
}
#soundBtn .mute { display: none; }
#soundBtn[aria-pressed="false"] .mute { display: inline; }
#soundBtn[aria-pressed="false"] .wave { display: none; }

.cover {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px;
  max-width: 980px; text-align: center; margin: 4px auto 22px;
}
.cover .title { min-width: 0; }
/* 제목 양옆: 완성 모형들이 종이처럼 살짝 기울어 둥실둥실 */
.side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; align-items: center; justify-items: center; }
.side-obj {
  width: 100%; max-width: 116px; aspect-ratio: 1; padding: 4px;
  transform: rotate(var(--tilt)); animation: bob 3.2s calc(var(--n) * -0.4s) ease-in-out infinite;
}
.side-obj:nth-child(even) { margin-top: 28px; }
.side-obj img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 5px 4px rgba(90, 60, 20, .18)); }
.side-obj:active { scale: .92; }
@keyframes bob { 50% { translate: 0 -7px; } }
@media (max-width: 560px) {
  .side { grid-template-columns: 1fr; gap: 2px; }
  .side-obj { max-width: 60px; padding: 0; }
  .side-obj:nth-child(even) { margin-top: 0; translate: 8px 0; }
  #sideR .side-obj:nth-child(even) { translate: -8px 0; }
  .cover h1 { font-size: clamp(2rem, 9vw, 2.6rem); }
}
.cover h1 { margin: 10px 0 0; font-size: clamp(2.4rem, 9vw, 3.6rem); font-weight: 400; letter-spacing: -.01em; }
.cover p { margin: 4px 0 0; color: var(--ink-soft); font-size: clamp(1rem, 3.6vw, 1.25rem); word-break: keep-all; }

/* 로고: 모서리 하나를 접은 색종이 셋 */
.logo { position: relative; display: inline-block; width: 128px; height: 74px; }
.logo i {
  position: absolute; bottom: 0; width: 56px; height: 56px; border-radius: 3px;
  background: linear-gradient(225deg, #FFFCF5 0 26%, rgba(0, 0, 0, .12) 26% 28%, var(--c) 28%);
  box-shadow: 0 4px 6px rgba(90, 60, 20, .2);
  animation: land .6s both cubic-bezier(.3, 1.4, .5, 1);
}
.logo i::after {
  /* 접힌 모서리 (뒷면의 흰색) */
  content: ""; position: absolute; right: 0; top: 0; width: 26%; height: 26%;
  background: linear-gradient(225deg, transparent 50%, var(--c) 50%);
  filter: brightness(1.15);
}
.logo i:nth-child(1) { --c: #EC4A3F; left: 0; transform: rotate(-12deg); animation-delay: .1s; }
.logo i:nth-child(2) { --c: #FFD338; left: 36px; bottom: 10px; transform: rotate(4deg); animation-delay: .25s; }
.logo i:nth-child(3) { --c: #3474E0; left: 72px; transform: rotate(14deg); animation-delay: .4s; }
@keyframes land { from { translate: 0 -40px; opacity: 0; } }

/* 시리즈 탭 */
.series { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 980px; margin: 0 auto 18px; }
.tab {
  display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 6px 18px 6px 8px; border-radius: 999px;
  background: var(--surface); box-shadow: 0 5px 0 var(--surface-edge); font-size: 1.3rem;
  transition: transform .08s, box-shadow .08s;
}
.tab img { width: 52px; height: 52px; object-fit: contain; }
.tab small { font-size: .9rem; color: var(--ink-soft); }
.tab:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--surface-edge); }
.tab[aria-selected="true"] { background: var(--go); color: #fff; box-shadow: 0 5px 0 var(--go-deep); }
.tab[aria-selected="true"] small { color: rgba(255, 255, 255, .85); }
.tab[aria-selected="true"] img { filter: drop-shadow(0 0 3px rgba(255, 255, 255, .8)); }
@media (max-width: 520px) {
  .series { gap: 8px; }
  .tab { min-height: 50px; padding: 4px 12px 4px 4px; gap: 4px; font-size: 1.05rem; }
  .tab img { width: 42px; height: 42px; }
  .tab small { font-size: .8rem; }
}
.levels { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 980px; margin: -4px auto 16px; }
.lv {
  min-height: 40px; padding: 0 14px; border-radius: 999px; font-size: 1rem;
  background: rgba(255, 255, 255, .7); box-shadow: inset 0 0 0 2px var(--surface-edge);
}
.lv i, .card .stars { font-style: normal; color: #F2A100; letter-spacing: -1px; }
.lv small { color: var(--ink-soft); }
.lv[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: none; }
.lv[aria-pressed="true"] small { color: rgba(255, 255, 255, .75); }

/* 모형 카드: 색종이 한 장 위에 완성 모습 */
.cards { display: grid; gap: 16px; max-width: 980px; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.card {
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding: 10px 10px 14px; border-radius: 24px; text-decoration: none; color: inherit;
  background: var(--surface); box-shadow: 0 6px 0 var(--surface-edge);
  transition: transform .08s, box-shadow .08s;
  animation: rise .45s calc(var(--n) * 50ms) both ease-out;
}
.card::before {
  content: ""; position: absolute; left: 10px; right: 10px; top: 10px; aspect-ratio: 1; border-radius: 16px;
  background: color-mix(in srgb, var(--c) 14%, #fff);
}
.card:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--surface-edge); }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } }
.card img { position: relative; width: 100%; aspect-ratio: 1; object-fit: contain; padding: 8px; filter: drop-shadow(0 4px 3px rgba(90, 60, 20, .16)); }
.card b { font-weight: 400; font-size: 1.3rem; margin-top: 4px; word-break: keep-all; line-height: 1.15; text-align: center; }
.card b.long { font-size: 1.08rem; }
.card .meta { color: var(--ink-soft); font-size: .92rem; }
.card .stamp, .card .going {
  position: absolute; top: 10px; right: 10px; padding: 4px 10px; border-radius: 999px; font-size: .9rem; transform: rotate(8deg);
}
.card .stamp { background: var(--butter); color: #6b4a00; box-shadow: 0 3px 0 #D9A900; }
.card .going { background: #DDF1FF; color: #1f5d8a; box-shadow: 0 3px 0 #b7dcf4; }

/* ── 설명서·내 작품 (위 막대) ────────────────────────── */
#guide, #shelf {
  min-height: 100%;
  padding: calc(12px + var(--safe-t)) calc(16px + var(--safe-r)) calc(28px + var(--safe-b)) calc(16px + var(--safe-l));
}
#guide { background: var(--wall); }
.page-bar { display: flex; align-items: center; gap: 14px; max-width: 980px; margin: 0 auto 16px; }
.page-bar h2 { margin: 0; font-weight: 400; font-size: 1.9rem; }
.page-bar p { margin: 0; color: var(--ink-soft); word-break: keep-all; }

/* 진짜 색종이 설명서: 번호 붙은 그림 카드 */
.g-steps { list-style: none; display: grid; gap: 14px; max-width: 980px; margin: 0 auto; padding: 0; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.g-step {
  position: relative; display: flex; flex-direction: column; align-items: center; padding: 12px 12px 14px; border-radius: 22px;
  background: var(--surface); box-shadow: 0 5px 0 var(--surface-edge); cursor: pointer;
  animation: rise .4s calc(var(--n) * 40ms) both ease-out;
}
.g-step img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 14px; background: var(--mat); }
.g-step b {
  position: absolute; left: 6px; top: 6px; min-width: 44px; height: 44px; padding: 0 10px; border-radius: 999px;
  display: grid; place-items: center; background: var(--ink); color: #fff; font-weight: 400; font-size: 1.4rem;
}
.g-step.g-start b, .g-step.g-end b { background: var(--go); font-size: 1.1rem; }
.g-step p { margin: 8px 0 0; font-size: 1.1rem; line-height: 1.3; text-align: center; word-break: keep-all; }
.g-step.g-back p::before { content: "뒤로 "; color: #E0492F; }
.g-play { display: flex; max-width: 420px; margin: 22px auto 0; font-size: 1.3rem; }

/* 내 작품: 코르크 판에 핀으로 꽂은 종이접기 */
#shelf { background: #F3E3C4; }
.board {
  display: grid; gap: 18px 12px; max-width: 980px; margin: 0 auto; padding: 22px 16px; border-radius: 22px;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  background:
    radial-gradient(circle at 20% 30%, rgba(120, 70, 20, .12) 2px, transparent 3px) 0 0 / 18px 18px,
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, .18) 2px, transparent 3px) 0 0 / 22px 22px,
    #C9955D;
  box-shadow: inset 0 0 0 10px #8C5A2B, inset 0 0 0 12px #6E4420;
}
.pin {
  position: relative; display: flex; flex-direction: column; align-items: center; padding: 14px 6px 8px; text-decoration: none; color: var(--ink);
  transform: rotate(var(--tilt)); animation: rise .4s calc(var(--n) * 50ms) both ease-out;
}
.pin::before {
  content: ""; position: absolute; top: 2px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; z-index: 1;
  background: radial-gradient(circle at 35% 35%, #ff9a8f, #d8322a 60%); box-shadow: 0 3px 3px rgba(0, 0, 0, .3);
}
.pin img { width: 100%; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 6px 4px rgba(0, 0, 0, .28)); }
.pin span { margin-top: 2px; padding: 2px 10px; border-radius: 8px; background: #FFFDF7; font-size: 1rem; box-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.shelf-empty { grid-column: 1 / -1; padding: 40px 20px; text-align: center; color: #fff; font-size: 1.2rem; word-break: keep-all; text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }

/* ── 놀이판: 초록 자르기 판 위 ───────────────────────── */
#play {
  position: fixed; inset: 0; overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, .6) 2px, transparent 2px) -1px -1px / 120px 120px,
    linear-gradient(90deg, rgba(255, 255, 255, .6) 2px, transparent 2px) -1px -1px / 120px 120px,
    linear-gradient(rgba(255, 255, 255, .28) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255, 255, 255, .28) 1px, transparent 1px) 0 0 / 24px 24px,
    radial-gradient(ellipse at 50% 40%, #DDF0E7, var(--mat) 70%);
}
#play[data-color="green"], #play[data-color="mint"], #play[data-color="lime"] { --mat: #F1E4CC; background-color: var(--mat); }
#play[data-color="green"], #play[data-color="mint"], #play[data-color="lime"] {
  background:
    linear-gradient(rgba(255, 255, 255, .6) 2px, transparent 2px) -1px -1px / 120px 120px,
    linear-gradient(90deg, rgba(255, 255, 255, .6) 2px, transparent 2px) -1px -1px / 120px 120px,
    linear-gradient(rgba(255, 255, 255, .3) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255, 255, 255, .3) 1px, transparent 1px) 0 0 / 24px 24px,
    radial-gradient(ellipse at 50% 40%, #FBF3E4, #EEDFC4 70%);
}
#stage, #fx { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#stage { touch-action: none; }
#fx { pointer-events: none; }

.topbar {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) 8px calc(12px + var(--safe-l));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.top-left { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.steps { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; align-items: center; margin-top: 6px; padding: 10px 14px; border-radius: 999px; background: rgba(255, 255, 255, .75); }
.steps i {
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: inset 0 0 0 3px #D8CBB3; transition: transform .25s, background .25s;
}
.steps i.deco-dot { border-radius: 4px; transform: rotate(45deg) scale(.9); }
.steps i.past { background: var(--go); box-shadow: inset 0 -3px 0 var(--go-deep); }
.steps i.now { transform: scale(1.35); background: var(--butter); box-shadow: inset 0 -3px 0 #D9A900; }
.steps i.deco-dot.now { transform: rotate(45deg) scale(1.25); }
.steps i.ping { animation: ping .6s ease-out; }
@keyframes ping { 40% { scale: 1.6; } }

/* 완성 모습 미리보기 */
.goal {
  position: relative; width: clamp(96px, 26vw, 150px); height: clamp(96px, 26vw, 150px); border-radius: 24px; flex: none; padding: 8px;
  background: var(--surface); box-shadow: 0 5px 0 var(--surface-edge); transform-origin: top right;
}
.goal img { width: 100%; height: 100%; object-fit: contain; }
.goal::after {
  content: "완성 모습"; position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%);
  padding: 1px 8px; border-radius: 999px; background: var(--ink); color: #fff; font-size: .8rem; white-space: nowrap;
}
.goal.peek { animation: peek 1.8s ease-in-out; }
@keyframes peek { 15%, 80% { transform: scale(1.9); } }

/* 아래 안내 말풍선: 읽어 주기 + 할 일 + (뒤집기·돌리기 단추) */
.caption {
  position: absolute; left: 50%; bottom: calc(16px + var(--safe-b)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; width: min(620px, calc(100% - 24px)); padding: 12px 14px;
  border-radius: 26px; background: rgba(255, 253, 247, .96); box-shadow: 0 6px 0 rgba(150, 120, 80, .25);
}
.caption.fresh { animation: capIn .35s both cubic-bezier(.3, 1.4, .5, 1); }
@keyframes capIn { from { translate: 0 30px; opacity: 0; } }
.caption p { flex: 1; margin: 0; font-size: 1.35rem; line-height: 1.25; word-break: keep-all; }
.cap-say { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: #FFF1C4; color: #C98400; }
.cap-say svg { width: 26px; height: 26px; }
.cap-say:active { scale: .92; }
.action { flex: none; min-height: 60px; font-size: 1.35rem; animation: nudge 1.6s 1s ease-in-out infinite; }
.action svg { width: 30px; height: 30px; }
.action[data-kind="turn"] .i-flip { transform: rotate(90deg); }
@keyframes nudge { 0%, 70%, 100% { rotate: 0deg; } 78% { rotate: -6deg; } 86% { rotate: 5deg; } 94% { rotate: -2deg; } }
@media (max-width: 480px) {
  .caption { gap: 8px; padding: 10px; }
  .caption p { font-size: 1.15rem; }
  .action { min-height: 52px; padding: 0 14px; font-size: 1.15rem; }
}

/* 손가락 힌트 (손끝이 좌표에 오도록) */
.hand { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 5; transform-origin: 0 0; }
.hand svg { display: block; margin: -3px 0 0 -23px; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .2)); }

/* 완성 */
.finish {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  padding: 0 16px calc(18px + var(--safe-b));
}
.finish-card {
  position: relative; width: min(440px, 100%); padding: 44px 18px 18px; border-radius: 30px; text-align: center;
  background: var(--surface); box-shadow: 0 7px 0 var(--surface-edge);
  animation: slideUp .5s both cubic-bezier(.3, 1.3, .5, 1);
}
@keyframes slideUp { from { transform: translateY(120%); } }
.badge { position: absolute; left: 50%; top: -46px; width: 92px; height: 92px; margin-left: -46px; animation: spinIn .8s .2s both cubic-bezier(.3, 1.5, .5, 1); }
@keyframes spinIn { from { transform: scale(0) rotate(-160deg); } }
.finish-title { margin: 0; font-size: 2.1rem; color: var(--accent); }
.finish-name { margin: 2px 0 0; font-size: 1.3rem; }
.finish-count { margin: 2px 0 10px; color: var(--ink-soft); }
.finish-info {
  display: flex; align-items: flex-start; gap: 8px; width: 100%; margin: 0 0 10px; padding: 10px 12px;
  border-radius: 16px; background: #FFF4D6; text-align: left; font-size: 1.02rem; line-height: 1.45; word-break: keep-all;
}
.finish-info svg { width: 22px; height: 22px; flex: none; margin-top: 2px; color: #D98A00; }
.finish-info:active { transform: scale(.98); }
.real {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin: 0 0 14px; padding: 8px;
  border-radius: 14px; background: #E6F4EC; color: #1D7535; font-size: 1.05rem;
}
.real svg { width: 24px; height: 24px; }
.finish-actions { display: flex; gap: 10px; justify-content: center; }
.finish-actions .chip { flex: 1; padding: 0 10px; }
.finish-actions .chip.primary { flex: 1.4; }
#play.is-view .steps, #play.is-view .caption { visibility: hidden; }

/* 가로로 누운 폰: 안내를 오른쪽 아래로 작게, 완성 카드는 오른쪽에 */
@media (orientation: landscape) and (max-height: 560px) {
  .round { width: 48px; height: 48px; }
  .round.sm { width: 40px; height: 40px; }
  .goal { width: 92px; height: 92px; border-radius: 20px; padding: 4px; }
  .caption { left: auto; right: calc(12px + var(--safe-r)); transform: none; width: min(420px, 50vw); bottom: calc(10px + var(--safe-b)); }
  .caption p { font-size: 1.1rem; }
  .finish { left: auto; top: 0; width: min(400px, 48vw); align-items: center; padding: 0 calc(12px + var(--safe-r)) 0 0; }
  .finish { padding-top: calc(12px + var(--safe-t)); padding-bottom: calc(8px + var(--safe-b)); }
  .finish-card { padding: 14px 14px 12px; max-height: 100%; overflow-y: auto; }
  .finish-title { font-size: 1.7rem; }
  .finish-count { margin-bottom: 6px; }
  .finish-info { padding: 8px 10px; font-size: .95rem; line-height: 1.35; }
  .real { margin-bottom: 10px; padding: 6px; }
  .finish-actions .chip { min-height: 46px; }
  .badge { display: none; } /* 카드가 스크롤되면 위로 튀어나온 별이 잘려서 */
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* ── 색종이 고르기 (첫 단계 전) ────────────────────────── */
.swatches {
  position: absolute; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%);
  display: flex; gap: 8px; max-width: calc(100% - 24px); padding: 8px 12px; overflow-x: auto; scrollbar-width: none;
  border-radius: 999px; background: rgba(255, 253, 247, .9); box-shadow: 0 4px 0 rgba(150, 120, 80, .2);
}
.swatches::-webkit-scrollbar, .free-colors::-webkit-scrollbar, .free-stickers::-webkit-scrollbar { display: none; }
.swatch {
  flex: none; width: 38px; height: 38px; border-radius: 6px; background: var(--c);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .14), 0 2px 3px rgba(0, 0, 0, .12);
  background-image: linear-gradient(225deg, #fff 0 22%, rgba(0, 0, 0, .12) 22% 24%, transparent 24%);
  transition: transform .15s;
}
.swatch[aria-pressed="true"] { transform: translateY(-5px) rotate(-6deg); outline: 3px solid var(--ink); outline-offset: 2px; }
.swatch:active { transform: scale(.9); }

/* ── 마음대로 접기 ────────────────────────────────── */
#play:not(.is-free) .free-top, #play:not(.is-free) .free-tray { display: none; }
#play.is-free .steps, #play.is-free .goal, #play.is-free #topGuide, #play.is-free #undoBtn,
#play.is-free .caption, #play.is-free .swatches, #play.is-free .finish { display: none !important; }
.free-top { position: absolute; top: calc(10px + var(--safe-t)); right: calc(12px + var(--safe-r)); }
.free-top .chip:disabled { opacity: .45; }
.chip.sm { min-height: 46px; padding: 0 14px; font-size: 1.05rem; }
.free-tray {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px calc(10px + var(--safe-r)) calc(10px + var(--safe-b)) calc(10px + var(--safe-l));
  background: rgba(255, 253, 247, .96); border-radius: 26px 26px 0 0; box-shadow: 0 -4px 0 rgba(150, 120, 80, .2);
}
.free-tools { display: flex; gap: 8px; justify-content: center; }
.tool {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 70px; padding: 6px 8px 4px; border-radius: 16px;
  background: #F4EEE2; box-shadow: 0 4px 0 var(--surface-edge); font-size: .95rem;
}
.tool svg { width: 26px; height: 26px; }
.tool:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--surface-edge); }
.tool:disabled { opacity: .4; }
#freeNew.armed { background: var(--accent); color: #fff; }
.seg { display: flex; gap: 4px; width: min(320px, 100%); margin: 10px auto 8px; padding: 4px; border-radius: 999px; background: #EFE6D4; }
.seg button { flex: 1; min-height: 36px; border-radius: 999px; font-size: 1.05rem; }
.seg button[aria-selected="true"] { background: var(--surface); box-shadow: 0 2px 0 var(--surface-edge); }
.free-colors, .free-stickers { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 6px 4px 4px; }
.sticker { flex: none; width: 52px; height: 52px; border-radius: 14px; padding: 6px; background: #fff; box-shadow: inset 0 0 0 2px #EADFCB; }
.sticker svg { width: 100%; height: 100%; }
.sticker[aria-pressed="true"] { background: #FFF1C4; box-shadow: inset 0 0 0 3px #F2A100; transform: translateY(-3px); }
@media (min-width: 700px) { .free-colors, .free-stickers { justify-content: center; flex-wrap: wrap; } }

/* 처음 화면의 마음대로 접기 단추 */
.home-bar .free-chip { margin-right: auto; background: #FFF1C4; box-shadow: 0 5px 0 #E8C75A; }
.home-bar .free-chip svg { width: 26px; height: 26px; }

/* 내 작품: 빼기 단추 */
.pin-del {
  position: absolute; top: 6px; right: 2px; width: 28px; height: 28px; border-radius: 50%; z-index: 2;
  background: rgba(255, 255, 255, .9); color: var(--ink); font-size: 1.1rem; line-height: 1; box-shadow: 0 2px 0 rgba(0, 0, 0, .2);
}
.pin-del.armed { background: var(--accent); color: #fff; }

/* 설명서 인쇄: 단추는 숨기고 한 쪽에 셋씩 */
.page-bar .grow { flex: 1; min-width: 0; }
@media print {
  @page { margin: 12mm; }
  body, #guide { background: #fff !important; }
  #guide { padding: 0 !important; }
  .page-bar .round, .print-btn, .g-play { display: none !important; }
  .g-steps { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .g-step { box-shadow: 0 0 0 1px #ddd; break-inside: avoid; animation: none; }
  .g-step img { background: #F3F7F4; }
}
