/* ========== RESET & BASE ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #0a0a0f;
  color: #e0e0e0;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* ========== A-FRAME CANVAS (touch rotation) ========== */
.a-canvas {
  touch-action: none;
}

/* ========== LOGIN MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-box {
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 32px;
  width: 420px;
  max-width: 90vw;
  text-align: center;
}

.modal-box h1 {
  font-size: 28px;
  color: #4A90D9;
  margin-bottom: 8px;
}

.modal-box p {
  color: #999;
  margin-bottom: 20px;
  font-size: 14px;
}

.modal-box label {
  display: block;
  text-align: left;
  font-size: 13px;
  color: #aaa;
  margin-bottom: 6px;
  margin-top: 12px;
}

.modal-box input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #444;
  background: #0f0f1a;
  color: #fff;
  font-size: 15px;
  outline: none;
}

.modal-box input[type="text"]:focus {
  border-color: #4A90D9;
}

/* Avatar grid */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0 20px;
}

.avatar-option {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  padding: 4px;
  background: #0f0f1a;
  transition: border-color 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.avatar-option:hover {
  border-color: #666;
  transform: scale(1.1);
}

.avatar-option.selected {
  border-color: #4A90D9;
  transform: scale(1.1);
}

.avatar-option img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

/* Avatar upload option (9th slot) */
.avatar-upload-option {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px dashed #555;
  cursor: pointer;
  background: #0f0f1a;
  transition: border-color 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  overflow: hidden;
}

.avatar-upload-option:hover {
  border-color: #4A90D9;
  transform: scale(1.1);
}

.avatar-upload-option.selected {
  border-color: #4A90D9;
  border-style: solid;
  transform: scale(1.1);
}

.avatar-upload-option img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* Crop dialog modal */
.crop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20000;
}

.crop-box {
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 24px;
  width: 340px;
  max-width: 90vw;
  text-align: center;
}

.crop-box h2 {
  font-size: 18px;
  color: #4A90D9;
  margin-bottom: 12px;
}

.crop-box p {
  color: #888;
  font-size: 12px;
  margin-bottom: 14px;
}

#crop-canvas-wrap {
  position: relative;
  width: 256px;
  height: 256px;
  margin: 0 auto 16px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #4A90D9;
  touch-action: none;
  cursor: grab;
}

#crop-canvas-wrap:active {
  cursor: grabbing;
}

#crop-canvas {
  display: block;
  width: 256px;
  height: 256px;
}

.crop-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.crop-buttons button {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.crop-btn-ok {
  background: #4A90D9;
  color: #fff;
}

.crop-btn-ok:hover {
  background: #357abd;
}

.crop-btn-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: #ccc;
}

.crop-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Join button */
.btn-primary {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #4A90D9;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover:not(:disabled) {
  background: #357abd;
}

.btn-primary:disabled {
  background: #333;
  color: #666;
  cursor: not-allowed;
}

/* ========== ROOM NAVIGATION ========== */
.room-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
}

.area-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 12px 0;
  border-bottom: 1px solid #333;
}

.area-tab {
  padding: 8px 16px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #888;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.editor-toggle-btn {
  margin-left: auto;
  padding: 5px 12px;
  border: 1px solid #555;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: rgba(74, 144, 217, 0.1);
  color: #4A90D9;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.editor-toggle-btn:hover {
  background: rgba(74, 144, 217, 0.25);
  color: #fff;
}

.editor-toggle-btn.active {
  background: #4A90D9;
  color: #fff;
}

.area-tab:hover {
  color: #ccc;
}

.area-tab.active {
  color: #4A90D9;
  border-bottom-color: #4A90D9;
}

.room-list {
  display: flex;
  gap: 4px;
  padding: 6px 12px 8px;
  overflow-x: auto;
}

.room-btn {
  padding: 6px 14px;
  border: 1px solid #333;
  border-radius: 6px;
  background: rgba(30, 30, 50, 0.8);
  color: #ccc;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.room-btn:hover {
  background: rgba(50, 50, 80, 0.9);
  color: #fff;
}

.room-btn.default-room {
  border-color: #4A90D9;
  font-weight: 600;
}

.room-btn.active {
  background: #4A90D9;
  color: #fff;
  border-color: #4A90D9;
}

/* ========== ROOM INFO ========== */
.room-info {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 10, 15, 0.75);
  backdrop-filter: blur(8px);
  padding: 6px 20px;
  border-radius: 20px;
  border: 1px solid #333;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  z-index: 999;
  pointer-events: none;
}

/* ========== MY AVATAR HUD ========== */
.my-avatar-hud {
  position: fixed;
  bottom: 62px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 15, 26, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid #333;
  border-radius: 10px;
  padding: 6px 12px 6px 6px;
  z-index: 1000;
}

.my-avatar-hud-bubble {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid #4A90D9;
}

.my-avatar-hud-bubble img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.my-avatar-hud-bubble .color-fill {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.my-avatar-hud-name {
  color: #e0e0e0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== RADIO WIDGET ========== */
.radio-widget {
  position: fixed;
  bottom: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 15, 26, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid #333;
  border-radius: 10px;
  padding: 8px 14px;
  z-index: 1000;
}

.radio-mute {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.radio-volume {
  width: 80px;
  height: 4px;
  accent-color: #4A90D9;
  cursor: pointer;
}

.radio-station-name {
  color: #4A90D9;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== USER PANEL ========== */
.user-panel {
  position: fixed;
  bottom: 16px;
  right: 380px;
  width: 220px;
  background: rgba(15, 15, 26, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid #333;
  border-radius: 10px;
  z-index: 1000;
  overflow: hidden;
}

.user-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}

.user-panel-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.toggle-arrow {
  font-size: 10px;
  transition: transform 0.2s;
}

.user-panel-body {
  max-height: 300px;
  overflow-y: auto;
  padding: 0 14px 10px;
  transition: max-height 0.3s ease;
}

.user-panel-body.collapsed {
  max-height: 0;
  padding: 0 14px;
  overflow: hidden;
}

.user-room-group {
  margin-bottom: 8px;
}

.user-room-label {
  font-size: 11px;
  color: #4A90D9;
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.user-entry {
  font-size: 13px;
  padding: 2px 0;
  color: #ccc;
  display: flex;
  align-items: center;
}

.user-entry .user-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4caf50;
  margin-right: 6px;
}

/* Avatar bubble (chat + user panel) */
.avatar-bubble {
  display: inline-block;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
  object-fit: cover;
}

/* ========== CHAT WIDGET ========== */
.chat-widget {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 350px;
  height: 450px;
  background: rgba(15, 15, 26, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid #333;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}

.chat-tabs {
  display: flex;
  border-bottom: 1px solid #333;
}

.chat-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: #888;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-tab:hover {
  color: #ccc;
}

.chat-tab.active {
  color: #4A90D9;
  border-bottom: 2px solid #4A90D9;
}

/* Private chat tab */
.chat-tab[data-tab="private"] {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.private-tab-close {
  font-size: 15px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.private-tab-close:hover {
  opacity: 1;
  color: #ff4444;
}

.chat-msg.private-msg {
  border-left: 2px solid #9B4AD9;
}

.chat-msg.private-msg .msg-nick {
  color: #9B4AD9;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-msg {
  font-size: 13px;
  line-height: 1.4;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  word-break: break-word;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0;
}

.chat-msg .avatar-bubble {
  margin-top: 1px;
}

.chat-msg .msg-nick {
  font-weight: 600;
  color: #4A90D9;
  margin-right: 6px;
}

.chat-msg .msg-time {
  font-size: 11px;
  color: #555;
  margin-left: auto;
  flex-shrink: 0;
}

.chat-msg.system-msg {
  color: #666;
  font-style: italic;
  background: none;
  padding: 2px 0;
}

.chat-input-row {
  display: flex;
  border-top: 1px solid #333;
  padding: 8px;
  gap: 6px;
}

#chat-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0f0f1a;
  color: #fff;
  font-size: 13px;
  outline: none;
}

#chat-input:focus {
  border-color: #4A90D9;
}

.btn-send {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: #4A90D9;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-send:hover {
  background: #357abd;
}

/* Voice button */
.btn-voice {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #888;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
  padding: 0;
  line-height: 1;
}

.btn-voice:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ccc;
}

.btn-voice.active {
  background: #4caf50;
  color: #fff;
}

.btn-voice.active:hover {
  background: #43a047;
}

/* Speaking indicator on 3D bubbles */
@keyframes speaking-pulse {
  0%   { color: #4caf50; opacity: 1; }
  50%  { color: #81c784; opacity: 0.6; }
  100% { color: #4caf50; opacity: 1; }
}

/* ========== VIDEO OVERLAY ========== */
.video-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.video-overlay-close {
  position: absolute;
  top: 20px;
  right: 28px;
  background: none;
  border: none;
  color: #fff;
  font-size: 40px;
  cursor: pointer;
  line-height: 1;
  z-index: 10000;
  transition: color 0.2s, transform 0.2s;
}

.video-overlay-close:hover {
  color: #ff4444;
  transform: scale(1.2);
}

.video-overlay-content {
  width: 90vw;
  max-width: 1280px;
}

.video-overlay-player {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
}

.video-overlay-player iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
}

/* Cinema close button (fixed position, used by CSS3D cinema) */
.cinema-close {
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  font-size: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s, transform 0.2s;
}

.cinema-close:hover {
  background: rgba(255, 50, 50, 0.8);
  transform: scale(1.15);
}

/* Cinema unmute button (fixed, above VR button + chat widget) */
.cinema-unmute {
  position: fixed;
  bottom: 540px;
  right: 16px;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  font-size: 24px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}

.cinema-unmute:hover {
  background: rgba(74, 144, 217, 0.8);
  transform: scale(1.1);
}

/* ========== POSITION DEBUG OVERLAY ========== */
.pos-debug {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 8000;
  pointer-events: none;
  text-align: center;
}

.pos-debug-crosshair {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255, 255, 0, 0.8);
  border-radius: 50%;
  margin: 0 auto 8px;
  position: relative;
}

.pos-debug-crosshair::before,
.pos-debug-crosshair::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 0, 0.8);
}

.pos-debug-crosshair::before {
  width: 2px;
  height: 12px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.pos-debug-crosshair::after {
  width: 12px;
  height: 2px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.pos-debug-info {
  background: rgba(0, 0, 0, 0.85);
  color: #ffff00;
  font-family: monospace;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 0, 0.4);
  white-space: nowrap;
}

/* ========== MEDIA HOTSPOT EDITOR ========== */
.mh-editor {
  position: fixed;
  top: 80px;
  left: 16px;
  width: 320px;
  max-height: calc(100vh - 100px);
  background: rgba(15, 15, 26, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid #333;
  border-radius: 12px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mh-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #333;
}

.mh-editor-title {
  font-size: 15px;
  font-weight: 700;
  color: #4A90D9;
}

.mh-editor-room {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.mh-editor-close {
  background: none;
  border: none;
  color: #888;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.2s;
}

.mh-editor-close:hover {
  color: #ff4444;
}

/* --- Editor Tabs --- */
.editor-tabs {
  display: flex;
  border-bottom: 1px solid #333;
}

.editor-tab {
  flex: 1;
  padding: 9px 10px;
  border: none;
  background: transparent;
  color: #888;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.editor-tab:hover {
  color: #ccc;
}

.editor-tab.active {
  color: #4A90D9;
  border-bottom-color: #4A90D9;
}

.editor-tab-body.hidden {
  display: none;
}

.mh-editor-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.mh-editor-footer {
  display: flex;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid #333;
}

/* --- List --- */
.mh-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.mh-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.mh-list-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.mh-list-item.selected {
  border-color: #4A90D9;
  background: rgba(74, 144, 217, 0.12);
}

.mh-list-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  color: #fff;
  flex-shrink: 0;
}

.mh-list-badge.youtube { background: #c00; }
.mh-list-badge.video { background: #2196f3; }
.mh-list-badge.image { background: #4caf50; }
.mh-list-badge.nav { background: #00bcd4; }
.mh-list-badge.seat { background: #9b59b6; }

.mh-list-label {
  font-size: 13px;
  color: #ccc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mh-list-empty {
  text-align: center;
  color: #555;
  font-size: 13px;
  padding: 16px 0;
}

/* --- Properties panel --- */
.mh-props {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #333;
}

.mh-props-title {
  font-size: 13px;
  font-weight: 600;
  color: #4A90D9;
  margin-bottom: 10px;
}

.mh-label {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
  margin-top: 10px;
}

.mh-label:first-of-type {
  margin-top: 0;
}

.mh-input,
.mh-select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #0f0f1a;
  color: #fff;
  font-size: 13px;
  outline: none;
}

.mh-input:focus,
.mh-select:focus {
  border-color: #4A90D9;
}

.mh-select {
  cursor: pointer;
}

.mh-position-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.mh-position-text {
  font-family: monospace;
  font-size: 12px;
  color: #aaa;
  flex: 1;
}

.mh-slider {
  width: 100%;
  height: 4px;
  accent-color: #4A90D9;
  cursor: pointer;
  margin-top: 4px;
}

/* --- Buttons --- */
.mh-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.mh-btn-primary {
  flex: 1;
  background: #4A90D9;
  color: #fff;
}

.mh-btn-primary:hover {
  background: #357abd;
}

.mh-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #ccc;
}

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

.mh-btn-danger {
  width: 100%;
  background: rgba(255, 60, 60, 0.15);
  color: #ff4444;
  margin-top: 12px;
}

.mh-btn-danger:hover {
  background: rgba(255, 60, 60, 0.3);
}

.mh-btn-add {
  width: 100%;
  background: rgba(74, 144, 217, 0.12);
  color: #4A90D9;
  border: 1px dashed #4A90D9;
}

.mh-btn-add:hover {
  background: rgba(74, 144, 217, 0.22);
}

/* --- Editor Crosshair --- */
.mh-crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 8500;
  pointer-events: none;
  text-align: center;
}

.mh-crosshair-ring {
  width: 50px;
  height: 50px;
  border: 2px solid rgba(0, 230, 64, 0.85);
  border-radius: 50%;
  margin: 0 auto 8px;
  position: relative;
  animation: mh-pulse 1.2s ease-in-out infinite alternate;
}

.mh-crosshair-ring::before,
.mh-crosshair-ring::after {
  content: '';
  position: absolute;
  background: rgba(0, 230, 64, 0.85);
}

.mh-crosshair-ring::before {
  width: 2px;
  height: 16px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.mh-crosshair-ring::after {
  width: 16px;
  height: 2px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes mh-pulse {
  from { border-color: rgba(0, 230, 64, 0.85); }
  to   { border-color: rgba(0, 230, 64, 0.35); }
}

.mh-crosshair-info {
  background: rgba(0, 0, 0, 0.85);
  color: #00e640;
  font-family: monospace;
  font-size: 14px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid rgba(0, 230, 64, 0.4);
  white-space: nowrap;
  display: inline-block;
}

.mh-crosshair-hint {
  color: rgba(0, 230, 64, 0.7);
  font-size: 12px;
  margin-top: 6px;
}

/* --- Editor drag hint --- */
.mh-editor-hint {
  font-size: 11px;
  color: #888;
  text-align: center;
  padding: 6px 0 2px;
  border-top: 1px solid #2a2a3a;
  margin-top: 8px;
}

/* ========== SEAT CROSSHAIR ========== */
.seat-crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 900;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.seat-crosshair-ring {
  width: 52px;
  height: 52px;
  border: 2px solid rgba(255, 100, 100, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 80, 80, 0.1);
}

.seat-crosshair-icon {
  width: 28px;
  height: 28px;
  color: rgba(255, 110, 110, 0.85);
}

.seat-crosshair-label {
  margin-top: 4px;
  font-size: 11px;
  color: rgba(255, 120, 120, 0.9);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 8px;
  transition: background 0.2s;
}

.seat-crosshair-label:hover {
  background: rgba(255, 80, 80, 0.25);
  color: #fff;
}

/* ========== SEAT BUTTONS ========== */
.seat-leave-btn {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 10px 24px;
  border-radius: 20px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.2s, transform 0.2s;
  border: 2px solid #9b59b6;
  background: rgba(155, 89, 182, 0.85);
}

.seat-leave-btn:hover {
  background: rgba(155, 89, 182, 1);
  transform: translateX(-50%) scale(1.05);
}

/* ========== SEAT TOAST ========== */
.seat-toast {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(200, 50, 50, 0.9);
  color: #fff;
  padding: 10px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  z-index: 1100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.seat-toast.show {
  opacity: 1;
}

/* ========== A-FRAME VR BUTTON ========== */
.a-enter-vr-button {
  bottom: 480px !important;
  right: 16px !important;
}

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

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

::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ========== CHAT TOGGLE (mobile) ========== */
.chat-toggle-btn {
  display: none; /* hidden on desktop */
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {

  /* --- Room Navigation --- */
  .room-nav {
    padding: 0;
  }

  .area-tabs {
    padding: 4px 8px 0;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .area-tab {
    padding: 6px 10px;
    font-size: 11px;
    flex-shrink: 0;
  }

  .editor-toggle-btn {
    padding: 4px 8px;
    font-size: 11px;
  }

  .room-list {
    padding: 4px 8px 6px;
    gap: 3px;
  }

  .room-btn {
    font-size: 11px;
    padding: 5px 10px;
  }

  /* --- Room Info --- */
  .room-info {
    top: 72px;
    font-size: 12px;
    padding: 4px 14px;
  }

  /* --- Chat Toggle Button (visible on mobile) --- */
  .chat-toggle-btn {
    display: flex;
    position: fixed;
    bottom: 12px;
    right: 12px;
    z-index: 1001;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #4A90D9;
    background: rgba(15, 15, 26, 0.92);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
  }

  .chat-toggle-btn:active {
    transform: scale(0.9);
  }

  .chat-toggle-btn.has-unread {
    border-color: #ff4444;
    animation: chat-pulse 1.5s ease-in-out infinite;
  }

  @keyframes chat-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(255, 68, 68, 0); }
  }

  /* --- Chat Widget: hidden by default on mobile, shown via toggle --- */
  .chat-widget {
    width: calc(100vw - 16px);
    height: 280px;
    bottom: 8px;
    right: 8px;
    border-radius: 8px;
  }

  .chat-widget.hidden {
    display: none !important;
  }

  .chat-widget.mobile-open {
    display: flex !important;
  }

  .chat-tab {
    padding: 7px 6px;
    font-size: 12px;
  }

  .chat-messages {
    padding: 6px 10px;
    gap: 4px;
  }

  .chat-msg {
    font-size: 12px;
    padding: 4px 8px;
  }

  .chat-input-row {
    padding: 6px;
    gap: 4px;
  }

  #chat-input {
    padding: 8px 10px;
    font-size: 14px;
  }

  .btn-send {
    padding: 6px 10px;
    font-size: 13px;
  }

  .btn-voice {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  /* --- User Panel: bottom-right, compact --- */
  .user-panel {
    right: 8px;
    bottom: 68px;
    width: 180px;
    max-height: 140px;
  }

  .user-panel-header {
    padding: 6px 10px;
    font-size: 12px;
  }

  .user-panel-body {
    max-height: 100px;
    padding: 0 10px 6px;
    font-size: 12px;
  }

  /* --- My Avatar HUD --- */
  .my-avatar-hud {
    bottom: 68px;
    left: 8px;
    padding: 4px 8px 4px 4px;
    gap: 6px;
  }

  .my-avatar-hud-bubble {
    width: 28px;
    height: 28px;
  }

  .my-avatar-hud-name {
    font-size: 11px;
    max-width: 80px;
  }

  /* --- Radio Widget --- */
  .radio-widget {
    bottom: 12px;
    left: 8px;
    padding: 5px 10px;
    gap: 6px;
    max-width: 45vw;
  }

  .radio-volume {
    width: 50px;
  }

  .radio-station-name {
    font-size: 10px;
    max-width: 70px;
  }

  /* --- Seat Crosshair --- */
  .seat-crosshair-ring {
    width: 44px;
    height: 44px;
  }

  .seat-crosshair-icon {
    width: 22px;
    height: 22px;
  }

  .seat-crosshair-label {
    font-size: 10px;
    padding: 6px 14px;
  }

  /* --- Seat Leave Button --- */
  .seat-leave-btn {
    bottom: 70px;
    padding: 8px 18px;
    font-size: 12px;
  }

  /* --- Seat Toast --- */
  .seat-toast {
    top: 15%;
    font-size: 12px;
    padding: 8px 18px;
  }

  /* --- Editor --- */
  .mh-editor {
    width: calc(100vw - 16px);
    left: 8px;
    top: 64px;
    max-height: calc(100vh - 80px);
    border-radius: 8px;
  }

  .mh-editor-header {
    padding: 10px 12px 8px;
  }

  .mh-editor-title {
    font-size: 14px;
  }

  .mh-editor-body {
    padding: 10px 12px;
  }

  .editor-tab {
    padding: 7px 6px;
    font-size: 11px;
  }

  .mh-editor-footer {
    padding: 8px 12px 10px;
  }

  /* --- Login Modal --- */
  .modal-box {
    padding: 20px;
    width: 100%;
    max-width: 92vw;
  }

  .modal-box h1 {
    font-size: 22px;
  }

  .modal-box p {
    font-size: 13px;
    margin-bottom: 14px;
  }

  .avatar-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 10px 0 14px;
  }

  .avatar-option {
    width: 50px;
    height: 50px;
  }

  .avatar-upload-option {
    width: 50px;
    height: 50px;
  }

  /* --- Video Overlay --- */
  .video-overlay-close {
    top: 10px;
    right: 14px;
    font-size: 32px;
  }

  /* --- VR Button --- */
  .a-enter-vr-button {
    bottom: 70px !important;
    right: 8px !important;
  }

  /* --- Cinema --- */
  .cinema-unmute {
    bottom: 120px;
    right: 8px;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  /* --- Position Debug --- */
  .pos-debug-info {
    font-size: 11px;
    padding: 4px 10px;
  }
}

/* ========== VERY SMALL SCREENS ========== */
@media (max-width: 400px) {
  .area-tab {
    padding: 5px 7px;
    font-size: 10px;
  }

  .room-btn {
    font-size: 10px;
    padding: 4px 8px;
  }

  .avatar-option,
  .avatar-upload-option {
    width: 44px;
    height: 44px;
  }
}
