@import url("https://fonts.googleapis.com/css2?family=Inter:wght@700;800&family=Playfair+Display:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap");

:root {
  --bg-light: #f0f9ff;
  --bg-dark: #0f172a;
  --text-light: #1e293b;
  --text-dark: #f8fafc;
  --rope-light: #000000;
  --rope-dark: #8b5cf6;
  --handle-bg-light: #000000;
  --handle-bg-dark: #8b5cf6;
  --card-shadow: rgba(0, 0, 0, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  transition: background-color 0.7s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light {
  background: linear-gradient(to bottom, #e0f2fe, #fff);
  color: var(--text-light);
}

body.dark {
  background: linear-gradient(to bottom, #020617, #0f172a);
  color: var(--text-dark);
}

.app-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.content {
  text-align: center;
  position: absolute;
  top: 20%;
  z-index: 10;
  pointer-events: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.status-line-1 {
  font-family: "Inter", sans-serif;
  font-weight: 800;
  font-size: 6rem;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text-light);
  transition: color 0.7s;
}

body.dark .status-line-1 {
  color: var(--text-dark);
}

.status-line-2 {
  font-family: "Playfair Display", serif;
  font-weight: 300;
  font-style: italic;
  font-size: 7rem;
  line-height: 0.8;
  color: var(--rope-light); /* Matches rope color */
  transition: color 0.7s, opacity 0.3s;
  margin-top: -1rem; /* Overlap slightly for tight feel */
}

body.dark .status-line-2 {
  color: var(--rope-dark);
}

.instruction-text {
  margin-top: 2rem;
  font-size: 0.9rem;
  opacity: 0.5;
  font-family: "Inter", sans-serif;
  letter-spacing: 0.5px;
}

/* Stars Background */
.stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}

body.dark .stars {
  opacity: 1;
}

.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  animation: twinkle 3s infinite;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.2;
    transform: scale(0.8);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.2);
  }
}

/* Rope System */
.rope-container {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 100%; /* Full height to allow dragging down */
  pointer-events: none;
  z-index: 20; /* Ensure rope system is above content */
}

/* SVG Rope */
.rope-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  z-index: 15;
}

/* Interactive Handle */
.handle-wrapper {
  position: absolute;
  top: 400px;
  left: 50%;
  width: 60px; /* Slimmer for card/tag look */
  height: 90px;
  transform: translate(-50%, 0);
  cursor: grab;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  touch-action: none;
  z-index: 25; /* Higher than rope-svg (15) */
}

.handle-wrapper:active {
  cursor: grabbing;
}

.knot {
  width: 12px;
  height: 12px;
  background: var(--rope-light);
  border-radius: 50%;
  margin-bottom: -6px; /* Overlap with card */
  z-index: 2;
  transition: background-color 0.7s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  position: relative; /* Ensure z-index works */
}

body.dark .knot {
  background: var(--rope-dark);
}

.handle-body {
  width: 60px;
  height: 90px;
  background: var(--handle-bg-light);
  border-radius: 12px;
  position: relative;
  box-shadow: 0 4px 6px -1px var(--card-shadow),
    0 2px 4px -1px var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.7s, box-shadow 0.3s;
  z-index: 1; /* Ensure body is below knot but part of stacking context */
}

body.dark .handle-body {
  background: var(--handle-bg-dark);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5),
    0 2px 4px -1px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-icon {
  color: #f8fafc; /* Always light */
  opacity: 0.8;
  transition: color 0.7s;
}

body.dark .card-icon {
  color: #f8fafc; /* Always light */
}

.pull-text {
  position: absolute;
  top: 110%;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--rope-light);
  letter-spacing: 0.5px;
  white-space: nowrap;
  transition: opacity 0.3s, color 0.7s;
  text-transform: uppercase;
}

body.dark .pull-text {
  color: var(--rope-dark);
}

.handle-wrapper:active .pull-text {
  opacity: 0;
}
