/* Puddle - shared notes canvas. Dark, soft, a little playful. */

:root {
  --bg: #000000;
  --ink: #e9eef6;
  --ink-dim: #8b97ab;
  --line: rgba(255, 255, 255, 0.1);
  --panel: rgba(13, 15, 19, 0.78);
  --accent: #38bdf8;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#board {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

/* ------------------------------------------------------------------ editor */

#editor-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

#editor-layer.visible {
  opacity: 1;
}

#editor {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: transparent;
  white-space: pre;
  font: 500 18px/26px var(--font);
  caret-color: #38bdf8;
  pointer-events: auto;
}

#editor::selection {
  background: rgba(56, 189, 248, 0.32);
}

/* --------------------------------------------------------------------- hud */

#hud {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.brand,
.chip,
.presence,
.conn {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px 7px 9px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.brand-name {
  font-weight: 650;
  font-size: 14px;
  letter-spacing: 0.2px;
}

.blob {
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 48% 52% / 55% 48% 52% 45%;
  background: linear-gradient(140deg, #7dd3fc, #38bdf8 55%, #0ea5e9);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.55);
  animation: bob 4.2s ease-in-out infinite;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0) scale(1, 1);
  }
  50% {
    transform: translateY(-2px) scale(1.05, 0.95);
  }
}

.presence {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  min-height: 32px;
}

.presence .who {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #06101f;
  border: 1px solid rgba(255, 255, 255, 0.25);
  margin-left: -5px;
}

.presence .who:first-child {
  margin-left: 0;
}

.presence .more {
  font-size: 11px;
  color: var(--ink-dim);
  margin-left: 4px;
}

.hud-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.conn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #475569;
}

.conn[data-state="online"] {
  background: #4ade80;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.6);
}

.conn[data-state="connecting"] {
  background: #fbbf24;
}

.chip {
  pointer-events: auto;
  font: 600 12px/1 var(--font);
  color: var(--ink-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.chip:hover {
  color: var(--ink);
  border-color: rgba(148, 163, 184, 0.5);
}

.chip:active {
  transform: translateY(1px);
}

.chip.solid {
  color: #07121f;
  background: linear-gradient(140deg, #7dd3fc, #38bdf8);
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.28);
}

.chip.solid:hover {
  color: #07121f;
}

#rename {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #7dd3fc;
  box-shadow: 0 0 8px currentColor;
}

/* -------------------------------------------------------------------- dock */

#dock {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.coords {
  font: 500 11px/1 var(--font);
  color: rgba(148, 163, 184, 0.65);
  font-variant-numeric: tabular-nums;
  min-width: 78px;
  text-align: right;
}

/* ------------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  font-size: 13px;
  color: var(--ink-dim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* -------------------------------------------------------------------- gate */

.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 90% at 50% 0%, rgba(56, 189, 248, 0.07), rgba(0, 0, 0, 0.88));
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 10;
}

.gate.open {
  opacity: 1;
  pointer-events: auto;
}

.card {
  width: min(340px, calc(100vw - 40px));
  padding: 28px 26px 22px;
  border-radius: 22px;
  background: rgba(10, 12, 16, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.75);
  text-align: center;
  transform: translateY(8px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.gate.open .card {
  transform: translateY(0) scale(1);
}

.mascot {
  height: 54px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
  margin-bottom: 14px;
}

.mascot span {
  display: block;
  width: 14px;
  border-radius: 12px 12px 9px 9px;
  background: linear-gradient(180deg, #7dd3fc, #38bdf8);
  animation: ripple 1.6s ease-in-out infinite;
}

.mascot span:nth-child(1) {
  height: 26px;
  animation-delay: 0s;
}
.mascot span:nth-child(2) {
  height: 46px;
  animation-delay: 0.18s;
}
.mascot span:nth-child(3) {
  height: 32px;
  animation-delay: 0.36s;
}

@keyframes ripple {
  0%,
  100% {
    transform: scaleY(0.72);
    opacity: 0.75;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

.card h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.tagline {
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-dim);
}

#gate-name {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: 500 15px var(--font);
  text-align: center;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#gate-name:focus {
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

#gate-go {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(140deg, #7dd3fc, #38bdf8);
  color: #06121f;
  font: 700 15px var(--font);
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
}

#gate-go:hover {
  filter: brightness(1.06);
}

#gate-go:active {
  transform: translateY(1px);
}

.hint {
  margin: 14px 0 0;
  font-size: 11.5px;
  color: rgba(148, 163, 184, 0.7);
}

@media (max-width: 520px) {
  .brand-name {
    display: none;
  }
  .coords {
    display: none;
  }
}
