/* 패패로 대첩 · 솔로들의 분노 — lobby, HUD, loading. Everything is prefixed pw-. */
:root {
  --pw-ink: #3b1f14;
  --pw-choco: #4a2616;
  --pw-choco-2: #5e3422;
  --pw-choco-3: #7d4a31;
  --pw-pink: #ff6f9f;
  --pw-pink-d: #e9497e;
  --pw-pink-2: #ffb3cb;
  --pw-pink-3: #ffe4ee;
  --pw-cream: #fff6e8;
  --pw-cream-2: #fbe8cc;
  --pw-paper: #fffaf3;
  --pw-biscuit: #e8c48a;
  --pw-biscuit-d: #c99a5b;
  --pw-gold: #f6c445;
  --pw-gold-d: #c98d12;
  --pw-red: #ff3d55;
  --pw-sl: env(safe-area-inset-left, 0px);
  --pw-sr: env(safe-area-inset-right, 0px);
  --pw-st: env(safe-area-inset-top, 0px);
  --pw-sb: env(safe-area-inset-bottom, 0px);
  --pw-font: Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  --pw-shadow: 0 5px 0 var(--pw-ink);
  --pw-r: 22px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #24120b;
  color: var(--pw-ink);
  font-family: var(--pw-font);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; touch-action: none; outline: none; }
#ui { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
[class^="pw-"][hidden], [class*=" pw-"][hidden], #loading[hidden] { display: none !important; }
:where(.pw-lobby, .pw-hud) button { font: inherit; color: inherit; cursor: pointer; -webkit-user-select: none; user-select: none; }
.pw-lobby button:focus-visible, .pw-hud button:focus-visible, .pw-input:focus-visible, .pw-range:focus-visible {
  outline: 3px solid var(--pw-gold); outline-offset: 2px;
}

.pw-kbd {
  display: inline-block; min-width: 1.6em; padding: 0.05em 0.45em; border-radius: 6px;
  background: var(--pw-cream); color: var(--pw-ink); border: 1.5px solid var(--pw-ink); box-shadow: 0 2px 0 var(--pw-ink);
  font: 800 0.78em/1.4 var(--pw-font); text-align: center; vertical-align: 0.08em;
}

/* ═════════════════════════ LOADING ═════════════════════════ */
#loading {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 111, 159, 0.28), transparent 55%),
    repeating-linear-gradient(135deg, rgba(255, 246, 232, 0.035) 0 14px, transparent 14px 40px),
    linear-gradient(180deg, #3b1f14, #24120b);
  color: var(--pw-cream); font-family: var(--pw-font);
  transition: opacity 0.35s ease;
}
#loading.pw-fade { opacity: 0; pointer-events: none; }
#loading.hidden, #loading.hide, #loading.done { display: none; }
.pw-load { display: grid; justify-items: center; gap: 22px; padding: 24px; text-align: center; }
.pw-load-title { font-weight: 900; font-size: clamp(30px, 8vw, 44px); letter-spacing: -0.02em; line-height: 1; text-shadow: 0 4px 0 #1a0c06; }
.pw-load-title small { display: block; margin-top: 10px; font-size: 0.42em; color: var(--pw-pink-2); letter-spacing: 0.08em; text-shadow: none; }
.pw-load-stick {
  position: relative; width: min(260px, 70vw); height: 26px; border-radius: 999px; overflow: hidden;
  background:
    radial-gradient(circle at 20% 40%, rgba(160, 110, 50, 0.35) 1px, transparent 2px) 0 0 / 9px 7px,
    linear-gradient(180deg, #f2d39f, var(--pw-biscuit) 55%, var(--pw-biscuit-d));
  border: 3px solid #1a0c06; box-shadow: 0 5px 0 #1a0c06; transform: rotate(-4deg);
}
.pw-load-choco {
  position: absolute; left: 20%; top: 0; bottom: 0; width: 0; border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, #7a4630, var(--pw-choco) 50%, #2c150b);
  animation: pw-fill 2.4s cubic-bezier(0.55, 0.1, 0.35, 1) infinite;
}
.pw-load-shine { position: absolute; left: 22%; right: 6%; top: 4px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.35); }
@keyframes pw-fill { 0% { width: 0; } 70%, 85% { width: 80%; } 100% { width: 80%; opacity: 0.6; } }
.pw-load-tips { position: relative; height: 1.5em; width: 18em; margin: 0; font-weight: 700; font-size: 16px; color: var(--pw-cream-2); }
.pw-load-tips span { position: absolute; inset: 0; opacity: 0; animation: pw-tip 10s infinite; }
.pw-load-tips span:nth-child(2) { animation-delay: 2s; }
.pw-load-tips span:nth-child(3) { animation-delay: 4s; }
.pw-load-tips span:nth-child(4) { animation-delay: 6s; }
.pw-load-tips span:nth-child(5) { animation-delay: 8s; }
@keyframes pw-tip { 0% { opacity: 0; transform: translateY(8px); } 3%, 17% { opacity: 1; transform: none; } 20%, 100% { opacity: 0; transform: translateY(-8px); } }
.pw-load-nojs { color: var(--pw-pink-2); }

/* ═════════════════════════ LOBBY ═════════════════════════ */
.pw-lobby {
  position: fixed; inset: 0; z-index: 10; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch;
  pointer-events: auto; color: var(--pw-ink); font-family: var(--pw-font); word-break: keep-all; overflow-wrap: anywhere;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(255, 111, 159, 0.38), transparent 60%),
    radial-gradient(800px 600px at 100% 110%, rgba(246, 196, 69, 0.3), transparent 60%),
    radial-gradient(700px 500px at 90% 0%, rgba(125, 74, 49, 0.18), transparent 60%),
    linear-gradient(180deg, #fff3e2, #ffe7ee);
  opacity: 0; transition: opacity 0.3s ease;
  overscroll-behavior: contain;
}
.pw-lobby.pw-in { opacity: 1; }
.pw-lobby.pw-out { opacity: 0; pointer-events: none; }
.pw-lobby::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; opacity: 0.5;
  background:
    repeating-linear-gradient(135deg, transparent 0 46px, rgba(74, 38, 22, 0.05) 46px 52px, transparent 52px 92px);
}
.pw-lobby-deco { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.pw-float {
  position: absolute; left: var(--x); bottom: -120px; width: 12px; height: 110px; border-radius: 6px; opacity: 0.22;
  background: linear-gradient(180deg, var(--pw-choco) 0 70%, var(--pw-biscuit) 70%);
  transform: scale(var(--s)) rotate(25deg);
  animation: pw-rise 18s linear var(--d) infinite;
}
.pw-float-1 { background: linear-gradient(180deg, #f39ab4 0 70%, var(--pw-biscuit) 70%); animation-duration: 22s; }
.pw-float-2 { background: linear-gradient(180deg, #8fb36a 0 70%, var(--pw-biscuit) 70%); animation-duration: 26s; opacity: 0.16; }
@keyframes pw-rise { from { transform: translateY(0) scale(var(--s)) rotate(25deg); } to { transform: translateY(calc(-100vh - 260px)) scale(var(--s)) rotate(385deg); } }

.pw-lobby-inner {
  position: relative; max-width: 1400px; margin: 0 auto;
  padding: calc(14px + var(--pw-st)) calc(16px + var(--pw-sr)) calc(118px + var(--pw-sb)) calc(16px + var(--pw-sl));
}

/* hero / logo */
.pw-hero { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 6px 0 16px; }
.pw-logo { display: flex; align-items: center; gap: 10px; }
.pw-logo-sticks { width: 74px; height: 74px; flex: none; animation: pw-wobble 2.8s ease-in-out infinite; transform-origin: 50% 70%; }
.pw-logo-svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 4px 0 rgba(59, 31, 20, 0.35)); }
.pw-logo-anger { animation: pw-anger 0.9s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pw-wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) scale(1.04); } }
@keyframes pw-anger { 0%, 100% { transform: translate(94px, 20px) scale(1); } 50% { transform: translate(94px, 20px) scale(1.25); } }
.pw-logo-title { margin: 0; display: grid; justify-items: start; line-height: 1; }
.pw-logo-main {
  display: flex; font-weight: 900; font-size: clamp(40px, 11vw, 68px); letter-spacing: -0.02em; color: var(--pw-cream);
  -webkit-text-stroke: 0; paint-order: stroke fill;
  text-shadow:
    2px 0 0 var(--pw-ink), -2px 0 0 var(--pw-ink), 0 2px 0 var(--pw-ink), 0 -2px 0 var(--pw-ink),
    1.5px 1.5px 0 var(--pw-ink), -1.5px 1.5px 0 var(--pw-ink), 1.5px -1.5px 0 var(--pw-ink), -1.5px -1.5px 0 var(--pw-ink),
    0 6px 0 var(--pw-ink);
}
.pw-logo-sp { display: inline-block; width: 0.28em; }
.pw-logo-ch { display: inline-block; animation: pw-bounce 2.4s cubic-bezier(0.3, 1.6, 0.5, 1) infinite; animation-delay: calc(var(--i) * 0.09s); }
.pw-logo-ch:nth-child(1), .pw-logo-ch:nth-child(2), .pw-logo-ch:nth-child(3) { color: #ffd9e6; }
@keyframes pw-bounce { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(-7px) rotate(-3deg); } }
.pw-logo-sub {
  margin: 10px 0 0 6px; padding: 5px 14px 6px; border-radius: 999px; font-weight: 900; font-size: clamp(15px, 4.2vw, 21px);
  color: #fff; background: linear-gradient(180deg, #ff8db3, var(--pw-pink-d)); border: 3px solid var(--pw-ink);
  box-shadow: 0 3px 0 var(--pw-ink); transform: rotate(-3deg); animation: pw-rage 3.2s ease-in-out infinite;
}
@keyframes pw-rage { 0%, 86%, 100% { transform: rotate(-3deg); } 88% { transform: rotate(-6deg) translateX(-2px); } 90% { transform: rotate(0deg) translateX(2px); } 92% { transform: rotate(-5deg); } 94% { transform: rotate(-1deg); } }
.pw-tagline { margin: 2px 0 0; font-weight: 800; font-size: clamp(15px, 4vw, 19px); color: var(--pw-choco-2); }
.pw-tag-meme { color: var(--pw-pink-d); white-space: nowrap; }
.pw-dday {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; font-weight: 800; font-size: 14px;
  background: var(--pw-ink); color: var(--pw-cream); box-shadow: 0 3px 0 rgba(59, 31, 20, 0.35);
}
.pw-dday-d { color: var(--pw-gold); font-size: 16px; }
.pw-dday-clock { font-variant-numeric: tabular-nums; color: var(--pw-pink-2); }
.pw-dday-today { color: var(--pw-gold); animation: pw-pulse 1s ease-in-out infinite; }

/* grid */
.pw-lobby-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "picker" "setup" "rules"; }
.pw-stage { grid-area: stage; }
.pw-picker { grid-area: picker; }
.pw-setup { grid-area: setup; }
.pw-rules { grid-area: rules; }

.pw-card {
  position: relative; min-width: 0; padding: 16px; border-radius: var(--pw-r);
  background: var(--pw-paper); border: 3px solid var(--pw-ink); box-shadow: var(--pw-shadow);
}
.pw-h2 { display: block; margin: 0 0 10px; font-size: 17px; font-weight: 900; letter-spacing: -0.01em; color: var(--pw-ink); }
.pw-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pw-count { font-size: 13px; font-weight: 700; color: var(--pw-choco-3); }

/* stage / preview */
.pw-preview {
  position: relative; height: clamp(300px, 46vh, 380px); border-radius: 18px; overflow: hidden; border: 3px solid var(--pw-ink);
  background:
    radial-gradient(ellipse 60% 18% at 50% 86%, rgba(59, 31, 20, 0.22), transparent 70%),
    radial-gradient(circle at 50% 30%, #fff 0, #ffe9f1 35%, #ffc4d8 75%, #ff9fbf 100%);
}
.pw-preview::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.55;
  background: repeating-conic-gradient(from 0deg at 50% 115%, rgba(255, 255, 255, 0.5) 0 6deg, transparent 6deg 18deg);
  animation: pw-rays 30s linear infinite;
}
@keyframes pw-rays { to { transform: rotate(0.0001deg); filter: hue-rotate(0deg); } }
.pw-preview-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; cursor: grab; }
.pw-preview-canvas:active { cursor: grabbing; }
.pw-preview-ph { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(59, 31, 20, 0.55); transition: opacity 0.4s; }
.pw-preview-ph svg { height: 62%; width: auto; animation: pw-idle 2.6s ease-in-out infinite; }
@keyframes pw-idle { 50% { transform: translateY(-6px) rotate(2deg); } }
.pw-has-3d .pw-preview-ph { opacity: 0; pointer-events: none; }
.pw-no-3d .pw-preview-canvas { display: none; }
.pw-stage-cap { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; pointer-events: none; }
.pw-stage-cap > div { padding: 7px 14px 8px; border-radius: 16px; background: var(--pw-ink); color: var(--pw-cream); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25); max-width: 70%; }
.pw-stage-group { font-size: 12px; font-weight: 700; color: var(--pw-pink-2); }
.pw-stage-name { font-size: 20px; font-weight: 900; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pw-preview-hint { position: absolute; top: 10px; left: 12px; font-size: 12px; font-weight: 700; color: rgba(59, 31, 20, 0.55); pointer-events: none; }
.pw-no-3d .pw-preview-hint { display: none; }

.pw-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 14px; border-radius: 14px;
  font-weight: 900; font-size: 15px; background: var(--pw-cream); color: var(--pw-ink); border: 3px solid var(--pw-ink); box-shadow: 0 3px 0 var(--pw-ink);
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}
.pw-btn:hover { background: #fff; }
.pw-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--pw-ink); }
.pw-random { pointer-events: auto; background: var(--pw-gold); }
.pw-random:hover { background: #ffd35f; }
.pw-btn-icon { width: 48px; padding: 0; font-size: 20px; flex: none; }

/* sticks */
.pw-stick-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 14px; }
.pw-stick-label { font-size: 13px; font-weight: 800; color: var(--pw-pink-d); }
.pw-sticks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pw-stick-chip {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 9px 4px 7px; border-radius: 14px; min-width: 0;
  background: var(--pw-cream); border: 2.5px solid rgba(59, 31, 20, 0.25); transition: transform 0.12s, border-color 0.12s, background 0.12s;
}
.pw-stick-chip:hover { border-color: var(--pw-ink); }
.pw-stick-chip.pw-on { background: var(--pw-pink-3); border-color: var(--pw-ink); box-shadow: 0 3px 0 var(--pw-ink); transform: translateY(-2px); }
.pw-chip-name { font-size: 12.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pw-swatch {
  position: relative; display: block; width: 64px; height: 14px; border-radius: 999px; border: 2px solid var(--pw-ink); overflow: hidden;
  background:
    radial-gradient(circle, var(--top) 1.1px, transparent 1.6px) 0 0 / 6px 5px,
    linear-gradient(90deg, var(--bis) 0 28%, var(--coat) 28% 100%);
  transform: rotate(-8deg);
}
.pw-swatch::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 28%; background: var(--bis); }
.pw-swatch::after { content: ''; position: absolute; left: 30%; right: 4%; top: 50%; height: 3px; margin-top: -1.5px; border-radius: 2px; background: var(--core); }
.pw-stick-chip.pw-on .pw-swatch { animation: pw-swish 0.5s ease; }
@keyframes pw-swish { 40% { transform: rotate(-30deg) scale(1.1); } 100% { transform: rotate(-8deg); } }

/* picker */
.pw-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px 6px; scrollbar-width: none; }
.pw-tabs::-webkit-scrollbar { display: none; }
.pw-tab {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px;
  font-weight: 800; font-size: 14px; background: var(--pw-cream); border: 2.5px solid rgba(59, 31, 20, 0.2); white-space: nowrap;
}
.pw-tab:hover { border-color: var(--pw-ink); }
.pw-tab.pw-on { background: var(--pw-ink); color: var(--pw-cream); border-color: var(--pw-ink); }
.pw-tab-n { font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 999px; background: rgba(59, 31, 20, 0.1); }
.pw-tab.pw-on .pw-tab-n { background: var(--pw-pink); color: #fff; }
.pw-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; align-content: start;
  max-height: 292px; overflow-y: auto; padding: 4px 4px 8px; margin: 0 -4px; scrollbar-width: thin; scrollbar-color: var(--pw-pink-2) transparent;
}
.pw-char {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 4px 7px; min-width: 0; border-radius: 16px;
  background: var(--pw-cream); border: 2.5px solid transparent; transition: transform 0.12s, border-color 0.12s, background 0.12s;
}
.pw-char:hover { border-color: rgba(59, 31, 20, 0.35); transform: translateY(-2px); }
.pw-char.pw-on { background: var(--pw-pink-3); border-color: var(--pw-ink); box-shadow: 0 3px 0 var(--pw-ink); }
.pw-av {
  position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  background: radial-gradient(circle at 50% 30%, hsl(var(--h) 90% 92%), hsl(var(--h) 70% 78%)); background-size: cover; background-position: center;
  border: 2px solid rgba(59, 31, 20, 0.15);
}
.pw-av-img { background-color: hsl(var(--h) 80% 88%); background-size: 116%; background-repeat: no-repeat; background-position: 50% 30%; }
.pw-av-init { font-size: 26px; font-weight: 900; color: hsl(var(--h) 45% 28%); }
.pw-av-emoji { position: absolute; top: 3px; right: 4px; font-size: 13px; }
.pw-av-img .pw-av-init, .pw-av-img .pw-av-emoji { display: none; }
.pw-char.pw-on .pw-av::after {
  content: '✓'; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--pw-pink); color: #fff; font-size: 12px; font-weight: 900; border: 2px solid var(--pw-ink);
}
.pw-char-name { width: 100%; font-size: 12px; font-weight: 800; line-height: 1.2; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* setup */
.pw-name-row { display: flex; gap: 8px; margin-bottom: 16px; }
.pw-input-wrap { position: relative; flex: 1; min-width: 0; }
.pw-input {
  width: 100%; height: 50px; padding: 0 58px 0 16px; border-radius: 14px; border: 3px solid var(--pw-ink); background: #fff;
  font: 800 18px var(--pw-font); color: var(--pw-ink); box-shadow: inset 0 3px 0 rgba(59, 31, 20, 0.08);
}
.pw-input:focus { outline: none; border-color: var(--pw-pink-d); box-shadow: 0 0 0 4px rgba(255, 111, 159, 0.25); }
.pw-input-count { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 700; color: var(--pw-choco-3); pointer-events: none; }
.pw-name-row .pw-btn-icon { height: 50px; }
.pw-server-head { margin-bottom: 0; }
.pw-live { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: var(--pw-choco-3); }
.pw-live i { width: 8px; height: 8px; border-radius: 50%; background: #3ccf6e; box-shadow: 0 0 0 3px rgba(60, 207, 110, 0.2); animation: pw-pulse 1.6s infinite; }
.pw-servers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pw-server {
  display: grid; grid-template-columns: 36px minmax(0, 1fr); grid-template-areas: "ic txt" "load load"; align-items: center; gap: 7px 9px;
  width: 100%; min-width: 0; padding: 8px 10px 9px 8px; text-align: left;
  border-radius: 16px; background: var(--pw-cream); border: 2.5px solid rgba(59, 31, 20, 0.2); transition: border-color 0.12s, background 0.12s, transform 0.12s;
}
.pw-server:hover:not(:disabled) { border-color: var(--pw-ink); }
.pw-server.pw-on { background: var(--pw-pink-3); border-color: var(--pw-ink); box-shadow: 0 3px 0 var(--pw-ink); transform: translateY(-1px); }
.pw-server:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.5); }
.pw-server-ic { grid-area: ic; }
.pw-arena-badge { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; font-size: 19px; border: 2px solid var(--pw-ink); }
.pw-arena-badge { position: relative; }
.pw-arena-n {
  position: absolute; right: -6px; bottom: -6px; min-width: 19px; height: 19px; padding: 0 4px; border-radius: 999px; display: grid; place-items: center;
  font: 900 11px/1 var(--pw-font); font-style: normal; background: var(--pw-gold); color: var(--pw-ink); border: 2px solid var(--pw-ink);
}
.pw-server-txt { grid-area: txt; display: grid; gap: 1px; min-width: 0; }
.pw-server-txt b { font-size: 14.5px; font-weight: 900; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pw-server-txt small { font-size: 11.5px; font-weight: 600; color: var(--pw-choco-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pw-server-load { grid-area: load; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.pw-server-load .pw-bar { grid-column: 1; grid-row: 1; }
.pw-server-n { grid-column: 2; grid-row: 1; font-size: 12px; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pw-server-n em { font-style: normal; font-weight: 700; font-size: 10.5px; color: var(--pw-choco-3); margin-left: 4px; }
.pw-full .pw-server-n em { color: var(--pw-red); }
.pw-bar { width: 100%; height: 8px; border-radius: 999px; background: rgba(59, 31, 20, 0.12); overflow: hidden; }
.pw-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ffa1c0, var(--pw-pink-d)); transition: width 0.4s; }

/* enter */
.pw-enter-bar {
  position: fixed; z-index: 3; left: 0; right: 0; bottom: 0;
  padding: 12px calc(16px + var(--pw-sr)) calc(12px + var(--pw-sb)) calc(16px + var(--pw-sl));
  background: linear-gradient(180deg, rgba(255, 231, 238, 0), rgba(255, 231, 238, 0.95) 38%);
}
.pw-enter {
  position: relative; display: grid; justify-items: center; gap: 2px; width: 100%; max-width: 560px; margin: 0 auto; padding: 12px 16px 11px;
  border-radius: 20px; border: 3px solid var(--pw-ink); overflow: hidden; color: #fff;
  background: linear-gradient(180deg, #ff8db3, var(--pw-pink) 45%, var(--pw-pink-d));
  box-shadow: 0 6px 0 var(--pw-ink), 0 12px 24px rgba(233, 73, 126, 0.35);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
.pw-enter::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent); animation: pw-shine 3.2s ease-in-out infinite;
}
@keyframes pw-shine { 0%, 55% { left: -60%; } 100% { left: 130%; } }
.pw-enter:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.pw-enter:active:not(:disabled), .pw-enter.pw-go { transform: translateY(5px); box-shadow: 0 1px 0 var(--pw-ink), 0 4px 10px rgba(233, 73, 126, 0.3); }
.pw-enter:disabled { filter: grayscale(0.8); opacity: 0.7; cursor: not-allowed; }
.pw-enter-main {
  font-size: 24px; font-weight: 900; letter-spacing: -0.01em;
  text-shadow: 2px 0 0 var(--pw-ink), -2px 0 0 var(--pw-ink), 0 2px 0 var(--pw-ink), 0 -2px 0 var(--pw-ink), 2px 2px 0 var(--pw-ink), -2px 2px 0 var(--pw-ink), 2px -2px 0 var(--pw-ink), -2px -2px 0 var(--pw-ink), 0 4px 0 var(--pw-ink);
}
.pw-enter-sub { max-width: 100%; font-size: 12.5px; font-weight: 700; color: #fff4f8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* rules */
.pw-rule-list { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 7px; }
.pw-rule-list li { font-size: 14px; font-weight: 600; line-height: 1.45; padding: 8px 12px; border-radius: 12px; background: var(--pw-cream); }
.pw-rule-list b { font-weight: 900; }
.pw-controls { display: grid; gap: 8px; font-size: 13px; font-weight: 600; line-height: 1.8; color: var(--pw-choco-2); }
.pw-ctl { display: grid; grid-template-columns: 74px 1fr; gap: 6px; }
.pw-ctl-t { font-weight: 900; color: var(--pw-ink); }

/* tablet: two columns */
@media (min-width: 760px) {
  .pw-lobby-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "stage picker" "setup rules"; }
  .pw-grid { max-height: 430px; }
  .pw-preview { height: 380px; }
}
/* desktop: three columns, everything on one screen, enter button inside the setup column */
@media (min-width: 1100px) {
  .pw-lobby-inner { padding: calc(10px + var(--pw-st)) 28px 28px; }
  .pw-hero { grid-template-columns: auto auto; grid-template-rows: auto auto; justify-content: center; column-gap: 28px; row-gap: 6px; padding: 4px 0 18px; text-align: left; justify-items: start; }
  .pw-logo { grid-row: 1 / 3; }
  .pw-tagline { align-self: end; }
  .pw-dday { align-self: start; }
  .pw-lobby-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "stage picker setup" "stage picker rules";
    align-items: stretch;
    height: calc(100vh - 168px); min-height: 640px;
  }
  .pw-stage, .pw-picker { display: flex; flex-direction: column; min-height: 0; }
  .pw-preview { height: auto; flex: 1; min-height: 340px; }
  .pw-grid { max-height: none; flex: 1; min-height: 0; }
  .pw-rules { overflow: auto; }
  .pw-enter-bar { position: static; padding: 16px 0 2px; background: none; }
  .pw-enter-main { font-size: 26px; }
}
@media (min-width: 1100px) and (max-height: 820px) {
  .pw-logo-sticks { width: 58px; height: 58px; }
  .pw-logo-main { font-size: 52px; }
  .pw-server { padding-top: 6px; padding-bottom: 7px; gap: 5px 9px; }
  .pw-rule-list li { padding: 6px 10px; }
}
@media (max-width: 559px) {
  .pw-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; max-height: 312px; }
  .pw-char { padding: 5px 3px 6px; border-radius: 13px; }
  .pw-char-name { font-size: 11px; }
  .pw-av-init { font-size: 22px; }
}
@media (max-width: 380px) {
  .pw-lobby-inner { padding-left: calc(12px + var(--pw-sl)); padding-right: calc(12px + var(--pw-sr)); }
  .pw-card { padding: 13px; }
  .pw-server { grid-template-columns: 30px minmax(0, 1fr); gap: 6px 7px; padding: 7px 8px 8px 7px; }
  .pw-arena-badge { width: 30px; height: 30px; font-size: 16px; border-radius: 10px; }
  .pw-server-n em { display: none; }
  .pw-ctl { grid-template-columns: 1fr; gap: 0; }
}

/* ═════════════════════════ HUD ═════════════════════════ */
.pw-hud {
  position: fixed; inset: 0; z-index: 6; pointer-events: none; color: var(--pw-cream); font-family: var(--pw-font); word-break: keep-all;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  --pw-glass: rgba(43, 21, 12, 0.72);
}
.pw-int { pointer-events: auto; }
.pw-round {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; font-size: 20px; line-height: 1;
  background: var(--pw-cream); color: var(--pw-ink); border: 3px solid var(--pw-ink); box-shadow: 0 3px 0 var(--pw-ink);
  transition: transform 0.08s, box-shadow 0.08s, background 0.12s;
}
.pw-round:active { transform: translateY(3px); box-shadow: 0 0 0 var(--pw-ink); }
.pw-round.pw-on { background: var(--pw-gold); }
.pw-burger { display: grid; gap: 3.5px; width: 18px; }
.pw-burger i { display: block; height: 3px; border-radius: 2px; background: var(--pw-ink); }

.pw-tl { position: absolute; top: calc(10px + var(--pw-st)); left: calc(10px + var(--pw-sl)); display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 20px); }
.pw-room {
  display: flex; align-items: center; gap: 10px; min-width: 0; height: 44px; padding: 0 14px; border-radius: 999px;
  background: var(--pw-glass); border: 2px solid rgba(255, 246, 232, 0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.pw-room-t { display: grid; min-width: 0; line-height: 1.15; }
.pw-room-t b { font-size: 14px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pw-room-t small { font-size: 11px; font-weight: 600; color: var(--pw-pink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pw-room-n { flex: none; font-size: 13px; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: rgba(255, 246, 232, 0.12); font-variant-numeric: tabular-nums; }

/* kill feed */
.pw-feed { position: absolute; top: calc(10px + var(--pw-st)); right: calc(10px + var(--pw-sr)); display: grid; justify-items: end; gap: 5px; max-width: min(420px, 46vw); }
.pw-feed-row {
  display: flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 12px; border-radius: 12px; font-size: 14px; font-weight: 600;
  background: var(--pw-glass); border: 2px solid rgba(255, 246, 232, 0.14); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  animation: pw-feed-in 0.35s cubic-bezier(0.2, 1.4, 0.5, 1);
  transition: opacity 0.4s, transform 0.4s;
}
.pw-feed-row b { font-weight: 900; overflow: hidden; text-overflow: ellipsis; max-width: 9em; }
.pw-feed-row .pw-victim { color: var(--pw-pink-2); }
.pw-feed-ic { font-size: 15px; }
.pw-feed-row.pw-steal { background: linear-gradient(90deg, rgba(233, 73, 126, 0.85), rgba(120, 30, 70, 0.8)); border-color: rgba(255, 228, 238, 0.4); }
.pw-feed-row.pw-steal .pw-couple { color: #fff1a8; }
.pw-feed-row.pw-bye { opacity: 0; transform: translateX(20px); }
@keyframes pw-feed-in { from { opacity: 0; transform: translateX(30px) scale(0.9); } }

/* banner + toasts */
.pw-banner-wrap { position: absolute; left: 0; right: 0; top: calc(18% + var(--pw-st)); display: grid; justify-items: center; }
.pw-banner { display: grid; justify-items: center; gap: 6px; animation: pw-banner-in 0.55s cubic-bezier(0.2, 1.6, 0.4, 1); transition: opacity 0.45s, transform 0.45s; }
.pw-banner.pw-bye { opacity: 0; transform: translateY(-16px) scale(0.96); }
.pw-banner-big {
  font-size: clamp(38px, 10vw, 62px); font-weight: 900; font-style: italic; letter-spacing: -0.02em; color: var(--pw-gold);
  text-shadow: 3px 0 0 var(--pw-ink), -3px 0 0 var(--pw-ink), 0 3px 0 var(--pw-ink), 0 -3px 0 var(--pw-ink), 2px 2px 0 var(--pw-ink), -2px 2px 0 var(--pw-ink), 2px -2px 0 var(--pw-ink), -2px -2px 0 var(--pw-ink), 0 7px 0 var(--pw-ink), 0 10px 18px rgba(0, 0, 0, 0.35);
}
.pw-banner-small { padding: 6px 16px; border-radius: 999px; font-size: 16px; font-weight: 900; background: var(--pw-pink); color: #fff; border: 3px solid var(--pw-ink); box-shadow: 0 3px 0 var(--pw-ink); }
@keyframes pw-banner-in { from { opacity: 0; transform: scale(0.4) rotate(-6deg); } }
.pw-toasts { position: absolute; left: 50%; top: calc(66px + var(--pw-st)); transform: translateX(-50%); display: grid; justify-items: center; gap: 6px; width: min(92vw, 460px); }
.pw-toast {
  padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 800; text-align: center; background: var(--pw-cream); color: var(--pw-ink);
  border: 2.5px solid var(--pw-ink); box-shadow: 0 3px 0 var(--pw-ink); animation: pw-toast-in 0.3s cubic-bezier(0.2, 1.5, 0.5, 1); transition: opacity 0.35s, transform 0.35s;
}
.pw-toast.pw-bye { opacity: 0; transform: translateY(-8px); }
@keyframes pw-toast-in { from { opacity: 0; transform: translateY(-10px) scale(0.9); } }

/* boss (giant couple) HP bar */
.pw-boss {
  position: absolute; left: 50%; top: calc(10px + var(--pw-st)); transform: translateX(-50%); width: min(520px, calc(100vw - 760px), 44vw); min-width: 300px;
  display: grid; gap: 4px; padding: 7px 10px 9px; border-radius: 18px;
  background: var(--pw-glass); border: 2px solid rgba(255, 179, 203, 0.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.pw-boss.pw-in { animation: pw-boss-in 0.5s cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes pw-boss-in { from { opacity: 0; transform: translateX(-50%) translateY(-16px) scale(0.9); } }
.pw-boss.pw-boss-hit .pw-boss-track { animation: pw-boss-shake 0.22s ease; }
@keyframes pw-boss-shake { 30% { transform: translateX(-3px); } 60% { transform: translateX(3px); } }
.pw-boss-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.pw-boss-name { font-size: 14px; font-weight: 900; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 0 var(--pw-ink); }
.pw-boss-num { flex: none; font-size: 15px; font-weight: 900; color: var(--pw-pink-2); font-variant-numeric: tabular-nums; text-shadow: 0 2px 0 var(--pw-ink); }
.pw-boss-track {
  position: relative; height: 18px; border-radius: 999px; overflow: hidden; border: 3px solid var(--pw-ink); box-shadow: 0 3px 0 var(--pw-ink);
  background: repeating-linear-gradient(135deg, #3a1420 0 8px, #2c0f18 8px 16px);
}
.pw-boss-fill, .pw-boss-lag { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; }
.pw-boss-fill {
  background: linear-gradient(180deg, #ff9fc0, var(--pw-pink) 40%, #d81b5a 75%, #a3123f);
  transition: width 0.2s ease-out;
}
.pw-boss-fill::after { content: ''; position: absolute; left: 4px; right: 4px; top: 2px; height: 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.4); }
.pw-boss-lag { background: linear-gradient(180deg, #fff6c8, #ffd36b); transition: width 0.7s ease-in; }
.pw-boss-ticks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(43, 21, 12, 0.45) calc(10% - 2px) 10%); pointer-events: none; }
.pw-boss.pw-boss-low .pw-boss-fill { background: linear-gradient(180deg, #ff8a7a, var(--pw-red) 45%, #9c0e22); animation: pw-pulse 0.7s ease-in-out infinite; }

.pw-ctimer {
  position: absolute; left: 50%; top: calc(12px + var(--pw-st)); transform: translateX(-50%); padding: 7px 14px; border-radius: 999px; white-space: nowrap;
  font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums; background: var(--pw-glass); border: 2px solid rgba(255, 179, 203, 0.3);
}
.pw-ctimer.pw-soon { color: var(--pw-gold); border-color: rgba(246, 196, 69, 0.6); animation: pw-pulse 1s ease-in-out infinite; }
.pw-has-boss .pw-ctimer { display: none; }

/* while dead: the overlay owns the centre; hide own-HP widgets */
.pw-dead .pw-hp, .pw-dead .pw-shout, .pw-dead .pw-hints, .pw-dead .pw-banner-wrap { visibility: hidden; }

/* big center announcements */
.pw-ann-wrap { position: absolute; left: 0; right: 0; top: 36%; display: grid; justify-items: center; padding: 0 16px; text-align: center; }
.pw-ann { display: grid; justify-items: center; gap: 8px; animation: pw-banner-in 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); transition: opacity 0.3s, transform 0.3s; }
.pw-ann.pw-bye { opacity: 0; transform: scale(1.08); }
.pw-ann-big {
  font-size: clamp(26px, 7.4vw, 50px); font-weight: 900; letter-spacing: -0.02em; line-height: 1.2; color: #fff; word-break: keep-all; max-width: 18em;
  text-shadow: 3px 0 0 var(--pw-ink), -3px 0 0 var(--pw-ink), 0 3px 0 var(--pw-ink), 0 -3px 0 var(--pw-ink), 2px 2px 0 var(--pw-ink), -2px 2px 0 var(--pw-ink), 2px -2px 0 var(--pw-ink), -2px -2px 0 var(--pw-ink), 0 7px 0 var(--pw-ink), 0 12px 24px rgba(0, 0, 0, 0.35);
}
.pw-ann-sub { padding: 6px 16px; border-radius: 999px; font-size: clamp(14px, 3.8vw, 18px); font-weight: 900; background: var(--pw-gold); color: var(--pw-ink); border: 3px solid var(--pw-ink); box-shadow: 0 3px 0 var(--pw-ink); }

/* HP stick + level */
.pw-hp {
  --lvl: 0;
  position: absolute; left: calc(18px + var(--pw-sl)); bottom: calc(18px + var(--pw-sb)); width: min(380px, calc(100vw - 36px));
  display: grid; gap: 7px;
}
.pw-lvl {
  justify-self: start; display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px;
  background: var(--pw-glass); border: 2px solid rgba(255, 246, 232, 0.16); font-size: 13px; font-weight: 800; white-space: nowrap; max-width: 100%;
}
.pw-lvl-badge { padding: 3px 10px; border-radius: 999px; background: linear-gradient(180deg, #ffe08a, var(--pw-gold) 60%, var(--pw-gold-d)); color: var(--pw-ink); font-weight: 900; border: 2px solid var(--pw-ink); }
.pw-lvl-t { overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.pw-lvl.pw-pop { animation: pw-lvl-pop 0.7s cubic-bezier(0.2, 1.8, 0.4, 1); }
@keyframes pw-lvl-pop { 0% { transform: scale(1); } 30% { transform: scale(1.22) rotate(-3deg); box-shadow: 0 0 0 6px rgba(246, 196, 69, 0.5); } 100% { transform: none; } }
.pw-hp-row { display: flex; align-items: center; }
.pw-hp-heart {
  position: relative; z-index: 2; flex: none; display: grid; place-items: center; width: 54px; height: 54px; margin-right: -14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff9fc0, var(--pw-pink-d)); border: 3px solid var(--pw-ink); box-shadow: 0 3px 0 var(--pw-ink);
  font-size: 0; color: #fff;
}
.pw-hp-heart::before { content: '❤'; position: absolute; top: 5px; font-size: 13px; opacity: 0.9; }
.pw-hp-num { margin-top: 10px; font-size: 19px; font-weight: 900; font-variant-numeric: tabular-nums; text-shadow: 0 2px 0 var(--pw-ink); }
.pw-hp-stick { flex: 1; min-width: 0; transform: rotate(-1.5deg); }
.pw-hp-track {
  position: relative; height: calc(28px + var(--lvl) * 1px); border-radius: 999px; overflow: hidden; border: 3px solid var(--pw-ink); box-shadow: 0 4px 0 var(--pw-ink);
  background:
    radial-gradient(circle at 30% 40%, rgba(150, 100, 40, 0.35) 1px, transparent 2px) 0 0 / 9px 7px,
    linear-gradient(180deg, #f4d8a6, var(--pw-biscuit) 55%, var(--pw-biscuit-d));
  transition: height 0.4s cubic-bezier(0.2, 1.6, 0.4, 1), border-color 0.2s;
}
.pw-hp-handle { position: absolute; left: 0; top: 0; bottom: 0; width: 16%; border-right: 2px dashed rgba(122, 74, 49, 0.35); }
.pw-hp-zone { position: absolute; left: 16%; right: 0; top: 0; bottom: 0; }
.pw-hp-coat, .pw-hp-lag { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: 0 999px 999px 0; }
.pw-hp-coat {
  background:
    radial-gradient(ellipse 8px 5px at 30% 100%, #3a1c0f 60%, transparent 62%) 0 0 / 34px 100% repeat-x,
    linear-gradient(180deg, #8a5236, var(--pw-choco) 45%, #2a1309);
  transition: width 0.22s ease-out, background 0.3s;
}
.pw-hp-lag { background: linear-gradient(180deg, #fff, #ffc6d8); transition: width 0.55s ease-in; }
.pw-hp-gloss { position: absolute; left: 18%; right: 3%; top: 4px; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.3); pointer-events: none; }
.pw-hp.pw-low .pw-hp-coat { background: linear-gradient(180deg, #ff7a7a, #c4202f 50%, #6d0f16); }
.pw-hp.pw-low .pw-hp-track { animation: pw-low 0.8s ease-in-out infinite; }
.pw-hp.pw-low .pw-hp-heart { animation: pw-beat 0.6s ease-in-out infinite; }
@keyframes pw-low { 50% { border-color: var(--pw-red); box-shadow: 0 4px 0 var(--pw-ink), 0 0 0 4px rgba(255, 61, 85, 0.45), 0 0 18px rgba(255, 61, 85, 0.6); } }
@keyframes pw-beat { 50% { transform: scale(1.12); } }
.pw-hp.pw-hurt .pw-hp-row { animation: pw-shake 0.32s ease; }
@keyframes pw-shake { 20% { transform: translateX(-5px) rotate(-1deg); } 40% { transform: translateX(4px) rotate(1deg); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.pw-hp.pw-heal .pw-hp-track { animation: pw-heal 0.8s ease; }
@keyframes pw-heal { 30% { box-shadow: 0 4px 0 var(--pw-ink), 0 0 0 5px rgba(255, 246, 232, 0.6), 0 0 22px rgba(255, 179, 203, 0.9); } }
.pw-hp.pw-zero .pw-hp-heart { filter: grayscale(1); }

/* shout */
.pw-shout { position: absolute; right: calc(18px + var(--pw-sr)); bottom: calc(18px + var(--pw-sb)); display: grid; justify-items: end; gap: 8px; }
.pw-shout-btn {
  width: 56px; height: 56px; border-radius: 50%; font-size: 26px; display: grid; place-items: center; position: relative;
  background: var(--pw-cream); border: 3px solid var(--pw-ink); box-shadow: 0 4px 0 var(--pw-ink); transition: transform 0.08s, box-shadow 0.08s;
}
.pw-shout-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--pw-ink); }
.pw-shout-btn.pw-on { background: var(--pw-gold); }
.pw-shout-btn.pw-cool::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%; background: conic-gradient(rgba(43, 21, 12, 0.55) var(--p, 100%), transparent 0);
  animation: pw-cool 3s linear forwards;
}
@property --p { syntax: '<percentage>'; inherits: false; initial-value: 100%; }
@keyframes pw-cool { from { --p: 100%; } to { --p: 0%; } }
.pw-shout-list {
  display: grid; gap: 6px; padding: 8px; border-radius: 18px; width: min(270px, calc(100vw - 30px));
  background: rgba(43, 21, 12, 0.88); border: 2px solid rgba(255, 246, 232, 0.2); animation: pw-pop-in 0.22s cubic-bezier(0.2, 1.5, 0.5, 1); transform-origin: 90% 100%;
}
.pw-shout-item {
  display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 6px 12px 6px 8px; border-radius: 12px; text-align: left; font-size: 14.5px; font-weight: 800;
  background: var(--pw-cream); color: var(--pw-ink); border: 2px solid var(--pw-ink); box-shadow: 0 2px 0 var(--pw-ink);
}
.pw-shout-item:hover { background: var(--pw-pink-3); }
.pw-shout-item:active { transform: translateY(2px); box-shadow: none; }
.pw-shout-item .pw-kbd { background: var(--pw-pink); color: #fff; }
@keyframes pw-pop-in { from { opacity: 0; transform: scale(0.85) translateY(8px); } }
.pw-hints {
  position: absolute; right: calc(88px + var(--pw-sr)); bottom: calc(32px + var(--pw-sb)); padding: 5px 10px; border-radius: 10px; font-size: 12px; font-weight: 700;
  background: rgba(43, 21, 12, 0.55); color: rgba(255, 246, 232, 0.9);
}
.pw-hints .pw-kbd { margin: 0 2px; }

/* chat */
.pw-chat-btn {
  position: absolute; right: calc(84px + var(--pw-sr)); bottom: calc(21px + var(--pw-sb)); width: 50px; height: 50px; border-radius: 50%; font-size: 23px;
  display: grid; place-items: center; background: var(--pw-cream); border: 3px solid var(--pw-ink); box-shadow: 0 4px 0 var(--pw-ink); transition: transform 0.08s, box-shadow 0.08s;
}
.pw-chat-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--pw-ink); }
.pw-chat-btn.pw-on { background: var(--pw-gold); }
.pw-fine .pw-hints { right: calc(146px + var(--pw-sr)); }
.pw-chat {
  position: absolute; z-index: 3; left: 50%; bottom: calc(118px + var(--pw-sb)); transform: translateX(-50%); width: min(560px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 8px; padding: 7px 7px 7px 12px; border-radius: 20px;
  background: var(--pw-paper); color: var(--pw-ink); border: 3px solid var(--pw-ink); box-shadow: 0 5px 0 var(--pw-ink), 0 14px 30px rgba(0, 0, 0, 0.3);
  animation: pw-pop-in 0.18s ease-out;
}
.pw-chat.pw-nope { animation: pw-shake 0.32s ease; }
.pw-chat-ic { font-size: 20px; flex: none; }
.pw-chat-field { position: relative; flex: 1; min-width: 0; }
.pw-chat-input {
  width: 100%; height: 44px; padding: 0 54px 0 12px; border-radius: 12px; border: 2.5px solid rgba(59, 31, 20, 0.25); background: #fff;
  font: 700 16px var(--pw-font); color: var(--pw-ink); -webkit-user-select: text; user-select: text;
}
.pw-chat-input:focus { outline: none; border-color: var(--pw-pink-d); box-shadow: 0 0 0 3px rgba(255, 111, 159, 0.25); }
.pw-chat-count { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 700; color: var(--pw-choco-3); pointer-events: none; font-variant-numeric: tabular-nums; }
.pw-chat-send {
  flex: none; height: 44px; padding: 0 16px; border-radius: 12px; font-size: 15px; font-weight: 900; color: #fff;
  background: linear-gradient(180deg, #ff8db3, var(--pw-pink-d)); border: 2.5px solid var(--pw-ink); box-shadow: 0 3px 0 var(--pw-ink);
}
.pw-chat-send:active { transform: translateY(3px); box-shadow: none; }
.pw-chat-x { flex: none; background: var(--pw-cream-2); }

/* tip host pill */
.pw-tip-btn {
  position: absolute; left: 50%; bottom: calc(28px + var(--pw-sb)); transform: translateX(-50%); padding: 10px 20px; border-radius: 999px; white-space: nowrap;
  font-size: 17px; font-weight: 900; color: var(--pw-ink); background: linear-gradient(180deg, #ffe08a, var(--pw-gold) 60%, var(--pw-gold-d));
  border: 3px solid var(--pw-ink); box-shadow: 0 4px 0 var(--pw-ink), 0 0 0 6px rgba(246, 196, 69, 0.25);
  animation: pw-tip-bob 1.4s ease-in-out infinite;
}
.pw-tip-btn:active { box-shadow: 0 1px 0 var(--pw-ink); }
@keyframes pw-tip-bob { 0%, 100% { transform: translateX(-50%); } 50% { transform: translateX(-50%) translateY(-5px); } }
.pw-typing .pw-tip-btn { display: none; }

/* scoreboard */
.pw-board { position: absolute; inset: 0; display: grid; place-items: center; padding: calc(64px + var(--pw-st)) 14px calc(20px + var(--pw-sb)); pointer-events: none; }
.pw-board-card {
  width: min(560px, 100%); max-height: 100%; display: flex; flex-direction: column; border-radius: var(--pw-r); overflow: hidden;
  background: var(--pw-paper); color: var(--pw-ink); border: 3px solid var(--pw-ink); box-shadow: 0 6px 0 var(--pw-ink), 0 20px 50px rgba(0, 0, 0, 0.35);
  animation: pw-pop-in 0.2s ease-out;
}
.pw-board.pw-pinned .pw-board-card { pointer-events: auto; }
.pw-board-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 10px 18px; background: var(--pw-ink); color: var(--pw-cream); }
.pw-board-head h2 { margin: 0; font-size: 19px; font-weight: 900; }
.pw-x { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 15px; background: rgba(255, 246, 232, 0.14); border: 0; color: inherit; }
.pw-board:not(.pw-pinned) .pw-x { visibility: hidden; }
.pw-board-scroll { overflow-y: auto; min-height: 0; }
.pw-table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.pw-table th { position: sticky; top: 0; background: var(--pw-cream-2); font-size: 12px; font-weight: 800; color: var(--pw-choco-3); padding: 7px 6px; text-align: center; }
.pw-table td { padding: 8px 6px; text-align: center; font-weight: 800; border-top: 1.5px solid rgba(59, 31, 20, 0.08); }
.pw-table .pw-tn { text-align: left; width: 50%; max-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pw-table .pw-rank { width: 44px; font-size: 17px; }
.pw-table tr.pw-me td { background: var(--pw-pink-3); }
.pw-table tr.pw-me .pw-tn { color: var(--pw-pink-d); }
.pw-me-tag { margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; background: var(--pw-pink); color: #fff; vertical-align: 1px; }
.pw-empty { padding: 22px !important; color: var(--pw-choco-3); }
.pw-board-foot { margin: 0; padding: 8px; font-size: 12px; font-weight: 700; color: var(--pw-choco-3); text-align: center; background: var(--pw-cream); }

/* death */
.pw-death {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(ellipse at center, rgba(40, 6, 16, 0.2), rgba(40, 6, 16, 0.72) 75%);
  backdrop-filter: grayscale(0.75) brightness(0.85); -webkit-backdrop-filter: grayscale(0.75) brightness(0.85);
}
.pw-death.pw-in { animation: pw-fade-in 0.45s ease-out; }
@keyframes pw-fade-in { from { opacity: 0; } }
.pw-death-card { display: grid; justify-items: center; gap: 12px; text-align: center; max-width: 520px; }
.pw-death-emoji { font-size: 46px; animation: pw-crack 1.4s ease-in-out infinite; }
@keyframes pw-crack { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg) scale(1.08); } }
.pw-death-title {
  margin: 0; font-size: clamp(22px, 6vw, 32px); font-weight: 900; line-height: 1.3; letter-spacing: -0.02em; word-break: keep-all;
  text-shadow: 2px 0 0 var(--pw-ink), -2px 0 0 var(--pw-ink), 0 2px 0 var(--pw-ink), 0 -2px 0 var(--pw-ink), 0 5px 0 var(--pw-ink);
}
.pw-death-title b { color: var(--pw-pink-2); }
.pw-ring { position: relative; width: 132px; height: 132px; display: grid; place-items: center; margin: 6px 0; }
.pw-ring-svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.pw-ring-bg { fill: rgba(43, 21, 12, 0.7); stroke: rgba(255, 246, 232, 0.18); stroke-width: 11; }
.pw-ring-fg { fill: none; stroke: var(--pw-pink); stroke-width: 11; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(255, 111, 159, 0.7)); }
.pw-ring-num { position: relative; margin-top: -14px; font-size: 52px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: #fff; }
.pw-ring-num.pw-tick { animation: pw-tick 0.35s cubic-bezier(0.2, 1.8, 0.4, 1); }
@keyframes pw-tick { from { transform: scale(1.4); } }
.pw-ring-sub { position: absolute; bottom: 30px; font-size: 12px; font-weight: 800; color: var(--pw-pink-2); }
.pw-soon .pw-ring-fg { stroke: var(--pw-gold); }
.pw-death-line { margin: 0; padding: 8px 18px; border-radius: 999px; font-size: 16px; font-weight: 800; background: rgba(255, 246, 232, 0.95); color: var(--pw-ink); border: 2.5px solid var(--pw-ink); box-shadow: 0 3px 0 var(--pw-ink); }
.pw-death-line.pw-swap { animation: pw-toast-in 0.35s cubic-bezier(0.2, 1.5, 0.5, 1); }
.pw-death-note { margin: 0; font-size: 13px; font-weight: 700; color: rgba(255, 246, 232, 0.75); }

/* menu */
.pw-menu {
  position: absolute; top: calc(62px + var(--pw-st)); left: calc(10px + var(--pw-sl)); width: min(320px, calc(100vw - 20px)); max-height: calc(100% - 80px - var(--pw-st) - var(--pw-sb));
  overflow-y: auto; display: grid; gap: 10px; padding: 14px; border-radius: var(--pw-r); color: var(--pw-ink);
  background: var(--pw-paper); border: 3px solid var(--pw-ink); box-shadow: 0 6px 0 var(--pw-ink), 0 18px 40px rgba(0, 0, 0, 0.3);
  animation: pw-pop-in 0.2s ease-out; transform-origin: 10% 0;
}
.pw-menu-head { display: flex; align-items: center; justify-content: space-between; font-size: 18px; font-weight: 900; }
.pw-menu-head .pw-x { background: var(--pw-cream-2); }
.pw-menu-sec { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--pw-cream); }
.pw-menu-cap { font-size: 13px; font-weight: 900; }
.pw-vol { display: grid; grid-template-columns: 60px 1fr 30px; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; }
.pw-vol-n { text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; color: var(--pw-choco-3); }
.pw-range { --v: 50%; -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; margin: 0; cursor: pointer; }
.pw-range::-webkit-slider-runnable-track { height: 10px; border-radius: 999px; border: 2px solid var(--pw-ink); background: linear-gradient(90deg, var(--pw-choco) var(--v), var(--pw-biscuit) var(--v)); }
.pw-range::-moz-range-track { height: 10px; border-radius: 999px; border: 2px solid var(--pw-ink); background: linear-gradient(90deg, var(--pw-choco) var(--v), var(--pw-biscuit) var(--v)); }
.pw-range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--pw-pink); border: 3px solid var(--pw-ink); }
.pw-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--pw-pink); border: 3px solid var(--pw-ink); }
.pw-menu-btn {
  min-height: 46px; padding: 0 14px; border-radius: 14px; font-size: 15px; font-weight: 900; text-align: left;
  background: var(--pw-cream); color: var(--pw-ink); border: 2.5px solid var(--pw-ink); box-shadow: 0 3px 0 var(--pw-ink);
}
.pw-menu-btn:active { transform: translateY(3px); box-shadow: none; }
.pw-menu-btn.pw-on { background: var(--pw-cream-2); }
.pw-menu-btn.pw-danger { background: var(--pw-pink); color: #fff; }
.pw-help { padding: 4px 6px; font-size: 13.5px; font-weight: 600; line-height: 1.6; }
.pw-help h3 { margin: 6px 0 2px; font-size: 14px; font-weight: 900; }
.pw-help ul { margin: 0; padding-left: 18px; }
.pw-help-tip { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--pw-pink-3); font-weight: 700; }

/* tip dialog (shared by lobby + HUD; appended to <body>) */
.pw-modal {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: calc(16px + var(--pw-st)) 16px calc(16px + var(--pw-sb));
  background: rgba(36, 18, 11, 0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); font-family: var(--pw-font); color: var(--pw-ink);
  opacity: 0; transition: opacity 0.18s; overflow-y: auto; word-break: keep-all;
}
.pw-modal.pw-in { opacity: 1; }
.pw-tip {
  width: min(380px, 100%); display: grid; gap: 12px; padding: 16px 18px 18px; border-radius: 24px; text-align: center;
  background: var(--pw-paper); border: 3px solid var(--pw-ink); box-shadow: 0 6px 0 var(--pw-ink), 0 24px 60px rgba(0, 0, 0, 0.35);
  transform: translateY(10px) scale(0.97); transition: transform 0.22s cubic-bezier(0.2, 1.5, 0.5, 1);
}
.pw-modal.pw-in .pw-tip { transform: none; }
.pw-tip-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pw-tip-head h2 { margin: 0; font-size: 19px; font-weight: 900; }
.pw-tip-x { width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center; font: 900 15px var(--pw-font); background: var(--pw-cream-2); color: var(--pw-ink); cursor: pointer; }
.pw-tip-lead { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.6; color: var(--pw-choco-2); }
.pw-tip-qr { margin: 0; display: grid; justify-items: center; gap: 6px; }
.pw-tip-qr img { width: 148px; height: 148px; padding: 8px; border-radius: 14px; background: #fff; border: 2.5px solid var(--pw-ink); image-rendering: pixelated; }
.pw-tip-qr figcaption { font-size: 12px; font-weight: 700; color: var(--pw-choco-3); }
.pw-tip-account { display: grid; gap: 2px; justify-items: center; padding: 12px; border-radius: 16px; background: var(--pw-cream); border: 2px dashed rgba(59, 31, 20, 0.3); }
.pw-tip-account small { font-size: 12.5px; font-weight: 700; color: var(--pw-choco-3); }
.pw-tip-account strong { font-size: 24px; font-weight: 900; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; -webkit-user-select: all; user-select: all; }
.pw-tip-copy {
  height: 50px; border-radius: 16px; font: 900 17px var(--pw-font); color: #fff; cursor: pointer;
  background: linear-gradient(180deg, #ff8db3, var(--pw-pink) 45%, var(--pw-pink-d)); border: 3px solid var(--pw-ink); box-shadow: 0 4px 0 var(--pw-ink);
}
.pw-tip-copy:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--pw-ink); }
.pw-tip-status { margin: 0; font-size: 12.5px; font-weight: 700; color: var(--pw-choco-3); }
.pw-tip-status.pw-ok { color: #1f9b52; }
.pw-tip-link {
  display: block; margin: 12px auto 0; padding: 4px 8px; border: 0; background: none; font-size: 13.5px; font-weight: 900; color: var(--pw-choco-2);
  text-decoration: underline; text-decoration-color: rgba(233, 73, 126, 0.5); text-underline-offset: 3px;
}
.pw-tip-link small { font-weight: 600; font-size: 12px; color: var(--pw-choco-3); }
.pw-tip-link:hover { color: var(--pw-pink-d); }
.pw-menu-btn.pw-tip-item { background: linear-gradient(180deg, #ffe08a, var(--pw-gold)); }

/* touch layout: keep the joystick (left-bottom ~170px) and attack/dash (right-bottom ~150px) corners clear */
.pw-touch .pw-hp {
  left: 50%; transform: translateX(-50%); width: min(300px, calc(100vw - 350px - var(--pw-sl) - var(--pw-sr)));
  bottom: calc(12px + var(--pw-sb)); min-width: 0;
}
.pw-touch .pw-shout { right: calc(14px + var(--pw-sr)); bottom: calc(170px + var(--pw-sb)); }
.pw-touch .pw-shout-btn { width: 50px; height: 50px; font-size: 23px; }
.pw-touch .pw-chat-btn { right: calc(14px + var(--pw-sr)); bottom: calc(232px + var(--pw-sb)); width: 46px; height: 46px; font-size: 21px; }
.pw-touch .pw-chat { top: calc(58px + var(--pw-st)); bottom: auto; width: calc(100vw - 20px - var(--pw-sl) - var(--pw-sr)); }
.pw-touch .pw-tip-btn { bottom: calc(132px + var(--pw-sb)); }
@media (min-width: 641px) and (max-width: 1100px) {
  .pw-boss { top: calc(62px + var(--pw-st)); width: min(520px, calc(100vw - 40px)); }
  .pw-has-boss .pw-feed { top: calc(128px + var(--pw-st)); }
  .pw-ctimer { top: calc(64px + var(--pw-st)); }
}
@media (max-width: 640px) {
  /* portrait phones: centre column is too narrow → float the HP stick just above the control zones */
  .pw-touch .pw-hp { width: min(250px, 66vw); bottom: calc(178px + var(--pw-sb)); }
  .pw-touch .pw-shout { bottom: calc(176px + var(--pw-sb)); }
  .pw-touch .pw-chat-btn { bottom: calc(236px + var(--pw-sb)); }
  .pw-touch .pw-tip-btn { bottom: calc(302px + var(--pw-sb)); }
  .pw-chat-send { padding: 0 12px; font-size: 14px; }
  .pw-chat-ic { display: none; }
  .pw-touch .pw-hp { width: min(240px, calc(100vw - 150px)); }
  .pw-lvl { font-size: 11.5px; }
  .pw-hp-heart { width: 46px; height: 46px; }
  .pw-hp-num { font-size: 16px; }
  .pw-hp-track { height: calc(24px + var(--lvl) * 0.8px); }
  .pw-room { height: 40px; padding: 0 12px; }
  .pw-room-t small { display: none; }
  .pw-round { width: 40px; height: 40px; font-size: 18px; }
  .pw-feed { top: calc(58px + var(--pw-st)); max-width: calc(100vw - 20px); }
  .pw-feed-row { font-size: 12.5px; padding: 5px 10px; }
  .pw-feed-row b { max-width: 7em; }
  .pw-toasts { top: auto; bottom: calc(282px + var(--pw-sb)); }
  .pw-boss { top: calc(58px + var(--pw-st)); width: calc(100vw - 20px - var(--pw-sl) - var(--pw-sr)); min-width: 0; padding: 5px 8px 7px; border-radius: 14px; }
  .pw-boss-name { font-size: 12px; }
  .pw-boss-num { font-size: 13px; }
  .pw-boss-track { height: 14px; border-width: 2.5px; }
  .pw-has-boss .pw-feed { top: calc(118px + var(--pw-st)); }
  .pw-ctimer { top: calc(60px + var(--pw-st)); left: calc(10px + var(--pw-sl)); transform: none; font-size: 12px; padding: 5px 11px; }
  .pw-hud:has(.pw-ctimer:not([hidden])) .pw-feed { top: calc(94px + var(--pw-st)); }
  .pw-feed-row:nth-child(n + 4) { display: none; }
  .pw-banner-wrap { top: 50%; }
  .pw-banner-big { font-size: 34px; }
  .pw-banner-small { font-size: 14px; padding: 4px 12px; }
  .pw-ann-wrap { top: 33%; }
}
@media (max-height: 460px) and (orientation: landscape) {
  .pw-touch .pw-hp { bottom: calc(8px + var(--pw-sb)); }
  .pw-touch .pw-shout { bottom: calc(160px + var(--pw-sb)); }
  .pw-touch .pw-chat-btn { bottom: calc(160px + var(--pw-sb)); right: calc(74px + var(--pw-sr)); }
  .pw-touch .pw-tip-btn { bottom: calc(124px + var(--pw-sb)); }
  .pw-touch .pw-chat { top: calc(10px + var(--pw-st)); width: min(560px, calc(100vw - 20px)); }
  .pw-death-card { gap: 6px; }
  .pw-ring { width: 104px; height: 104px; }
  .pw-death-note { display: none; }
  .pw-room-t small { display: none; }
  .pw-ctimer { top: calc(14px + var(--pw-st)); left: 50%; transform: translateX(-50%); }
  .pw-boss { top: calc(8px + var(--pw-st)); width: min(360px, calc(100vw - 600px)); min-width: 220px; padding: 4px 8px 6px; }
  .pw-boss-track { height: 12px; }
  .pw-banner-wrap { top: 44%; }
  .pw-banner-big { font-size: 30px; }
  .pw-banner-small { font-size: 13px; padding: 3px 12px; }
  .pw-ann-wrap { top: 20%; }
  .pw-ann-big { font-size: 30px; }
  .pw-toasts { top: auto; bottom: calc(124px + var(--pw-sb)); }
}

@keyframes pw-pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) {
  .pw-lobby *, .pw-hud *, #loading * { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; }
  .pw-float { display: none; }
}
