:root {
  --navy: #183B5B;
  --reward: #FFB45A;
  --panel: #EEF8FF;
  --font: 'Jua', 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; position: fixed; inset: 0;
  background: linear-gradient(#9CD3F5, #F2FAFF);
  touch-action: none; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  font-family: var(--font); color: var(--navy);
}
#safe { position: fixed; pointer-events: none; visibility: hidden; top: env(safe-area-inset-top); right: env(safe-area-inset-right); bottom: env(safe-area-inset-bottom); left: env(safe-area-inset-left); }
#root { position: absolute; left: 0; top: 0; width: 540px; height: 960px; transform-origin: 0 0; overflow: hidden; box-shadow: 0 0 40px rgba(24,59,91,.25); }
#game { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
img { -webkit-user-drag: none; pointer-events: none; }
button {
  font-family: var(--font); border: 0; cursor: pointer; color: var(--navy); background: none; padding: 0;
  touch-action: manipulation; transition: transform 70ms, filter 70ms;
}
button:active { transform: translateY(3px); }
.ico { display: inline-block; width: 26px; height: 26px; background: center/contain no-repeat; vertical-align: -4px; }
.ico-crown { background-image: url("lib/ui/crown.webp?v=202611202135"); }
.ico-sound { display: inline-block; width: 26px; height: 26px; background: center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='%23fff'/%3E%3Cpath d='M16 8.5c1.6 1.8 1.6 5.2 0 7M18.5 6c3 3.2 3 8.8 0 12' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.muted .ico-sound { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='%23fff'/%3E%3Cpath d='M16 9l5 6M21 9l-5 6' stroke='%23fff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }

/* 터치 영역 */
#touch { position: absolute; inset: 0; display: flex; }
.pad { flex: 1; position: relative; touch-action: none; }
.pad img { position: absolute; bottom: calc(18px + var(--safe-b, 0px)); width: 92px; height: 92px; object-fit: contain; opacity: .8; filter: drop-shadow(0 4px 4px rgba(24,59,91,.3)); transition: transform 60ms, opacity 60ms; }
#padL img { left: 22px; }
#padR img { right: 22px; }
.pad.down img { transform: scale(.88); opacity: 1; }
/* 점프하기 버튼 (가운데, 아이템이 있을 때만) */
.jump { position: absolute; left: 50%; bottom: calc(14px + var(--safe-b, 0px)); width: 118px; height: 120px; margin-left: -59px; padding: 0; z-index: 2; touch-action: none;
  background: url("assets/ui/btn_jump.webp?v=202611202135") center/contain no-repeat; filter: drop-shadow(0 6px 6px rgba(24,59,91,.35)); }
.jump:active { transform: scale(.92); }
.jump span { position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); background: #fff; color: #C2620A; font-size: 19px; padding: 1px 12px; border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,.2); white-space: nowrap; }
.jump i { position: absolute; top: -6px; right: -6px; min-width: 40px; height: 40px; padding: 0 8px; border-radius: 20px; background: #FF5C7A; color: #fff; border: 3px solid #fff; font-style: normal; font-size: 24px; line-height: 34px; text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.jump.pop { animation: jpop 380ms; }
@keyframes jpop { 40% { transform: scale(1.18); } }

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; }
.hud-top { position: absolute; left: 14px; right: 14px; top: calc(12px + var(--safe-t, 0px)); display: flex; align-items: center; gap: 8px; }
.hud-sub { position: absolute; left: 14px; right: 14px; top: calc(72px + var(--safe-t, 0px)); display: flex; align-items: center; gap: 8px; }
.img-btn { pointer-events: auto; width: 52px; height: 52px; flex: 0 0 52px; }
.img-btn img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(24,59,91,.3)); }
.pill {
  background: rgba(24,40,62,.84); color: #fff; border-radius: 12px; padding: 4px 12px 4px 8px;
  font-size: 24px; display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 8px rgba(24,59,91,.25); border: 2px solid rgba(255,255,255,.25);
}
.pill b { font-weight: normal; }
.pill img { width: 28px; height: 28px; object-fit: contain; }
.pill.dist { min-width: 120px; }
.pill.coins { min-width: 84px; }
.best { font-size: 17px; color: #FFD34D; text-shadow: 0 2px 0 #8A4A0E, 0 0 6px rgba(0,0,0,.35); }
.best b { font-weight: normal; }
.hearts { margin-left: auto; display: flex; gap: 2px; }
.heart { width: 34px; height: 32px; background: center/contain no-repeat; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.heart.pop { animation: pop 380ms; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.buffs { margin-left: auto; display: flex; gap: 6px; }
.buff { background: rgba(255,255,255,.88); border-radius: 12px; padding: 2px 8px 2px 4px; font-size: 15px; display: flex; align-items: center; gap: 3px; }
.buff i { width: 22px; height: 22px; background: center/contain no-repeat; display: inline-block; }

/* screens */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(20px + var(--safe-t, 0px)) 24px calc(20px + var(--safe-b, 0px)); }
.screen.dim { background: rgba(24,40,62,.5); }
#home { background: linear-gradient(#9CD3F5, #F2FAFF); gap: 10px; }
.home-art img { width: 380px; max-width: 100%; height: auto; border-radius: 24px; border: 4px solid #fff; box-shadow: 0 8px 20px rgba(24,59,91,.25); display: block; }
.label { font-size: 22px; }
.chars { display: flex; gap: 14px; }
.char { width: 130px; padding: 8px; border-radius: 20px; background: #fff; border: 4px solid transparent; font-size: 20px; box-shadow: 0 4px 0 #CDE6FA; }
.char img { width: 80px; height: 96px; object-fit: contain; display: block; margin: 0 auto 2px; }
.char[data-char="eunyu"].on { border-color: #FF8FB5; background: #FFF0F6; }
.char[data-char="eungyeol"].on { border-color: #4FA3F0; background: #EEF6FF; }
.char:not(.on) img { filter: saturate(.5) opacity(.7); }
.btn-start {
  width: 320px; height: 70px; border-radius: 35px; font-size: 32px; letter-spacing: 1px; color: #fff;
  background: linear-gradient(#FFD36B, #FF9F2E); text-shadow: 0 2px 0 #C76A12;
  box-shadow: 0 6px 0 #D9761A, 0 10px 16px rgba(217,118,26,.35); border: 3px solid #FFF3D6;
}
.btn-start.small { width: auto; height: 58px; font-size: 26px; padding: 0 30px; }
.btn-sub { height: 50px; padding: 0 22px; border-radius: 25px; font-size: 21px; background: #fff; box-shadow: 0 4px 0 #B7D7F0; border: 2px solid #CDE6FA; }
.round { width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(#7CC0F2, #4A97D8); box-shadow: 0 4px 0 #2F6FA8; display: grid; place-items: center; }
.home-row, .row { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 10px; }
.home-stats { font-size: 19px; display: flex; align-items: center; gap: 4px; }
.home-stats img { width: 24px; }
.home-stats b { font-weight: normal; color: #D9761A; }

.panel { background: var(--panel); border-radius: 28px; padding: 22px 30px; text-align: center; min-width: 360px; box-shadow: 0 10px 30px rgba(24,59,91,.4); border: 4px solid #fff; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.panel.wood { background: linear-gradient(#FFF4DC, #F6DDB0); border: 6px solid #B9783F; box-shadow: 0 0 0 3px #7A4A22, 0 12px 30px rgba(0,0,0,.4); }
.p-title { font-size: 40px; color: #7A3E14; text-shadow: 0 2px 0 #fff; }
.panel:not(.wood) .p-title { color: var(--reward); text-shadow: 0 3px 0 #B5600F; }
.res-face { width: 110px; height: 120px; object-fit: contain; }
.res-table { width: 300px; background: #fff; border-radius: 16px; padding: 6px 16px; box-shadow: inset 0 0 0 2px #F0D9B0; }
.res-table > div { display: flex; justify-content: space-between; align-items: center; font-size: 20px; padding: 5px 0; border-bottom: 1px solid #F3E6CC; }
.res-table > div:last-child { border-bottom: 0; }
.res-table b { font-weight: normal; display: flex; align-items: center; gap: 5px; color: #D9761A; font-size: 22px; }
.res-table i { font-style: normal; }
.res-table img { width: 24px; height: 24px; object-fit: contain; }
.badge { font-style: normal; font-size: 17px; background: #FF5C7A; color: #fff; border-radius: 10px; padding: 2px 10px; animation: pop 600ms infinite alternate; display: inline-block; }
.earn { font-size: 21px; color: #C25E12; }
.earn small { display: block; font-size: 15px; color: var(--navy); opacity: .75; }
.btn-orange, .btn-blue { width: 260px; height: 56px; border-radius: 18px; font-size: 25px; color: #fff; border: 3px solid rgba(255,255,255,.7); }
.btn-orange { background: linear-gradient(#FFD36B, #FF9F2E); box-shadow: 0 5px 0 #D9761A; text-shadow: 0 2px 0 #C76A12; }
.btn-blue { background: linear-gradient(#6FC0FF, #2F86E8); box-shadow: 0 5px 0 #1D5DAB; }

/* PC 가로 화면 */
#root.wide { box-shadow: none; }
#root.wide .hud-top, #root.wide .hud-sub { left: 30px; right: 30px; }
#root.wide .pad img { opacity: 0; }
