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

body {
  overflow: hidden;
  background: #000;
  font-family: 'Segoe UI', Arial, sans-serif;
}

canvas {
  display: block;
}

#loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #1a1a2e;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  color: #e0e0e0;
}

#loading h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: #fff;
}

#loading-anim {
  border-radius: 12px;
  margin-bottom: 1.5rem;
  box-shadow: 0 0 30px rgba(79, 195, 247, 0.15);
}

#loading p {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  color: #aaa;
}

#loading .progress-bar {
  width: 300px;
  height: 6px;
  background: #333;
  border-radius: 3px;
  overflow: hidden;
}

#loading .progress-fill {
  height: 100%;
  width: 0%;
  background: #4fc3f7;
  border-radius: 3px;
  transition: width 0.3s;
}

#loading .status {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #888;
}

#hud {
  position: fixed;
  bottom: 20px;
  left: 20px;
  color: #fff;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.5);
  padding: 10px 15px;
  border-radius: 8px;
  pointer-events: none;
  line-height: 1.6;
  z-index: 10;
}

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10;
  display: none;
}

#instructions {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  text-align: center;
  z-index: 50;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.7);
  padding: 40px 60px;
  border-radius: 16px;
}

#instructions h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

#instructions p {
  font-size: 1rem;
  color: #ccc;
  margin-bottom: 0.5rem;
}

#location-menu {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 15, 25, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 0;
  z-index: 60;
  color: #fff;
  width: 420px;
  max-height: 70vh;
  overflow-y: auto;
}

.location-header {
  padding: 14px 20px;
  font-size: 1.1rem;
  font-weight: bold;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#location-close {
  cursor: pointer;
  color: #888;
  font-size: 0.9rem;
}

#location-close:hover {
  color: #fff;
}

.location-cat {
  padding: 8px 20px;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #44bbff;
  background: rgba(68, 187, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.location-item {
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s;
}

.location-item:hover {
  background: rgba(68, 187, 255, 0.15);
}

.location-item .loc-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.location-item .loc-desc {
  font-size: 0.8rem;
  color: #888;
}

.location-item.active {
  background: rgba(68, 187, 255, 0.25);
  border-left: 3px solid #44bbff;
}

#teleport-loading {
  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: 80;
  color: #fff;
}

.teleport-text {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

#daynight-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 20;
  padding: 8px 16px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s;
}
#daynight-btn:hover {
  background: rgba(255,255,255,0.15);
}

#walls-btn {
  position: fixed;
  top: 20px;
  left: 140px;
  z-index: 20;
  padding: 8px 16px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s;
}
#walls-btn:hover {
  background: rgba(255,255,255,0.15);
}

#interaction-prompt {
  display: none;
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  padding: 10px 24px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 8px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 1rem;
  text-align: center;
  backdrop-filter: blur(4px);
  pointer-events: none;
  white-space: nowrap;
}

#floor-indicator {
  display: none;
  position: fixed;
  top: 60px;
  left: 20px;
  z-index: 20;
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 0.85rem;
  pointer-events: none;
}

#fade-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 90;
}
#fade-overlay.active {
  opacity: 1;
}

#controls-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 0;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  pointer-events: none;
  z-index: 10;
}

#minimap {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  overflow: hidden;
  z-index: 10;
  pointer-events: none;
}

#minimap canvas {
  width: 100%;
  height: 100%;
}

.city-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 10px 16px;
}

.city-btn {
  padding: 8px 6px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.city-btn:hover {
  background: rgba(68, 187, 255, 0.2);
  border-color: rgba(68, 187, 255, 0.4);
}

.city-btn.active {
  background: rgba(68, 187, 255, 0.3);
  border-color: #44bbff;
  color: #fff;
}

#address-search {
  display: flex;
  padding: 10px 14px;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#address-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.9rem;
  outline: none;
}

#address-input:focus {
  border-color: #44bbff;
  background: rgba(255, 255, 255, 0.12);
}

#address-input::placeholder {
  color: #666;
}

#address-go {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: #44bbff;
  color: #000;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

#address-go:hover {
  background: #66ccff;
}

#address-results {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s;
}

#address-results.has-results {
  max-height: 200px;
  overflow-y: auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.address-result-item {
  padding: 10px 20px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.85rem;
  color: #ccc;
}

.address-result-item:hover {
  background: rgba(68, 187, 255, 0.15);
  color: #fff;
}

.address-error {
  padding: 10px 20px;
  font-size: 0.85rem;
  color: #ff6666;
}

.location-subcat {
  padding: 6px 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #999;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* Discovery toast notification */
#discovery-toast {
  position: fixed;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  padding: 14px 28px;
  background: rgba(10, 30, 20, 0.92);
  border: 1px solid rgba(80, 220, 120, 0.5);
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  text-align: center;
  backdrop-filter: blur(8px);
  pointer-events: none;
  transition: top 0.4s ease-out, opacity 0.4s ease;
  opacity: 0;
  white-space: nowrap;
}

#discovery-toast.show {
  top: 30px;
  opacity: 1;
}

#discovery-toast.fade-out {
  top: 30px;
  opacity: 0;
}

#discovery-toast .toast-icon {
  font-size: 1.2rem;
  margin-right: 8px;
}

#discovery-toast .toast-name {
  font-weight: 700;
  color: #50dc78;
}

/* Explorer panel overlay */
#explorer-panel {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 15, 25, 0.95);
  border: 1px solid rgba(80, 220, 120, 0.3);
  border-radius: 12px;
  z-index: 60;
  color: #fff;
  width: 400px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 0;
}

.explorer-header {
  padding: 14px 20px;
  font-size: 1.1rem;
  font-weight: bold;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.explorer-header .explorer-progress {
  font-size: 0.85rem;
  color: #50dc78;
  font-weight: 600;
}

#explorer-close {
  cursor: pointer;
  color: #888;
  font-size: 0.9rem;
}

#explorer-close:hover {
  color: #fff;
}

.explorer-cat {
  padding: 8px 20px;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #50dc78;
  background: rgba(80, 220, 120, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.explorer-item {
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 10px;
}

.explorer-item .exp-check {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: transparent;
}

.explorer-item.discovered .exp-check {
  border-color: #50dc78;
  background: rgba(80, 220, 120, 0.2);
  color: #50dc78;
}

.explorer-item .exp-info {
  flex: 1;
}

.explorer-item .exp-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.explorer-item.discovered .exp-name {
  color: #fff;
}

.explorer-item:not(.discovered) .exp-name {
  color: #666;
}

.explorer-item .exp-desc {
  font-size: 0.78rem;
  color: #888;
}

.explorer-item:not(.discovered) .exp-desc {
  color: #444;
}

/* Customization panel */
#customize-panel {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 15, 25, 0.95);
  border: 1px solid rgba(79, 195, 247, 0.3);
  border-radius: 12px;
  z-index: 60;
  color: #fff;
  width: 360px;
  padding: 0;
}

.cust-header {
  padding: 14px 20px;
  font-size: 1.1rem;
  font-weight: bold;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#cust-close {
  cursor: pointer;
  color: #888;
  font-size: 0.9rem;
}

#cust-close:hover {
  color: #fff;
}

.cust-section {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cust-section:last-child {
  border-bottom: none;
  padding-bottom: 16px;
}

.cust-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4fc3f7;
  margin-bottom: 10px;
}

.cust-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cust-swatch {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.cust-swatch:hover {
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

.cust-swatch.selected {
  border-color: #4fc3f7;
  box-shadow: 0 0 8px rgba(79, 195, 247, 0.5);
}

/* ==================== Meeting Panel ==================== */

#meeting-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 15, 25, 0.95);
  border: 1px solid rgba(0, 200, 255, 0.3);
  border-radius: 12px;
  z-index: 60;
  color: #fff;
  width: 340px;
  padding: 0;
}

.meeting-header {
  padding: 14px 20px;
  font-size: 1.1rem;
  font-weight: bold;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#meeting-close {
  cursor: pointer;
  color: #888;
  font-size: 0.9rem;
}
#meeting-close:hover {
  color: #fff;
}

#meeting-status {
  padding: 8px 20px;
  font-size: 0.85rem;
  color: #0cf;
  background: rgba(0, 200, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#meeting-join-section {
  padding: 20px;
  text-align: center;
}

#meeting-create-btn {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(0, 200, 255, 0.4);
  border-radius: 8px;
  background: rgba(0, 200, 255, 0.15);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
#meeting-create-btn:hover {
  background: rgba(0, 200, 255, 0.3);
}

.meeting-divider {
  margin: 14px 0;
  color: #666;
  font-size: 0.8rem;
}

.meeting-join-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

#meeting-join-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  font-family: monospace;
}
#meeting-join-input::placeholder {
  text-transform: none;
  letter-spacing: normal;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #666;
}

#meeting-join-btn {
  padding: 10px 20px;
  border: 1px solid rgba(0, 200, 255, 0.4);
  border-radius: 6px;
  background: rgba(0, 200, 255, 0.15);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}
#meeting-join-btn:hover {
  background: rgba(0, 200, 255, 0.3);
}

#meeting-active-section {
  padding: 16px 20px;
}

.meeting-code-row {
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #aaa;
}

.meeting-code {
  font-family: monospace;
  font-size: 1.3rem;
  font-weight: bold;
  color: #0cf;
  letter-spacing: 3px;
  user-select: all;
  cursor: pointer;
}

#meeting-participants {
  margin-bottom: 12px;
  max-height: 200px;
  overflow-y: auto;
}

.meeting-participant {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #ccc;
}
.meeting-participant.speaking {
  background: rgba(0, 200, 255, 0.1);
  color: #fff;
}

.speaking-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #444;
  flex-shrink: 0;
  transition: background 0.15s;
}
.meeting-participant.speaking .speaking-dot {
  background: #0f0;
  box-shadow: 0 0 6px rgba(0, 255, 0, 0.5);
}

.meeting-controls {
  display: flex;
  gap: 8px;
}

#meeting-mute-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}
#meeting-mute-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}
#meeting-mute-btn.muted {
  background: rgba(255, 60, 60, 0.2);
  border-color: rgba(255, 60, 60, 0.4);
  color: #f66;
}

.meeting-leave {
  flex: 1;
  padding: 10px;
  border: 1px solid rgba(255, 60, 60, 0.4);
  border-radius: 6px;
  background: rgba(255, 60, 60, 0.15);
  color: #f66;
  cursor: pointer;
  transition: background 0.2s;
}
.meeting-leave:hover {
  background: rgba(255, 60, 60, 0.3);
}
