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

:root {
  --bg: #fdf6f0;
  --bg-warm: #fceee4;
  --text: #3d2c2c;
  --text-light: #8a7070;
  --accent: #e84393;
  --accent-soft: #fd79a8;
  --accent-glow: rgba(232, 67, 147, 0.2);
  --sean-color: #3498db;
  --becca-color: #e67e22;
  --card: #ffffff;
  --shadow: 0 2px 20px rgba(61, 44, 44, 0.08);
  --radius: 16px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* --- Picker Overlay --- */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.picker-card {
  text-align: center;
  animation: fadeUp 0.6s ease;
}

.picker-title {
  font-family: 'Caveat', cursive;
  font-size: 2.5rem;
  color: var(--text);
  margin-bottom: 2rem;
  font-weight: 400;
}

.picker-buttons {
  display: flex;
  gap: 1.5rem;
}

.picker-btn {
  font-family: 'Caveat', cursive;
  font-size: 1.8rem;
  padding: 1rem 2.5rem;
  border: 2px solid var(--text);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.picker-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.picker-btn[data-user="sean"]:hover {
  border-color: var(--sean-color);
  color: var(--sean-color);
}

.picker-btn[data-user="becca"]:hover {
  border-color: var(--becca-color);
  color: var(--becca-color);
}

/* --- Header --- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  position: relative;
}

.user-badge {
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-weight: 600;
}

.user-badge.sean {
  background: rgba(52, 152, 219, 0.1);
  color: var(--sean-color);
}

.user-badge.becca {
  background: rgba(232, 67, 147, 0.1);
  color: var(--becca-color);
}

.app-title {
  font-family: 'Caveat', cursive;
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--accent);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0;
}

.app-title .heart {
  display: inline-block;
  line-height: 1;
  margin: 0 0.1em 0 0.35em;
}

.switch-user-btn {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 0.5rem 1.5rem 0;
}

.tab {
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.5rem 1.5rem;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* --- Love Section --- */
#love-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 120px);
}

.love-totals {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 2rem;
}

.love-counter {
  text-align: center;
  margin-bottom: 0.5rem;
}

.counter-number {
  display: block;
  font-family: 'Caveat', cursive;
  font-size: 4rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  transition: transform 0.15s ease;
}

.counter-number.bump {
  transform: scale(1.15);
}

.counter-label {
  font-size: 0.85rem;
  color: var(--text-light);
  letter-spacing: 0.05em;
}

.love-btn-wrapper {
  position: relative;
}

.press-hint {
  position: absolute;
  top: -38px;
  right: -18px;
  transform: rotate(30deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  animation: hintBob 2.5s ease-in-out infinite;
}

.press-hint span {
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
  color: var(--text-light);
}

.press-hint-arrow {
  width: 24px;
  height: 36px;
  color: var(--text-light);
  margin-top: -4px;
  transform: scaleX(-1);
}

@keyframes hintBob {
  0%, 100% { transform: rotate(30deg) translateY(0); }
  50% { transform: rotate(30deg) translateY(-5px); }
}

.love-btn {
  background: none;
  border: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
  padding: 0;
  overflow: visible;
}

.love-btn-heart {
  width: 260px;
  height: 250px;
  color: var(--accent);
  filter: drop-shadow(0 4px 15px var(--accent-glow));
  transition: transform 0.15s ease, filter 0.15s ease;
  display: block;
}

.love-btn:hover .love-btn-heart {
  filter: drop-shadow(0 6px 25px rgba(232, 67, 147, 0.4));
}

.love-btn.pressing .love-btn-heart {
  transform: scale(0.85);
}

.love-btn.popping .love-btn-heart {
  transform: scale(1.05);
}

/* Expanding heart ring animation */
.love-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  width: 260px;
  height: 250px;
  pointer-events: none;
  color: var(--accent);
  opacity: 0;
  animation: heartRing 0.8s ease-out forwards;
}

@keyframes heartRing {
  0% {
    opacity: 0.6;
    transform: translate(-50%, -55%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -55%) scale(1.8);
  }
}

.love-btn-label {
  font-family: 'Caveat', cursive;
  font-size: 2.2rem;
  color: white;
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.love-stats {
  display: flex;
  gap: 3rem;
  margin-top: 0.5rem;
}

.stat {
  text-align: center;
}

.stat-name {
  display: block;
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  color: var(--text-light);
}

.stat-count {
  display: block;
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
}

/* Floating particles */
.love-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.particle {
  position: absolute;
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  color: var(--accent);
  opacity: 0;
  animation: floatUp 1.5s ease forwards;
  pointer-events: none;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-120px) scale(0.5); }
}

/* --- Canvas Section --- */
#canvas-section {
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
}

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

.canvas-month {
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--text);
}

.canvas-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.canvas-nav-btn {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbar-left { flex: 1; justify-content: flex-start; }
.toolbar-center { flex: 0; justify-content: center; }
.toolbar-right { flex: 1; justify-content: flex-end; }

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

.tool-btn {
  width: 34px;
  height: 34px;
  border: 1.5px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  color: var(--text);
}

.tool-btn svg {
  width: 16px;
  height: 16px;
}

.tool-btn:hover {
  border-color: rgba(0,0,0,0.2);
}

.tool-btn.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}

.color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.color-btn.active {
  border-color: var(--text);
  transform: scale(1.15);
}

.size-btn {
  width: 32px;
  height: 32px;
  border: 1.5px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.size-btn.active {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.canvas-wrapper {
  flex: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: white;
  box-shadow: var(--shadow);
  touch-action: none;
  position: relative;
}

#draw-canvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
  display: block;
}

/* --- Zoom Controls --- */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.zoom-btn {
  width: 28px;
  height: 28px;
  border: 1.5px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  font-family: 'Caveat', cursive;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.zoom-btn:hover {
  border-color: var(--accent);
}

#zoom-slider {
  width: 80px;
  height: 4px;
  accent-color: var(--accent);
  cursor: pointer;
}

.zoom-label {
  font-family: 'Caveat', cursive;
  font-size: 0.9rem;
  color: var(--text-light);
  min-width: 3em;
  text-align: center;
}

/* --- Minimap (hidden for now — remove display:none to re-enable) --- */
#minimap {
  display: none;
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 160px;
  height: 107px;
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 6px;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}

#remote-cursors {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 15;
}

/* --- Remote Cursor --- */
.remote-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 15;
  transition: left 0.08s linear, top 0.08s linear, opacity 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.remote-cursor-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.remote-cursor-label {
  font-family: 'Caveat', cursive;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  color: white;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.remote-cursor.sean .remote-cursor-dot,
.remote-cursor.sean .remote-cursor-label { background: var(--sean-color); }

.remote-cursor.becca .remote-cursor-dot,
.remote-cursor.becca .remote-cursor-label { background: var(--becca-color); }

.remote-cursor.faded { opacity: 0; }

/* --- Zoom Rect Overlay --- */
.zoom-rect-overlay {
  position: absolute;
  border: 2px dashed var(--accent);
  background: rgba(232, 67, 147, 0.08);
  pointer-events: none;
  z-index: 5;
}

/* --- Archive Modal --- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

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

.modal-header h2 {
  font-family: 'Caveat', cursive;
  font-weight: 400;
  font-size: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.archive-item {
  padding: 0.75rem 1rem;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  transition: background 0.15s;
}

.archive-item:hover {
  background: var(--bg-warm);
}

.archive-viewer canvas {
  width: 100%;
  border-radius: 8px;
  background: white;
  margin: 0.5rem 0;
}

.archive-viewer h3 {
  font-family: 'Caveat', cursive;
  font-weight: 400;
  font-size: 1.3rem;
}

.back-btn {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  text-decoration: underline;
}

/* --- Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .picker-title { font-size: 2rem; }
  .picker-btn { font-size: 1.4rem; padding: 0.8rem 2rem; }
  .counter-number { font-size: 3rem; }
  .love-btn { font-size: 1.6rem; padding: 1rem 2.5rem; }
  .press-hint { top: -4px; right: -6px; }

  /* Merge header and toolbar into a compact layout */
  .canvas-header {
    margin-bottom: 0.25rem;
  }
  .canvas-month { font-size: 1rem; }
  .canvas-nav-btn { font-size: 0.8rem; }

  /* Toolbar wraps into rows on mobile */
  .canvas-toolbar {
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.25rem 0;
    margin-bottom: 0.2rem;
    justify-content: center;
  }

  .toolbar-left,
  .toolbar-center,
  .toolbar-right {
    flex: unset;
    justify-content: center;
  }

  /* Row 1: pan, pen, eraser, undo, redo — full width */
  .toolbar-left .tool-group:first-child,
  .toolbar-center {
    /* These stay inline */
  }

  /* Row 2: colors + sizes wrap to next line */
  .toolbar-left {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
  }

  /* Hide zoom controls on mobile — use gestures */
  .toolbar-right {
    display: none;
  }

  /* Compact tool buttons */
  .tool-btn {
    width: 32px;
    height: 32px;
  }

  .tool-btn svg {
    width: 14px;
    height: 14px;
  }

  /* Smaller color swatches */
  .color-btn {
    width: 22px;
    height: 22px;
  }

  .size-btn {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
  }

  /* Tighter gaps */
  .tool-group {
    gap: 0.1rem;
  }

  .tool-group.colors {
    gap: 0.08rem;
  }

  /* Smaller minimap */
  #minimap {
    width: 90px;
    height: 60px;
    bottom: 4px;
    right: 4px;
  }

  /* Canvas gets maximum space */
  #canvas-section {
    padding: 0.4rem 0.5rem;
    height: calc(100vh - 95px);
  }
}
