:root {
  --grass-1: #22b455;
  --grass-2: #1c9e4a;
  --ink: #26314a;
  --ink-soft: #5b6680;
  --paper: #fffdf7;
  --gold: #ffc400;
  --gold-deep: #e09a00;
  --shadow: 0 6px 0 rgba(0, 0, 0, .18), 0 14px 30px rgba(0, 0, 0, .18);
  --radius: 26px;
  --font: 'Jua', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--grass-2);
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
}
input, textarea, select { -webkit-user-select: text; user-select: text; font-family: var(--font); }
button { font-family: var(--font); cursor: pointer; border: 0; color: inherit; }

/* ---------- 잔디 구장 배경 ---------- */
.field-bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 118px, rgba(255,255,255,.35) 119px 124px, transparent 125px),
    linear-gradient(90deg, transparent calc(50% - 3px), rgba(255,255,255,.35) calc(50% - 3px) calc(50% + 3px), transparent calc(50% + 3px)),
    repeating-linear-gradient(90deg, var(--grass-1) 0 80px, var(--grass-2) 80px 160px);
}

#app { max-width: 1180px; margin: 0 auto; padding: 18px 16px 60px; }

/* ---------- 상단 바 ---------- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 52px; height: 52px; border-radius: 18px;
  background: #fff; font-size: 26px; box-shadow: 0 4px 0 rgba(0,0,0,.2);
  display: grid; place-items: center; transition: transform .12s;
}
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.2); }
.pill-btn {
  padding: 12px 20px; border-radius: 999px; background: #fff; font-size: 20px;
  box-shadow: 0 4px 0 rgba(0,0,0,.2); display: inline-flex; align-items: center; gap: 8px;
}
.pill-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.2); }
.kid-chip {
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 18px 8px 8px;
  border-radius: 999px; background: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.2); font-size: 24px; white-space: nowrap;
}
@media (max-width: 420px) {
  .kid-chip { font-size: 20px; padding-right: 14px; }
  .kid-chip .ava { width: 38px; height: 38px; font-size: 22px; }
  .topbar { gap: 8px; }
  .topbar .icon-btn { width: 46px; height: 46px; font-size: 22px; }
  .topbar .pill-btn { padding: 10px 14px; font-size: 18px; }
}
.kid-chip .ava { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; background: var(--kc); }

/* ---------- 홈 ---------- */
.hero { text-align: center; color: #fff; margin: 18px 0 30px; }
.hero h1 {
  font-size: clamp(40px, 8vw, 68px); margin: 0; letter-spacing: 1px;
  text-shadow: 0 5px 0 #0d6b2e, 0 10px 18px rgba(0,0,0,.25);
}
.hero h1 .ball { display: inline-block; animation: spin 3s linear infinite; }
.hero p { font-size: clamp(20px, 4vw, 28px); margin: 10px 0 0; text-shadow: 0 2px 0 #0d6b2e; }

.kid-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.kid-card {
  position: relative; background: #fff; border-radius: 32px; padding: 26px 18px 22px; text-align: center;
  box-shadow: 0 8px 0 rgba(0,0,0,.2), 0 18px 34px rgba(0,0,0,.18);
  border: 6px solid var(--kc);
  animation: popIn .6s cubic-bezier(.2,1.6,.4,1) both;
  transition: transform .15s;
}
.kid-card:hover { transform: translateY(-4px) rotate(-1deg); }
.kid-card:active { transform: scale(.96); }
.kid-card .ava {
  width: 128px; height: 128px; margin: 0 auto 12px; border-radius: 50%;
  background: var(--kc); display: grid; place-items: center; font-size: 76px;
  box-shadow: inset 0 -8px 0 rgba(0,0,0,.12);
  animation: bob 2.4s ease-in-out infinite;
}
.kid-card .name { font-size: 36px; }
.kid-card .stats { display: flex; justify-content: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.stat { background: #f4f1e8; border-radius: 999px; padding: 6px 14px; font-size: 19px; }
.stat.gold { background: #fff3c4; }
.stat.wait { background: #e5f3ff; }
.kid-card .go {
  margin-top: 16px; display: inline-block; padding: 12px 28px; border-radius: 999px;
  background: var(--kc); color: #fff; font-size: 24px; box-shadow: 0 5px 0 rgba(0,0,0,.2);
  text-shadow: 0 2px 0 rgba(0,0,0,.18);
}

.admin-link { display: block; margin: 40px auto 0; background: rgba(255,255,255,.25); color: #fff; padding: 10px 20px; border-radius: 999px; font-size: 17px; }

/* ---------- 덱 ---------- */
.deck-title { color: #fff; font-size: clamp(28px, 6vw, 42px); text-shadow: 0 4px 0 #0d6b2e; margin: 6px 0 20px; text-align: center; }
.deck {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 26px; justify-items: center;
}
.empty { text-align: center; color: #fff; font-size: 26px; padding: 50px 10px; text-shadow: 0 2px 0 #0d6b2e; }

/* ---------- 미션 카드 ---------- */
.mcard {
  --c: #3fb7ff;
  position: relative; width: 100%; max-width: 320px; aspect-ratio: 5 / 7.4;
  perspective: 1200px;
}
.mcard.deal { animation: deal .7s cubic-bezier(.2,1.4,.4,1) both; animation-delay: calc(var(--i) * 90ms); }
.mcard-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.3,1.4,.5,1); }
.mcard.flipped .mcard-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; border-radius: var(--radius); backface-visibility: hidden; -webkit-backface-visibility: hidden;
  overflow: hidden; box-shadow: var(--shadow);
}
.front {
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 82%, #fff), var(--c) 60%, color-mix(in srgb, var(--c) 75%, #000));
  padding: 12px; display: flex;
}
.front-in {
  flex: 1; background: var(--paper); border-radius: 18px; display: flex; flex-direction: column; overflow: hidden;
  border: 3px solid rgba(0,0,0,.08);
}
.ctop { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px 0; font-size: 15px; color: var(--ink-soft); }
.ctop .tag { background: var(--c); color: #fff; padding: 3px 11px; border-radius: 999px; letter-spacing: 1px; font-size: 14px; }
.ctop .medals { color: var(--gold-deep); font-size: 16px; }

.art {
  position: relative; margin: 8px 12px 0; border-radius: 14px; height: 36%; min-height: 120px; overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 34px, rgba(255,255,255,.5) 35px 38px, transparent 39px),
    linear-gradient(90deg, transparent calc(50% - 2px), rgba(255,255,255,.5) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)),
    repeating-linear-gradient(90deg, #36c56a 0 26px, #2bb35c 26px 52px);
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 3px rgba(0,0,0,.06);
}
.art .emoji { font-size: clamp(64px, 18vw, 86px); filter: drop-shadow(0 6px 0 rgba(0,0,0,.18)); animation: bob 2.2s ease-in-out infinite; }
.art .sparkle { position: absolute; font-size: 20px; animation: twinkle 1.8s ease-in-out infinite; }
.art .sparkle.s1 { top: 10px; left: 14px; }
.art .sparkle.s2 { bottom: 12px; right: 16px; animation-delay: .6s; }
.art .sparkle.s3 { top: 14px; right: 26px; animation-delay: 1.1s; font-size: 14px; }

.cname {
  text-align: center; font-size: clamp(24px, 6vw, 28px); margin: 8px 8px 2px; line-height: 1.1;
  color: color-mix(in srgb, var(--c) 70%, #000);
}
.missions { flex: 1; padding: 4px 14px 0; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.mission { background: #f6f2e6; border-radius: 14px; padding: 8px 10px; }
.mission .mtext { font-size: 18px; display: flex; justify-content: space-between; gap: 6px; }
.mission .mtext b { color: color-mix(in srgb, var(--c) 70%, #000); font-weight: normal; white-space: nowrap; }
.balls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.ball-btn {
  width: 40px; height: 40px; border-radius: 50%; font-size: 26px; display: grid; place-items: center;
  background: #fff; border: 3px dashed #c9c2ad; padding: 0; transition: transform .15s;
}
.ball-btn.on { border: 3px solid var(--c); background: color-mix(in srgb, var(--c) 18%, #fff); }
.ball-btn span { display: inline-block; }
.ball-btn.pop span { animation: ballPop .5s cubic-bezier(.2,1.8,.4,1); }
.ball-btn:not(.on) span { opacity: .18; filter: grayscale(1); }
.ball-btn.next { animation: nudge 1.4s ease-in-out infinite; border-color: var(--c); }
.ball-btn:active { transform: scale(.85); }
.undo-btn { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; background: #e9e4d6; font-size: 18px; color: var(--ink-soft); }
.counter { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.counter .num { font-size: 26px; min-width: 70px; text-align: center; }
.counter .plus { width: 54px; height: 44px; border-radius: 14px; background: var(--c); color: #fff; font-size: 28px; box-shadow: 0 4px 0 rgba(0,0,0,.2); }
.counter .plus:active { transform: translateY(3px); box-shadow: none; }
.bar { height: 10px; border-radius: 6px; background: #e3ddcb; overflow: hidden; flex: 1; }
.bar i { display: block; height: 100%; background: var(--c); border-radius: 6px; transition: width .4s cubic-bezier(.2,1.4,.4,1); }

.cfoot { padding: 10px 14px 14px; }
.done-btn {
  width: 100%; padding: 14px; border-radius: 16px; font-size: 24px; color: #fff;
  background: linear-gradient(180deg, #ff8a3d, #ff5a5f); box-shadow: 0 5px 0 #c4373b;
  text-shadow: 0 2px 0 rgba(0,0,0,.2); animation: pulse 1s ease-in-out infinite;
}
.done-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #c4373b; }
.hint { text-align: center; font-size: 17px; color: var(--ink-soft); padding: 6px 0 2px; }

.mcard.full .front { animation: glow 1.4s ease-in-out infinite; }

/* 확인 대기 */
.overlay-state {
  position: absolute; inset: 0; border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 6px; padding: 20px; z-index: 3;
}
.pending .overlay-state { background: rgba(38, 49, 74, .55); color: #fff; backdrop-filter: blur(1.5px); }
.pending .overlay-state .big { font-size: 64px; animation: wobble 1.6s ease-in-out infinite; }
.pending .overlay-state .t { font-size: 26px; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.pending .overlay-state .s { font-size: 18px; opacity: .9; }

/* 잠김 */
.locked .front { filter: grayscale(.85) brightness(.9); }
.locked .overlay-state { background: rgba(255,255,255,.35); }
.locked .overlay-state .big { font-size: 70px; animation: shakeLock 2.6s ease-in-out infinite; }
.locked .overlay-state .t { font-size: 22px; background: #fff; padding: 8px 14px; border-radius: 14px; box-shadow: 0 4px 0 rgba(0,0,0,.15); }

/* 완료: 황금 카드 */
.done .front { background: linear-gradient(135deg, #fff1a8, #ffc400 30%, #ffdf5e 50%, #e09a00 75%, #ffe680); }
.done .front::after {
  content: ''; position: absolute; inset: -40%; pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.75) 50%, transparent 60%);
  animation: shine 3.2s ease-in-out infinite;
}
.stamp {
  position: absolute; z-index: 4; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-14deg);
  border: 6px solid #e8333a; color: #e8333a; border-radius: 16px; padding: 4px 16px 2px; font-size: 40px;
  background: rgba(255,255,255,.88); letter-spacing: 2px; text-align: center; line-height: 1;
  animation: stampIn .5s cubic-bezier(.2,1.8,.4,1) both;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.stamp small { display: block; font-size: 16px; letter-spacing: 0; margin-top: 3px; }
.done .missions { opacity: .55; }
.again { text-align: center; font-size: 16px; color: #8a6a00; padding: 4px 0 0; }

/* 카드 뒷면 */
.back {
  transform: rotateY(180deg);
  background: repeating-linear-gradient(45deg, var(--c) 0 18px, color-mix(in srgb, var(--c) 80%, #000) 18px 36px);
  display: grid; place-items: center; border: 10px solid #fff;
}
.back .logo { width: 62%; aspect-ratio: 1; background: #fff; border-radius: 50%; display: grid; place-items: center; font-size: 80px; box-shadow: 0 6px 0 rgba(0,0,0,.2); }

/* ---------- 메달 모음 ---------- */
.shelf { background: rgba(255,255,255,.95); border-radius: 30px; padding: 24px 16px; box-shadow: var(--shadow); }
.shelf h2 { text-align: center; margin: 0 0 6px; font-size: 32px; font-weight: normal; }
.shelf .sub { text-align: center; color: var(--ink-soft); font-size: 20px; margin-bottom: 18px; }
.medal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px; }
.medal { text-align: center; animation: popIn .5s cubic-bezier(.2,1.6,.4,1) both; animation-delay: calc(var(--i) * 70ms); }
.medal .coin {
  position: relative; width: 110px; height: 110px; margin: 0 auto; border-radius: 50%;
  display: grid; place-items: center; font-size: 54px;
  background: radial-gradient(circle at 35% 30%, #fff6c9, #ffd23f 40%, #e09a00 80%);
  border: 6px solid #fff0a0; box-shadow: 0 6px 0 #b67b00, 0 10px 18px rgba(0,0,0,.2);
  overflow: hidden;
}
.medal .coin::after {
  content: ''; position: absolute; inset: -30%;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.8) 50%, transparent 58%);
  animation: shine 3s ease-in-out infinite; animation-delay: calc(var(--i) * 300ms);
}
.medal .ribbon { width: 54px; height: 26px; margin: -6px auto 0; background: linear-gradient(90deg, var(--c) 50%, color-mix(in srgb, var(--c) 70%, #000) 50%); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 70%, 0 100%); }
.medal .mname { font-size: 19px; margin-top: 6px; }
.medal .count { display: inline-block; background: #fff3c4; color: #8a6a00; padding: 2px 10px; border-radius: 999px; font-size: 16px; margin-top: 4px; }
.medal.none .coin { background: #e6e1d3; border-color: #f3efe4; box-shadow: 0 6px 0 #c4bda9; filter: grayscale(1); }
.medal.none .coin span { opacity: .25; }
.medal.none .coin::after { display: none; }
.medal.none .ribbon { background: #cfc8b5; }
.medal.none .mname { color: #a59f8e; }

/* ---------- 모달 / 키패드 ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(20, 30, 50, .55); z-index: 50; display: grid; place-items: center; padding: 16px;
  animation: fadeIn .2s both;
}
.modal {
  background: #fff; border-radius: 28px; width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow: auto;
  padding: 24px; box-shadow: var(--shadow); animation: popIn .4s cubic-bezier(.2,1.6,.4,1) both;
}
.modal.wide { max-width: 860px; }
.modal h3 { margin: 0 0 14px; font-size: 26px; font-weight: normal; text-align: center; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 6px 0 18px; }
.pin-dots i { width: 20px; height: 20px; border-radius: 50%; background: #e3ddcb; transition: transform .15s, background .15s; }
.pin-dots i.on { background: var(--grass-2); transform: scale(1.15); }
.pin-dots.err { animation: shake .4s; }
.pin-dots.err i { background: #ff5a5f; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { height: 66px; border-radius: 18px; background: #f4f1e8; font-size: 30px; box-shadow: 0 4px 0 #d9d2bd; }
.keypad button:active { transform: translateY(3px); box-shadow: 0 1px 0 #d9d2bd; }
.keypad .muted { background: transparent; box-shadow: none; font-size: 20px; color: var(--ink-soft); }

/* ---------- 축하 오버레이 ---------- */
.celebrate {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(circle, rgba(255,230,120,.95), rgba(255,160,0,.92) 60%, rgba(220,90,0,.95));
  animation: fadeIn .3s both; padding: 16px; text-align: center;
}
.celebrate .rays {
  position: absolute; width: 200vmax; height: 200vmax; left: 50%; top: 50%; translate: -50% -50%;
  background: repeating-conic-gradient(rgba(255,255,255,.22) 0 10deg, transparent 10deg 20deg);
  animation: spin 18s linear infinite; pointer-events: none;
}
.celebrate h2 { position: relative; margin: 0; font-size: clamp(38px, 9vw, 70px); font-weight: normal; color: #fff; text-shadow: 0 5px 0 #b35a00, 0 10px 20px rgba(0,0,0,.25); animation: bounceIn .9s cubic-bezier(.2,1.8,.4,1) both .2s; }
.celebrate .big-medal { position: relative; animation: medalDrop 1.1s cubic-bezier(.2,1.6,.4,1) both .4s; }
.celebrate .big-medal .coin { width: min(56vw, 230px); height: min(56vw, 230px); font-size: min(28vw, 120px); border-width: 10px; }
.celebrate .big-medal .ribbon { width: 110px; height: 50px; }
.celebrate p { position: relative; margin: 0; font-size: clamp(22px, 5vw, 32px); color: #fff; text-shadow: 0 3px 0 #b35a00; animation: fadeUp .6s both 1s; }
.celebrate .pill-btn { position: relative; font-size: 26px; padding: 16px 34px; animation: fadeUp .6s both 1.3s; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

#toast {
  position: fixed; left: 50%; bottom: 28px; translate: -50% 0; z-index: 80; background: var(--ink); color: #fff;
  padding: 12px 22px; border-radius: 999px; font-size: 19px; opacity: 0; transform: translateY(20px); transition: .25s; pointer-events: none;
  max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: none; }

/* ---------- 관리자 ---------- */
.admin { background: #fff; border-radius: 28px; padding: 18px; box-shadow: var(--shadow); }
.admin h2 { margin: 0; font-size: 28px; font-weight: normal; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 18px; }
.tabs button { padding: 10px 16px; border-radius: 999px; background: #f4f1e8; font-size: 18px; }
.tabs button.on { background: var(--grass-2); color: #fff; }
.tabs .badge { background: #ff5a5f; color: #fff; border-radius: 999px; padding: 0 8px; margin-left: 4px; font-size: 15px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; background: #faf8f1; margin-bottom: 10px; flex-wrap: wrap; }
.row .em { font-size: 34px; width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 25%, #fff); }
.row .info { flex: 1; min-width: 160px; }
.row .info .t { font-size: 21px; }
.row .info .s { font-size: 16px; color: var(--ink-soft); font-family: system-ui, sans-serif; margin-top: 2px; }
.row .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.btn { padding: 10px 16px; border-radius: 14px; font-size: 17px; background: #ece7d9; box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn.primary { background: var(--grass-2); color: #fff; }
.btn.ok { background: #2ecc71; color: #fff; }
.btn.warn { background: #ffb020; color: #fff; }
.btn.danger { background: #ff5a5f; color: #fff; }
.btn.sm { padding: 7px 11px; font-size: 15px; border-radius: 11px; }
.btn[disabled] { opacity: .35; pointer-events: none; }
.muted-note { color: var(--ink-soft); font-size: 17px; text-align: center; padding: 24px 0; }

.form { display: grid; gap: 14px; }
.form label.f { display: grid; gap: 6px; font-size: 17px; color: var(--ink-soft); }
.form input[type=text], .form input[type=number], .form input[type=password] {
  font-size: 20px; padding: 11px 14px; border-radius: 14px; border: 2px solid #e3ddcb; background: #fffdf7; color: var(--ink); width: 100%;
}
.form input:focus { outline: none; border-color: var(--grass-2); }
.edit-layout { display: grid; grid-template-columns: 1fr 280px; gap: 22px; align-items: start; }
.edit-layout .preview { position: sticky; top: 0; }
.edit-layout .preview .mcard { margin: 0 auto; max-width: 280px; }
.emoji-pick, .color-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-pick button { width: 44px; height: 44px; font-size: 24px; border-radius: 12px; background: #f4f1e8; }
.emoji-pick button.on { background: #fff3c4; outline: 3px solid var(--gold); }
.color-pick button { width: 38px; height: 38px; border-radius: 50%; background: var(--sw); }
.color-pick button.on { outline: 4px solid var(--ink); outline-offset: 2px; }
.mrow { display: grid; grid-template-columns: 1fr 86px 44px; gap: 8px; align-items: center; }
.mrow .x { height: 44px; border-radius: 12px; background: #ffe1e1; color: #d33; font-size: 20px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: #f4f1e8; font-size: 18px; color: var(--ink); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--grass-2); }
.check.on { background: #dff5e6; }
.form-acts { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.grid-table { overflow-x: auto; }
.grid-table table { border-collapse: separate; border-spacing: 6px; width: 100%; min-width: 520px; }
.grid-table th { font-weight: normal; font-size: 17px; color: var(--ink-soft); text-align: left; padding: 4px 6px; }
.grid-table td { background: #faf8f1; border-radius: 12px; padding: 8px; font-size: 16px; vertical-align: top; }
.grid-table td .st { display: block; margin-bottom: 6px; }
.ava:has(.ava-img) { background: color-mix(in srgb, var(--kc) 22%, #fff) !important; border: 4px solid var(--kc); }
.kid-chip .ava:has(.ava-img) { border-width: 2px; }
.order-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.order-bar .spacer { flex: 1; }
.order-label { font-size: 17px; color: var(--ink-soft); }
.order-bar .check .ava-img { width: 1.3em; height: 1.3em; display: inline-block; vertical-align: -0.3em; }
.order-note { font-size: 16px; color: var(--ink-soft); background: #f6f9ff; border-radius: 14px; padding: 10px 14px; margin-bottom: 12px; line-height: 1.6; }
.order-note .ava-img { width: 1.4em; height: 1.4em; display: inline-block; vertical-align: -0.35em; }
.order-note b { color: var(--ink); font-weight: normal; }
.hidden-tag { font-size: 14px; background: #eceaf3; color: #6a6480; padding: 2px 8px; border-radius: 999px; vertical-align: 2px; }
.ava-img { width: 86%; height: 86%; object-fit: contain; display: block; }
.row .info .t .ava-img, .grid-table th .ava-img, .check .ava-img { width: 1.3em; height: 1.3em; display: inline-block; vertical-align: -0.3em; }
.kid-edit { display: grid; grid-template-columns: 96px 1fr 60px; gap: 8px; align-items: center; }

@media (max-width: 720px) {
  .edit-layout { grid-template-columns: 1fr; }
  .edit-layout .preview { position: static; order: -1; }
  .edit-layout .preview .mcard { max-width: 230px; }
  .modal { padding: 18px; }
  .deck { gap: 20px; }
}

/* ---------- 애니메이션 ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
@keyframes popIn { from { opacity: 0; transform: scale(.6) translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes deal { from { opacity: 0; transform: translateY(-60px) rotate(-12deg) scale(.7); } to { opacity: 1; transform: none; } }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.4) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(30deg); } }
@keyframes ballPop { 0% { transform: scale(.2) rotate(-180deg); } 70% { transform: scale(1.35) rotate(20deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes nudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes glow { 0%, 100% { box-shadow: var(--shadow), 0 0 0 0 rgba(255, 196, 0, .0); } 50% { box-shadow: var(--shadow), 0 0 0 10px rgba(255, 196, 0, .65); } }
@keyframes wobble { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
@keyframes shakeLock { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-14deg); } 90% { transform: rotate(14deg); } 95% { transform: rotate(-8deg); } }
@keyframes shine { 0% { transform: translateX(-60%); } 60%, 100% { transform: translateX(60%); } }
@keyframes stampIn { from { opacity: 0; transform: translate(-50%, -50%) rotate(-14deg) scale(2.6); } to { opacity: 1; transform: translate(-50%, -50%) rotate(-14deg) scale(1); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } }
@keyframes bounceIn { 0% { opacity: 0; transform: scale(.3); } 60% { opacity: 1; transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes medalDrop { 0% { opacity: 0; transform: translateY(-120vh) rotate(-30deg); } 70% { opacity: 1; transform: translateY(10px) rotate(6deg); } 100% { transform: none; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
@keyframes cardShake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-3deg) scale(1.03); } 75% { transform: rotate(3deg) scale(1.03); } }
.mcard.shake { animation: cardShake .45s ease-in-out 2; }

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