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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a1a;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #e0e0e0;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  image-rendering: auto;
}

#ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

#ui-overlay > * {
  pointer-events: auto;
}

/* Main Menu */
.menu-screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 26, 0.95);
  z-index: 100;
}

.menu-title {
  font-size: 72px;
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(135deg, #ff6b35, #f7c948, #ff6b35);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 60px;
  text-shadow: none;
}

.menu-subtitle {
  font-size: 18px;
  color: #888;
  margin-top: -50px;
  margin-bottom: 50px;
  letter-spacing: 6px;
  text-transform: uppercase;
}

.menu-btn {
  width: 280px;
  padding: 16px 32px;
  margin: 8px 0;
  font-size: 18px;
  font-weight: 600;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #e0e0e0;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.menu-btn:hover {
  background: rgba(255, 107, 53, 0.2);
  border-color: #ff6b35;
  color: #ff6b35;
  transform: translateY(-2px);
}

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

.menu-btn.primary {
  background: linear-gradient(135deg, #ff6b35, #e85d26);
  border-color: #ff6b35;
  color: white;
}

.menu-btn.primary:hover {
  background: linear-gradient(135deg, #ff7f4f, #ff6b35);
  color: white;
}

/* Lobby */
.lobby-screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  background: rgba(10, 10, 26, 0.98);
  z-index: 100;
}

.lobby-sidebar {
  width: 300px;
  padding: 20px;
  border-right: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
}

.lobby-main {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.room-list {
  flex: 1;
  overflow-y: auto;
}

.room-card {
  padding: 14px 18px;
  margin: 6px 0;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  transition: all 0.2s;
}

.room-card:hover {
  border-color: #ff6b35;
  background: rgba(255, 107, 53, 0.1);
}

.room-card .room-name {
  font-weight: 600;
  font-size: 16px;
}

.room-card .room-info {
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

/* Player slots in lobby */
.player-slot {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  margin: 4px 0;
  border-radius: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
}

.player-slot .player-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-right: 12px;
}

.player-slot .player-name {
  flex: 1;
  font-weight: 500;
}

.player-slot .ready-badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(76, 175, 80, 0.2);
  color: #4caf50;
}

.player-slot .not-ready-badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 152, 0, 0.2);
  color: #ff9800;
}

/* In-game HUD */
.hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
}

.hud-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 12px 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
}

.weapon-bar {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.weapon-slot {
  width: 52px;
  height: 52px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  font-size: 11px;
  text-align: center;
  padding: 2px;
}

.weapon-slot:hover {
  border-color: #ff6b35;
  background: rgba(255, 107, 53, 0.2);
}

.weapon-slot.active {
  border-color: #ff6b35;
  background: rgba(255, 107, 53, 0.3);
  transform: translateY(-4px);
}

.weapon-slot .ammo-count {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 10px;
  color: #aaa;
}

.power-meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.power-bar-container {
  width: 24px;
  height: 120px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  background: rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
}

.power-bar-fill {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, #4caf50, #f7c948, #ff5722);
  transition: height 0.05s;
}

.power-label {
  font-size: 14px;
  font-weight: 600;
}

.angle-display {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.wind-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.turn-indicator {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.timer-display {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.timer-display.warning {
  color: #ff5722;
  animation: pulse 0.5s ease-in-out infinite;
}

/* Chat panel */
.chat-panel {
  position: absolute;
  bottom: 80px;
  left: 10px;
  width: 320px;
  max-height: 200px;
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.5);
  border-radius: 8px;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  font-size: 13px;
}

.chat-messages .msg {
  margin: 2px 0;
}

.chat-messages .msg .author {
  font-weight: 600;
}

.chat-messages .msg.system {
  color: #888;
  font-style: italic;
}

.chat-input-row {
  display: flex;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.chat-input-row input {
  flex: 1;
  padding: 8px 10px;
  background: rgba(0,0,0,0.3);
  border: none;
  color: #e0e0e0;
  font-size: 13px;
  outline: none;
}

.chat-input-row button {
  padding: 8px 14px;
  background: #ff6b35;
  border: none;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

/* Toast notifications */
.toast-container {
  position: absolute;
  top: 60px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  padding: 12px 20px;
  border-radius: 8px;
  background: rgba(0,0,0,0.8);
  border-left: 4px solid #ff6b35;
  font-size: 14px;
  animation: slideInRight 0.3s ease, fadeOut 0.5s ease 2.5s forwards;
  max-width: 300px;
}

.toast.xp {
  border-left-color: #f7c948;
}

.toast.levelup {
  border-left-color: #4caf50;
  font-weight: 600;
}

.toast.kill {
  border-left-color: #ff5722;
}

/* Shop */
.shop-screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(10, 10, 26, 0.98);
  z-index: 100;
  padding: 30px;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  overflow-y: auto;
  padding: 20px 0;
}

.shop-item {
  padding: 20px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.shop-item:hover {
  border-color: #f7c948;
  background: rgba(247, 201, 72, 0.1);
}

.shop-item .item-name {
  font-weight: 600;
  margin-bottom: 8px;
}

.shop-item .item-cost {
  color: #f7c948;
  font-weight: 700;
}

.shop-item .item-level {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

.shop-item.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.shop-item.owned {
  border-color: #4caf50;
  opacity: 0.7;
}

/* Profile / Stats */
.xp-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f7c948, #ff6b35);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* Leaderboard */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid rgba(255,255,255,0.1);
  color: #888;
  font-size: 13px;
  text-transform: uppercase;
}

.leaderboard-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.leaderboard-table tr:hover td {
  background: rgba(255,255,255,0.03);
}

/* Settings */
.settings-screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 26, 0.98);
  z-index: 100;
}

.settings-group {
  margin: 16px 0;
  width: 400px;
}

.settings-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #aaa;
}

.settings-group input[type="range"] {
  width: 100%;
  accent-color: #ff6b35;
}

/* Form inputs */
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: #ff6b35;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
}

/* Results screen */
.results-screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 26, 0.95);
  z-index: 100;
}

.results-title {
  font-size: 48px;
  font-weight: 900;
  margin-bottom: 30px;
}

.results-table {
  width: 500px;
  margin-bottom: 30px;
}

.result-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  margin: 4px 0;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
}

.result-row.winner {
  background: rgba(255, 107, 53, 0.15);
  border: 1px solid rgba(255, 107, 53, 0.3);
}

.result-rank {
  font-size: 24px;
  font-weight: 700;
  width: 50px;
  text-align: center;
}

.result-name {
  flex: 1;
  font-weight: 600;
}

.result-stats {
  color: #888;
  font-size: 13px;
}

/* ========== META PLAY ========== */

.meta-btn {
  width: 280px;
  padding: 16px 32px;
  margin: 8px 0;
  font-size: 18px;
  font-weight: 700;
  border: 2px solid #8247e5;
  border-radius: 8px;
  background: linear-gradient(135deg, #8247e5, #6c3bbf);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 0 0 20px rgba(130, 71, 229, 0.3);
}

.meta-btn:hover {
  background: linear-gradient(135deg, #9b5de5, #8247e5);
  box-shadow: 0 0 30px rgba(130, 71, 229, 0.5);
  transform: translateY(-2px);
}

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

.wallet-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(130, 71, 229, 0.15);
  border: 1px solid rgba(130, 71, 229, 0.3);
  font-size: 13px;
  font-family: 'Courier New', monospace;
  color: #b388ff;
}

.wallet-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4caf50;
}

.tier-card {
  padding: 28px 24px;
  border-radius: 12px;
  border: 2px solid rgba(130, 71, 229, 0.2);
  background: rgba(130, 71, 229, 0.05);
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  min-width: 160px;
}

.tier-card:hover {
  border-color: #8247e5;
  background: rgba(130, 71, 229, 0.15);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(130, 71, 229, 0.2);
}

.tier-card.selected {
  border-color: #8247e5;
  background: rgba(130, 71, 229, 0.2);
  box-shadow: 0 0 20px rgba(130, 71, 229, 0.3);
}

.tier-card .tier-amount {
  font-size: 32px;
  font-weight: 900;
  color: #b388ff;
  margin-bottom: 4px;
}

.tier-card .tier-label {
  font-size: 13px;
  color: #888;
}

.deposit-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 4px;
}

.deposit-status.verified {
  background: rgba(76, 175, 80, 0.2);
  color: #4caf50;
}

.deposit-status.pending {
  background: rgba(255, 152, 0, 0.2);
  color: #ff9800;
}

.payout-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 26, 0.95);
  z-index: 100;
}

.payout-amount {
  font-size: 56px;
  font-weight: 900;
  background: linear-gradient(135deg, #b388ff, #8247e5, #b388ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 20px 0;
}

.claim-btn {
  padding: 18px 48px;
  font-size: 20px;
  font-weight: 700;
  border: 2px solid #4caf50;
  border-radius: 10px;
  background: linear-gradient(135deg, #4caf50, #388e3c);
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
}

.claim-btn:hover {
  background: linear-gradient(135deg, #66bb6a, #4caf50);
  box-shadow: 0 0 30px rgba(76, 175, 80, 0.5);
  transform: translateY(-2px);
}

.claim-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.meta-label {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(130, 71, 229, 0.2);
  color: #b388ff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
