:root {
  --bg-1: #0f172a;
  --bg-2: #1d4ed8;
  --bg-3: #0ea5e9;
  --panel: rgba(15, 23, 42, 0.72);
  --panel-border: rgba(255, 255, 255, 0.2);
  --text-main: #f8fafc;
  --text-muted: #dbeafe;
  --accent: #f59e0b;
  --accent-2: #f97316;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  touch-action: manipulation; /* disables double-tap zoom */
}

/* ── Rotate overlay (portrait on mobile) ──────────────── */
.rotate-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-1);
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text-main);
}

.rotate-overlay-text {
  margin: 0;
  padding: 20px 24px;
  font-weight: 700;
  font-size: 1.05rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(2, 8, 23, 0.62);
}

.network-ping {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1300;
  padding: 5px 10px;
  border-radius: 10px;
  background: rgba(2, 8, 23, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #dbeafe;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.network-ping.mid {
  border-color: rgba(245, 158, 11, 0.48);
  color: #fde68a;
}

.network-ping.high {
  border-color: rgba(239, 68, 68, 0.54);
  color: #fecaca;
}

@media (max-width: 767px) and (orientation: portrait) {
  .rotate-overlay { display: flex; }
}

/* ── Target hint ───────────────────────────────────────── */
.target-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 2px 0 0;
  min-height: 2rem;
}

.target-hint-text {
  font-size: 1.5rem;
  font-weight: 700;
}

.target-hint-svg {
  width: 1.8rem;
  height: 1.8rem;
  flex-shrink: 0;
}

body {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 15px;
  color: var(--text-main);
  background:
    radial-gradient(circle at 18% 18%, rgba(251, 191, 36, 0.3), transparent 36%),
    radial-gradient(circle at 82% 12%, rgba(56, 189, 248, 0.28), transparent 34%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2) 56%, var(--bg-3));
  overflow: hidden;
  height: 100dvh;
  margin: 0;
  padding: 0;
}

.app {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.app::before,
.app::after {
  content: "";
  position: absolute;
  width: 42vmax;
  height: 42vmax;
  border-radius: 50%;
  filter: blur(10px);
  z-index: 0;
  pointer-events: none;
}

.app::before {
  background: rgba(249, 115, 22, 0.24);
  top: -18vmax;
  left: -14vmax;
}

.app::after {
  background: rgba(14, 165, 233, 0.2);
  right: -18vmax;
  bottom: -20vmax;
}

.screen {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.screen.active {
  display: flex;
}

.hero-card,
.panel {
  width: min(620px, 100%);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(2, 8, 23, 0.35);
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.2em;
  font-weight: 700;
  font-size: 0.8rem;
}

h1,
h2 {
  margin: 0;
  font-family: "Bungee", "Trebuchet MS", sans-serif;
  line-height: 1.2;
}

h3 {
  margin: 0;
  font-size: 1.1rem;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  margin-top: 10px;
}

h2 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.tagline {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 48ch;
}

.menu-buttons {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.start-difficulty-menu {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.start-difficulty-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 8px;
}

.text-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: var(--text-main);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 1rem;
}

.text-input::placeholder {
  color: rgba(219, 234, 254, 0.55);
}

.text-input-code {
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #0f172a;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--text-main);
}

.btn-small {
  padding: 8px 12px;
  font-size: 0.9rem;
}

.option-row {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.option-row label {
  font-weight: 500;
}

.option-stack {
  flex-direction: column;
  align-items: stretch;
}

select,
input[type="checkbox"] {
  cursor: pointer;
}

select {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: var(--text-main);
  border-radius: 8px;
  padding: 9px;
  font-family: inherit;
}

.toggle-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

#game-screen {
  padding: 0;
  gap: 0;
  align-items: stretch;
  justify-content: flex-start;
  flex-direction: column;
  height: 100dvh;
  height: 100svh;
  min-height: 100svh;
  overflow: hidden;
  width: 100vw;
}

#game-screen.active {
  display: block;
}

#game-screen .game-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Canvas overlay HUD elements ─────────────────── */
.canvas-notch {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: rgba(2, 8, 23, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.canvas-notch-top {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  max-width: 65%;
  border-radius: 0 0 14px 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  border-top: 0;
  padding: 4px 52px 6px 52px;
  text-align: center;
  min-height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.canvas-notch-br {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  max-width: 70%;
  border-radius: 14px 14px 0 0;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom: 0;
  padding: 5px 12px 7px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.canvas-notch-label {
  display: block;
  font-size: 0.56rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.canvas-top-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 2px;
}

.canvas-chip-label {
  font-size: 0.54rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.canvas-chip-value {
  font-size: 0.8rem;
  font-weight: 700;
}

.canvas-score-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  justify-content: center;
}

.canvas-score-row + .canvas-score-row {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  padding-left: 14px;
  margin-left: 4px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.canvas-score-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.canvas-score-value {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: "Bungee", "Trebuchet MS", sans-serif;
  line-height: 1;
}

.canvas-battle-banner {
  position: absolute;
  top: 44px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(2, 8, 23, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  padding: 2px 8px;
  font-size: 0.65rem;
  color: var(--text-muted);
  z-index: 5;
  pointer-events: none;
  margin: 0;
}

.battle-panel {
  width: min(680px, 100%);
  padding: 18px;
  position: relative;
}

.battle-home-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.battle-home-btn:hover {
  filter: brightness(1.08);
}

.battle-name-setup {
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(2, 8, 23, 0.42);
}

.battle-identity-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.battle-mode-switch {
  margin-top: 12px;
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mode-btn.active {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #0f172a;
}

.battle-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
}

.battle-action-row {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.join-code-row {
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.join-code-row label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.rating-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.6);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.rank-medal {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.rank-name {
  letter-spacing: 0.01em;
}

.rank-brass .rank-medal {
  background: linear-gradient(135deg, #caa472, #9f6f42);
}

.rank-bronze .rank-medal {
  background: linear-gradient(135deg, #d89a63, #b56a31);
}

.rank-silver .rank-medal {
  background: linear-gradient(135deg, #e5e7eb, #9ca3af);
}

.rank-gold .rank-medal {
  background: linear-gradient(135deg, #fde68a, #f59e0b);
}

.store-panel {
  width: min(900px, 100%);
}

.store-balance {
  margin-top: 16px;
  font-size: 1.1rem;
  font-weight: 700;
}

.tap-pass-card {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(2, 8, 23, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.tap-pass-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tap-pass-level {
  margin: 0;
  font-weight: 700;
  color: #facc15;
}

.tap-pass-bar {
  margin-top: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.tap-pass-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22d3ee, #f59e0b);
}

.tap-pass-rewards-wrap {
  margin-top: 12px;
}

.tap-pass-reward-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.tap-pass-reward-list li {
  margin: 4px 0;
  color: var(--text-muted);
}

/* ── Tournament bracket ──────────────────────────── */
@keyframes bracketPulseIn {
  0%   { opacity: 0; transform: scale(0.84); }
  60%  { opacity: 1; transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}

.bracket-pulse-in {
  animation: bracketPulseIn 0.42s ease-out forwards;
}

.tournament-bracket {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 12px 0 4px;
  scrollbar-width: thin;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  min-width: 148px;
  flex-shrink: 0;
}

.bracket-round-label {
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding: 0 4px;
}

.bracket-match {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 5px 4px;
  position: relative;
}

.bracket-match::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  width: 4px;
  height: 1px;
  background: rgba(255,255,255,0.18);
}

.bracket-slot {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 30px;
  transition: border-color 0.25s, opacity 0.25s;
}

.bracket-slot.winner {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.08);
  color: #86efac;
}

.bracket-slot.loser {
  opacity: 0.45;
  color: var(--text-muted);
}

.bracket-slot-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bracket-slot.loser .bracket-slot-name {
  text-decoration: line-through;
  text-decoration-color: #f87171;
}

.bracket-slot-x {
  color: #f87171;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.bracket-wins {
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.bracket-slot.winner .bracket-wins {
  color: #86efac;
  font-weight: 700;
}

.bracket-slot.live-slot {
  border-color: rgba(96, 165, 250, 0.45);
}

/* Ready card */
.tournament-ready-card {
  margin-top: 14px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}

.tournament-ready-timer {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fde68a;
  margin: 6px 0 12px;
}

.tournament-match-list {
  margin: 10px 0 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.tournament-match-list li {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.55);
  padding: 10px;
}

.tournament-match-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 700;
}

.tournament-badge {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #bae6fd;
}

.tournament-badge.bo5 {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.16);
}

.tournament-badge.live {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.16);
}

.tournament-match-line {
  margin-top: 6px;
  color: var(--text-muted);
}

.battle-leaderboard-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.store-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.store-card {
  background: rgba(2, 8, 23, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 14px;
}

.store-card p {
  margin: 10px 0 0;
  color: var(--text-muted);
}

.store-price {
  color: #fde68a;
  font-weight: 700;
}

.store-note {
  margin-top: 10px;
  font-size: 0.95rem;
}

.store-sound-list {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-list {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  cursor: pointer;
  padding: 0;
}

.color-dot.selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.color-dot.locked {
  opacity: 0.38;
  filter: grayscale(0.5);
  cursor: not-allowed;
}

.store-sound-list .btn.locked {
  opacity: 0.55;
}

.battle-achievements-card {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(2, 8, 23, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.battle-status-card {
  margin-top: 18px;
  padding: 18px;
  border-radius: 16px;
  background: rgba(2, 8, 23, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.room-code-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.room-code {
  margin: 8px 0 0;
  font-family: "Bungee", "Trebuchet MS", sans-serif;
  font-size: clamp(1.4rem, 4vw, 2rem);
  letter-spacing: 0.1em;
}

.battle-status,
.battle-detail {
  margin: 10px 0 0;
}

.battle-status {
  font-size: 1.05rem;
  font-weight: 700;
}

.battle-detail {
  color: var(--text-muted);
}

.queue-ad {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  background: linear-gradient(120deg, rgba(245, 158, 11, 0.2), rgba(59, 130, 246, 0.2));
}

.queue-ad-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: #fef3c7;
}

.queue-ad-slot-wrap {
  margin-top: 8px;
  min-height: 110px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 8px;
}

.queue-ad-slot {
  width: 100%;
  min-height: 90px;
}

.queue-ad-copy {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.hud {
  width: min(1200px, 100%);
  margin: 8px auto 0;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 12px;
}

.hud-box {
  background: rgba(2, 8, 23, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 10px 14px;
}

.hud-label {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hud-value {
  margin: 2px 0 0;
  font-size: 1.5rem;
  font-weight: 700;
}

/* Legacy HUD blocks kept for non-game screens; game screen uses in-canvas overlays. */

.idle-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
  font-family: "Bungee", "Trebuchet MS", sans-serif;
  font-size: clamp(4rem, 14vw, 9rem);
  color: #ef4444;
  text-shadow: 0 0 32px rgba(239, 68, 68, 0.7), 0 0 4px #000;
  animation: countdown-pulse 1s ease-in-out infinite;
}

.idle-countdown.hidden {
  display: none;
}

@keyframes countdown-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.82; }
}

#game-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 10% 20%, rgba(249, 115, 22, 0.14), transparent 38%),
    radial-gradient(circle at 90% 80%, rgba(56, 189, 248, 0.16), transparent 42%),
    rgba(2, 8, 23, 0.55);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  touch-action: manipulation;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 8, 23, 0.45);
  border-radius: 18px;
}

.hidden {
  display: none;
}

.gameover-panel {
  width: min(640px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  overflow-x: hidden;
  overflow-y: auto;
}

.gameover-panel p {
  margin: 12px 0 0;
}

.final-score {
  font-size: 1.1rem;
  font-weight: 700;
}

.new-record {
  margin-top: 8px;
  color: #facc15;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.achievement-carousel {
  margin-top: 14px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.achievement-chip {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(130deg, rgba(56, 189, 248, 0.22), rgba(245, 158, 11, 0.2));
  padding: 10px;
  font-size: 0.92rem;
  color: var(--text-main);
  min-height: 58px;
}

.battle-chat {
  margin-top: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(15, 23, 42, 0.45);
  padding: 10px;
}

.battle-chat-messages {
  margin-top: 8px;
  max-height: 160px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
}

.battle-chat-line {
  border-radius: 8px;
  padding: 7px 8px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.battle-chat-line.achievement {
  background: rgba(250, 204, 21, 0.18);
  color: #fde68a;
}

.battle-chat-input-row {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.battle-chat-quick-row {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 820px) {
  .screen {
    padding: 16px;
  }

  .hero-card,
  .panel {
    padding: 20px;
  }

  .hud {
  .hud { display: none; }

  .battle-actions,
  .join-row {
    grid-template-columns: 1fr;
  }

  .store-grid {
    grid-template-columns: 1fr;
  }

  .battle-leaderboard-grid {
    grid-template-columns: 1fr;
  }

  .hud-value,
  .target-hint-text {
    font-size: 1.3rem;
  }
}
