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

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

.hidden { display: none !important; }

/* Sound Controls */
#soundControls {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(150,120,80,0.2);
  border-radius: 20px;
  padding: 6px 12px;
  backdrop-filter: blur(8px);
}

.sound-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  filter: grayscale(0.2);
  transition: transform 0.15s;
}

.sound-btn:hover { transform: scale(1.15); }

#volumeSlider {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(150,120,80,0.3);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#volumeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #DAA520;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(218,165,32,0.5);
}

#volumeSlider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #DAA520;
  border: none;
  cursor: pointer;
}

.screen {
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
}

/* ===== LOBBY ===== */
#lobby {
  background: #0d0b14;
  overflow: hidden;
}

.lobby-backdrop {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(100,60,30,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 30%, rgba(60,40,100,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(30,20,50,0.3) 0%, transparent 60%),
    linear-gradient(180deg, #12101e 0%, #1a1428 40%, #0d0b14 100%);
  z-index: 0;
}

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

.lobby-layout {
  display: flex;
  width: 100%; height: 100%;
  position: relative;
  z-index: 2;
  align-items: center;
  padding: 30px 50px;
}

.lobby-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.game-title {
  text-align: center;
  text-transform: uppercase;
  line-height: 1.1;
  margin-bottom: 40px;
}

.game-title > span {
  display: block;
  font-size: 3.5rem;
  color: #F0E6D0;
  letter-spacing: 10px;
  text-shadow: 0 0 30px rgba(218,165,32,0.3), 0 0 60px rgba(218,165,32,0.1), 0 3px 6px rgba(0,0,0,0.8);
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: bold;
}

.game-title > span:nth-child(2) {
  font-size: 2.8rem;
  color: #C8B89A;
  letter-spacing: 14px;
}

.roll-word {
  display: inline;
  font-size: inherit;
}

.game-title small {
  display: block;
  font-size: 0.85rem;
  color: rgba(180,160,130,0.5);
  letter-spacing: 5px;
  font-weight: normal;
  font-style: italic;
  margin-top: 10px;
  font-family: Georgia, 'Times New Roman', serif;
}

.lobby-art {
  position: relative;
  width: 200px;
  height: 200px;
}

.rune-circle {
  position: absolute;
  top: 50%; left: 50%;
  width: 160px; height: 160px;
  margin: -80px 0 0 -80px;
  border: 1px solid rgba(218,165,32,0.15);
  border-radius: 50%;
  animation: spin-rune 20s linear infinite;
}

.rune-circle::before {
  content: '✦ ✧ ⟡ ✦ ✧ ⟡ ✦ ✧';
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: rgba(218,165,32,0.3);
  letter-spacing: 8px;
}

.rune-circle.r2 {
  width: 120px; height: 120px;
  margin: -60px 0 0 -60px;
  border-color: rgba(155,89,240,0.12);
  animation-duration: 15s;
  animation-direction: reverse;
}

.rune-circle.r3 {
  width: 80px; height: 80px;
  margin: -40px 0 0 -40px;
  border-color: rgba(100,149,237,0.1);
  animation-duration: 10s;
}

@keyframes spin-rune {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.lobby-panel {
  width: 380px;
  min-width: 320px;
  max-width: 420px;
  max-height: calc(100vh - 60px);
  padding: 28px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(15,12,25,0.75);
  border: 1px solid rgba(150,120,80,0.15);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 80px rgba(100,60,180,0.05);
}

.lobby-panel input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  background: rgba(20,15,30,0.8);
  border: 1px solid rgba(150,120,80,0.25);
  border-radius: 8px;
  color: #e0d5c0;
  outline: none;
  font-family: Georgia, 'Times New Roman', serif;
}

.lobby-panel input[type="text"]:focus {
  border-color: rgba(218,165,32,0.4);
  box-shadow: 0 0 10px rgba(218,165,32,0.1);
}

.lobby-panel input.input-error {
  border-color: rgba(220,50,50,0.7);
  box-shadow: 0 0 12px rgba(220,50,50,0.3);
  animation: shake 0.4s ease;
}

.lobby-panel input.input-error::placeholder {
  color: rgba(220,80,80,0.8);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.class-select h3 {
  text-align: center;
  margin-bottom: 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(150,130,100,0.8);
}

.class-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.class-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  border-radius: 8px;
  border: 2px solid rgba(100,80,60,0.3);
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(30,20,15,0.4);
}

.class-option span {
  font-size: 0.65rem;
}

.class-option:hover {
  border-color: rgba(200,160,100,0.5);
  background: rgba(50,35,25,0.5);
}

.class-option.selected {
  border-color: currentColor;
  background: rgba(50,35,25,0.6);
  box-shadow: 0 0 8px rgba(200,160,100,0.3);
}

.class-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid currentColor;
}

.class-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  border: 2px solid rgba(150,120,80,0.3);
  transition: all 0.2s;
}

.class-option.selected .class-thumb {
  border-color: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.selected-wizard-preview {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: rgba(20,15,30,0.4);
  border: 1px solid rgba(150,120,80,0.1);
  border-radius: 12px;
  padding: 14px;
}

.wizard-preview-img {
  width: 85px;
  height: 85px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid rgba(150,120,80,0.4);
  flex-shrink: 0;
}

.wizard-preview-img[src=""] {
  display: none;
}

.spell-preview {
  border-radius: 8px;
  flex: 1;
  min-height: 60px;
  color: #d0c5b0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

.spell-preview .spell-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spell-icon-wrap {
  position: relative;
  display: inline-flex;
  cursor: help;
}

.spell-icon-wrap img {
  border-radius: 4px;
}

.spell-preview .spell-key-badge {
  background: rgba(150,120,80,0.3);
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 0.6rem;
  text-align: center;
  color: #c0b090;
  font-weight: bold;
  letter-spacing: 0.5px;
  min-width: 42px;
}

.spell-preview .spell-name {
  font-size: 0.88rem;
  font-weight: bold;
  line-height: 1.2;
  position: static;
  top: auto;
  color: inherit;
}

/* Hover tooltip on spell icon */
.spell-hover-tip {
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  background: rgba(12,10,20,0.97);
  border: 1px solid rgba(150,120,80,0.4);
  border-radius: 8px;
  padding: 10px 12px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  box-shadow: 0 6px 20px rgba(0,0,0,0.6);
}

.spell-icon-wrap:hover .spell-hover-tip {
  opacity: 1;
}

.spell-hover-tip .tip-title {
  font-size: 0.9rem;
  font-weight: bold;
  margin-bottom: 2px;
}

.spell-hover-tip .tip-stats {
  font-size: 0.68rem;
  color: rgba(200,190,170,0.6);
  margin-bottom: 6px;
}

.spell-hover-tip .tip-desc {
  font-size: 0.74rem;
  line-height: 1.4;
  color: #d0c5b0;
}

.spell-hover-tip b { color: #f0e0c0; }

.lobby-settings {
  background: rgba(20,15,30,0.5);
  border: 1px solid rgba(150,120,80,0.15);
  border-radius: 8px;
  padding: 10px;
}

.lobby-settings .setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.lobby-settings .setting-row.hidden {
  display: none;
}

.lobby-settings input[type="number"] {
  background: rgba(20,15,30,0.8);
  border: 1px solid rgba(150,120,80,0.25);
  border-radius: 6px;
  color: #e0d5c0;
  padding: 4px 8px;
  width: 70px;
  text-align: center;
}

.lobby-settings input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.lobby-settings label {
  color: rgba(180,160,130,0.7);
  font-size: 0.8rem;
}

.lobby-settings select {
  background: rgba(20,15,30,0.8);
  border: 1px solid rgba(150,120,80,0.25);
  border-radius: 6px;
  color: #e0d5c0;
  padding: 4px 8px;
  font-size: 0.8rem;
}

.players-list {
  background: rgba(20,15,30,0.4);
  border: 1px solid rgba(150,120,80,0.15);
  border-radius: 8px;
  padding: 10px;
}

.players-list h3 {
  color: rgba(150,130,100,0.8);
  font-size: 0.7rem;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.player-list-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(150,120,80,0.1);
  font-size: 0.8rem;
}

.lobby-links {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.editor-link {
  color: rgba(150,130,100,0.5);
  font-size: 0.7rem;
  text-decoration: none;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: color 0.2s;
}

.editor-link:hover {
  color: rgba(218,165,32,0.8);
}

.btn {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 1.1rem;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, #5b4fcf, #3b82f6);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(91,79,207,0.4);
}

/* Custom spell picker */
.custom-picker {
  background: rgba(30,20,15,0.5);
  border: 1px solid rgba(150,120,80,0.3);
  border-radius: 8px;
  padding: 10px;
}

.custom-picker h3 {
  text-align: center;
  color: rgba(200,180,120,0.8);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.custom-spell-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.custom-spell-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.65rem;
  border: 1px solid rgba(100,80,60,0.2);
  transition: all 0.15s;
  color: #c0b090;
}

.custom-spell-item:hover {
  background: rgba(150,120,80,0.15);
}

.custom-spell-item.picked {
  border-color: #DAA520;
  background: rgba(218,165,32,0.2);
  color: #FFD700;
}

.custom-spell-item img {
  width: 22px;
  height: 22px;
  border-radius: 3px;
}

.custom-selected-label {
  text-align: center;
  font-size: 0.7rem;
  color: #DAA520;
  margin-top: 6px;
}

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: #ccc;
  border: 1px solid rgba(255,255,255,0.2);
}

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

.lobby-actions {
  display: flex;
  gap: 8px;
}

.lobby-actions .btn {
  flex: 1;
}

.game-hosted-info {
  text-align: center;
  padding: 8px;
  background: rgba(218,165,32,0.1);
  border: 1px solid rgba(218,165,32,0.25);
  border-radius: 8px;
  color: rgba(218,165,32,0.9);
  font-size: 0.8rem;
  font-family: Georgia, 'Times New Roman', serif;
}

/* Settings */
.settings-panel {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 500px;
  margin-bottom: 20px;
}

.settings-panel h3 {
  text-align: center;
  margin-bottom: 15px;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.9rem;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.setting-row label {
  color: #bbb;
  font-size: 0.9rem;
}

.setting-row select,
.setting-row input[type="number"] {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  color: white;
  padding: 6px 10px;
  font-size: 0.9rem;
}

.setting-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.players-list {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 500px;
}

.players-list h3 {
  color: #aaa;
  font-size: 0.9rem;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.player-list-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.9rem;
}

/* ===== GAME ===== */
#gameCanvas {
  display: block;
  cursor: crosshair;
}

/* HUD */
#hud {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 10;
}

.hud-bar {
  width: 300px;
  height: 22px;
  background: rgba(0,0,0,0.6);
  border-radius: 11px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.15);
}

.bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.15s ease;
  position: absolute;
  left: 0;
  top: 0;
}

.bar-fill.health {
  background: linear-gradient(90deg, #e74c3c, #e67e22);
  z-index: 1;
}

.bar-fill.shield {
  background: rgba(205, 133, 63, 0.6);
  z-index: 2;
}

.bar-fill.xp {
  background: linear-gradient(90deg, #9b59b6, #3498db);
}

.xp-bar {
  height: 14px;
  width: 250px;
}

.hud-bar span {
  position: absolute;
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  font-weight: bold;
  line-height: 22px;
  z-index: 3;
  text-shadow: 1px 1px 2px black;
}

.xp-bar span {
  line-height: 14px;
  font-size: 0.65rem;
}

/* Spell Bar */
#spellBar {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.spell-slot {
  width: 70px;
  height: 70px;
  background: rgba(0,0,0,0.6);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* No overflow:hidden — it would clip the hover tooltip above the slot.
     The icon and cooldown overlay are rounded individually instead. */
}

.spell-icon {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  margin-bottom: 2px;
}

.spell-cd-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: rgba(0,0,0,0.7);
  border-radius: 8px 8px 0 0;
  transition: height 0.1s linear;
}

.spell-key {
  font-size: 0.6rem;
  color: #aaa;
  position: absolute;
  bottom: 2px;
}

.spell-name {
  font-size: 0.55rem;
  color: #ccc;
  position: absolute;
  top: 2px;
}

/* Spell Tooltip */
.spell-tooltip {
  display: none;
  position: absolute;
  bottom: 75px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 10, 25, 0.95);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 180px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
}

.spell-slot:hover .spell-tooltip {
  display: block;
}

.spell-tooltip-name {
  font-size: 0.9rem;
  font-weight: bold;
  margin-bottom: 4px;
}

.spell-tooltip-desc {
  font-size: 0.75rem;
  color: #aaa;
  margin-bottom: 6px;
  white-space: normal;
  max-width: 220px;
}

.spell-tooltip-stats {
  font-size: 0.75rem;
  color: #ccc;
  line-height: 1.5;
}

.spell-tooltip-stats span {
  color: #FFD700;
}

/* Orb Bar */
#orbBar {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

#orbPips {
  display: flex;
  gap: 4px;
}

.orb-pip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 215, 0, 0.3);
  background: transparent;
  transition: all 0.3s;
}

.orb-pip.filled {
  background: radial-gradient(circle, #FFD700, #FF8C00);
  border-color: #FFD700;
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.5);
}

.ultimate-slot {
  opacity: 0.4;
  transition: all 0.3s;
}

.ultimate-slot.ready {
  opacity: 1;
  border-color: #FF00FF;
  animation: ult-pulse 1s infinite alternate;
}

@keyframes ult-pulse {
  from { box-shadow: 0 0 8px rgba(255,0,255,0.3); }
  to { box-shadow: 0 0 18px rgba(255,0,255,0.7); }
}

/* Upgrade panel */
#upgradePanel {
  background: rgba(0,0,0,0.8);
  border: 2px solid #FFD700;
  border-radius: 12px;
  padding: 12px 16px;
  pointer-events: auto;
  animation: pulse-glow 1s infinite alternate;
}

@keyframes pulse-glow {
  from { box-shadow: 0 0 10px rgba(255,215,0,0.3); }
  to { box-shadow: 0 0 20px rgba(255,215,0,0.6); }
}

.upgrade-title {
  text-align: center;
  font-size: 0.85rem;
  color: #FFD700;
  margin-bottom: 8px;
  font-weight: bold;
}

.upgrade-options {
  display: flex;
  gap: 8px;
}

.upgrade-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: white;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.75rem;
  text-align: center;
  transition: all 0.2s;
}

.upgrade-btn:hover {
  background: rgba(255,215,0,0.2);
  border-color: #FFD700;
}

.upgrade-val {
  color: #90EE90;
  font-size: 0.7rem;
}

/* Minimap */
#minimap {
  position: fixed;
  top: 10px;
  left: 10px;
  width: 320px;
  height: 320px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  z-index: 15;
  pointer-events: none;
}

/* Level-up gains, shown directly under the minimap */
#upgradeSummary {
  position: fixed;
  top: 338px; /* just below the 320px minimap (top:10 + 320 + 8) */
  left: 10px;
  width: 320px;
  z-index: 15;
  pointer-events: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 0.72rem;
  color: #d0c5b0;
}

#upgradeSummary:empty { display: none; }

#upgradeSummary .ug-item {
  background: rgba(20,20,40,0.7);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
}

#upgradeSummary .ug-val { color: #FFD700; font-weight: bold; }

/* Tournament Bracket */
#tournamentBracket {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 65;
}

#tournamentBracket h2 {
  font-size: 2rem;
  color: #FFD700;
  margin-bottom: 30px;
  font-family: Georgia, 'Times New Roman', serif;
  text-shadow: 0 0 20px rgba(255,215,0,0.4);
}

#bracketRounds {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

#bracketCountdown {
  margin-top: 26px;
  font-size: 1.2rem;
  color: #FFD700;
  font-family: Georgia, 'Times New Roman', serif;
  letter-spacing: 1px;
  text-shadow: 0 0 14px rgba(255,215,0,0.3);
}

.bracket-col-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(180,160,130,0.6);
  margin-bottom: 12px;
  text-align: center;
}

.bracket-team {
  background: rgba(20,15,30,0.8);
  border: 1px solid rgba(150,120,80,0.25);
  border-radius: 8px;
  padding: 10px 20px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: #e0d5c0;
  min-width: 160px;
  text-align: center;
}

.bracket-team.eliminated {
  opacity: 0.4;
  text-decoration: line-through;
  border-color: rgba(220,80,80,0.3);
}

.bracket-team.winner {
  border-color: rgba(80,200,120,0.5);
  color: #50C878;
  box-shadow: 0 0 12px rgba(80,200,120,0.15);
}

.league-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.league-table th, .league-table td {
  padding: 5px 8px;
  text-align: center;
  border-bottom: 1px solid rgba(150,120,80,0.15);
}
.league-table th { color: rgba(180,160,130,0.6); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; }
.league-table tbody tr:first-child td { color: #FFD700; }

/* Fixtures (who has met who) */
.league-table.fixtures td { border-bottom: 1px solid rgba(150,120,80,0.1); }
.fixture-done td { color: rgba(200,200,210,0.45); }
.fixture-now td { color: #7dffab; font-weight: bold; }

.bracket-next {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #cdbfa0;
  text-align: center;
}
.bracket-next b { color: #FFD54A; }

.bracket-tiebreak {
  text-align: center;
  font-weight: bold;
  letter-spacing: 3px;
  color: #FFD54A;
  text-shadow: 0 0 12px rgba(255,213,74,0.6);
  margin-bottom: 8px;
}

/* Big centre-screen announcement (tiebreaker etc.) */
#bigAnnounce {
  position: fixed;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 95;
  pointer-events: none;
  text-align: center;
  animation: ba-in 0.4s ease-out;
}
#bigAnnounce .ba-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 4rem;
  font-weight: bold;
  letter-spacing: 4px;
  text-shadow: 0 0 26px rgba(255,213,74,0.7), 0 2px 6px rgba(0,0,0,0.8);
}
#bigAnnounce .ba-sub {
  margin-top: 8px;
  font-size: 1.3rem;
  color: #eee;
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
}
@keyframes ba-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Spectator Overlay */
#spectatorOverlay {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  text-align: center;
  pointer-events: none;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(150,120,80,0.25);
  border-radius: 12px;
  padding: 8px 28px;
}

.spec-label {
  font-size: 0.7rem;
  letter-spacing: 4px;
  color: rgba(180,160,130,0.6);
  text-transform: uppercase;
}

.spec-name {
  font-size: 1.3rem;
  font-weight: bold;
  color: #F0E6D0;
  font-family: Georgia, 'Times New Roman', serif;
}

.spec-hint {
  font-size: 0.7rem;
  color: rgba(180,160,130,0.4);
  font-style: italic;
  margin-top: 2px;
}

/* CTF Score Banner */
#ctfScoreBanner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 22px;
  z-index: 25;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 12px 40px;
  pointer-events: none;
}

.ctf-team {
  font-size: 4rem;
  font-weight: bold;
  font-family: Georgia, 'Times New Roman', serif;
  min-width: 80px;
  text-align: center;
}

.ctf-team.red-score {
  color: #ff4444;
  text-shadow: 0 0 12px rgba(255,60,60,0.4);
}

.ctf-team.blue-score {
  color: #4488ff;
  text-shadow: 0 0 12px rgba(60,100,255,0.4);
}

.ctf-divider {
  color: rgba(255,255,255,0.3);
  font-size: 3rem;
}

/* Haunted Mode Banner */
#wantedBanner {
  position: fixed;
  /* Sits BELOW the team-score banner (which is also top-centred) so the two
     don't overlap in Team Haunted. */
  top: 118px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  background: rgba(0,10,5,0.75);
  border: 2px solid rgba(80,255,130,0.5);
  border-radius: 12px;
  padding: 8px 28px;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 0 20px rgba(80,255,130,0.15);
}

.wanted-label {
  font-size: 0.65rem;
  color: rgba(80,255,130,0.7);
  letter-spacing: 4px;
  text-transform: uppercase;
  font-family: Georgia, 'Times New Roman', serif;
}

.wanted-name {
  font-size: 1.4rem;
  font-weight: bold;
  color: #50FF80;
  text-shadow: 0 0 15px rgba(80,255,130,0.5);
  font-family: Georgia, 'Times New Roman', serif;
}

/* Big centre-screen callout for the player who currently holds the Haunted tag */
#youAreHaunted {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 40;
  pointer-events: none;
  text-align: center;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 3.4rem;
  font-weight: bold;
  letter-spacing: 3px;
  color: #7dffab;
  text-shadow: 0 0 24px rgba(80,255,130,0.85), 0 0 8px rgba(80,255,130,0.9);
  animation: yah-pulse 1.4s ease-in-out infinite;
}

#youAreHaunted .yah-sub {
  display: block;
  margin-top: 6px;
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: rgba(180,255,210,0.85);
  text-shadow: 0 0 10px rgba(80,255,130,0.5);
}

@keyframes yah-pulse {
  0%, 100% { opacity: 0.9; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

/* Tournament staging lobby */
#tournamentLobby {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8, 6, 16, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tl-config { display: flex; gap: 14px; margin-bottom: 14px; }
.tl-config .setting-row { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.tl-config label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: rgba(180,160,130,0.7); }
.tl-config select {
  background: #15101f; color: #fff; border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px; padding: 6px 8px;
}
.tl-config select:disabled { opacity: 0.7; }
.ts-box {
  background: linear-gradient(180deg, #1a1428, #0d0b14);
  border: 1px solid rgba(218,165,32,0.3);
  border-radius: 14px;
  padding: 24px 28px;
  width: min(560px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  color: #d0c5b0;
  box-shadow: 0 0 40px rgba(0,0,0,0.6);
}
.ts-box h2 {
  text-align: center;
  color: #FFD700;
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.ts-hint { text-align: center; font-size: 0.8rem; color: rgba(180,160,130,0.6); margin-bottom: 14px; }
.ts-players { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.ts-player-row {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px; padding: 6px 12px;
}
.ts-player-row select {
  background: #15101f; color: #fff; border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px; padding: 4px 8px;
}
.ts-preview { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.ts-team {
  background: rgba(218,165,32,0.1); border: 1px solid rgba(218,165,32,0.25);
  border-radius: 8px; padding: 6px 12px; font-size: 0.85rem;
}
.ts-team.invalid { background: rgba(231,76,60,0.12); border-color: rgba(231,76,60,0.4); }
.ts-team-label { color: #FFD700; font-weight: bold; margin-right: 6px; }
.ts-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.haunt-progress {
  margin: 6px auto 0;
  width: 260px;
  height: 8px;
  background: rgba(255,255,255,0.12);
  border-radius: 4px;
  overflow: hidden;
}

.haunt-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition: width 0.2s linear;
}

/* Kill Feed */
#killFeed {
  position: fixed;
  top: 70px;
  right: 40px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.kill-entry {
  background: rgba(0,0,0,0.7);
  padding: 14px 28px;
  border-radius: 10px;
  font-size: 2rem;
  white-space: nowrap;
  animation: killfeed-in 0.3s ease;
  opacity: 1;
  transition: opacity 0.5s ease;
}

@keyframes killfeed-in {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Scoreboard */
#scoreboard {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.85);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 20px 30px;
  z-index: 50;
  min-width: 400px;
}

#scoreboard h2 {
  text-align: center;
  margin-bottom: 15px;
  color: #ddd;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 3px;
}

#scoreboardTable {
  width: 100%;
  border-collapse: collapse;
}

#scoreboardTable th {
  color: #888;
  font-size: 0.8rem;
  text-transform: uppercase;
  padding: 6px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

#scoreboardTable td {
  padding: 6px 12px;
  font-size: 0.9rem;
}

.scoreboard-row-self {
  background: rgba(255,255,255,0.05);
}

/* Team select */
#teamSelect {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.9);
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  z-index: 60;
}

#teamSelect h2 {
  margin-bottom: 20px;
  color: #ccc;
}

.team-btn {
  display: inline-block;
  width: 150px;
  margin: 0 10px;
  padding: 16px;
  font-size: 1rem;
}

.team-red { background: rgba(231, 76, 60, 0.3); border: 2px solid #e74c3c; color: #e74c3c; }
.team-red:hover { background: rgba(231, 76, 60, 0.5); }
.team-blue { background: rgba(52, 152, 219, 0.3); border: 2px solid #3498db; color: #3498db; }
.team-blue:hover { background: rgba(52, 152, 219, 0.5); }

/* Death screen */
#deathScreen {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(139, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 30;
  pointer-events: none;
}

.death-text {
  font-size: 4rem;
  font-weight: bold;
  color: #e74c3c;
  text-shadow: 0 0 30px rgba(231, 76, 60, 0.5);
  letter-spacing: 10px;
}

.killed-by-text {
  font-size: 1.1rem;
  color: #ddd;
  margin-top: 8px;
}

.respawn-text {
  font-size: 1.5rem;
  color: #ccc;
  margin-top: 10px;
}

/* Match End */
#matchEnd {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 70;
}

#matchEnd h1 {
  font-size: 2.8rem;
  color: #FFD700;
  margin-bottom: 12px;
  text-shadow: 0 0 30px rgba(255,215,0,0.5);
}

#matchEnd .btn {
  width: auto;
  padding: 14px 40px;
  margin-top: 16px;
}

.match-mvp {
  font-size: 1.2rem;
  margin-bottom: 20px;
  font-family: Georgia, 'Times New Roman', serif;
}

.match-mvp .mvp-label {
  color: #FFD700;
  text-shadow: 0 0 12px rgba(255,215,0,0.6);
  font-weight: bold;
}

.match-mvp .mvp-stats {
  color: rgba(200,190,170,0.6);
  font-size: 0.9rem;
}

#matchStatsTable {
  border-collapse: collapse;
  background: rgba(15,12,25,0.6);
  border: 1px solid rgba(150,120,80,0.2);
  border-radius: 10px;
  overflow: hidden;
  min-width: 480px;
  max-height: 50vh;
}

#matchStatsTable th {
  background: rgba(0,0,0,0.4);
  color: rgba(200,180,140,0.8);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px 14px;
  text-align: center;
}

#matchStatsTable td {
  padding: 8px 14px;
  text-align: center;
  font-size: 0.85rem;
  border-top: 1px solid rgba(150,120,80,0.08);
  color: #d0c5b0;
}

#matchStatsTable td:nth-child(2) { text-align: left; font-weight: bold; }

#matchStatsTable tr.mvp-row td {
  background: rgba(218,165,32,0.1);
}

.match-countdown {
  margin-top: 16px;
  font-size: 0.8rem;
  color: rgba(180,160,130,0.5);
  font-style: italic;
}

/* Escape Menu */
#escMenu {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
}

.esc-menu-box {
  background: rgba(15, 15, 30, 0.95);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  min-width: 280px;
}

.esc-menu-box h2 {
  color: #ccc;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 4px;
  font-size: 1.4rem;
}

.esc-menu-box .btn {
  margin-bottom: 10px;
}

.esc-menu-box .btn:last-child {
  margin-bottom: 0;
}

.btn-match {
  background: linear-gradient(135deg, #9b59b6, #e74c3c);
  color: white;
}

.btn-match:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(155,89,182,0.4);
}

.esc-settings {
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.esc-settings .setting-row {
  margin-bottom: 8px;
}

.esc-settings .setting-row:last-child {
  margin-bottom: 0;
}

.esc-classswitch {
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.classswitch-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.classswitch-row select {
  flex: 1;
}

.classswitch-row .btn {
  width: auto;
  white-space: nowrap;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.esc-kick-panel {
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  max-height: 220px;
  overflow-y: auto;
}

.esc-kick-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #888;
  margin-bottom: 8px;
}

.kick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
}

.btn-kick {
  background: #b91c1c;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  width: auto;
}

.btn-kick:hover {
  background: #dc2626;
}
