/* 벨리 범프 화면 스타일 */
:root {
  --ink: #3a2a5c; --pink: #ff5f9e; --pink2: #ff8fb8; --yellow: #ffd84a; --blue: #4aa8ff; --mint: #6fdcae;
  --panel: rgba(255, 255, 255, 0.92); --shadow: 0 6px 0 rgba(58, 42, 92, 0.18), 0 12px 30px rgba(58, 42, 92, 0.18);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Arial Rounded MT Bold", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fd8ff; color: var(--ink); font-family: var(--font); font-weight: 700; }
body { touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
#app { position: fixed; inset: 0; }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font-family: var(--font); font-weight: 800; color: var(--ink); cursor: pointer; border: 0; }

/* ── 메뉴 ── */
.wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-start; padding: max(16px, env(safe-area-inset-top)) 16px 16px max(5vw, 16px); pointer-events: none; }
.panel { pointer-events: auto; background: var(--panel); border-radius: 28px; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
.menu-card { width: min(400px, 100%); max-height: 100%; overflow-y: auto; padding: 18px 22px 16px; display: flex; flex-direction: column; align-items: stretch; gap: 9px; scrollbar-width: none; }
.logo { margin: 0; text-align: center; font-size: 46px; line-height: 1; letter-spacing: -1px; font-weight: 900; }
.logo span:first-child { color: var(--pink); text-shadow: 0 4px 0 #c93d78; }
.logo span:last-child { color: var(--yellow); text-shadow: 0 4px 0 #d39c12; -webkit-text-stroke: 1.5px #d39c12; }
.tag { text-align: center; font-size: 15px; opacity: 0.75; margin-top: -2px; }
.pick { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
#previewBox { flex: 1; height: 170px; border-radius: 22px; background: radial-gradient(circle at 50% 70%, #fff 0%, #ffeaf3 60%, #ffd9ea 100%); }
.arrow { width: 44px; height: 64px; border-radius: 16px; background: #fff0f6; font-size: 20px; color: var(--pink); box-shadow: 0 3px 0 #f3c6d9; }
.arrow:active { transform: translateY(2px); box-shadow: none; }
.aname { text-align: center; font-size: 22px; font-weight: 900; }
#swatches { display: flex; justify-content: center; gap: 10px; }
#swatches button { width: 32px; height: 32px; border-radius: 50%; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15); outline: 3px solid transparent; outline-offset: 2px; }
#swatches button.on { outline-color: var(--ink); }
#nick { font-family: var(--font); font-weight: 800; font-size: 18px; color: var(--ink); text-align: center; padding: 11px; border-radius: 16px; border: 3px solid #f1dcea; background: #fff; outline: none; }
#nick:focus { border-color: var(--pink2); }
.big { font-size: 20px; padding: 13px; border-radius: 18px; background: #fff; box-shadow: 0 5px 0 #e6d6ea; transition: transform 0.08s; }
.big.primary { background: linear-gradient(#ff7cb0, #ff5f9e); color: #fff; box-shadow: 0 5px 0 #c93d78; }
.big:active { transform: translateY(3px); box-shadow: 0 2px 0 #c93d78; }
.how { margin: 2px 0 0; padding-left: 18px; font-size: 12.5px; opacity: 0.75; line-height: 1.45; }
.row { display: flex; gap: 8px; justify-content: center; }
.row .big { flex: 1; }
.small { font-size: 13px; padding: 7px 14px; border-radius: 12px; background: #f6eef8; }

/* ── HUD ── */
#hud { position: absolute; inset: 0; pointer-events: none; }
.card { background: rgba(255, 255, 255, 0.86); border-radius: 18px; box-shadow: 0 4px 0 rgba(58, 42, 92, 0.15); }
#meCard { position: absolute; left: max(10px, env(safe-area-inset-left)); top: max(10px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; }
#meCard .ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; }
.mass .lbl { font-size: 12px; opacity: 0.8; } .mass .lbl b { font-size: 15px; opacity: 1; }
.bar { width: 96px; height: 10px; border-radius: 6px; background: #eee3f2; overflow: hidden; margin-top: 3px; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--mint), var(--yellow), var(--pink)); border-radius: 6px; transition: width 0.3s; }
.kos { display: flex; flex-direction: column; align-items: center; min-width: 38px; }
.kos b { font-size: 24px; line-height: 1; color: var(--pink); } .kos span { font-size: 11px; opacity: 0.7; }
#feed { position: absolute; left: max(10px, env(safe-area-inset-left)); top: calc(max(10px, env(safe-area-inset-top)) + 66px); display: flex; flex-direction: column; gap: 4px; max-width: 46vw; }
#feed div { background: rgba(58, 42, 92, 0.62); color: #fff; font-size: 12.5px; padding: 4px 10px; border-radius: 10px; animation: feedIn 0.25s ease-out; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#feed div.me { background: rgba(255, 95, 158, 0.85); }
#feed .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: 0; }
@keyframes feedIn { from { transform: translateX(-20px); opacity: 0; } }
#top { position: absolute; left: 50%; top: max(10px, env(safe-area-inset-top)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pill { background: rgba(255, 255, 255, 0.9); padding: 5px 16px; border-radius: 999px; font-size: 22px; font-weight: 900; box-shadow: 0 4px 0 rgba(58, 42, 92, 0.15); font-variant-numeric: tabular-nums; }
.pill.rush { background: var(--pink); color: #fff; animation: pulse 0.6s infinite alternate; }
#phase { font-size: 14px; font-weight: 900; color: #fff; background: rgba(58, 42, 92, 0.6); padding: 3px 12px; border-radius: 10px; text-align: center; }
#phase:empty { display: none; }
@keyframes pulse { to { transform: scale(1.08); } }
#board { position: absolute; right: max(10px, env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top)); padding: 7px 10px; min-width: 150px; font-size: 13px; }
#board .r { display: flex; gap: 6px; align-items: center; padding: 1px 0; }
#board .r.me { color: var(--pink); }
#board .n { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
#board .rk { width: 16px; opacity: 0.6; } #board .s { font-variant-numeric: tabular-nums; }
#board .sep { height: 1px; background: #eadff0; margin: 3px 0; }
#callouts { position: absolute; left: 0; right: 0; top: 24%; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.call { font-size: 44px; font-weight: 900; color: #fff; -webkit-text-stroke: 2px var(--ink); text-shadow: 0 5px 0 var(--ink); animation: pop 1.3s ease-out forwards; letter-spacing: 1px; white-space: nowrap; }
.call.huge { font-size: 64px; color: var(--yellow); }
.call.bad { color: #ffb3c6; font-size: 34px; }
.call.small { font-size: 26px; color: #d8f2ff; }
@keyframes pop { 0% { transform: scale(0.2) rotate(-8deg); opacity: 0; } 14% { transform: scale(1.25) rotate(3deg); opacity: 1; } 26% { transform: scale(1) rotate(0); } 80% { opacity: 1; } 100% { transform: translateY(-30px) scale(0.95); opacity: 0; } }
#center { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); font-size: 22px; font-weight: 900; color: #fff; text-shadow: 0 3px 0 rgba(58, 42, 92, 0.6); text-align: center; white-space: nowrap; }
#hint { position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: rgba(58, 42, 92, 0.55); color: #fff; padding: 6px 14px; border-radius: 12px; font-size: 14px; transition: opacity 0.6s; white-space: nowrap; }
#vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(255, 60, 90, 0) 58%, rgba(255, 60, 90, 0.5) 100%); opacity: 0; transition: opacity 0.2s; }
#hudBtns { position: absolute; right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); display: flex; gap: 8px; pointer-events: auto; }
.hudbtn { width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); font-size: 18px; box-shadow: 0 3px 0 rgba(58, 42, 92, 0.15); }
#joy { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); border: 3px solid rgba(255, 255, 255, 0.6); opacity: 0; transition: opacity 0.15s; }
#joy.on { opacity: 1; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; border-radius: 50%; background: rgba(255, 255, 255, 0.9); transform: translate(-50%, -50%); box-shadow: 0 3px 0 rgba(58, 42, 92, 0.2); }
#dashBtn { display: none; position: absolute; right: calc(max(16px, env(safe-area-inset-right)) + 10px); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 60px); width: 116px; height: 116px; border-radius: 50%; background: rgba(255, 95, 158, 0.85); color: #fff; font-size: 20px; pointer-events: auto; box-shadow: 0 6px 0 #c93d78; }
#dashBtn.on { transform: scale(0.94); box-shadow: 0 2px 0 #c93d78; }
#dashBtn svg { position: absolute; inset: 0; transform: rotate(-90deg); }
#dashBtn .bg { fill: none; stroke: rgba(255, 255, 255, 0.3); stroke-width: 7; }
#dashBtn .fg { fill: none; stroke: var(--yellow); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 276.5; stroke-dashoffset: 276.5; }
#dashBtn span { position: relative; }
body.touch #dashBtn { display: block; }
body.touch #hudBtns { bottom: auto; top: calc(max(10px, env(safe-area-inset-top)) + 0px); right: calc(max(10px, env(safe-area-inset-right)) + 172px); }

/* ── 결과 ── */
#results .wrap, #results { justify-content: center; }
.res-card { width: min(420px, 100%); padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; max-height: 100%; overflow-y: auto; }
.res-title { text-align: center; font-size: 34px; font-weight: 900; color: var(--pink); }
.res-sub { text-align: center; font-size: 16px; opacity: 0.8; }
#resList { margin: 4px 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
#resList li { display: flex; gap: 8px; align-items: center; background: #faf3fb; padding: 6px 10px; border-radius: 12px; font-size: 15px; }
#resList li.me { background: #ffe1ee; color: #c93d78; }
#resList li .n { flex: 1; } #resList li .k { opacity: 0.7; font-size: 13px; }
#resList li .rk { width: 22px; text-align: center; font-weight: 900; }
.res-next { text-align: center; font-size: 14px; opacity: 0.7; }

#toast { position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%); background: rgba(58, 42, 92, 0.85); color: #fff; padding: 10px 18px; border-radius: 14px; font-size: 15px; opacity: 0; transition: opacity 0.3s; pointer-events: none; text-align: center; max-width: 90vw; }
#toast.on { opacity: 1; }
#loading { position: absolute; inset: 0; display: grid; place-items: center; background: #9fd8ff; transition: opacity 0.4s; }
#loading .dot { width: 48px; height: 48px; border-radius: 50%; background: var(--pink); animation: bounce 0.6s infinite alternate ease-in; }
@keyframes bounce { to { transform: translateY(-30px) scaleY(1.1); } }

/* 세로 화면: 메뉴를 가운데, HUD를 작게 */
@media (max-aspect-ratio: 1/1) {
  .wrap { justify-content: center; padding-left: 16px; align-items: flex-end; }
  .menu-card { width: 100%; max-width: 440px; gap: 7px; padding: 14px 18px; }
  #previewBox { height: 130px; }
  .logo { font-size: 38px; }
  #board { font-size: 11.5px; min-width: 120px; top: calc(max(10px, env(safe-area-inset-top)) + 54px); }
  #top { top: max(10px, env(safe-area-inset-top)); }
  #meCard { padding: 5px 9px 5px 5px; } #meCard .ico { width: 32px; height: 32px; font-size: 20px; } .bar { width: 64px; }
  .call { font-size: 34px; } .call.huge { font-size: 46px; }
  #feed { top: calc(max(10px, env(safe-area-inset-top)) + 54px); }
  body.touch #hudBtns { right: max(10px, env(safe-area-inset-right)); top: calc(max(10px, env(safe-area-inset-top)) + 150px); flex-direction: column; }
}
@media (max-height: 460px) {
  .menu-card { gap: 6px; padding: 12px 16px; }
  #previewBox { height: 110px; } .logo { font-size: 34px; } .how { display: none; }
  .big { padding: 9px; font-size: 17px; }
  .call { font-size: 34px; } .call.huge { font-size: 48px; }
}

/* 선택·포커스 테두리가 스크롤 영역(메뉴·결과 카드) 가장자리에서 잘리지 않게: 테두리는 안쪽에, 스크롤 끝에는 여유 */
.menu-card, .res-card { scroll-padding-block: 16px; padding-bottom: 22px; }
button:focus-visible { outline: 3px solid var(--ink); outline-offset: -4px; }
#swatches { padding: 6px 4px; }
#swatches button:focus-visible { outline-offset: 2px; }
