:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #e2e8f0;
  --text-primary: #334155;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --card-bg: #ffffff;
  --shadow-light: rgba(148, 163, 184, 0.1);
  --shadow-medium: rgba(148, 163, 184, 0.15);
  --shadow-heavy: rgba(148, 163, 184, 0.3);
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --border-color: #334155;
  --card-bg: #1e293b;
  --shadow-light: rgba(0, 0, 0, 0.2);
  --shadow-medium: rgba(0, 0, 0, 0.3);
  --shadow-heavy: rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
    sans-serif;
  background: linear-gradient(
    135deg,
    var(--bg-primary) 0%,
    var(--bg-secondary) 100%
  );
  min-height: 100vh;
  overflow: hidden;
  position: relative;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.02;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  pointer-events: none;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem;
  transition: all 0.3s ease;
}

[data-theme="dark"] .header {
  background: rgba(15, 23, 42, 0.8);
}

.header-content {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.header-top {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 0.8rem;
}

.theme-toggle {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.theme-toggle:hover {
  transform: scale(1.05);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.title {
  font-size: 2rem;
  font-weight: bold;
  color: #1e293b;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.goal-input-wrapper {
  position: relative;
  max-width: 500px;
  margin: 0 auto;
}

#goalInput {
  width: 100%;
  padding: 1rem 1.5rem;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  font-size: 1rem;
  background: #ffffff;
  color: #1e293b;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(148, 163, 184, 0.1);
  font-weight: 500;
  text-align: left;
}

#goalInput:focus {
  border-color: #475569;
  box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.1),
    0 4px 12px rgba(148, 163, 184, 0.15);
  transform: translateY(-1px);
}

#goalInput::placeholder {
  color: #1e293b;
  font-weight: 400;
}

.input-indicator {
  /* place indicator inside the input on the right */
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.875rem;
  pointer-events: none;
  opacity: 0.9;
}

.trash-zone {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 72px;
  height: 72px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #1e293b;
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(148, 163, 184, 0.15);
}

.trash-zone:hover {
  transform: scale(1.05);
  border-color: #94a3b8;
  color: #475569;
}

.trash-zone.drag-over {
  transform: scale(1.1);
  background: #fef2f2;
  border-color: #f87171;
  color: #ef4444;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.2);
}

/* Visual state for mobile "armed" tap-to-delete mode */
.trash-zone.armed {
  transform: scale(1.05);
  background: #fee2e2;
  border-color: #ef4444; /* stronger red border */
  color: #ef4444;
}

.goal-pill {
  position: absolute;
  padding: 0.75rem 1.25rem;
  background: #0f172a;
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #f8fafc;
  cursor: grab;
  user-select: none;
  box-shadow: 0 2px 8px rgba(148, 163, 184, 0.12);
  transition: box-shadow 0.18s ease, transform 0.12s ease;
  z-index: 10;
  min-width: 120px;
  max-width: 600px;
  word-wrap: break-word;
  text-align: center;
  white-space: normal;
  overflow: hidden;
  transform-origin: center center;
}

.goal-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(148, 163, 184, 0.2);
  border-color: #94a3b8;
}

.goal-pill:active {
  cursor: grabbing;
}

.goal-pill.dragging {
  transform-origin: center center;
  transform: scale(1.06);
  box-shadow: 0 8px 32px rgba(148, 163, 184, 0.3);
  z-index: 1000;
  border-color: #475569;
}

.goal-pill.physics-active {
  /* Let JS control transform for smooth GPU-driven motion */
  transition: none !important;
}

/* Pill color variants */
.goal-pill:nth-child(4n + 1),
.goal-pill:nth-child(4n + 2),
.goal-pill:nth-child(4n + 3),
.goal-pill:nth-child(4n) {
  /* Force all pill variants to use the same solid dark background for consistency */
  background: #0f172a;
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.06);
}

.goal-pill.deleting {
  animation: deleteAnimation 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes deleteAnimation {
  0% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: scale(0.3) rotate(180deg);
    opacity: 0.3;
  }
  100% {
    transform: scale(0) rotate(360deg);
    opacity: 0;
  }
}

.instructions {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  padding: 1rem;
  border-radius: 12px;
  font-size: 0.8rem;
  color: #475569;
  max-width: 200px;
  line-height: 1.4;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(148, 163, 184, 0.1);
}

.stats {
  position: fixed;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(148, 163, 184, 0.1);
  z-index: 50;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: #475569;
}

.stat-number {
  font-weight: 600;
  color: #1e293b;
  min-width: 1.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header {
    padding: 1rem;
  }

  .title {
    font-size: 1.25rem;
  }

  #goalInput {
    font-size: 0.9rem;
    padding: 0.875rem 1.25rem;
  }

  .trash-zone {
    width: 56px;
    height: 56px;
    font-size: 1.25rem;
    bottom: 1.5rem;
    right: 1.5rem;
  }

  .instructions {
    bottom: 1.5rem;
    left: 1.5rem;
    font-size: 0.75rem;
    max-width: 160px;
    padding: 0.75rem;
  }

  .goal-pill {
    min-width: 100px;
    max-width: 400px;
    font-size: 0.85rem;
    padding: 0.625rem 1rem;
  }

  .stats {
    left: 0.5rem;
    padding: 0.75rem;
  }

  .stat-item {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 0.75rem;
  }

  .goal-input-wrapper {
    max-width: 100%;
  }

  #goalInput {
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
  }

  .trash-zone {
    position: static;
    margin: 1rem auto 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 48px;
    height: 48px;
    font-size: 1rem;
  }

  .instructions {
    bottom: 1rem;
    left: 1rem;
    max-width: 140px;
  }

  .goal-pill {
    min-width: 80px;
    max-width: 300px;
    font-size: 0.8rem;
    padding: 0.5rem 0.875rem;
  }

  .stats {
    position: static;
    margin: 1rem;
    transform: none;
  }
}
