html, body {
  margin: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: Arial, sans-serif;
}

.map-container {
  display: flex;
  height: 100%;
  width: 100%;
}

.sidebar {
  width: 250px;
  background: #0a0a0af0;
  color: var(--text-primary);
  padding: var(--spacing-sm);
  box-sizing: border-box;
  overflow-y: auto;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  z-index: 1000;
}

.sidebar h3 {
  margin-bottom: var(--spacing-sm);
  font-size: 18px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: var(--spacing-sm);
}

.sidebar section {
  margin-bottom: 25px;
}

.sidebar-buttons {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: var(--spacing-md);
}

.open-sidebar-btn {
  position: fixed;
  left: 12px;
  top: 12px;
  display: none;
  z-index: 9999;
}

.world-header {
  color: var(--text-primary);
  font-size: 12px;
  text-transform: uppercase;
  margin-top: 15px;
  font-weight: bold;
  letter-spacing: 0.5px;
  font-family: 'Courier New', monospace;
}

.map-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 3px 7px;
  margin-bottom: 8px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  transition: all 0.2s ease;
}

.map-button:hover {
  background: var(--bg-hover);
}

.map-button.active {
  background: var(--accent-primary);
}

.map-button:disabled:not(.active) {
  cursor: default;
  opacity: 0.6;
  filter: grayscale(10%);
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.map-button .lock-icon {
  margin-left: 8px;
  font-size: 12px;
  opacity: 0.9;
}

.player-item {
  padding: 8px 10px;
  margin-bottom: 5px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.player-item:hover {
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
}

.player-avatar {
  width: 24px;
  height: 24px;
  background: var(--bg-primary);
  border-radius: 2px;
}

.player-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.player-name {
  flex: 1;
}

.player-world {
  font-size: 11px;
  color: var(--text-muted);
}

.show-options {
  margin-left: var(--spacing-sm);
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 0;
}

.show-options div {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.show-options label {
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  color: var(--text-primary);
  font-weight: bold;
  font-family: 'Courier New', Courier, monospace;
  text-transform: uppercase;
}

.show-options label:hover {
  color: var(--accent-primary);
}

.show-options input[type="checkbox"] {
  width: 12px;
  height: 12px;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

.iframe-container {
  /* flex: 1;
  position: relative; */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

iframe {
  border: none;
  width: 100%;
  height: 100%;
}


.map-ui {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1500;
  transition: left 0.3s ease;
  pointer-events: none;
}

.location-display {
  position: absolute;
  top: var(--spacing-sm);
  right: var(--spacing-sm);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(10px);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: 13px;
  z-index: 9998;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  font-family: 'Courier New', monospace;
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
  pointer-events: all;
}

.location-display:hover {
  background: rgba(10, 10, 10, 0.95);
  border-color: var(--accent-primary);
}

.location-world {
  color: var(--accent-primary);
  font-weight: bold;
  margin-bottom: 4px;
  text-align: center;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.location-coords {
  color: var(--text-primary);
  display: flex;
  gap: 10px;
  justify-content: center;
}

.location-label {
  color: var(--text-muted);
  font-weight: bold;
}

body:not(.sidebar-hidden) .map-ui {
  left: 250px;
}

.chat-container {
  position: absolute;
  bottom: var(--spacing-sm);
  left: var(--spacing-sm);
  width: 400px;
  z-index: 2000;
  pointer-events: all;
}

.chat-messages {
  margin-bottom: var(--spacing-sm);
  max-height: 300px;
  display: flex;
  flex-direction: column;
  gap: 0;
  pointer-events: none;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(10, 10, 10, 0.85);
}

.chat-message {
  padding: 0 var(--spacing-sm);
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-message.fading {
  animation: messageFadeOut 0.5s ease forwards;
}

@keyframes messageSlideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes messageFadeOut {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.chat-message-player {
  color: var(--accent-primary);
  font-weight: bold;
}

.chat-message-text {
  color: var(--text-primary);
}

.chat-message-system {
  color: var(--text-muted);
}

.chat-message-time {
  color: var(--text-muted);
  font-size: 11px;
  margin-right: 8px;
  font-family: monospace;
}

.chat-input-bar {
  display: flex;
  gap: 0px;
  align-items: center;
  height: 30px;
}

.chat-history-btn {
  padding: 0 var(--spacing-md);
  height: 100%;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.chat-input {
  flex: 1;
  padding: 0 var(--spacing-sm);
  background: rgba(10, 10, 10, 0.9);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  height: 100%;
}

.chat-input:focus {
  border-color: var(--accent-primary);
  background: rgba(10, 10, 10, 0.95);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send-btn {
  padding: 0 var(--spacing-md);
  height: 100%;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

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

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

@media (max-width: 768px) {
  .chat-container {
    width: calc(100% - 40px);
    left: 20px;
  }
  
  body:not(.sidebar-hidden) .chat-container {
    left: 20px;
  }
}

.chat-history-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.chat-history-container {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 700px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  gap: 0;
}

.chat-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm);
  border-bottom: 2px solid var(--border-color);
  background: var(--bg-secondary);
}

.chat-history-header h2 {
  margin: 0;
  font-size: 20px;
}

.chat-history-close {
  padding: 5px var(--spacing-sm);
}

.chat-history-container .chat-input-bar {
  border-top: 2px solid var(--border-color);
  padding: 2px var(--spacing-sm) 4px;
  background: var(--bg-secondary);
  height: 35px;
}

.chat-history-container .chat-input {
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.chat-history-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-sm);
  min-height: 0;
}

.chat-history-empty {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 40px 20px;
  font-size: 16px;
}

.chat-history-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-history-messages::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

.chat-history-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.chat-history-messages::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

.copy-link-btn {
  padding: 4px 6px;
  background: rgba(10, 10, 10, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-primary);
  pointer-events: all;
  position: absolute;
  bottom: var(--spacing-sm);
  right: var(--spacing-sm);
}

.copy-link-btn:hover {
  background: rgba(10, 10, 10, 0.95);
  border-color: var(--accent-primary);
}

.copied-text {
  position: absolute;
  bottom: calc(var(--spacing-sm) + 37px);
  right: var(--spacing-sm);
  padding: 1px 6px;
  pointer-events: all;
  background: rgba(10, 10, 10, 0.6);
  border: 2px solid var(--accent-primary);
  border-radius: var(--radius-lg);
  color: var(--accent-primary);
  font-size: 13px;
  transition: all 0.3s ease;
  opacity: 1;
}

@keyframes copied-text-show {
  0%, 50% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}