:root {
  --bg-grad-start: #0f172a;
  --bg-grad-end: #1e3a8a;
  --glass-bg: rgba(15, 23, 42, 0.62);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.35);
  --gold: #fde047;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --success: #34d399;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at 50% 0%, var(--bg-grad-end), var(--bg-grad-start));
  color: var(--text-main);
  min-height: 100vh;
  padding: 1rem 1.25rem;
  transition: background 1.2s ease;
  overflow-x: hidden;
}

/* Topbar Limpa e Fluida */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 0.75rem 1.25rem;
  border-radius: 18px;
  margin-bottom: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-orb {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(253, 224, 71, 0.2));
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.sky-telemetry {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.telemetry-pill {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-border);
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  color: #e2e8f0;
  white-space: nowrap;
}

.telemetry-select {
  background: rgba(15, 23, 42, 0.75);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

.dreamer-Identity {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.online-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.name-input-group {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 0.2rem 0.25rem 0.2rem 0.75rem;
}

.prefix-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold);
  margin-right: 0.35rem;
}

.name-input-group input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.82rem;
  width: 110px;
  outline: none;
}

/* Workspace Principal */
.workspace {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 1rem;
  align-items: start;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

.sky-stage-wrapper {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
}

.floating-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.35rem 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tool-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  cursor: pointer;
}

.tool-label input[type="color"] {
  border: none;
  width: 22px;
  height: 22px;
  background: transparent;
  cursor: pointer;
}

.tool-label input[type="range"] {
  width: 68px;
  accent-color: var(--accent);
}

.cloud-seed-pill {
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #e0f2fe;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.82rem;
}

/* Palco dos 3 Canvas + Lupa E-commerce */
.canvas-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35);
  user-select: none;
}

.canvas-stage canvas#cloudCanvas,
.canvas-stage canvas#weatherCanvas,
.canvas-stage canvas#drawCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#weatherCanvas {
  pointer-events: none;
}

#drawCanvas {
  cursor: crosshair;
  touch-action: none;
}

/* Lupa E-Commerce na Ponta do Mouse */
.magnifier-lens {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 18px;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.55),
    inset 0 0 18px rgba(255, 255, 255, 0.25);
  background: #0f172a;
}

.zoom-indicator {
  position: absolute;
  pointer-events: none;
  z-index: 20;
  border: 1.5px dashed rgba(253, 224, 71, 0.85);
  border-radius: 6px;
  background: rgba(253, 224, 71, 0.06);
}

.magnifier-lens canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.lens-crosshair {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.lens-crosshair::before,
.lens-crosshair::after {
  content: '';
  position: absolute;
  background: rgba(253, 224, 71, 0.55);
}

.lens-crosshair::before {
  top: 50%;
  left: 38%;
  right: 38%;
  height: 1px;
}

.lens-crosshair::after {
  left: 50%;
  top: 38%;
  bottom: 38%;
  width: 1px;
}

.lens-badge {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.78);
  color: var(--gold);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(253, 224, 71, 0.35);
}

/* Barra de Input de Visão */
.dream-input-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 0.45rem 0.55rem 0.45rem 0.9rem;
}

.input-icon {
  font-size: 1.2rem;
}

.dream-input-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
}

.dream-input-bar input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* Botões */
.btn-primary,
.btn-primary-sm,
.btn-glass,
.btn-glass-sm,
.btn-icon,
.btn-companion {
  cursor: pointer;
  border: none;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #fff;
  padding: 0.65rem 1.2rem;
  border-radius: 10px;
  font-size: 0.9rem;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary-sm {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #fff;
  padding: 0.5rem 0.95rem;
  border-radius: 10px;
  font-size: 0.84rem;
}

.btn-glass {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-main);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.76rem;
}

.btn-glass-sm {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
}

.btn-glass-sm.active-lens {
  background: rgba(253, 224, 71, 0.18);
  border-color: rgba(253, 224, 71, 0.55);
  color: var(--gold);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.btn-companion {
  background: rgba(253, 224, 71, 0.14);
  color: var(--gold);
  border: 1px solid rgba(253, 224, 71, 0.35);
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.74rem;
}

.btn-primary:hover,
.btn-glass-sm:hover,
.btn-companion:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.glass-card h2 {
  font-size: 0.96rem;
  font-weight: 700;
}

.pill-count {
  background: rgba(56, 189, 248, 0.18);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}

/* Medidor de Sintonia (1/3, 2/3, 3/3) */
.harmony-meter {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.75rem;
}

.harmony-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.step-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.25s ease;
}

.step-dot.lit {
  background: var(--gold);
  color: #0f172a;
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(253, 224, 71, 0.6);
}

.step-line {
  width: 36px;
  height: 2px;
  background: var(--glass-border);
}

.harmony-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* Tira de Visões Registradas pelo Sonhador */
.sightings-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 0.45rem;
  max-height: 155px;
  overflow-y: auto;
}

.sighting-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 0.3rem;
  text-align: center;
}

.sighting-chip img {
  width: 100%;
  height: 46px;
  object-fit: cover;
  border-radius: 6px;
}

.sighting-chip span {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Grupos de Sonhos (Constelações) */
.group-tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  margin-bottom: 0.65rem;
  padding-bottom: 0.25rem;
}

.group-tab-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.74rem;
  cursor: pointer;
  white-space: nowrap;
}

.group-tab-btn.active {
  background: rgba(253, 224, 71, 0.2);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 700;
}

.empty-group-state {
  text-align: center;
  padding: 1.1rem 0.5rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.empty-icon {
  font-size: 1.8rem;
  margin-bottom: 0.35rem;
}

.group-meta {
  background: rgba(253, 224, 71, 0.1);
  border: 1px solid rgba(253, 224, 71, 0.32);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.65rem;
}

.group-meta h3 {
  font-size: 0.9rem;
  color: var(--gold);
  margin-bottom: 0.35rem;
}

.members-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.member-pill {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--glass-border);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  color: #e2e8f0;
}

.shared-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}

.shared-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 0.25rem;
  text-align: center;
  font-size: 0.72rem;
}

.shared-item img {
  width: 100%;
  height: 42px;
  object-fit: cover;
  border-radius: 5px;
}

.chat-messages {
  height: 185px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.msg {
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.35;
  max-width: 90%;
}

.msg.mine {
  align-self: flex-end;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
}

.msg.theirs {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.12);
}

.msg.system {
  align-self: center;
  background: rgba(253, 224, 71, 0.14);
  border: 1px solid rgba(253, 224, 71, 0.3);
  color: var(--gold);
  font-size: 0.75rem;
  text-align: center;
  max-width: 96%;
}

.chat-form {
  display: flex;
  gap: 0.45rem;
}

.chat-form input {
  flex: 1;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  color: var(--text-main);
  font-size: 0.82rem;
  outline: none;
}

/* Feed de Ecos */
.echoes-feed {
  list-style: none;
  max-height: 110px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.hidden {
  display: none !important;
}

.shared-placeholder {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: rgba(56, 189, 248, 0.12);
  border-radius: 5px;
}

/* ============================================================================
   JUICE & RELAXAMENTO VISUAL: TOASTS, PRESENÇA AO VIVO E MODO ZEN
   ============================================================================ */

/* Toast Notifications suaves */
.toast-container {
  position: fixed;
  top: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  color: #f8fafc;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  backdrop-filter: blur(14px);
  animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.4s ease 3.6s forwards;
  pointer-events: auto;
}

.toast.toast-join {
  border-color: rgba(253, 224, 71, 0.6);
}

.toast.toast-left {
  border-color: rgba(148, 163, 184, 0.4);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-12px); }
}

/* Botão de Áudio Relaxante */
.audio-pill {
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
}

.audio-pill.active {
  background: rgba(56, 189, 248, 0.24);
  border-color: var(--accent);
  color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

/* Barra de Presença Estelar Online */
.active-dreamers-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  margin-bottom: 0.85rem;
  font-size: 0.78rem;
}

.presence-title {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.dreamers-orb-list {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  overflow-x: auto;
}

.dreamer-orb {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  color: #e2e8f0;
  white-space: nowrap;
  transition: transform 0.2s ease;
}

.dreamer-orb:hover {
  transform: translateY(-1px);
}

.dreamer-orb .star-pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
}

/* Indicador de alguém desenhando agora */
.live-drawing-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(253, 224, 71, 0.12);
  border: 1px solid rgba(253, 224, 71, 0.35);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--gold);
  animation: pulseGentle 1.8s infinite ease-in-out;
}

@keyframes pulseGentle {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; transform: scale(1.01); }
}

.pen-wave {
  animation: wigglePen 1s infinite alternate ease-in-out;
}

@keyframes wigglePen {
  from { transform: rotate(-8deg); }
  to { transform: rotate(12deg); }
}

/* Efeito de Partículas ao Enviar Visão */
.star-sparkle {
  position: absolute;
  pointer-events: none;
  width: 8px;
  height: 8px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--gold);
  animation: sparkleFly 1.2s forwards cubic-bezier(0.12, 0.8, 0.32, 1);
  z-index: 50;
}

@keyframes sparkleFly {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0.2); }
}

/* Modo Zen */
.zen-mode #sidebarPanel {
  display: none !important;
}

.zen-mode .workspace {
  grid-template-columns: 1fr;
}

.zen-mode .topbar {
  opacity: 0.3;
  transition: opacity 0.3s ease;
}

.zen-mode .topbar:hover {
  opacity: 1;
}

.btn-glass-sm.active-zen {
  background: rgba(56, 189, 248, 0.22);
  border-color: var(--accent);
  color: #38bdf8;
}

.back-portfolio-btn {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  color: #f8fafc;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.back-portfolio-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--accent);
  color: #38bdf8;
  transform: translateX(-2px);
}
