* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #14161c; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color: #f3f1ea; display: flex; justify-content: center; align-items: center;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
#app { display: flex; flex-direction: column; width: 100vw; max-width: 100vw; }
#stage { position: relative; width: 100%; overflow: hidden; background: #e9dcc3; }
canvas { display: block; width: 100%; height: 100%; }

/* 만화 스티커 느낌: 굵은 남색 외곽선 + 딱딱한 그림자 + 로고와 같은 통통한 글씨 */
@font-face { font-family: "Lilita One"; src: url("assets/fonts/LilitaOne.ttf") format("truetype"); font-display: swap; }
:root { --ink: #14204a; --pop: #ff4a1c; --sun: #ffd23c; --paper: #fffaf0; --fun: "Lilita One", "Arial Rounded MT Bold", system-ui, sans-serif; }
.hud { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; justify-content: space-between; pointer-events: none; font-family: var(--fun); }
.hud > div { background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 12px; padding: 2px 12px 3px; text-align: center; min-width: 62px; box-shadow: 0 4px 0 var(--ink); }
.hud .score { transform: rotate(-3deg); } .hud .best { transform: rotate(3deg); }
.hud small { display: block; font-size: 10px; letter-spacing: .06em; color: #5a6699; }
.hud b { font-size: 23px; font-weight: 400; font-variant-numeric: tabular-nums; line-height: 1; }

.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; font-family: var(--fun);
  background: radial-gradient(ellipse at 50% 45%, rgba(20,32,74,.35), rgba(8,10,26,.82)); }
.overlay[hidden] { display: none; }
.panel { width: 100%; max-width: 340px; text-align: center; color: #fff; }
.panel h1 { font-size: 0; margin: 0 -6px; }
.logo { display: block; width: 100%; height: auto; filter: drop-shadow(0 7px 0 rgba(8,10,26,.55)); animation: logoBob 2.4s ease-in-out infinite; }
@keyframes logoBob { 0%, 100% { transform: rotate(-2deg) translateY(0); } 50% { transform: rotate(-1deg) translateY(-5px); } }
.ink { -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; }
.tag { margin-top: 4px; font-size: 19px; line-height: 1.2; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }

.tiles { list-style: none; display: flex; gap: 9px; margin: 18px 0 14px; }
.tiles li { flex: 1; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 16px; padding: 9px 4px 8px; box-shadow: 0 5px 0 var(--ink); }
.tiles li:nth-child(1) { transform: rotate(-3deg); } .tiles li:nth-child(2) { transform: translateY(5px) rotate(1.5deg); } .tiles li:nth-child(3) { transform: rotate(3deg); }
.tiles b { display: block; font-weight: 400; font-size: 21px; line-height: 1; margin-top: 7px; color: var(--pop); }
.tiles small { display: block; font-size: 12px; line-height: 1.15; margin-top: 3px; }
.ico { display: flex; align-items: center; justify-content: center; height: 44px; margin: 0 6px; border-radius: 10px; background: #2b2e38; border: 2px solid var(--ink); overflow: hidden; }
.ico img { display: block; width: 78%; height: auto; }
.ico img[src*="eyes"] { width: 100%; }
.flipper { animation: flipper 1.6s ease-in-out infinite; }
@keyframes flipper { 0%, 35% { transform: rotate(0); } 50%, 85% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } }
.ico-drag i { width: 30px; height: 30px; border-radius: 50%; border: 2px dashed rgba(255,255,255,.5); position: relative; }
.ico-drag i::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #5dffb0; left: 6px; top: 6px; animation: dragDot 1.8s ease-in-out infinite; }
@keyframes dragDot { 0%, 100% { transform: translate(-7px, 3px); } 50% { transform: translate(8px, -3px); } }

.tip { font-size: 15px; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.tip em { font-style: normal; color: var(--sun); font-size: 19px; }
.keys { margin-top: 12px; font-size: 12px; color: rgba(255,255,255,.6); font-family: system-ui, sans-serif; }
@media (hover: none) { .keys { display: none; } }

.btn { margin-top: 16px; width: 100%; border: 4px solid var(--ink); border-radius: 18px; background: var(--pop); color: #fff; font: 400 30px/1 var(--fun); letter-spacing: .04em;
  padding: 13px 14px 15px; cursor: pointer; box-shadow: 0 7px 0 var(--ink); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; animation: btnPulse 1.3s ease-in-out infinite; }
.btn:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--ink); animation: none; }
@keyframes btnPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }

/* 결과 화면 */
.stamp { font-weight: 400; font-size: 58px; line-height: .95; text-transform: uppercase; color: var(--pop); -webkit-text-stroke: 9px var(--ink); paint-order: stroke fill;
  transform: rotate(-5deg); text-shadow: 0 7px 0 var(--ink); animation: stampIn .38s cubic-bezier(.2, 1.6, .4, 1) both; }
#endScreen[data-kind="caught"] .stamp { color: var(--sun); }
@keyframes stampIn { from { transform: rotate(-14deg) scale(2.6); opacity: 0; } to { transform: rotate(-5deg) scale(1); opacity: 1; } }
.sub { margin: 16px 6px 0; font-size: 16px; line-height: 1.25; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.result { margin-top: 12px; display: flex; align-items: baseline; justify-content: center; gap: 6px; }
.result b { font-weight: 400; font-size: 84px; line-height: 1; font-variant-numeric: tabular-nums; -webkit-text-stroke: 10px var(--ink); paint-order: stroke fill; text-shadow: 0 7px 0 var(--ink); }
.result small { font-size: 22px; color: var(--sun); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.stat { margin-top: 8px; font-size: 15px; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.rank { display: inline-block; margin-top: 12px; padding: 6px 14px 7px; font-size: 16px; color: var(--ink); background: var(--sun); border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 4px 0 var(--ink); transform: rotate(2deg); }
.rank:empty { display: none; }
#stage { touch-action: none; }
.toggles { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.tg { flex: 1; max-width: 150px; font: 400 15px/1 var(--fun); letter-spacing: .03em; color: var(--ink); background: var(--sun); border: 3px solid var(--ink); border-radius: 12px; padding: 8px 6px 9px; box-shadow: 0 4px 0 var(--ink); cursor: pointer; }
.tg:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.tg.off { background: #8a90a8; color: #2b3152; text-decoration: line-through; }
