/* Copyright (c) 2026 Murr (https://github.com/vtstv) */

/* --------------------------------------------------------------------------
   Glass Panels Shared Styling
   -------------------------------------------------------------------------- */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  color: var(--text-main);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

/* --------------------------------------------------------------------------
   Unified Header Overlay (Top Bar)
   -------------------------------------------------------------------------- */
.app-header {
  position: fixed;
  top: max(14px, var(--sat));
  left: max(14px, var(--sal));
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.brand-logo-img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.5);
  flex-shrink: 0;
}

.drop-logo-img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.app-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-badge {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--accent-cyan);
}

/* Room Chip Widget */
.room-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-full);
  min-height: 32px;
  flex-shrink: 0;
}

.room-lock-icon {
  font-size: 11px;
}

.room-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: #c4b5fd;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-perm-badge {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
  margin-left: -2px;
  line-height: 1;
}

.room-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  flex-shrink: 0;
}

.room-action-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.room-action-btn.highlight {
  background: rgba(139, 92, 246, 0.3);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}

.room-action-btn.highlight:hover {
  background: var(--accent-purple);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.6);
}

/* Top Right Settings & Options Menu (Gear on Desktop, Hamburger on Mobile) */
.settings-wrapper {
  position: fixed;
  top: max(14px, var(--sat));
  right: max(14px, var(--sar));
  z-index: 100;
  display: flex;
  align-items: center;
}

.header-settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: rgba(22, 27, 46, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(139, 92, 246, 0.38);
  border-radius: var(--radius-full);
  color: #f8fafc;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: all var(--transition-fast);
}

.header-settings-btn:hover {
  background: rgba(139, 92, 246, 0.32);
  border-color: rgba(139, 92, 246, 0.75);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.45);
}

.header-settings-btn .icon-gear {
  display: block;
}

.header-settings-btn .icon-hamburger {
  display: none;
}

@media (max-width: 768px) {
  .settings-wrapper {
    top: max(10px, var(--sat));
    right: max(10px, var(--sar));
  }

  .header-settings-btn {
    width: 36px;
    height: 36px;
  }

  .header-settings-btn .icon-gear {
    display: none !important;
  }
  .header-settings-btn .icon-hamburger {
    display: block !important;
  }
}

.settings-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 230px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: var(--radius-md);
  z-index: 180;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.96);
  transform-origin: top right;
  transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.settings-dropdown.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.settings-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4px;
}

.settings-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
}

.settings-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.settings-lang-grid {
  display: flex;
  gap: 6px;
}

.settings-lang-btn {
  flex: 1;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.settings-lang-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.4);
  color: #fff;
}

.settings-lang-btn.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: #fff;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.settings-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 2px 0;
}

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

.settings-input {
  flex: 1;
  height: 32px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.settings-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

.settings-color-input {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  flex-shrink: 0;
}

.settings-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.settings-color-input::-webkit-color-swatch {
  border: none;
  border-radius: var(--radius-sm);
}

.settings-action-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.settings-action-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  transition: all var(--transition-fast);
  width: 100%;
}

.lang-option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.lang-option.active {
  background: rgba(139, 92, 246, 0.2);
  color: #fff;
}

.lang-opt-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-cyan);
  width: 20px;
  flex-shrink: 0;
}

.lang-opt-name {
  flex: 1;
}

/* Integrated Header Status */
.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  min-height: 32px;
}

.header-ping {
  color: #10b981;
  font-weight: 500;
}

/* User Profile Chip */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 32px;
  flex-shrink: 0;
}

.user-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-purple);
  box-shadow: 0 0 8px currentColor;
  flex-shrink: 0;
}

.user-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  max-width: 85px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-name-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 2px;
}

.edit-name-btn:hover {
  color: var(--text-main);
}

/* --------------------------------------------------------------------------
   Main Floating Toolbar
   -------------------------------------------------------------------------- */
.main-toolbar {
  position: absolute;
  top: max(14px, var(--sat));
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  max-width: 95vw;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.tool-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.tool-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.tool-btn.active {
  color: #fff;
  background: rgba(139, 92, 246, 0.24);
  border-color: rgba(139, 92, 246, 0.45);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.3);
}

.tool-btn.danger-hover:hover {
  color: #fda4af;
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(244, 63, 94, 0.35);
}

.tool-btn.action-btn.primary-glow {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.25));
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #fff;
}

.tool-btn.action-btn.primary-glow:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.45), rgba(139, 92, 246, 0.45));
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.45);
}

.tool-btn .tooltip {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: 4px 8px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all var(--transition-fast);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.tool-btn:hover .tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Color Palette Swatches */
.color-palette {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: var(--c);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  flex-shrink: 0;
}

.color-swatch:hover {
  transform: scale(1.18);
}

.color-swatch.active {
  transform: scale(1.22);
  border-color: #ffffff;
  box-shadow: 0 0 12px var(--c);
}

.custom-color-wrapper {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.custom-color-wrapper:hover {
  transform: scale(1.15);
}

#custom-color-picker {
  position: absolute;
  inset: -10px;
  width: 50px;
  height: 50px;
  opacity: 0;
  cursor: pointer;
}

/* Brush Size Group */
.brush-size-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brush-preview {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.preview-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--accent-purple);
  box-shadow: 0 0 8px currentColor;
  transition: width 0.1s ease, height 0.1s ease;
}

#brush-size-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 64px;
  height: 4px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  outline: none;
}

#brush-size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  transition: transform 0.1s ease;
}

#brush-size-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

.brush-size-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  width: 26px;
  text-align: right;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Floating Emoji Reaction Dock
   -------------------------------------------------------------------------- */
.reaction-dock {
  position: absolute;
  bottom: max(20px, var(--sab));
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

.reaction-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: transform var(--transition-bounce), background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.reaction-btn:hover {
  transform: scale(1.35) translateY(-4px);
  background: rgba(255, 255, 255, 0.12);
}

.reaction-btn:active {
  transform: scale(0.95);
}

/* --------------------------------------------------------------------------
   Desktop Edge Status Bar (Bottom Right)
   -------------------------------------------------------------------------- */
.status-bar {
  position: absolute;
  bottom: max(20px, var(--sab));
  right: max(20px, var(--sar));
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 12px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.status-val {
  color: var(--text-main);
  font-weight: 500;
}

.status-val.bold {
  font-weight: 600;
  color: #fff;
}

.status-separator {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.14);
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
}

.pulse-indicator.offline {
  background: var(--accent-rose);
  box-shadow: 0 0 10px var(--accent-rose);
}

.fly-icon {
  display: flex;
  color: var(--accent-cyan);
}

/* --------------------------------------------------------------------------
   Live Connected Peers Badge (Bottom Right)
   -------------------------------------------------------------------------- */
.peers-counter {
  position: fixed;
  bottom: max(16px, var(--sab));
  right: max(16px, var(--sar));
  z-index: 95;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
  user-select: none;
  pointer-events: auto;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.peers-counter:hover {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 10px 28px rgba(139, 92, 246, 0.35);
  transform: translateY(-2px);
}

.peer-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  flex-shrink: 0;
  animation: pulseGreen 2.5s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.peers-count-text {
  color: #e2e8f0;
  letter-spacing: 0.2px;
}

/* --------------------------------------------------------------------------
   Active Participants Modal
   -------------------------------------------------------------------------- */
.participants-modal-card {
  max-width: 360px;
  width: 90vw;
}

.participants-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.participants-count-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.35);
}

.participants-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin: 14px 0 6px 0;
  padding-right: 2px;
}

.participant-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.participant-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.participant-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

.participant-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-you-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-left: 6px;
}

.participant-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  flex-shrink: 0;
}

.participants-empty {
  text-align: center;
  padding: 18px 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   Pointer Events Restriction (Active in Select & Bucket Modes)
   -------------------------------------------------------------------------- */
body:not(.tool-select):not(.tool-bucket) #strokes-layer,
body:not(.tool-select):not(.tool-bucket) #shapes-layer,
body:not(.tool-select):not(.tool-bucket) .canvas-stroke,
body:not(.tool-select):not(.tool-bucket) .vector-shape {
  pointer-events: none !important;
}

body.tool-select .canvas-stroke,
body.tool-select .vector-shape,
body.tool-bucket .canvas-stroke,
body.tool-bucket .vector-shape {
  pointer-events: auto !important;
}

/* --------------------------------------------------------------------------
   Vector Strokes Layer & Controls (Pencil, Brush, Highlighter)
   -------------------------------------------------------------------------- */
#strokes-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: auto !important;
}

.canvas-stroke {
  position: absolute;
  pointer-events: auto;
  cursor: grab;
  user-select: none;
  touch-action: none;
  background: rgba(0, 0, 0, 0.001);
  transform-origin: center center;
}

.canvas-stroke.dragging {
  cursor: grabbing;
  z-index: 1000 !important;
}

.canvas-stroke .stroke-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  display: block;
}

.canvas-stroke .stroke-path {
  pointer-events: stroke;
  cursor: grab;
}

.canvas-stroke.dragging .stroke-path {
  cursor: grabbing;
}

.canvas-stroke .stroke-transform-box {
  display: none;
  position: absolute;
  inset: -6px;
  border: 1.5px dashed var(--accent-purple);
  border-radius: 4px;
  pointer-events: none;
}

.canvas-stroke.selected .stroke-transform-box {
  display: block;
}

/* --------------------------------------------------------------------------
   Vector Shapes Layer & Controls (Stretch & Rotate)
   -------------------------------------------------------------------------- */
#shapes-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: auto !important;
}

.vector-shape {
  position: absolute;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.001);
  cursor: grab;
  touch-action: none;
  user-select: none;
  transform-origin: center center;
}

.vector-shape.dragging {
  cursor: grabbing;
}

.vector-shape.selected .shape-transform-box,
.selected > .transform-gizmo-box {
  display: block;
}

.shape-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  display: block;
}

.shape-transform-box,
.transform-gizmo-box {
  display: none;
  position: absolute;
  inset: -6px;
  border: 1.5px dashed var(--accent-purple);
  pointer-events: none;
  border-radius: 4px;
}

.resize-handle {
  position: absolute;
  width: 9px;
  height: 9px;
  background: #ffffff;
  border: 1.5px solid var(--accent-purple);
  border-radius: 2px;
  pointer-events: auto;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.resize-handle::before {
  content: '';
  position: absolute;
  inset: -8px;
}

.resize-handle.nw { top: -5px; left: -5px; cursor: nwse-resize; }
.resize-handle.n  { top: -5px; left: calc(50% - 4.5px); cursor: ns-resize; }
.resize-handle.ne { top: -5px; right: -5px; cursor: nesw-resize; }
.resize-handle.e  { top: calc(50% - 4.5px); right: -5px; cursor: ew-resize; }
.resize-handle.se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.resize-handle.s  { bottom: -5px; left: calc(50% - 4.5px); cursor: ns-resize; }
.resize-handle.sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.resize-handle.w  { top: calc(50% - 4.5px); left: -5px; cursor: ew-resize; }

/* Two-Stage Selection & Transform Gizmo: Scale & Rotate Modes */
.vector-shape.transform-mode-scale .resize-handle,
.canvas-stroke.transform-mode-scale .resize-handle,
.image-card.transform-mode-scale .resize-handle,
.sticky-note.transform-mode-scale .resize-handle,
.canvas-text-box.transform-mode-scale .resize-handle,
.checklist-card.transform-mode-scale .resize-handle {
  display: block;
}
.vector-shape.transform-mode-scale .rot-corner-handle,
.vector-shape.transform-mode-scale .pivot-indicator,
.canvas-stroke.transform-mode-scale .rot-corner-handle,
.canvas-stroke.transform-mode-scale .pivot-indicator,
.image-card.transform-mode-scale .rot-corner-handle,
.image-card.transform-mode-scale .pivot-indicator,
.sticky-note.transform-mode-scale .rot-corner-handle,
.sticky-note.transform-mode-scale .pivot-indicator,
.canvas-text-box.transform-mode-scale .rot-corner-handle,
.canvas-text-box.transform-mode-scale .pivot-indicator,
.checklist-card.transform-mode-scale .rot-corner-handle,
.checklist-card.transform-mode-scale .pivot-indicator {
  display: none !important;
}

.vector-shape.transform-mode-rotate .resize-handle,
.canvas-stroke.transform-mode-rotate .resize-handle,
.image-card.transform-mode-rotate .resize-handle,
.sticky-note.transform-mode-rotate .resize-handle,
.canvas-text-box.transform-mode-rotate .resize-handle,
.checklist-card.transform-mode-rotate .resize-handle {
  display: none !important;
}
.vector-shape.transform-mode-rotate .rot-corner-handle,
.vector-shape.transform-mode-rotate .pivot-indicator,
.canvas-stroke.transform-mode-rotate .rot-corner-handle,
.canvas-stroke.transform-mode-rotate .pivot-indicator,
.image-card.transform-mode-rotate .rot-corner-handle,
.image-card.transform-mode-rotate .pivot-indicator,
.sticky-note.transform-mode-rotate .rot-corner-handle,
.sticky-note.transform-mode-rotate .pivot-indicator,
.canvas-text-box.transform-mode-rotate .rot-corner-handle,
.canvas-text-box.transform-mode-rotate .pivot-indicator,
.checklist-card.transform-mode-rotate .rot-corner-handle,
.checklist-card.transform-mode-rotate .pivot-indicator {
  display: flex !important;
}

/* Corner Rotation Arrow Handles */
.rot-corner-handle {
  position: absolute;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: rgba(139, 92, 246, 0.92);
  border: 1.5px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  cursor: grab;
  pointer-events: auto;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  z-index: 10;
}

.rot-corner-handle:hover {
  transform: scale(1.22);
  background: var(--accent-purple);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.85);
}

.rot-corner-handle.nw { top: -11px; left: -11px; }
.rot-corner-handle.ne { top: -11px; right: -11px; }
.rot-corner-handle.se { bottom: -11px; right: -11px; }
.rot-corner-handle.sw { bottom: -11px; left: -11px; }

.rot-arrow-icon {
  width: 14px;
  height: 14px;
  display: block;
}

/* Center Pivot Indicator */
.pivot-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 8px var(--accent-cyan);
  pointer-events: none;
  z-index: 9;
}

/* Rotation Handle (Legacy Top Stem) */
.rot-handle {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 24px;
  cursor: grab;
  pointer-events: auto;
  display: none;
  flex-direction: column;
  align-items: center;
}

.rot-stem {
  width: 1.5px;
  height: 14px;
  background: var(--accent-purple);
}

.rot-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid var(--accent-purple);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* --------------------------------------------------------------------------
   Marquee Selection Box
   -------------------------------------------------------------------------- */
.marquee-selection-box {
  position: absolute;
  display: none;
  border: 1.5px dashed var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  pointer-events: none;
  z-index: 80;
  border-radius: 4px;
}

/* Multi-Selection Highlights */
.sticky-note.selected {
  outline: 2px solid var(--accent-purple);
  outline-offset: 4px;
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.45) !important;
}

.image-card.selected {
  outline: 2px solid var(--accent-purple);
  outline-offset: 4px;
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.45) !important;
}

.canvas-text-box.selected {
  outline: 2px solid var(--accent-purple);
  outline-offset: 4px;
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.45) !important;
}

.checklist-card.selected {
  outline: 2px solid var(--accent-purple);
  outline-offset: 4px;
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.45) !important;
}

.canvas-stroke.selected {
  outline: none;
}

/* --------------------------------------------------------------------------
   Sticky Notes UI
   -------------------------------------------------------------------------- */
.sticky-note {
  position: absolute;
  width: 220px;
  min-height: 180px;
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: 0 14px 30px -6px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  user-select: none;
  touch-action: none;
  cursor: grab;
  transform-origin: center center;
  transition: box-shadow 0.12s ease;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.card-transform-box {
  display: none;
  position: absolute;
  inset: -6px;
  border: 1.5px dashed var(--accent-purple);
  pointer-events: none;
  border-radius: 6px;
}

.sticky-note.selected .card-transform-box,
.canvas-text-box.selected .card-transform-box,
.checklist-card.selected .card-transform-box {
  display: block;
}

.sticky-note.dragging {
  cursor: grabbing;
  box-shadow: 0 22px 42px -6px rgba(0, 0, 0, 0.7), 0 0 20px rgba(255, 255, 255, 0.15);
  z-index: 1000 !important;
}

.sticky-note[data-color="#fef08a"] {
  background: linear-gradient(145deg, #fef9c3, #fef08a);
  color: #422006;
}
.sticky-note[data-color="#bbf7d0"] {
  background: linear-gradient(145deg, #dcfce7, #bbf7d0);
  color: #14532d;
}
.sticky-note[data-color="#bae6fd"],
.sticky-note[data-color="#bfdbfe"] {
  background: linear-gradient(145deg, #dbeafe, #bfdbfe);
  color: #1e3a8a;
}
.sticky-note[data-color="#e9d5ff"] {
  background: linear-gradient(145deg, #f3e8ff, #e9d5ff);
  color: #3b0764;
}
.sticky-note[data-color="#fecdd3"],
.sticky-note[data-color="#fbcfe8"] {
  background: linear-gradient(145deg, #fce7f3, #fbcfe8);
  color: #831843;
}
.sticky-note[data-color="#fed7aa"] {
  background: linear-gradient(145deg, #ffedd5, #fed7aa);
  color: #7c2d12;
}

.note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 8px;
  cursor: grab;
  touch-action: none;
}

.note-drag-handle {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 8px 6px;
  min-height: 36px;
}

.note-handle-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
}

.note-color-picker {
  display: flex;
  gap: 6px;
  align-items: center;
}

.note-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform var(--transition-fast);
  position: relative;
}

.note-color-dot::before {
  content: '';
  position: absolute;
  inset: -8px;
}

.note-color-dot:hover {
  transform: scale(1.3);
}

.note-delete-btn {
  background: none;
  border: none;
  color: currentColor;
  opacity: 0.45;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.note-delete-btn:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.12);
}

.note-content {
  flex: 1;
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 500;
  resize: none;
  outline: none;
  cursor: text;
  touch-action: pan-y;
}

.note-content::placeholder {
  color: inherit;
  opacity: 0.4;
}

/* --------------------------------------------------------------------------
   Freeform Canvas Text Box UI
   -------------------------------------------------------------------------- */
#texts-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: auto !important;
}

.canvas-text-box {
  position: absolute;
  pointer-events: auto;
  min-width: 80px;
  max-width: 600px;
  display: inline-flex;
  align-items: flex-start;
  gap: 4px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px dashed transparent;
  transform-origin: center center;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  user-select: none;
}

.canvas-text-box:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.03);
}

.canvas-text-box.dragging {
  opacity: 0.85;
  cursor: grabbing;
  z-index: 1000 !important;
}

.text-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 24px;
  cursor: grab;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
  user-select: none;
  touch-action: none;
}

.canvas-text-box:hover .text-drag-handle,
.canvas-text-box.selected .text-drag-handle {
  opacity: 1;
}

.text-editable {
  outline: none;
  cursor: text;
  font-family: var(--font-sans);
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  min-width: 60px;
  padding: 2px 4px;
}

.text-editable:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  opacity: 0.5;
  pointer-events: none;
}

.text-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast), background var(--transition-fast);
  flex-shrink: 0;
}

.canvas-text-box:hover .text-delete-btn,
.canvas-text-box.selected .text-delete-btn {
  opacity: 1;
}

.text-delete-btn:hover {
  background: rgba(244, 63, 94, 0.35);
}

/* --------------------------------------------------------------------------
   Interactive Checklist / Task Card UI
   -------------------------------------------------------------------------- */
#checklists-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: auto !important;
}

.checklist-card {
  position: absolute;
  pointer-events: auto;
  width: 260px;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: rgba(18, 24, 38, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 10px;
  user-select: none;
  touch-action: none;
  transform-origin: center center;
  transition: box-shadow var(--transition-fast);
}

.checklist-card.dragging {
  cursor: grabbing;
  box-shadow: 0 24px 48px -6px rgba(0, 0, 0, 0.8), 0 0 20px rgba(139, 92, 246, 0.35);
  z-index: 1000 !important;
}

.checklist-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: grab;
  touch-action: none;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.checklist-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 24px;
  cursor: grab;
  color: var(--text-muted);
}

.checklist-bar {
  width: 12px;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.checklist-title {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  box-sizing: border-box;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 2px 0;
}

.checklist-title::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.checklist-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.checklist-delete-btn:hover {
  background: rgba(244, 63, 94, 0.2);
  color: var(--accent-rose);
}

.checklist-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden !important;
  width: 100%;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.checklist-items::-webkit-scrollbar {
  width: 5px;
}

.checklist-items::-webkit-scrollbar-track {
  background: transparent;
}

.checklist-items::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.checklist-items::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  transition: background var(--transition-fast);
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.checklist-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.checklist-item.completed {
  opacity: 0.6;
}

.checklist-item.completed .checklist-item-input {
  text-decoration: line-through;
  color: var(--text-muted);
}

.checklist-check-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.checklist-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checklist-custom-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.2);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.checklist-checkbox:checked ~ .checklist-custom-check {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.checklist-checkbox:checked ~ .checklist-custom-check::after {
  content: '✓';
  color: #0b1120;
  font-size: 11px;
  font-weight: 800;
}

.checklist-item-input {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  box-sizing: border-box;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 2px 0;
}

.checklist-item-del-btn {
  flex-shrink: 0;
  min-width: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}

.checklist-item:hover .checklist-item-del-btn {
  opacity: 1;
}

.checklist-item-del-btn:hover {
  color: var(--accent-rose);
}

.checklist-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.checklist-add-btn {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.checklist-add-btn:hover {
  background: rgba(139, 92, 246, 0.3);
  color: #ffffff;
}

.checklist-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Image Cards UI (Frameless with hover controls)
   -------------------------------------------------------------------------- */
.image-card {
  position: absolute;
  pointer-events: auto;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  box-shadow: none;
  display: block;
  user-select: none;
  touch-action: none;
  cursor: grab;
  transform-origin: center center;
  transition: box-shadow var(--transition-fast), outline var(--transition-fast);
}

.image-card.dragging {
  cursor: grabbing;
  box-shadow: 0 24px 48px -6px rgba(0, 0, 0, 0.8), 0 0 20px rgba(139, 92, 246, 0.35);
  z-index: 1000 !important;
}

.image-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  border-radius: var(--radius-md);
  display: block;
}

.image-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  opacity: 0;
  transition: opacity var(--transition-fast), background var(--transition-fast);
  z-index: 10;
}

.image-card:hover .image-delete-btn,
.image-card.selected .image-delete-btn {
  opacity: 1;
}

.image-delete-btn:hover {
  background: var(--accent-rose);
  border-color: var(--accent-rose);
}

.image-resize-handle {
  position: absolute;
  right: 0px;
  bottom: 0px;
  width: 28px;
  height: 28px;
  cursor: nwse-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  pointer-events: auto;
  transition: color var(--transition-fast);
  z-index: 10;
  touch-action: none;
}

.image-resize-handle::before {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: 44px;
  height: 44px;
  cursor: nwse-resize;
}

.image-resize-handle:hover,
.image-resize-handle:active {
  color: var(--accent-purple);
}

/* --------------------------------------------------------------------------
   Live Remote Multi-User Cursors
   -------------------------------------------------------------------------- */
.remote-cursor {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 50;
  transition: transform 0.06s cubic-bezier(0, 0, 0.2, 1);
  will-change: transform;
}

.cursor-pointer {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.cursor-tag {
  position: absolute;
  top: 18px;
  left: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  letter-spacing: 0.2px;
}

/* --------------------------------------------------------------------------
   Floating Emoji Reactions
   -------------------------------------------------------------------------- */
.floating-emoji,
.floating-reaction {
  position: absolute;
  pointer-events: none;
  user-select: none;
  will-change: transform, opacity;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: floatReaction 2.2s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
  z-index: 9999;
}

.floating-emoji-char {
  font-size: 32px;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

.reaction-sender-badge {
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 9999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2);
  white-space: nowrap;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* --------------------------------------------------------------------------
   Glassmorphic Context Menu
   -------------------------------------------------------------------------- */
.context-menu {
  position: fixed;
  z-index: 2000;
  min-width: 180px;
  padding: 6px;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.12);
  user-select: none;
  animation: fadeInScale 0.12s ease-out;
}

.ctx-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.ctx-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.ctx-item.danger:hover {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
}

.ctx-icon {
  font-size: 14px;
}

.ctx-shortcut {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding-left: 12px;
}

.ctx-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

.ctx-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
}

.ctx-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.ctx-swatch:hover {
  transform: scale(1.22);
  border-color: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.ctx-sub-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
}

.ctx-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  width: 44px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ctx-pill-btn {
  flex: 1;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  text-align: center;
}

.ctx-pill-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.ctx-pill-btn.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Modals & Password Gate Modal
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 16px;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  padding: 24px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transform: scale(0.92);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-card {
  max-width: 380px;
}

.room-settings-card {
  max-width: 460px;
  text-align: left;
  align-items: stretch;
}

.modal-backdrop.show .modal-card {
  transform: scale(1);
}

.modal-icon.warning {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border: 1px solid rgba(244, 63, 94, 0.3);
  margin-left: auto;
  margin-right: auto;
}

.modal-icon.purple {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  margin-left: auto;
  margin-right: auto;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
  text-align: center;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
  text-align: center;
}

.code-badge {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: #c4b5fd;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.settings-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ttl-selector {
  display: flex;
  gap: 5px;
  width: 100%;
  overflow-x: auto;
}

.ttl-btn {
  flex: 1;
  min-height: 38px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  padding: 0 6px;
}

.ttl-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.ttl-btn.active {
  background: rgba(139, 92, 246, 0.28);
  border-color: var(--accent-purple);
  color: #fff;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.35);
}

.ttl-info {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
  margin-top: 4px;
}

.settings-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 14px 0;
}

.password-input-group {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
  gap: 8px;
  flex-wrap: wrap;
}

.password-input-group .nickname-input {
  margin-bottom: 0;
  flex: 1;
  min-width: 160px;
}

.pwd-toggle-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.6;
}

.pwd-toggle-btn:hover {
  opacity: 1;
}

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

.modal-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.modal-btn {
  flex: 1;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.modal-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.modal-btn.primary {
  background: var(--accent-purple);
  color: #fff;
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.4);
}

.modal-btn.primary:hover {
  background: #7c3aed;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
}

.modal-btn.danger {
  background: var(--accent-rose);
  color: #fff;
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.4);
}

.modal-btn.danger:hover {
  background: #e11d48;
  box-shadow: 0 0 20px rgba(244, 63, 94, 0.6);
}

.nickname-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 15px;
  outline: none;
  margin-bottom: 20px;
  transition: border-color var(--transition-fast);
}

.nickname-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.35);
}

/* --------------------------------------------------------------------------
   Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: max(68px, calc(var(--sat) + 54px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
  width: max-content;
  max-width: 90vw;
}

.toast {
  padding: 8px 16px;
  background: rgba(17, 24, 39, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.25s cubic-bezier(0.16, 1, 0.3, 1) 2.75s forwards;
}

/* --------------------------------------------------------------------------
   Popovers & Floating Tool Submenus
   -------------------------------------------------------------------------- */
.popover-anchor {
  position: relative;
  display: flex;
  align-items: center;
}

.shapes-popover,
.draw-popover,
.more-actions-popover,
.color-popover {
  position: fixed;
  top: calc(max(14px, var(--sat)) + 62px);
  bottom: auto;
  left: 50%;
  transform: translateX(-50%) translateY(-6px) scale(0.95);
  transform-origin: top center;
  opacity: 0;
  pointer-events: none;
  z-index: 120;
  transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.shapes-popover.show,
.draw-popover.show,
.more-actions-popover.show,
.color-popover.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}

.shapes-popover,
.draw-popover {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
}

.more-actions-popover {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  min-width: 154px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
}

.popover-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  border-radius: 8px;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.popover-action-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.35);
  color: #ffffff;
  transform: translateX(2px);
}

.popover-action-btn.danger:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.35);
  color: #fda4af;
}

.split-tool-btn {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.split-tool-btn:hover {
  border-color: rgba(139, 92, 246, 0.4);
}

.split-tool-btn .tool-btn {
  border: none;
  border-radius: 0;
  background: transparent;
}

.split-tool-btn .tool-btn.active {
  background: rgba(139, 92, 246, 0.24);
  color: #fff;
  box-shadow: none;
}

.tool-caret-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 36px;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}

.tool-caret-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.popover-tool-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #f8fafc;
  cursor: pointer;
  transition: all 0.16s ease;
}

.popover-tool-btn:hover {
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(139, 92, 246, 0.5);
  color: #ffffff;
  transform: translateY(-2px);
}

.popover-tool-btn.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
}

.color-trigger-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.color-trigger-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.color-trigger-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  transition: transform var(--transition-fast);
}

.color-trigger-btn:hover .color-trigger-dot {
  transform: scale(1.1);
}

.color-popover {
  width: 220px;
  padding: 14px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
}

.color-swatches-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  justify-items: center;
}

.color-popover .brush-size-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.zoom-badge-btn {
  min-height: 32px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-badge-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.4);
  color: #fff;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

.reaction-dock {
  position: absolute;
  bottom: calc(64px + max(16px, var(--sab)) + 12px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  z-index: 85;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  animation: cardFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Responsive Mobile Optimization (@media max-width: 768px & 480px)
   ========================================================================== */
@media (max-width: 768px) {
  .app-header {
    top: max(10px, var(--sat));
    left: max(10px, var(--sal));
    right: auto;
    max-width: calc(100vw - 60px);
    width: auto;
    padding: 5px 10px;
    border-radius: var(--radius-lg);
  }

  .header-right {
    display: none !important;
  }

  .room-name {
    max-width: 75px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-ping {
    display: none;
  }

  .status-bar {
    display: none !important;
  }

  .main-toolbar {
    position: fixed;
    top: auto;
    bottom: max(12px, var(--sab));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100vw - 16px);
    max-width: 480px;
    gap: 6px;
    padding: 6px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    box-sizing: border-box;
    -webkit-mask-image: linear-gradient(to right, transparent, black 14px, black calc(100% - 14px), transparent);
    mask-image: linear-gradient(to right, transparent, black 14px, black calc(100% - 14px), transparent);
  }
  .main-toolbar::-webkit-scrollbar {
    display: none;
  }

  .tool-btn {
    width: 40px;
    height: 40px;
  }

  .tool-btn .tooltip {
    display: none;
  }

  .brush-size-group {
    display: none;
  }

  .reaction-dock {
    bottom: calc(max(14px, var(--sab)) + 58px);
    gap: 6px;
    padding: 4px 10px;
  }

  .shapes-popover,
  .draw-popover,
  .more-actions-popover,
  .color-popover {
    position: fixed !important;
    bottom: calc(max(14px, var(--sab)) + 60px) !important;
    top: auto !important;
    left: 50% !important;
    transform: translateX(-50%) translateY(8px) scale(0.95) !important;
    transform-origin: bottom center !important;
    max-width: calc(100vw - 24px) !important;
    width: max-content !important;
    z-index: 130 !important;
  }

  .shapes-popover.show,
  .draw-popover.show,
  .more-actions-popover.show,
  .color-popover.show {
    transform: translateX(-50%) translateY(0) scale(1) !important;
  }

  .reaction-btn {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .sticky-note {
    width: 190px;
    min-height: 160px;
  }
}

@media (max-width: 480px) {
  .app-header {
    gap: 4px;
    padding: 4px 8px;
  }

  .app-title {
    display: none;
  }

  .brand-logo-img {
    width: 24px;
    height: 24px;
  }

  .brand-text .app-badge {
    display: none;
  }

  .user-name {
    display: none;
  }

  .room-name {
    max-width: 60px;
  }

  .main-toolbar {
    gap: 4px;
    padding: 4px 8px;
  }

  .tool-btn {
    width: 38px;
    height: 38px;
  }

  .color-palette {
    gap: 4px;
  }

  .color-swatch {
    width: 18px;
    height: 18px;
  }

  .custom-color-wrapper {
    width: 18px;
    height: 18px;
  }
}
