:root {
  --ink: #23303f;
  --ink-dim: rgba(35, 48, 63, .6);
  --glass: rgba(255, 255, 255, .88);
  --line: rgba(35, 48, 63, .1);
  --red: #e2574c;
  --font: "Pretendard Variable", Pretendard, -apple-system, system-ui, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #e9f0f6; color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
#game, #labels { position: fixed; inset: 0; }
#game canvas { display: block; touch-action: none; }
#labels { pointer-events: none; z-index: 2; }
#crosshair { position: fixed; left: 50%; top: 50%; z-index: 4; width: 0; height: 0; pointer-events: none; }
#crosshair i { position: absolute; background: #fff; box-shadow: 0 0 0 1px rgba(35,48,63,.45); border-radius: 2px; }
#crosshair i:nth-child(1) { width: 2px; height: 8px; left: -1px; top: -14px; }
#crosshair i:nth-child(2) { width: 2px; height: 8px; left: -1px; top: 6px; }
#crosshair i:nth-child(3) { width: 8px; height: 2px; left: -14px; top: -1px; }
#crosshair i:nth-child(4) { width: 8px; height: 2px; left: 6px; top: -1px; }
#crosshair { transition: transform .16s ease-out; }
#crosshair.hitmark { transform: rotate(45deg) scale(1.5); transition: none; }
#crosshair.killmark { transform: rotate(45deg) scale(2.4); transition: none; }
#crosshair.hitmark i, #crosshair.killmark i { background: #e2574c; }
.lock-hint { position: fixed; left: 50%; top: 58%; transform: translateX(-50%); z-index: 6; padding: 10px 18px; border-radius: 999px; background: rgba(35,48,63,.78); color: #fff; font-size: 14px; font-weight: 600; pointer-events: none; }
.tag3 { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag3 span { padding: 2px 9px; border-radius: 999px; background: rgba(255,255,255,.8); color: var(--ink); }
.tag3 span.bot { color: var(--ink-dim); }
.tag3 .hp { width: 38px; height: 4px; border-radius: 2px; background: rgba(35,48,63,.2); overflow: hidden; }
.tag3 .hp b { display: block; height: 100%; background: #e2574c; }
.dmg { font-size: 19px; font-weight: 800; color: #e2574c; -webkit-text-stroke: 4px #fff; paint-order: stroke fill; animation: dmgUp .9s ease forwards; }
@keyframes dmgUp { to { transform: translateY(-34px); opacity: 0; } }

.hud { position: fixed; z-index: 5; pointer-events: none; }
.hud button { pointer-events: auto; }
.top-left { top: max(14px, env(safe-area-inset-top)); left: 14px; }
.top-center { top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; }
.round-timer { padding: 9px 15px; border-radius: 999px; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.round-timer.last { color: #fff; background: var(--red); }
body.village .round-timer { display: none; }
.champ::before { content: ""; display: inline-block; width: 15px; height: 11px; margin-right: 4px; vertical-align: -1px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 36'%3E%3Cpath d='M4 30 2 8l12 9L24 2l10 15 12-9-2 22z' fill='%23f4c23c' stroke='%23b98a14' stroke-width='3'/%3E%3C/svg%3E") center / contain no-repeat; }
.round-over { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 7; width: min(360px, calc(100vw - 32px)); padding: 16px 20px 14px; border-radius: 20px; background: rgba(255, 255, 255, .95); box-shadow: 0 14px 44px rgba(40, 70, 110, .3); text-align: center; pointer-events: none; animation: ro-in .3s ease-out; }
@keyframes ro-in { from { opacity: 0; transform: translate(-50%, -46%) scale(.94); } }
.ro-crown { display: block; width: 44px; margin: 0 auto 4px; }
.ro-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.ro-sub { margin-top: 2px; font-size: 13.5px; font-weight: 700; color: var(--red); }
.round-over ol { list-style: none; margin: 10px 0 8px; padding: 0; font-size: 13.5px; }
.round-over li { display: flex; align-items: center; gap: 8px; padding: 3px 8px; border-radius: 8px; }
.round-over li.me { background: rgba(226, 87, 76, .12); font-weight: 700; }
.round-over li .nm { flex: 1; min-width: 0; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.round-over li .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.round-over li small { font-size: 10px; color: var(--ink-dim); }
.ro-next { font-size: 12.5px; color: var(--ink-dim); }
.top-right { top: max(14px, env(safe-area-inset-top)); right: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.go-btn { display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--ink); }
.go-btn kbd { font: inherit; font-size: 11px; padding: 1px 6px; border-radius: 6px; background: rgba(35,48,63,.08); color: var(--ink-dim); }
.temp.roll-meter { display: none; }
body.village .temp.roll-meter { display: flex; }
body.village .temp:not(.roll-meter), body.village .ammo-row, body.village #t-swap { display: none !important; }
#roll-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #cfe3f5, #7fb4e0); transition: width .15s; }
#roll-hint { width: auto; min-width: 150px; font-size: 12.5px; font-weight: 700; text-align: left; }
.pile-tag span { background: rgba(255,255,255,.68); color: var(--ink-dim); font-weight: 600; font-size: 11.5px; }
.pile-tag { transition: opacity .4s; }
.bottom-center { bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; }

.pill {
  background: var(--glass); border: 1px solid rgba(255, 255, 255, .8); border-radius: 18px;
  box-shadow: 0 6px 22px rgba(60, 90, 130, .16);
}
.kills { display: flex; align-items: baseline; gap: 8px; padding: 7px 18px; border-radius: 999px; }
.kills b { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.k-label { font-size: 13px; font-weight: 700; color: var(--red); }
.k-sub { font-size: 11.5px; color: var(--ink-dim); }
.kills.bump b { animation: bump .5s ease; }
@keyframes bump { 30% { transform: scale(1.45); color: var(--red); } }

.board { min-width: 196px; padding: 10px 12px 8px; font-size: 12.5px; }
.board-head { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 4px; }
.people { flex: 1; font-weight: 500; color: var(--ink-dim); font-size: 11.5px; }
.board ol { margin: 0; padding: 0; list-style: none; }
.board li { display: flex; align-items: center; gap: 7px; padding: 3px 0; }
.board li .rank { width: 14px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.board li .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.board li .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.board li .bot { font-size: 10px; color: var(--ink-dim); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; margin-left: 3px; }
.board li b { font-variant-numeric: tabular-nums; }
.board li.me { font-weight: 700; }
.board li.me .nm::after { content: ' (나)'; color: var(--red); font-weight: 600; }
.ic { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn { background: none; border: 0; padding: 2px; display: grid; place-items: center; }

.feed { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.feed div {
  font-size: 12.5px; padding: 5px 11px; border-radius: 999px; background: var(--glass);
  box-shadow: 0 3px 12px rgba(60, 90, 130, .12); animation: feedIn .25s ease; transition: opacity .6s;
}
.feed div b { font-weight: 700; }
.feed div.mine { background: rgba(226, 87, 76, .92); color: #fff; }
@keyframes feedIn { from { opacity: 0; transform: translateX(-8px); } }

.temp { display: flex; align-items: center; gap: 9px; padding: 8px 14px; border-radius: 999px; background: var(--glass); box-shadow: 0 6px 22px rgba(60, 90, 130, .16); }
.temp-label { white-space: nowrap; font-size: 12px; font-weight: 700; color: var(--ink-dim); }
.temp-bar { width: 200px; height: 10px; border-radius: 99px; background: rgba(35, 48, 63, .12); overflow: hidden; }
#temp-fill { height: 100%; width: 100%; border-radius: 99px; background: linear-gradient(90deg, #ff8a5c, #e2574c); transition: width .15s, background .3s; }
#temp-fill.cold { background: linear-gradient(90deg, #7fc4ff, #3d8fd1); }
#temp-num { width: 28px; font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }
.ammo-row { display: flex; gap: 8px; }
.slot {
  white-space: nowrap;
  display: flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 14px; border: 2px solid transparent;
  background: var(--glass); box-shadow: 0 4px 16px rgba(60, 90, 130, .14); font-size: 12.5px;
}
.slot.on { border-color: var(--ink); }
.slot.empty { opacity: .55; }
.slot-name { font-weight: 700; }
.balls { display: flex; gap: 3px; }
.balls i { width: 9px; height: 9px; border-radius: 50%; background: #fff; box-shadow: inset 0 -2px 0 #c9d8e6, 0 0 0 1px rgba(35, 48, 63, .25); }
.balls i.off { background: transparent; box-shadow: 0 0 0 1px rgba(35, 48, 63, .18); }
.count { font-variant-numeric: tabular-nums; color: var(--ink-dim); }
.keys { white-space: nowrap; font-size: 11.5px; color: var(--ink-dim); text-shadow: 0 1px 0 rgba(255, 255, 255, .8); transition: opacity 1s; }
.keys kbd { padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, .9); box-shadow: 0 1px 0 #b9c8d6; font: inherit; font-weight: 700; color: var(--ink); }
.kick-prompt { position: fixed; left: 50%; bottom: 128px; z-index: 5; display: flex; align-items: center; gap: 9px; padding: 7px 16px 7px 8px; border-radius: 999px; background: rgba(255, 255, 255, .95); box-shadow: 0 6px 20px rgba(60, 90, 130, .22); font-size: 15px; font-weight: 700; color: var(--ink); pointer-events: none; opacity: 0; transform: translate(-50%, 6px); transition: opacity .12s, transform .12s; }
.kick-prompt.show { opacity: 1; transform: translate(-50%, 0); }
.kick-prompt kbd { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--ink); box-shadow: 0 3px 0 rgba(0, 0, 0, .35); font: inherit; font-size: 17px; color: #fff; }

#minimap { position: fixed; left: 14px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 5; width: 140px; height: 140px; border-radius: 16px; background: rgba(255, 255, 255, .6); box-shadow: 0 6px 22px rgba(60, 90, 130, .16); }

.banner {
  position: fixed; top: 26%; left: 50%; transform: translate(-50%, 0) scale(.9); z-index: 6; pointer-events: none;
  font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); text-shadow: 0 2px 0 #fff, 0 4px 20px rgba(255, 255, 255, .9);
  opacity: 0; transition: opacity .25s, transform .25s; white-space: nowrap;
}
.banner.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.banner small { display: block; width: max-content; margin: 6px auto 0; padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.9); text-shadow: none; text-align: center; font-size: 13.5px; font-weight: 700; color: var(--red); box-shadow: 0 4px 14px rgba(60,90,130,.16); }
.dead { position: fixed; top: 38%; left: 50%; transform: translateX(-50%); z-index: 6; text-align: center; pointer-events: none; text-shadow: 0 2px 0 #fff, 0 2px 16px #fff; }
.dead-title { font-size: 30px; font-weight: 800; }
.dead-sub { margin-top: 4px; font-size: 15px; color: var(--ink-dim); }

.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(225, 236, 246, .35); }
.card { position: relative; width: min(370px, 100%); padding: 30px 26px 22px; border-radius: 24px; background: rgba(255, 255, 255, .9); box-shadow: 0 24px 70px rgba(60, 90, 130, .3); overflow: hidden; }
h1 { margin: 0 0 8px; font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.lead { margin: 0 0 20px; color: var(--ink-dim); font-size: 14px; line-height: 1.6; }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-dim); margin-bottom: 6px; }
.nick-row { display: flex; gap: 8px; }
input { width: 100%; padding: 11px 13px; border-radius: 12px; border: 1.5px solid var(--line); background: #f5f8fb; outline: none; }
input:focus { border-color: var(--ink); background: #fff; }
.ghost { border: 1.5px solid var(--line); background: #f5f8fb; border-radius: 12px; padding: 0 12px; display: grid; place-items: center; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; padding: 0; box-shadow: 0 0 0 1.5px var(--line); }
.swatch.on { box-shadow: 0 0 0 2.5px var(--ink); }
.primary { width: 100%; margin-top: 6px; padding: 14px; border: 0; border-radius: 15px; background: var(--red); color: #fff; font-weight: 800; font-size: 16px; box-shadow: 0 8px 24px rgba(226, 87, 76, .35); }
.primary:active { transform: translateY(1px); }
.secondary { width: 100%; margin-top: 8px; padding: 12px; border: 1.5px solid var(--line); border-radius: 15px; background: #f5f8fb; font-weight: 700; font-size: 15px; }
.secondary:active { transform: translateY(1px); }
.fine { margin: 14px 0 0; font-size: 11.5px; color: var(--ink-dim); text-align: center; line-height: 1.5; }
.flakes { position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(circle, #d6e4f1 1.5px, transparent 2px), radial-gradient(circle, #e3edf6 1px, transparent 1.5px); background-size: 46px 46px, 27px 27px; background-position: 0 0, 13px 9px; opacity: .7; mask-image: linear-gradient(180deg, #000, transparent 45%); -webkit-mask-image: linear-gradient(180deg, #000, transparent 45%); }

/* touch */
.touch { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.stick { position: absolute; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 70px); width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .35); border: 2px solid rgba(255, 255, 255, .7); pointer-events: auto; touch-action: none; }
.stick.left { left: 22px; }
.stick.right { right: 22px; }
.knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px; border-radius: 50%; background: rgba(255, 255, 255, .85); box-shadow: 0 4px 14px rgba(60, 90, 130, .25); }
.tbtn { position: absolute; right: 30px; pointer-events: auto; padding: 10px 14px; border-radius: 999px; border: 0; background: rgba(255, 255, 255, .85); font-size: 13px; font-weight: 700; box-shadow: 0 4px 14px rgba(60, 90, 130, .2); touch-action: none; }
.tbtn.fire { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 70px); width: 96px; height: 96px; border-radius: 50%; padding: 0; background: rgba(226,87,76,.9); color: #fff; font-size: 15px; }
.tbtn.scoop { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 206px); }
.tbtn.swap { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 254px); }
.tbtn.kick { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 302px); }
.tbtn.held { background: var(--ink); color: #fff; }
.tbtn.kick.ready { background: var(--red); color: #fff; }

@media (max-width: 700px), (pointer: coarse) {
  .keys, .kick-prompt { display: none; }
  #minimap { display: none; }
  .top-center { left: 12px; transform: none; }
  .round-timer { padding: 6px 11px; font-size: 14px; }
  .round-over li:nth-child(n+6):not(.me) { display: none; }
  .kills { padding: 5px 13px; }
  .kills b { font-size: 21px; }
  .k-sub { display: none; }
  .top-left { top: calc(max(14px, env(safe-area-inset-top)) + 46px); left: 12px; }
  .feed { max-width: 52vw; }
  .feed div { font-size: 10.5px; padding: 4px 9px; }
  .feed div:nth-child(n+3) { display: none; }
  .top-right { right: 10px; }
  .board { min-width: 0; width: 158px; padding: 8px 10px 6px; font-size: 11px; }
  .board li { padding: 2px 0; gap: 5px; }
  .board li:nth-child(n+4):not(.me) { display: none; }
  .board li .nm { max-width: 74px; }
  .board li .bot { display: none; }
  .board li.me .nm::after { content: ''; }
  .people { font-size: 10px; }
  .bottom-center { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 150px); gap: 6px; }
  .temp { padding: 6px 12px; gap: 7px; }
  .temp-bar { width: 110px; height: 8px; }
  .slot { padding: 5px 10px; font-size: 11.5px; gap: 6px; }
  .balls i { width: 7px; height: 7px; }
  .stick { bottom: max(18px, env(safe-area-inset-bottom)); width: 124px; height: 124px; }
  .stick.left { left: 16px; }
  .tbtn { right: 18px; font-size: 12.5px; }
  .tbtn.fire { bottom: max(22px, env(safe-area-inset-bottom)); width: 104px; height: 104px; }
  .go-btn { padding: 5px 10px; font-size: 11px; }
  .go-btn kbd { display: none; }
  #roll-hint { min-width: 0; font-size: 11px; }
  .tbtn.scoop { bottom: calc(max(22px, env(safe-area-inset-bottom)) + 116px); right: 24px; }
  .tbtn.swap { bottom: calc(max(22px, env(safe-area-inset-bottom)) + 34px); right: 134px; }
  .tbtn.kick { bottom: calc(max(22px, env(safe-area-inset-bottom)) + 164px); right: 24px; }
  .banner { top: 30%; font-size: 21px; }
}
