/* ═══════════════════════════════════════════════════════
   Pinboard — Playful, colorful, light-first design system
   Palette: indigo primary · pink CTA · sunshine, mint, sky
   Type: Baloo 2 (display) + Nunito (body)
   ═══════════════════════════════════════════════════════ */

:root {
  /* Core palette */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-soft: #eef0ff;
  --pink: #ec4899;
  --pink-hover: #db2777;
  --pink-soft: #fdeef6;
  --yellow: #fbbf24;
  --orange: #fb923c;
  --mint: #10b981;
  --mint-soft: #e2f8f0;
  --sky: #38bdf8;

  --rainbow: linear-gradient(90deg, #6366f1, #38bdf8, #10b981, #fbbf24, #fb923c, #ec4899);

  /* Surfaces & text */
  --bg: #faf9ff;
  --bg-warm: #f3f1fc;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --text: #2d2a4a;
  --text-dim: #64607f;
  --text-muted: #8d89a6;
  --border: #e6e3f4;
  --border-light: #efedfa;

  --shadow-sm: 0 1px 3px rgba(70, 60, 140, 0.07);
  --shadow: 0 4px 16px rgba(70, 60, 140, 0.1);
  --shadow-lg: 0 10px 34px rgba(70, 60, 140, 0.14);
  --shadow-xl: 0 22px 54px rgba(70, 60, 140, 0.18);

  --radius: 18px;
  --radius-sm: 12px;
  --nav-h: 64px;

  --hero-gradient: linear-gradient(140deg, #eef0ff 0%, #fdeef6 32%, #fff7e0 62%, #e2f8f0 100%);
  --overlay-bg: rgba(45, 42, 74, 0.45);
  --input-bg: #f7f6fd;
  --code-bg: #f3f1fc;
  --celebrate-bg: linear-gradient(135deg, #fbbf24, #fb923c);
  --celebrate-hover: linear-gradient(135deg, #f59e0b, #f97316);

  --font-display: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --primary: #818cf8;
  --primary-hover: #a5b4fc;
  --primary-soft: rgba(129, 140, 248, 0.14);
  --pink: #f472b6;
  --pink-hover: #f9a8d4;
  --pink-soft: rgba(244, 114, 182, 0.14);
  --mint: #34d399;
  --mint-soft: rgba(52, 211, 153, 0.12);

  --bg: #14122b;
  --bg-warm: #1b1836;
  --surface: #201d40;
  --surface-raised: #282450;
  --text: #ece9ff;
  --text-dim: #aca7cd;
  --text-muted: #7d7899;
  --border: #322e5c;
  --border-light: #282450;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 34px rgba(0, 0, 0, 0.45);
  --shadow-xl: 0 22px 54px rgba(0, 0, 0, 0.55);

  --hero-gradient: linear-gradient(140deg, #221e48 0%, #2c1e3e 35%, #1e2544 65%, #1a2b3d 100%);
  --overlay-bg: rgba(8, 6, 24, 0.65);
  --input-bg: #1b1836;
  --code-bg: #282450;
  --celebrate-bg: linear-gradient(135deg, #d97706, #ea580c);
  --celebrate-hover: linear-gradient(135deg, #f59e0b, #f97316);
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  transition: background 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Buttons ───────────────────────────────────────── */
.btn {
  padding: 10px 20px;
  min-height: 40px;
  border: none;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
  outline: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn svg { flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #818cf8);
  color: #fff;
  box-shadow: 0 3px 12px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.42);
}

.btn-pink {
  background: linear-gradient(135deg, var(--pink), #f97316);
  color: #fff;
  box-shadow: 0 3px 12px rgba(236, 72, 153, 0.3);
}
.btn-pink:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 22px rgba(236, 72, 153, 0.42);
}

.btn-outline {
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--primary); background: var(--primary-soft); }
.btn-danger { color: #e0355b !important; }
.btn-danger:hover { background: rgba(224, 53, 91, 0.1) !important; }
.btn-lg { padding: 15px 34px; font-size: 1.05rem; min-height: 52px; }

.btn:active { transform: translateY(0) scale(0.97); }
.btn:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}
.post:focus-within .post-actions { opacity: 1; }

/* ─── Celebrate Button ─────────────────────────────── */
.btn-celebrate {
  background: var(--celebrate-bg);
  color: #fff;
  border: none;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  box-shadow: 0 3px 12px rgba(251, 146, 60, 0.35);
}

.btn-celebrate:hover {
  background: var(--celebrate-hover);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 24px rgba(251, 146, 60, 0.45);
}

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

.btn-celebrate.btn-sm { padding: 8px 16px; font-size: 0.84rem; }

.celebrate-icon { display: inline-block; transition: transform 0.3s ease; }
.btn-celebrate:hover .celebrate-icon { transform: scale(1.25) rotate(-12deg); }
.btn-celebrate.celebrating { animation: celebratePulse 0.5s ease-in-out 3; }

@keyframes celebratePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

/* ─── Balloons ─────────────────────────────────────── */
.balloons-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.balloon {
  position: absolute;
  bottom: -60px;
  will-change: transform, opacity;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
  z-index: 9999;
}

@keyframes balloonRise {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg) scale(0.3);
    opacity: 0;
  }
  8% {
    opacity: 1;
    transform: translateY(-8vh) translateX(calc(var(--drift) * 0.1)) rotate(-5deg) scale(1);
  }
  50% {
    transform: translateY(-55vh) translateX(var(--drift)) rotate(8deg) scale(1.05);
    opacity: 1;
  }
  85% { opacity: 0.8; }
  100% {
    transform: translateY(-110vh) translateX(calc(var(--drift) * 1.5)) rotate(-3deg) scale(0.9);
    opacity: 0;
  }
}

/* ─── Theme Toggle ──────────────────────────────────── */
.theme-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  transition: all 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
  color: var(--text-dim);
  border: 2px solid var(--border);
  background: var(--surface) !important;
}

.theme-toggle:hover {
  transform: rotate(25deg) scale(1.1);
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft) !important;
}

.theme-icon-light,
.theme-icon-dark {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: flex; }

/* ─── Navbar ────────────────────────────────────────── */
.navbar {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  border-bottom: 1px solid var(--border-light);
  transition: background 0.4s ease, border-color 0.4s ease;
}

/* Rainbow ribbon across the top — the app's signature stripe */
.navbar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--rainbow);
}

.nav-brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.nav-brand:hover .nav-title { color: var(--primary); }
.nav-logo { display: flex; align-items: center; transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1); }
.nav-brand:hover .nav-logo { transform: rotate(-14deg) scale(1.18); }
.nav-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  transition: color 0.25s ease;
}
.nav-actions { display: flex; gap: 10px; align-items: center; }

/* ─── Screens ───────────────────────────────────────── */
.screen {
  display: none;
  position: fixed;
  top: var(--nav-h); left: 0; right: 0; bottom: 0;
  overflow: auto;
}
.screen.active { display: block; }

/* ─── Home Screen ───────────────────────────────────── */
.home-hero {
  text-align: center;
  padding: 84px 28px 64px;
  background: var(--hero-gradient);
  position: relative;
  overflow: hidden;
  transition: background 0.4s ease;
}

/* Floating color blobs */
.home-hero::before {
  content: '';
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(ellipse at 22% 40%, rgba(99, 102, 241, 0.13) 0%, transparent 45%),
    radial-gradient(ellipse at 78% 28%, rgba(236, 72, 153, 0.12) 0%, transparent 45%),
    radial-gradient(ellipse at 55% 80%, rgba(251, 191, 36, 0.12) 0%, transparent 40%),
    radial-gradient(ellipse at 35% 15%, rgba(16, 185, 129, 0.1) 0%, transparent 40%);
  animation: heroGlow 14s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes heroGlow {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  100% { transform: translate(-3%, 2%) scale(1.06) rotate(2deg); }
}

/* Decorative floating mini sticky notes */
.hero-note {
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  pointer-events: none;
  z-index: 0;
  animation: heroFloat 6s ease-in-out infinite alternate;
}
.hero-note-1 { background: #fff176; top: 18%; left: 9%; transform: rotate(-9deg); animation-delay: 0s; }
.hero-note-2 { background: #ff9ec7; top: 58%; left: 16%; transform: rotate(7deg); animation-delay: -1.5s; }
.hero-note-3 { background: #90caf9; top: 22%; right: 10%; transform: rotate(10deg); animation-delay: -3s; }
.hero-note-4 { background: #a5e8b0; top: 62%; right: 15%; transform: rotate(-6deg); animation-delay: -4.5s; }

@keyframes heroFloat {
  0%   { translate: 0 0; }
  100% { translate: 0 -16px; }
}

[data-theme="dark"] .hero-note { opacity: 0.7; }

.home-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 5vw, 3.7rem);
  font-weight: 800;
  line-height: 1.14;
  margin-bottom: 18px;
  color: var(--text);
  letter-spacing: -0.03em;
  position: relative;
  z-index: 1;
}

/* Colorful marker highlight behind a key word */
.hero-highlight {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}
.hero-highlight::after {
  content: '';
  position: absolute;
  left: -2%; right: -2%;
  bottom: 6%;
  height: 34%;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.55), rgba(236, 72, 153, 0.4));
  border-radius: 6px;
  z-index: -1;
  transform: rotate(-1deg);
}

.home-hero p {
  font-size: 1.12rem;
  color: var(--text-dim);
  margin-bottom: 38px;
  font-weight: 500;
  position: relative;
  z-index: 1;
  max-width: 470px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

/* ─── Boards Section ────────────────────────────────── */
.boards-heading {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  max-width: 1200px;
  margin: 36px auto 0;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.boards-heading::after {
  content: '';
  flex: 0 0 60px;
  height: 5px;
  border-radius: 3px;
  background: var(--rainbow);
}

.boards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
  padding: 22px 28px 60px;
  max-width: 1200px;
  margin: 0 auto;
}

.board-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.28s cubic-bezier(0.34, 1.3, 0.64, 1);
  overflow: hidden;
  border: 2px solid var(--border-light);
}

.board-card:hover {
  transform: translateY(-8px) rotate(-0.5deg);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.board-card-preview {
  height: 130px;
  background: linear-gradient(135deg, var(--primary-soft), var(--pink-soft) 55%, var(--mint-soft));
  position: relative;
  overflow: hidden;
}

.board-card-preview .mini-post {
  position: absolute;
  width: 60px;
  height: 56px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  font-size: 0.5rem;
  padding: 4px;
  overflow: hidden;
  color: rgba(0, 0, 0, 0.6);
  transition: transform 0.3s ease;
}

.board-card:hover .mini-post { transform: scale(1.06) rotate(-2deg); }

.board-card-info { padding: 16px 18px; }
.board-card-info h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 4px;
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}
.board-card-info p { font-size: 0.82rem; color: var(--text-dim); font-weight: 500; }

.board-card-new {
  border: 2.5px dashed var(--border);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 200px;
  font-size: 2.4rem;
  color: var(--text-muted);
  transition: all 0.28s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.board-card-new small {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.board-card-new:hover {
  border-color: var(--pink);
  color: var(--pink);
  transform: translateY(-8px) rotate(0.5deg);
  background: var(--pink-soft);
}

/* ─── Board Screen ──────────────────────────────────── */
.board-toolbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  z-index: 50;
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--border-light);
  transition: background 0.4s ease, border-color 0.4s ease;
}

.board-title-wrap { flex: 1; }

.board-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  outline: none;
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  transition: background 0.2s, box-shadow 0.2s;
  display: inline-block;
  min-width: 80px;
  letter-spacing: -0.01em;
}

.board-title:hover { background: var(--bg-warm); }
.board-title:focus { background: var(--bg-warm); box-shadow: 0 0 0 3px var(--primary-soft); }

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

/* ─── Background Picker ─────────────────────────────── */
.bg-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 600;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.bg-swatches { display: flex; gap: 9px; }

.bg-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
  box-shadow: var(--shadow-sm);
}

.bg-swatch:hover { transform: scale(1.3) rotate(8deg); }
.bg-swatch.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ─── Canvas ────────────────────────────────────────── */
.canvas {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--nav-h) - 58px);
  overflow: hidden;
  background: var(--bg-warm);
  transition: background 0.35s;
}

.canvas.grid-bg {
  background-image: linear-gradient(rgba(99, 102, 241, 0.07) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(99, 102, 241, 0.07) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ─── Posts (sticky notes) ──────────────────────────── */
.post {
  position: absolute;
  width: 200px;
  min-height: 180px;
  border-radius: 10px;
  padding: 20px 18px 16px;
  cursor: grab;
  box-shadow:
    2px 3px 8px rgba(70, 60, 140, 0.08),
    5px 8px 22px rgba(70, 60, 140, 0.1);
  transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.34, 1.3, 0.64, 1);
  user-select: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: postPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  word-wrap: break-word;
  overflow-wrap: break-word;
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, 0.03) 100%);
  transform: rotate(var(--tilt, 0deg));
}

/* Charming slight tilt, alternating per note; straightens on hover */
.canvas:not(.layout-list) .post:nth-child(3n)   { --tilt: -1.2deg; }
.canvas:not(.layout-list) .post:nth-child(3n+1) { --tilt: 0.9deg; }
.canvas:not(.layout-list) .post:nth-child(3n+2) { --tilt: -0.4deg; }

.post:hover {
  box-shadow:
    4px 6px 14px rgba(70, 60, 140, 0.12),
    10px 14px 36px rgba(70, 60, 140, 0.16);
  z-index: 10;
  transform: translateY(-5px) rotate(0deg) scale(1.02);
}

.post.dragging {
  cursor: grabbing;
  box-shadow:
    6px 8px 16px rgba(70, 60, 140, 0.14),
    16px 20px 48px rgba(70, 60, 140, 0.22);
  transform: rotate(2.5deg) scale(1.05);
  z-index: 999;
}

/* Folded corner */
.post::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 0 18px 18px;
  border-color: transparent transparent rgba(0, 0, 0, 0.06) transparent;
  border-radius: 0 0 4px 0;
  pointer-events: none;
}

.post-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: rgba(20, 15, 40, 0.85);
  line-height: 1.25;
}

.post-content {
  font-size: 0.85rem;
  color: rgba(20, 15, 40, 0.62);
  line-height: 1.6;
  flex: 1;
  white-space: pre-wrap;
  letter-spacing: 0.01em;
  font-weight: 500;
}

.post-author {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  justify-content: flex-start;
}

.post-author-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-family: var(--font-body);
  font-size: 0.62rem;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  font-weight: 800;
  color: rgba(20, 15, 40, 0.45);
  background: rgba(255, 255, 255, 0.55);
}

.author-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--pink);
  flex-shrink: 0;
}

.post-actions {
  position: absolute;
  top: 6px; right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 2;
}

.post:hover .post-actions { opacity: 1; }

.post-btn {
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 9px;
  padding: 0;
  cursor: pointer;
  color: rgba(20, 15, 40, 0.5);
  transition: all 0.2s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.post-btn:hover {
  background: #fff;
  color: var(--primary);
  transform: scale(1.15) rotate(-6deg);
  box-shadow: var(--shadow-sm);
}

@keyframes postPop {
  from { transform: scale(0.5) rotate(-4deg); opacity: 0; }
  to   { transform: scale(1) rotate(var(--tilt, 0deg)); opacity: 1; }
}

/* ─── List & Grid layouts ───────────────────────────── */
.canvas.layout-list .post {
  position: relative !important;
  left: auto !important; top: auto !important;
  width: 100%;
  margin-bottom: 12px;
  cursor: default;
  --tilt: 0deg;
}

.canvas.layout-grid .post { cursor: default; }

.canvas.layout-list,
.canvas.layout-grid {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px;
}

.canvas.layout-grid {
  flex-direction: row;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 16px;
}

.canvas.layout-grid .post {
  position: relative !important;
  left: auto !important; top: auto !important;
}

/* ─── Modals ────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeIn 0.25s;
}

.modal {
  background: var(--surface);
  border-radius: 24px;
  padding: 34px;
  width: min(480px, calc(100vw - 32px));
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
  transition: background 0.4s ease, border-color 0.4s ease;
}

/* Rainbow ribbon on modals too */
.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: var(--rainbow);
}

.modal h3 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 22px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-dim);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text);
  background: var(--input-bg);
  transition: border-color 0.25s, box-shadow 0.25s;
  resize: vertical;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); font-weight: 500; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 10px;
}

/* ─── Layout Options ────────────────────────────────── */
.layout-options { display: flex; gap: 12px; }

.layout-opt {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 8px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--input-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.layout-opt:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
.layout-opt.selected {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.layout-icon { display: flex; align-items: center; justify-content: center; }

/* ─── Color Swatches ────────────────────────────────── */
.color-swatches { display: flex; gap: 10px; flex-wrap: wrap; }

.color-swatch {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(0, 0, 0, 0.07);
}

.color-swatch:hover { transform: scale(1.25) rotate(10deg); }
.color-swatch.selected {
  border-color: var(--primary);
  transform: scale(1.15);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ─── Animations ────────────────────────────────────── */
@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(28px) scale(0.97); opacity: 0 } to { transform: translateY(0) scale(1); opacity: 1 } }

/* ─── Empty State ───────────────────────────────────── */
.empty-canvas {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  pointer-events: none;
  text-align: center;
}

.empty-canvas .empty-icon {
  font-size: 4rem;
  margin-bottom: 12px;
  opacity: 0.55;
  animation: heroFloat 3s ease-in-out infinite alternate;
}
.empty-canvas p { font-size: 1.02rem; opacity: 0.75; font-weight: 600; }

/* ─── Footer ────────────────────────────────────────── */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 12px 20px;
  font-size: 0.74rem;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 90;
  letter-spacing: 0.04em;
  font-weight: 500;
  border-top: 1px solid var(--border-light);
  transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

.site-footer a { color: inherit; }
.site-footer a:hover { color: var(--primary); }

.site-footer strong {
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

/* ─── Collaboration UI ──────────────────────────────── */
.collab-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #067a58;
  background: var(--mint-soft);
  padding: 6px 14px;
  border-radius: 50px;
  font-weight: 800;
}

[data-theme="dark"] .collab-badge { color: var(--mint); }

.collab-dot {
  width: 8px; height: 8px;
  background: var(--mint);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* Sync Banner */
.sync-banner {
  background: var(--mint-soft);
  border-bottom: 1px solid color-mix(in srgb, var(--mint) 25%, transparent);
  padding: 8px 24px;
  font-size: 0.85rem;
  color: #067a58;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  transition: background 0.4s ease;
}

[data-theme="dark"] .sync-banner { color: var(--mint); }

.sync-banner span:first-child { display: inline-flex; align-items: center; gap: 5px; }
.sync-banner .btn-sm { margin-left: auto; padding: 4px 12px; font-size: 0.78rem; }

/* Share Modal */
.modal-share { max-width: 380px; }

.modal-desc {
  color: var(--text-dim);
  font-size: 0.94rem;
  margin-bottom: 22px;
  font-weight: 500;
  line-height: 1.55;
}

.room-code {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: 8px;
  text-align: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  font-family: var(--font-display);
  border: 2px dashed color-mix(in srgb, var(--primary) 35%, transparent);
  transition: background 0.4s ease, border-color 0.4s ease;
}

.qr-container {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.qr-container canvas,
.qr-container img {
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  border: 4px solid #fff;
}

.copy-row { display: flex; gap: 8px; margin-bottom: 16px; }

.copy-row input {
  flex: 1;
  padding: 9px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font-body);
  color: var(--text-dim);
  background: var(--input-bg);
  outline: none;
  transition: border-color 0.25s;
}

.btn-sm { padding: 8px 16px; font-size: 0.82rem; min-height: 36px; }
.btn-block { width: 100%; margin-bottom: 14px; }

.collab-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #067a58;
  justify-content: center;
  font-weight: 700;
}

[data-theme="dark"] .collab-info { color: var(--mint); }

/* Join code input */
.input-code {
  font-size: 2rem !important;
  font-weight: 800 !important;
  letter-spacing: 12px !important;
  text-align: center !important;
  font-family: var(--font-display) !important;
  color: var(--primary) !important;
}

/* Error message */
.error-msg {
  background: color-mix(in srgb, #e0355b 10%, var(--surface));
  border: 1px solid color-mix(in srgb, #e0355b 25%, transparent);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 0.87rem;
  font-weight: 600;
  color: #c81e46;
  margin-bottom: 14px;
}

[data-theme="dark"] .error-msg { color: #ff8aa5; }

/* ─── Reduced Motion ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .balloon { animation: none !important; display: none !important; }
  .btn-celebrate.celebrating { animation: none !important; }
  .hero-note, .empty-canvas .empty-icon { animation: none !important; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ─── Responsive ────────────────────────────────────── */
@media (max-width: 600px) {
  .navbar { padding: 0 14px; gap: 8px; }
  .nav-title { font-size: 1.15rem; }
  .nav-actions { gap: 6px; }
  .nav-actions .btn { padding: 7px 11px; font-size: 0.76rem; min-height: 36px; }
  #btnMyBoards { padding: 7px 9px; font-size: 0.72rem; }
  #btnNewBoard { padding: 7px 11px; font-size: 0.76rem; }

  .board-toolbar { flex-wrap: wrap; padding: 8px 14px; gap: 6px; }
  .board-title-wrap { flex: 1 1 auto; min-width: 0; }
  .board-title {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
  }
  .toolbar-actions { flex-wrap: wrap; gap: 6px; }
  .toolbar-actions .btn { padding: 6px 10px; font-size: 0.75rem; min-height: 34px; }
  .collab-badge { font-size: 0.72rem; padding: 3px 9px; }
  #btnBack { padding: 6px 9px; font-size: 0.8rem; }

  .sync-banner { padding: 6px 14px; font-size: 0.78rem; gap: 6px; }
  .bg-picker { padding: 8px 14px; gap: 8px; flex-wrap: wrap; }
  .bg-swatch { width: 26px; height: 26px; }

  .canvas {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    height: auto;
    min-height: calc(100vh - var(--nav-h) - 80px);
  }

  .post {
    position: relative !important;
    left: auto !important; top: auto !important;
    width: calc(100% - 8px) !important;
    max-width: 360px;
    min-height: auto;
    padding: 14px 12px 10px;
    cursor: default;
    --tilt: 0deg;
  }
  .post-title { font-size: 0.9rem; }
  .post-content { font-size: 0.8rem; }
  .post-author-tag { font-size: 0.58rem; }
  .post .post-actions { opacity: 1; }

  .empty-canvas { position: relative; }

  .home-hero { padding: 48px 18px 40px; }
  .home-hero p { font-size: 0.98rem; }
  .hero-note { width: 34px; height: 34px; }
  .btn-lg { padding: 13px 26px; font-size: 0.95rem; min-height: 46px; }
  .hero-actions { gap: 10px; }
  .boards-heading { padding: 0 18px; margin-top: 24px; font-size: 1.2rem; }
  .boards-grid { padding: 16px 18px 50px; gap: 14px; }

  .modal { padding: 26px 22px; border-radius: 20px; }
  .modal h3 { font-size: 1.2rem; }
  .room-code { font-size: 2rem; letter-spacing: 5px; padding: 14px; }
  .input-code { font-size: 1.5rem !important; letter-spacing: 8px !important; }

  .site-footer { padding: 8px 14px; font-size: 0.65rem; }

  .theme-toggle { width: 36px; height: 36px; }
  .theme-toggle svg { width: 15px; height: 15px; }

  .btn-celebrate { padding: 12px 20px; font-size: 0.88rem; }
}

@media (max-width: 380px) {
  .navbar { padding: 0 10px; }
  .nav-title { font-size: 1rem; }
  #btnMyBoards { display: none; }
  .nav-actions .btn { padding: 6px 9px; font-size: 0.7rem; }
  .board-toolbar { padding: 6px 10px; }
  .board-title { font-size: 0.9rem; }
}

/* ─── Real-Time Collaboration Cursors & Presence ──────────────────────── */
.remote-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 9999;
  transition: transform 0.08s ease-out;
  transform: translate(0, 0);
  will-change: transform;
}
.cursor-arrow {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}
.cursor-label {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  margin-left: 12px;
  margin-top: -6px;
}

.collab-users-list {
  display: flex;
  align-items: center;
  gap: 4px;
}
.collab-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: default;
}

/* ═══════════════════════════════════════════════════════
   防短时间大量发帖（Rate Limiting）管理模态框与监控 UI
   ═══════════════════════════════════════════════════════ */
.modal-admin-ratelimit {
  max-width: 680px;
  width: 92%;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0 20px 0;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 8px;
}

.admin-tab-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-dim);
  transition: all 0.2s ease;
}

.admin-tab-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.admin-tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.28);
}

.switch-label-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--input-bg);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.switch-text h4 {
  margin: 0 0 4px 0;
  font-size: 0.98rem;
  color: var(--text);
}

.switch-text p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #10b981;
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

.limit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

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

.limit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.limit-card label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
  display: block;
  margin-bottom: 6px;
}

.limit-card input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
}

.ip-banner {
  background: var(--primary-soft);
  color: var(--primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.ip-table-wrap {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.ip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.ip-table th {
  background: var(--bg-warm);
  color: var(--text-dim);
  font-weight: 700;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}

.ip-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

.badge-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-normal {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.badge-blocked {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  animation: pulse 1.6s infinite;
}

.badge-whitelist {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
}

/* ═══════════════════════════════════════════════════════
   Coffee Break 咖啡休息 Toast 气泡提醒
   ═══════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.coffee-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #78350f, #92400e);
  color: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(120, 53, 15, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
  min-width: 300px;
  max-width: 420px;
  animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.coffee-toast-icon {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
  animation: coffeeBounce 2s infinite ease-in-out;
}

.coffee-toast-content h5 {
  margin: 0 0 4px 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.coffee-toast-content p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.92;
  line-height: 1.35;
}

@keyframes toastSlideIn {
  from {
    transform: translateY(-20px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes coffeeBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(-4deg); }
}

