:root {
  --bg-0: #160505;
  --bg-1: #2a0a0a;
  --bg-2: #4a1010;
  --ink: #f4ecd8;
  --ink-dim: #c9a98a;
  --accent: #ffcc66;
  --accent-warm: #ff8a4c;
  --panel: rgba(22, 5, 5, 0.88);
  --panel-line: rgba(255, 204, 102, 0.28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background:
    radial-gradient(1200px 800px at 50% -10%, #5a1010 0%, var(--bg-0) 70%),
    var(--bg-0);
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  overflow: hidden;
}

.hidden { display: none !important; }

.landing {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 10;
}
.landing-card {
  width: min(420px, 90vw);
  padding: 32px 28px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  text-align: center;
}
.title {
  font-size: 32px;
  letter-spacing: 3px;
  margin: 0 0 6px;
  color: var(--ink);
  text-shadow: 0 0 24px rgba(255,204,102,0.25);
}
.title .accent { color: var(--accent); }
.tagline {
  margin: 0 0 22px;
  color: var(--ink-dim);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.field {
  display: block;
  text-align: left;
  margin: 14px 0;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.field input {
  margin-top: 6px;
  width: 100%;
  padding: 10px 12px;
  background: rgba(0,0,0,0.35);
  color: var(--ink);
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  letter-spacing: 1px;
}
.field input:focus { outline: 1px solid var(--accent); }

.color-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.color-row button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.color-row button.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--accent);
}

.play-btn {
  margin-top: 10px;
  width: 100%;
  padding: 14px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-warm) 100%);
  color: #1a0f04;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 4px;
  font-size: 16px;
  cursor: pointer;
  transition: transform 80ms ease;
}
.play-btn:hover { transform: translateY(-1px); }
.play-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.notice {
  margin: 14px 0 0;
  font-size: 10px;
  color: var(--ink-dim);
  letter-spacing: 0.5px;
}
.status {
  margin: 6px 0 0;
  font-size: 10px;
  color: var(--ink-dim);
  letter-spacing: 1px;
}
.status.error { color: var(--accent-warm); }

.game {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
}
#canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  width: min(1280px, calc(100vw - 24px));
  height: auto;
  max-height: calc(100vh - 24px);
  aspect-ratio: 1280 / 800;
  background: #1a1530;
  border: 1px solid var(--panel-line);
  border-radius: 6px;
}

.hud {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  pointer-events: none;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-dim);
  z-index: 2;
}
.hud-left {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--panel);
  padding: 8px 14px;
  border: 1px solid var(--panel-line);
  border-radius: 10px;
}
.hud-controls {
  background: var(--panel);
  padding: 8px 14px;
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  font-size: 10px;
  color: var(--ink-dim);
}
.hud-self {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}
.hud-self .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.hud-hp {
  display: flex;
  gap: 3px;
  letter-spacing: 0;
}
.hud-hp .heart {
  font-size: 16px;
  line-height: 1;
  text-shadow: 0 0 6px rgba(255,111,145,0.6);
}
.hud-hp .heart.on { color: #ff6f91; }
.hud-hp .heart.off { color: #3a1a2a; text-shadow: none; }
.hud-kills {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 2px;
}

.leaderboard {
  position: absolute;
  top: 70px;
  right: 18px;
  width: 260px;
  max-height: calc(100vh - 100px);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: 14px 14px 12px;
  z-index: 2;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.lb-head {
  border-bottom: 1px solid var(--panel-line);
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.lb-title {
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--accent);
  font-weight: 700;
}
.lb-sub {
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.lb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.lb-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 8px;
}
.lb-row.prize-1 {
  background: linear-gradient(135deg, rgba(255,204,102,0.18), rgba(255,138,76,0.10));
  border-color: rgba(255,204,102,0.45);
  box-shadow: 0 0 24px rgba(255,204,102,0.15);
}
.lb-row.prize-2 {
  background: linear-gradient(135deg, rgba(207,214,220,0.14), rgba(180,190,200,0.06));
  border-color: rgba(207,214,220,0.35);
}
.lb-row.prize-3 {
  background: linear-gradient(135deg, rgba(204,138,74,0.16), rgba(150,90,40,0.08));
  border-color: rgba(204,138,74,0.4);
}
.lb-rank {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
}
.lb-mid {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lb-name {
  font-size: 12px;
  color: var(--ink);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-name .dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.lb-empty {
  color: var(--ink-dim);
  font-style: italic;
  letter-spacing: 1px;
}
.lb-kills {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.lb-prize {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
}
.lb-divider {
  height: 1px;
  background: var(--panel-line);
  margin: 4px 0;
}
.lb-row-mini {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  padding: 5px 8px;
  font-size: 11px;
  background: transparent;
  border: none;
}
.lb-rank-mini {
  color: var(--ink-dim);
  letter-spacing: 1px;
}
.lb-name-mini {
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-name-mini .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.lb-kills-mini {
  color: var(--accent);
  font-weight: 700;
}
.lb-foot {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--panel-line);
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--ink-dim);
  text-align: center;
}

.tutorial {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  animation: tutorialFade 360ms ease-out;
}
@keyframes tutorialFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.tutorial-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(140, 18, 24, 0.55) 0%, rgba(0, 0, 0, 0.78) 70%),
    repeating-linear-gradient(45deg, rgba(255, 60, 60, 0.04) 0 2px, transparent 2px 14px);
  backdrop-filter: blur(2px);
}
.tutorial-card {
  position: relative;
  width: min(520px, 92vw);
  max-height: 92vh;
  overflow-y: auto;
  padding: 32px 34px 26px;
  text-align: center;
  background:
    linear-gradient(180deg, #2b0a0a 0%, #160404 100%);
  border: 1px solid rgba(255, 204, 102, 0.4);
  border-radius: 12px;
  box-shadow:
    0 0 0 1px rgba(180, 30, 30, 0.4),
    0 40px 100px rgba(0, 0, 0, 0.7),
    inset 0 0 60px rgba(180, 30, 30, 0.18);
  color: #f4e9c8;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.tutorial-ink-1,
.tutorial-ink-2 {
  position: absolute;
  font-family: "STKaiti", "KaiTi", "AR PL UKai CN", "SimSun", "Songti SC", serif;
  font-weight: 700;
  color: rgba(255, 80, 80, 0.10);
  pointer-events: none;
  user-select: none;
  text-shadow: 0 0 40px rgba(180, 30, 30, 0.35);
}
.tutorial-ink-1 {
  top: -18px;
  left: -8px;
  font-size: 220px;
  line-height: 1;
  transform: rotate(-8deg);
}
.tutorial-ink-2 {
  bottom: -28px;
  right: -10px;
  font-size: 220px;
  line-height: 1;
  transform: rotate(8deg);
}
.tutorial-banner {
  font-family: "STKaiti", "KaiTi", "Songti SC", "AR PL UKai CN", "SimSun", serif;
  font-size: 38px;
  letter-spacing: 18px;
  padding-left: 18px;
  color: #ffd86a;
  text-shadow:
    0 0 18px rgba(255, 170, 80, 0.55),
    0 0 2px rgba(255, 60, 40, 0.8);
  margin-bottom: 6px;
  position: relative;
}
.tutorial-title {
  margin: 0 0 4px;
  font-size: 18px;
  letter-spacing: 8px;
  color: #f4e9c8;
  position: relative;
}
.tutorial-sub {
  margin: 0 0 22px;
  font-size: 10px;
  letter-spacing: 3px;
  color: #c9a85a;
  text-transform: uppercase;
  position: relative;
}
.tutorial-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
  position: relative;
  text-align: left;
}
.tutorial-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 204, 102, 0.18);
  border-left: 3px solid #c0344f;
  border-radius: 6px;
}
.tutorial-han {
  font-family: "STKaiti", "KaiTi", "Songti SC", "AR PL UKai CN", "SimSun", serif;
  font-size: 44px;
  line-height: 1;
  color: #ffd86a;
  text-align: center;
  text-shadow:
    0 0 14px rgba(255, 170, 80, 0.5),
    1px 1px 0 #6a1a1a;
  font-weight: 700;
}
.tutorial-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tutorial-key {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #f4e9c8;
}
.tutorial-desc {
  font-size: 11px;
  letter-spacing: 1px;
  color: #c9a85a;
}
.tutorial-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(180deg, #d33a3a 0%, #7a1a1a 100%);
  color: #fff5d6;
  border: 1px solid rgba(255, 204, 102, 0.5);
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 6px;
  font-size: 15px;
  cursor: pointer;
  position: relative;
  text-shadow: 0 0 8px rgba(255, 220, 150, 0.4);
  transition: transform 80ms ease, box-shadow 120ms ease;
  box-shadow: 0 6px 24px rgba(120, 20, 20, 0.45);
}
.tutorial-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 32px rgba(180, 40, 40, 0.6);
}
.tutorial-hint {
  margin: 10px 0 0;
  font-size: 9px;
  letter-spacing: 2px;
  color: #8a6a3a;
  text-transform: uppercase;
  position: relative;
}

.attack-hint {
  position: absolute;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 12px;
  background: linear-gradient(180deg, rgba(43, 10, 10, 0.95) 0%, rgba(22, 4, 4, 0.95) 100%);
  border: 1px solid rgba(255, 204, 102, 0.45);
  border-radius: 10px;
  color: #f4e9c8;
  box-shadow:
    0 0 0 1px rgba(180, 30, 30, 0.4),
    0 20px 50px rgba(0, 0, 0, 0.55),
    inset 0 0 40px rgba(180, 30, 30, 0.18);
  font-size: 13px;
  letter-spacing: 1.5px;
  animation: hintIn 480ms ease-out, hintPulse 1.8s ease-in-out 480ms infinite;
}
.attack-hint.fading {
  animation: hintOut 700ms ease-in forwards;
}
.attack-hint .ah-han {
  font-family: "STKaiti", "KaiTi", "Songti SC", "AR PL UKai CN", "SimSun", serif;
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
  color: #ffd86a;
  text-shadow: 0 0 12px rgba(255, 170, 80, 0.5);
  padding-right: 8px;
  border-right: 1px solid rgba(255, 204, 102, 0.25);
}
.attack-hint .ah-text {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.attack-hint kbd {
  display: inline-block;
  margin: 0 2px;
  padding: 2px 8px;
  background: rgba(255, 204, 102, 0.15);
  border: 1px solid rgba(255, 204, 102, 0.45);
  border-radius: 4px;
  color: #ffd86a;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
}
.attack-hint .ah-close {
  background: transparent;
  border: none;
  color: #c9a85a;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 0 0 6px;
  font-family: inherit;
}
.attack-hint .ah-close:hover { color: #ffd86a; }
@keyframes hintIn {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes hintOut {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, 16px); }
}
@keyframes hintPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(180, 30, 30, 0.4), 0 20px 50px rgba(0, 0, 0, 0.55), inset 0 0 40px rgba(180, 30, 30, 0.18); }
  50% { box-shadow: 0 0 0 1px rgba(220, 60, 60, 0.6), 0 20px 60px rgba(255, 110, 70, 0.18), inset 0 0 50px rgba(220, 60, 60, 0.28); }
}

.sound-toggle {
  position: absolute;
  top: 18px;
  right: 296px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--panel);
  color: var(--accent);
  border: 1px solid var(--panel-line);
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 120ms ease, color 120ms ease;
}
.sound-toggle:hover { background: rgba(255, 204, 102, 0.12); }
.sound-toggle.muted { color: var(--ink-dim); opacity: 0.7; }

.death {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at center, rgba(150,30,40,0.45), rgba(0,0,0,0.65));
  z-index: 6;
  animation: deathFade 320ms ease-out;
}
@keyframes deathFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.death-card {
  background: var(--panel);
  border: 1px solid rgba(255,111,145,0.5);
  border-radius: 14px;
  padding: 28px 36px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(120,20,40,0.4);
}
.death-card h2 {
  margin: 0 0 6px;
  letter-spacing: 8px;
  font-size: 28px;
  color: #ff6f91;
  text-shadow: 0 0 24px rgba(255,111,145,0.5);
}
.death-card p {
  margin: 0 0 16px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.death-card button {
  padding: 12px 28px;
  background: linear-gradient(180deg, #ff6f91 0%, #c0344f 100%);
  color: #ffe;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 80ms ease;
}
.death-card button:hover { transform: translateY(-1px); }

.chat {
  position: absolute;
  bottom: 28px;
  left: 28px;
  width: 300px;
  max-width: calc(50vw - 30px);
  z-index: 2;
}
.chat-log {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 8px 8px 0 0;
  padding: 10px 12px;
  max-height: 160px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.5;
  scrollbar-width: thin;
}
.chat-log .msg .who { font-weight: 700; margin-right: 6px; }
.chat-log .msg .text { color: var(--ink); }
.chat-log:empty::before {
  content: "Say hi to the other warriors…";
  color: var(--ink-dim);
  font-style: italic;
}
.chat-input {
  display: block;
  width: 100%;
  padding: 9px 12px;
  background: rgba(0,0,0,0.55);
  color: var(--ink);
  border: 1px solid var(--panel-line);
  border-top: none;
  border-radius: 0 0 8px 8px;
  font: inherit;
  font-size: 12px;
}
.chat-input:focus { outline: 1px solid var(--accent); }

.pause {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.55);
  z-index: 5;
}
.pause-card {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: 24px 30px;
  text-align: center;
}
.pause-card h2 { margin: 0 0 14px; letter-spacing: 4px; }
.pause-card button {
  display: block;
  width: 200px;
  margin: 8px auto;
  padding: 10px;
  background: rgba(255,204,102,0.15);
  color: var(--ink);
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  letter-spacing: 2px;
}
.pause-card button:hover { background: rgba(255,204,102,0.25); }

.touch-controls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  display: none;
}
.touch-joystick {
  position: absolute;
  left: max(20px, env(safe-area-inset-left));
  bottom: max(24px, env(safe-area-inset-bottom));
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.6) 100%);
  border: 2px solid rgba(255,204,102,0.45);
  box-shadow: 0 6px 22px rgba(0,0,0,0.55);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.joystick-stick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  margin: -31px 0 0 -31px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffcc66 0%, #ff8a4c 100%);
  border: 2px solid rgba(255,255,255,0.55);
  box-shadow: 0 4px 12px rgba(0,0,0,0.45);
  pointer-events: none;
  transition: transform 60ms ease-out;
  will-change: transform;
}
.touch-attack {
  position: absolute;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(28px, env(safe-area-inset-bottom));
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd84d 0%, #c41818 75%);
  color: #f4eedb;
  font-size: 52px;
  font-weight: 700;
  border: 3px solid rgba(255,204,102,0.7);
  pointer-events: auto;
  touch-action: none;
  cursor: pointer;
  font-family: 'STKaiti','KaiTi','Songti SC','Noto Serif CJK SC','SimSun','PingFang SC',serif;
  text-shadow: 0 0 14px rgba(255,204,102,0.65), 0 2px 0 rgba(0,0,0,0.4);
  box-shadow: 0 8px 24px rgba(0,0,0,0.55), inset 0 -6px 0 rgba(0,0,0,0.28);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  padding: 0;
  line-height: 1;
}
.touch-attack:active { transform: scale(0.94); }
.touch-menu {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  color: var(--ink);
  font-size: 22px;
  font-weight: 700;
  pointer-events: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

body.is-touch .game { touch-action: none; }
body.is-touch #canvas { touch-action: none; }
body.is-touch .touch-controls { display: block; }
body.is-touch .hud-controls { display: none; }
body.is-touch .chat { display: none; }
body.is-touch .attack-hint { display: none !important; }
body.is-touch .sound-toggle { display: none; }

body.is-touch .leaderboard {
  display: flex;
  top: max(64px, calc(env(safe-area-inset-top) + 56px));
  right: max(8px, env(safe-area-inset-right));
  width: 156px;
  max-height: 240px;
  padding: 8px 8px 6px;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
}
body.is-touch .lb-head { padding-bottom: 5px; margin-bottom: 5px; }
body.is-touch .lb-title { font-size: 10px; letter-spacing: 2px; }
body.is-touch .lb-sub { display: none; }
body.is-touch .lb-foot { display: none; }
body.is-touch .lb-list { gap: 4px; }
body.is-touch .lb-row {
  padding: 4px 6px;
  gap: 5px;
  grid-template-columns: 24px 1fr auto;
  border-radius: 6px;
}
body.is-touch .lb-rank { font-size: 10px; letter-spacing: 0; }
body.is-touch .lb-name {
  font-size: 10px;
  letter-spacing: 0.5px;
  gap: 4px;
}
body.is-touch .lb-name .dot { width: 6px; height: 6px; }
body.is-touch .lb-kills { font-size: 8px; letter-spacing: 1px; }
body.is-touch .lb-prize { display: none; }
body.is-touch .lb-row-mini {
  grid-template-columns: 20px 1fr auto;
  padding: 3px 5px;
  font-size: 9px;
  gap: 4px;
}
body.is-touch .lb-rank-mini { font-size: 9px; }
body.is-touch .lb-name-mini { font-size: 9px; gap: 4px; }
body.is-touch .lb-name-mini .dot { width: 6px; height: 6px; }
body.is-touch .lb-kills-mini { font-size: 9px; }
body.is-touch .lb-bot {
  margin-left: 2px;
  padding: 0 3px;
  font-size: 7px;
  letter-spacing: 0.5px;
}

@media (hover: none) and (pointer: coarse) {
  .touch-controls { display: block; }
  .hud-controls { display: none; }
  .chat { display: none; }
  .attack-hint { display: none !important; }
  .sound-toggle { display: none; }
  .hud { top: 12px; left: 12px; right: 64px; }
  .hud-left {
    padding: 6px 10px;
    gap: 10px;
    font-size: 9px;
    letter-spacing: 1px;
  }
  .hud-hp .heart { font-size: 13px; }
  .hud-kills { font-size: 10px; }
  #canvas {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
  .tutorial-card { max-width: 92vw; padding: 22px 18px; }
  .death-card, .pause-card { max-width: 86vw; }
  .leaderboard {
    display: flex;
    top: 60px;
    right: 8px;
    width: 138px;
    padding: 8px 8px 6px;
    border-radius: 8px;
    max-height: calc(100vh - 80px);
  }
  .lb-head { padding-bottom: 6px; margin-bottom: 6px; }
  .lb-title { font-size: 10px; letter-spacing: 2px; }
  .lb-sub { display: none; }
  .lb-foot { display: none; }
  .lb-row {
    grid-template-columns: 22px 1fr auto;
    gap: 6px;
    padding: 5px 6px;
  }
  .lb-rank { font-size: 10px; letter-spacing: 0.5px; }
  .lb-name { font-size: 10px; letter-spacing: 0.5px; gap: 4px; }
  .lb-name .dot { width: 6px; height: 6px; }
  .lb-kills { font-size: 8px; letter-spacing: 0.5px; }
  .lb-prize { font-size: 10px; letter-spacing: 0; }
  .lb-row-mini { display: none; }
  .lb-divider { display: none; }
}

@media (max-width: 760px) and (hover: hover) {
  .leaderboard { display: none; }
  .hud-controls { display: none; }
}
