* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0a0a1a;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  color: white;
}

#gameCanvas {
  display: block;
  cursor: none;
}

/* ===== MAIN MENU / JOIN SCREEN ===== */
#joinScreen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 100;
  overflow: hidden;
}

.menu-bg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: url('../assets/menu_bg.png') center center / cover no-repeat,
              linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.menu-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.75) 100%);
  z-index: 1;
}

/* Menu Content Container */
.menu-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 20px;
}

/* Logo */
.menu-logo {
  max-width: 420px;
  width: 35%;
  margin-bottom: 36px;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,0.7));
}

.menu-logo-fallback {
  text-align: center;
  margin-bottom: 36px;
}

.menu-logo-fallback h1 {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: -2px;
  margin-bottom: 4px;
  text-shadow: 0 4px 20px rgba(0,0,0,0.8);
}

.accent {
  color: #e74c3c;
}

.menu-logo-fallback .subtitle {
  font-size: 16px;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 6px;
}

/* Primary CTA - PLAY Button */
.menu-primary {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
}

.menu-play-btn {
  width: 300px;
  padding: 18px 40px;
  font-size: 30px;
  font-weight: 900;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  letter-spacing: 10px;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 6px 30px rgba(231,76,60,0.35), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.menu-play-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 8px 40px rgba(231,76,60,0.5), inset 0 1px 0 rgba(255,255,255,0.25);
}

.menu-play-btn:active {
  transform: scale(0.98);
  box-shadow: 0 3px 15px rgba(231,76,60,0.3);
}

/* Name input (always visible above PLAY) */
.menu-name-input {
  display: block;
  width: 300px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 16px;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  color: white;
  outline: none;
  text-align: center;
  backdrop-filter: blur(8px);
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.menu-name-input:focus {
  border-color: #c9a84c;
}

.menu-name-input::placeholder {
  color: rgba(255,255,255,0.35);
}

/* Confirm Buttons (shared) */
.menu-confirm {
  display: block;
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 3px;
  transition: all 0.2s;
  box-shadow: 0 3px 12px rgba(231,76,60,0.3);
}

.menu-confirm:hover {
  background: linear-gradient(180deg, #ff5544 0%, #e74c3c 100%);
  box-shadow: 0 4px 18px rgba(231,76,60,0.45);
}

/* Secondary Button Row */
.menu-secondary {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.menu-sec-btn {
  padding: 11px 20px;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.menu-sec-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: #c9a84c;
  color: #c9a84c;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.menu-sec-btn:active {
  transform: translateY(0);
}

/* Skins button highlight */
.menu-sec-btn-skins {
  border-color: rgba(243,156,18,0.5);
  color: #f5ab35;
  background: rgba(243,156,18,0.1);
  box-shadow: 0 0 12px rgba(243,156,18,0.15);
}

.menu-sec-btn-skins:hover {
  border-color: #f39c12;
  color: #f5ab35;
  background: rgba(243,156,18,0.18);
  box-shadow: 0 0 20px rgba(243,156,18,0.25);
}

/* Footer */
.menu-footer {
  position: absolute;
  bottom: 24px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.version-text {
  font-size: 12px;
  color: rgba(255,255,255,0.2);
  margin-left: 4px;
}

/* ===== MODAL SYSTEM ===== */
.menu-modal {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(4px);
}

.menu-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: rgba(18,18,32,0.97);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 16px;
  padding: 32px 36px;
  min-width: 340px;
  max-width: 440px;
  width: 90%;
  position: relative;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.menu-modal.open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-card.modal-wide {
  max-width: 680px;
  min-width: 560px;
}

.modal-card h3 {
  font-size: 18px;
  color: #c9a84c;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
  padding: 0;
}

.modal-close:hover {
  color: #fff;
}

/* Modal Inputs */
.modal-input {
  display: block;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 10px;
  font-size: 16px;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  color: white;
  outline: none;
  text-align: center;
  transition: border-color 0.2s;
}

.modal-input:focus {
  border-color: #c9a84c;
}

.modal-input::placeholder {
  color: rgba(255,255,255,0.3);
}

.modal-input.room-code {
  font-family: monospace;
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 5px;
}

/* ===== SKINS PANEL ===== */
.skins-aircraft-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.skins-tab {
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.04);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.skins-tab:hover {
  color: rgba(255,255,255,0.8);
  background: rgba(255,255,255,0.08);
}

.skins-tab.active {
  color: #c9a84c;
  border-color: #c9a84c;
  background: rgba(201,168,76,0.1);
}

.skins-tier-label {
  display: flex;
  align-items: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.25);
  padding: 4px 8px;
  white-space: nowrap;
}

.skins-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
  padding-top: 4px;
  padding-right: 4px;
}

.skins-grid::-webkit-scrollbar {
  width: 4px;
}

.skins-grid::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}

.skin-card {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.skin-card:hover {
  border-color: rgba(201,168,76,0.5);
  background: rgba(255,255,255,0.07);
  transform: translateY(-2px);
}

.skin-card.selected {
  border-color: #2ecc71;
  background: rgba(46,204,113,0.08);
}

.skin-card.selected::before {
  content: 'EQUIPPED';
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #2ecc71;
  background: rgba(46,204,113,0.15);
  padding: 2px 6px;
  border-radius: 4px;
}

.skin-card.locked {
  opacity: 0.55;
}

.skin-card.locked:hover {
  opacity: 0.75;
}

.skin-preview {
  width: 80px;
  height: 80px;
  margin: 0 auto 10px;
}

.skin-preview canvas {
  display: block;
}

.skin-name {
  font-size: 13px;
  font-weight: 700;
  color: #eee;
  margin-bottom: 2px;
}

.skin-desc {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 4px;
}

.skin-unlock-btn {
  margin-top: 10px;
  padding: 7px 14px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(180deg, #f39c12 0%, #e67e22 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  box-shadow: 0 2px 10px rgba(243,156,18,0.3);
}

.skin-unlock-btn:hover {
  background: linear-gradient(180deg, #f5ab35 0%, #f39c12 100%);
  box-shadow: 0 3px 14px rgba(243,156,18,0.45);
  transform: translateY(-1px);
}

/* ===== HOW TO PLAY ===== */
.htp-pages {
  position: relative;
  min-height: 260px;
}

.htp-page {
  display: none;
  padding: 4px 0;
}

.htp-page.active {
  display: block;
}

.htp-page-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #c9a84c;
  text-align: center;
  margin-bottom: 16px;
}

.htp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}

.htp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.htp-row:last-of-type {
  border-bottom: none;
}

.htp-key {
  display: inline-block;
  min-width: 90px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  font-family: monospace;
  color: #c9a84c;
  background: rgba(201,168,76,0.1);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 6px;
  text-align: center;
}

.htp-row span:last-child {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
}

.htp-tip {
  margin-top: 18px;
  font-size: 13px;
  color: rgba(255,255,255,0.4);
  line-height: 1.6;
  text-align: center;
}

/* Evolution tree */
.htp-evolution-tree {
  text-align: center;
  padding: 10px 0;
}

.htp-evo-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0;
}

.htp-evo-node {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: 8px;
  text-transform: uppercase;
}

.htp-evo-node.starter {
  color: #aaa;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
}

.htp-evo-node.t1 {
  color: #5dade2;
  background: rgba(93,173,226,0.1);
  border: 1px solid rgba(93,173,226,0.3);
}

.htp-evo-node.t2 {
  color: #f39c12;
  background: rgba(243,156,18,0.1);
  border: 1px solid rgba(243,156,18,0.3);
  font-size: 11px;
}

.htp-evo-arrow {
  color: rgba(255,255,255,0.3);
  font-size: 13px;
  margin: 4px 0;
}

/* Tutorial navigation */
.htp-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.htp-nav-btn {
  padding: 6px 18px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.htp-nav-btn:hover {
  color: #c9a84c;
  border-color: #c9a84c;
  background: rgba(201,168,76,0.1);
}

.htp-dots {
  display: flex;
  gap: 8px;
}

.htp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transition: all 0.2s;
}

.htp-dot.active {
  background: #c9a84c;
  box-shadow: 0 0 6px rgba(201,168,76,0.4);
}

/* ===== SETTINGS (inside modal) ===== */
.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.settings-row label {
  font-size: 14px;
  font-weight: 600;
  color: #ccc;
  min-width: 60px;
}

.settings-row input[type="range"] {
  flex: 1;
  accent-color: #c9a84c;
  cursor: pointer;
}

.settings-row span {
  font-size: 13px;
  color: #aaa;
  min-width: 36px;
  text-align: right;
}

.menu-mute-btn {
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s;
}

.menu-mute-btn:hover {
  background: rgba(255,255,255,0.15);
}

.menu-mute-btn.muted {
  color: #e74c3c;
  border-color: #e74c3c;
}

/* ===== IN-GAME UI ===== */
#roomCodeDisplay {
  position: fixed;
  top: 15px;
  left: 15px;
  background: rgba(10,10,20,0.82);
  backdrop-filter: blur(6px);
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  font-family: monospace;
  font-size: 14px;
  z-index: 30;
  cursor: pointer;
  user-select: all;
}

.room-code-prefix {
  color: rgba(255,255,255,0.55);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-right: 8px;
}

#roomCodeValue {
  color: #c9a84c;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 3px;
}

/* Loading Screen */
#loadingScreen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3e 50%, #0a0a1a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.loading-box {
  text-align: center;
}

.loading-box h1 {
  font-size: 72px;
  font-weight: 900;
  letter-spacing: -2px;
  margin-bottom: 4px;
}

.loading-box .subtitle {
  font-size: 18px;
  color: #888;
  margin-bottom: 30px;
  text-transform: uppercase;
  letter-spacing: 4px;
}

.progress-bar-container {
  width: 320px;
  height: 12px;
  background: rgba(255,255,255,0.1);
  border-radius: 6px;
  margin: 0 auto 12px;
  overflow: hidden;
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: #e74c3c;
  border-radius: 6px;
  transition: width 0.2s ease;
}

.progress-text {
  font-size: 14px;
  color: #666;
  letter-spacing: 1px;
}

/* Death Screen */
#deathScreen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.death-box {
  text-align: center;
}

.death-box h2 {
  font-size: 48px;
  color: #e74c3c;
  margin-bottom: 10px;
}

.death-box p {
  font-size: 18px;
  color: #ccc;
  margin-bottom: 8px;
}

/* Evolution Modal - anchored to bottom, no full-screen overlay */
#evolutionModal {
  position: fixed;
  bottom: 0; left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  z-index: 60;
  pointer-events: none;
}

.evolution-box {
  text-align: center;
  background: rgba(20,20,40,0.95);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px 16px 0 0;
  padding: 14px 20px;
  max-width: 900px;
  pointer-events: auto;
}

.evolution-box h2 {
  font-size: 24px;
  color: #f1c40f;
  margin-bottom: 4px;
}

.evolution-box > p {
  color: #888;
  font-size: 13px;
  margin-bottom: 12px;
}

#evolutionChoices {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.evo-choice {
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 16px;
  width: 220px;
  cursor: pointer;
  transition: all 0.2s;
}

.evo-choice:hover {
  border-color: #f1c40f;
  background: rgba(241,196,15,0.1);
  transform: translateY(-4px);
}

.evo-choice h3 {
  font-size: 18px;
  color: #f1c40f;
  margin-bottom: 6px;
}

.evo-choice .evo-desc {
  font-size: 13px;
  color: #888;
  margin-bottom: 10px;
}

.evo-choice .evo-stats {
  font-size: 12px;
  color: #aaa;
  text-align: left;
  line-height: 1.5;
}

.evo-choice .evo-stats span {
  color: #2ecc71;
}

.evo-attr-title {
  flex-basis: 100%;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  color: #2ecc71;
  margin-bottom: 4px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.evo-attr-icon {
  font-size: 28px;
  margin-bottom: 4px;
}

.evo-attr-level {
  font-size: 13px;
  color: #2ecc71;
  margin-top: 8px;
  font-weight: bold;
}

.evo-attr-choice {
  text-align: center;
  width: 160px;
}

.evo-attr-choice h3 {
  font-size: 15px;
}

.evo-key-hint {
  display: inline-block;
  background: rgba(241,196,15,0.2);
  color: #f1c40f;
  font-size: 14px;
  font-weight: bold;
  padding: 2px 10px;
  border-radius: 4px;
  margin-bottom: 6px;
  letter-spacing: 1px;
  border: 1px solid rgba(241,196,15,0.4);
}

/* Chat */
#chatLog {
  position: fixed;
  bottom: 60px;
  left: 340px;
  width: 420px;
  max-height: 270px;
  overflow-y: auto;
  font-size: 18px;
  font-family: monospace;
  pointer-events: none;
  z-index: 30;
}

#chatLog div {
  background: rgba(10,10,20,0.82);
  padding: 3px 9px;
  margin-bottom: 2px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.06);
}

#chatLog .chat-name {
  color: #3498db;
  font-weight: bold;
}

#chatInput {
  position: fixed;
  bottom: 15px;
  left: 340px;
  width: 420px;
  padding: 9px 15px;
  background: rgba(10,10,20,0.82);
  backdrop-filter: blur(6px);
  color: white;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  font-size: 19px;
  font-family: monospace;
  outline: none;
  z-index: 30;
}

/* Round Scoreboard */
#roundScoreboard {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 55;
}

.scoreboard-box {
  text-align: center;
  background: rgba(20,20,40,0.95);
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: 16px;
  padding: 30px 40px;
  min-width: 400px;
  max-width: 600px;
}

.scoreboard-box h2 {
  font-size: 42px;
  color: #FFD700;
  margin-bottom: 20px;
  letter-spacing: 4px;
}

.scoreboard-box #scoreboardTimer {
  font-size: 16px;
  color: #888;
  margin-top: 20px;
}

.sb-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-family: monospace;
  font-size: 16px;
}

.sb-row.sb-top {
  background: rgba(255,215,0,0.08);
}

.sb-rank {
  width: 30px;
  color: #888;
  text-align: right;
  margin-right: 8px;
}

.sb-medal {
  width: 24px;
  font-size: 18px;
}

.sb-name {
  flex: 1;
  color: white;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-score {
  width: 70px;
  color: #f1c40f;
  text-align: right;
  margin-right: 16px;
}

.sb-kd {
  width: 60px;
  color: #aaa;
  text-align: right;
}

/* Animations */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== KEYBINDS PANEL ===== */
#keybindsPanel {
  position: fixed;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  background: rgba(10,10,20,0.82);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 10px 14px;
  z-index: 40;
  font-family: monospace;
  min-width: 190px;
  backdrop-filter: blur(6px);
}

.kb-header {
  font-size: 13px;
  font-weight: 800;
  color: #c9a84c;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.kb-hint {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  font-weight: 400;
}

.kb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 11px;
}

.kb-key {
  color: #c9a84c;
  font-weight: 700;
  min-width: 80px;
  font-size: 10px;
}

.kb-row span:last-child {
  color: rgba(255,255,255,0.55);
  text-align: right;
}

/* Keybinds panel sections & action buttons */
.kb-section {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.kb-btn {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 700;
  font-family: monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.kb-btn:hover {
  background: rgba(255,255,255,0.11);
  border-color: #c9a84c;
  color: #c9a84c;
}

.kb-btn.active {
  background: rgba(231,76,60,0.15);
  border-color: #e74c3c;
  color: #e74c3c;
}

.kb-volume-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding-top: 4px;
}

.kb-volume-panel input[type="range"] {
  flex: 1;
  accent-color: #c9a84c;
  cursor: pointer;
}

.kb-volume-panel span {
  font-size: 10px;
  font-family: monospace;
  color: rgba(255,255,255,0.6);
  min-width: 28px;
  text-align: right;
}

/* Utility */
.hidden {
  display: none !important;
}

/* ===== RESPONSIVE ===== */

/* Wide screens */
@media (min-width: 1600px) {
  .menu-logo-fallback h1 { font-size: 80px; }
  #chatLog   { width: 520px; }
  #chatInput { width: 520px; }
}

/* Standard laptop / large tablet */
@media (max-width: 1280px) {
  #chatLog   { left: 220px; width: 340px; }
  #chatInput { left: 220px; width: 340px; }
}

/* Tablet / small laptop */
@media (max-width: 1024px) {
  .menu-play-btn    { width: 260px; font-size: 24px; padding: 15px 30px; }
  .menu-play-expand { width: 260px; }

  .modal-card.modal-wide { min-width: 0; width: 92vw; max-width: 92vw; }

  #chatLog   { left: 15px; width: calc(55vw - 15px); font-size: 15px; }
  #chatInput { left: 15px; width: calc(55vw - 15px); }

  #evolutionChoices { flex-wrap: wrap; }
  .evo-choice { width: 190px; }

  .scoreboard-box { min-width: 0; width: 88vw; }
}

/* Small tablet / landscape phone */
@media (max-width: 768px) {
  .menu-logo-fallback h1 { font-size: 44px; }
  .menu-play-btn    { width: 220px; font-size: 20px; padding: 13px 20px; letter-spacing: 6px; }
  .menu-play-expand { width: 220px; }

  .modal-card.modal-wide { min-width: 0; width: 96vw; max-width: 96vw; }
  .skins-grid { grid-template-columns: repeat(2, 1fr); max-height: 50vh; }

  #keybindsPanel { min-width: 160px; padding: 8px 10px; }
  .kb-key { min-width: 64px; }

  #chatLog   { left: 10px; width: calc(100vw - 80px); font-size: 13px; bottom: 54px; }
  #chatInput { left: 10px; width: calc(100vw - 80px); font-size: 16px; }

  .scoreboard-box { padding: 16px 12px; }
  .scoreboard-box h2 { font-size: 30px; }

  .evo-choice { width: 140px; padding: 10px 8px; }
  .evo-choice h3 { font-size: 14px; }

  .loading-box h1 { font-size: 52px; }
  .progress-bar-container { width: 80vw; }
}
