:root {
  --color-bg: #fafafa;
  --color-text: #2d3436;
  --color-text-secondary: #666666;
  --color-primary: #ff6b6b;
  --color-secondary: #4ecdc4;
  --color-yellow: #ffe66d;
  --color-border: #e5e5e5;

  --radius: 16px;
  --radius-lg: 24px;
  --space: 24px;

  --shadow-soft: 0 6px 20px rgba(45, 52, 54, 0.08);
  --shadow-pop: 0 10px 30px rgba(255, 107, 107, 0.28);

  font-family: "Nunito", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  min-height: 100dvh;
  background: var(--color-bg);
  color: var(--color-text);
  overflow: hidden;
  position: relative;
  /* The whole page is the play space — keep the native cursor visible. */
  cursor: crosshair;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- Confetti-ish backdrop ---------- */
.confetti {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 20%, rgba(255, 107, 107, 0.14) 0 10px, transparent 11px),
    radial-gradient(circle at 82% 14%, rgba(78, 205, 196, 0.16) 0 12px, transparent 13px),
    radial-gradient(circle at 26% 78%, rgba(255, 230, 109, 0.22) 0 9px, transparent 10px),
    radial-gradient(circle at 68% 64%, rgba(255, 107, 107, 0.12) 0 7px, transparent 8px),
    radial-gradient(circle at 92% 84%, rgba(78, 205, 196, 0.14) 0 11px, transparent 12px),
    radial-gradient(circle at 46% 36%, rgba(255, 230, 109, 0.16) 0 6px, transparent 7px),
    radial-gradient(circle at 6% 58%, rgba(78, 205, 196, 0.12) 0 8px, transparent 9px),
    radial-gradient(circle at 58% 92%, rgba(255, 107, 107, 0.13) 0 9px, transparent 10px);
  background-repeat: no-repeat;
  animation: float-bg 16s ease-in-out infinite alternate;
}

@keyframes float-bg {
  from {
    transform: translateY(0) scale(1);
  }
  to {
    transform: translateY(-18px) scale(1.03);
  }
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--space);
  padding: 16px var(--space);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.brand-mark {
  font-size: 26px;
  animation: wobble 3s ease-in-out infinite;
  display: inline-block;
}

@keyframes wobble {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}

.presence {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 10px 18px;
  background: #fff;
  border: 2px solid var(--color-border);
  border-radius: 999px;
  font-weight: 800;
  font-size: 15px;
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
}

.presence .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #2ecc71;
  box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.55);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(46, 204, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  box-shadow: var(--shadow-pop);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(255, 107, 107, 0.36);
}

.share-btn:active {
  transform: translateY(0) scale(0.97);
}

.share-icon {
  font-size: 16px;
}

/* ---------- Cursor layer ---------- */
.cursor-layer,
.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.fx-layer {
  z-index: 25;
}

.cursor {
  position: absolute;
  top: 0;
  left: 0;
  /* JS sets transform; we transition nothing here — interpolation is done in rAF. */
  will-change: transform;
}

.cursor-arrow {
  display: block;
  filter: drop-shadow(0 3px 5px rgba(45, 52, 54, 0.22));
}

.cursor-label {
  position: absolute;
  left: 18px;
  top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(45, 52, 54, 0.18);
  transform-origin: left center;
  animation: label-in 0.25s ease;
}

@keyframes label-in {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- Emoji bursts & reactions ---------- */
.burst {
  position: absolute;
  font-size: 42px;
  transform: translate(-50%, -50%);
  animation: burst-pop 1.8s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes burst-pop {
  0% { transform: translate(-50%, -50%) scale(0.2) rotate(-12deg); opacity: 0; }
  18% { transform: translate(-50%, -50%) scale(1.35) rotate(6deg); opacity: 1; }
  45% { transform: translate(-50%, -70%) scale(1) rotate(-4deg); opacity: 1; }
  100% { transform: translate(-50%, -160%) scale(0.85) rotate(2deg); opacity: 0; }
}

.reaction {
  position: absolute;
  bottom: 90px;
  font-size: 34px;
  transform: translateX(-50%);
  animation: reaction-float 3s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes reaction-float {
  0% { transform: translate(-50%, 0) scale(0.5); opacity: 0; }
  12% { transform: translate(-50%, -10px) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -62vh) scale(1); opacity: 0; }
}

/* ---------- Empty / share state ---------- */
.empty-state {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  padding: var(--space);
  pointer-events: none;
}

/* Respect the `hidden` attribute (display:grid above would otherwise win
   over the user-agent default). Lets app.js hide the dialog when others join. */
.empty-state[hidden] {
  display: none;
}

.empty-card {
  pointer-events: auto;
  max-width: 460px;
  text-align: center;
  background: #fff;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  box-shadow: var(--shadow-soft);
  animation: card-in 0.4s ease;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.empty-emoji {
  font-size: 56px;
  animation: wobble 3s ease-in-out infinite;
}

.empty-card h1 {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 16px 0 12px;
}

.empty-card p {
  font-size: 17px;
  line-height: 1.55;
  color: var(--color-text-secondary);
  margin: 0 0 24px;
}

.big-share {
  width: 100%;
  padding: 18px 24px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 800;
  font-size: 17px;
  cursor: pointer;
  box-shadow: var(--shadow-pop);
  transition: transform 0.12s ease;
}

.big-share:hover { transform: translateY(-2px); }
.big-share:active { transform: scale(0.98); }

.empty-card .hint {
  margin-top: 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

/* ---------- You badge ---------- */
.you-badge {
  position: fixed;
  left: var(--space);
  bottom: var(--space);
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #fff;
  border: 2px solid var(--color-border);
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow-soft);
}

.you-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

/* ---------- Reaction bar ---------- */
.reaction-bar {
  position: fixed;
  left: 50%;
  bottom: var(--space);
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  gap: 8px;
  padding: 8px;
  background: #fff;
  border: 2px solid var(--color-border);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}

.reaction-bar button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: var(--color-bg);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.reaction-bar button:hover {
  transform: translateY(-4px) scale(1.12);
  background: var(--color-yellow);
}

.reaction-bar button:active {
  transform: scale(0.9);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 78px;
  transform: translateX(-50%) translateY(-12px);
  z-index: 40;
  padding: 12px 22px;
  background: var(--color-text);
  color: #fff;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .brand-name { display: none; }
  .topbar { gap: 12px; padding: 12px 16px; }
  .presence { font-size: 13px; padding: 8px 14px; }
  .share-btn { padding: 10px 14px; font-size: 13px; }
  #share-label { display: none; }
  .empty-card { padding: 36px 24px; }
  .empty-card h1 { font-size: 24px; }
  .you-badge { font-size: 12px; padding: 8px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .confetti,
  .brand-mark,
  .empty-emoji,
  .presence .dot {
    animation: none;
  }
}
