.gravity-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
  align-items: start;
}

.gravity-top {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.gravity-pill {
  min-width: 180px;
  flex: 1 1 220px;
}

.gravity-controls {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.gravity-switch {
  width: 88px;
  min-width: 88px;
  height: 88px;
  min-height: 88px;
  padding: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff7f7f 0%, #d93333 100%);
  color: #fff7f7;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow:
    0 16px 26px rgba(0, 0, 0, 0.26),
    inset 0 2px 0 rgba(255, 214, 214, 0.55);
  border: 4px solid rgba(255, 224, 224, 0.72);
}

.gravity-switch[aria-pressed="true"] {
  background: linear-gradient(180deg, #ff6e6e 0%, #c91f1f 100%);
}

.gravity-board-card,
.gravity-side-card {
  position: relative;
}

.gravity-side-card {
  display: grid;
  gap: 14px;
}

.gravity-room {
  position: relative;
  min-height: 540px;
  overflow: hidden;
  border-radius: 28px;
  border: 2px solid rgba(171, 211, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(9, 18, 38, 0.34), rgba(9, 18, 38, 0.16)),
    url("../../Images/space-background.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: inset 0 10px 24px rgba(87, 118, 182, 0.12);
  touch-action: none;
}

.gravity-celebration {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.gravity-celebration[hidden] {
  display: none;
}

.gravity-celebration.show {
  display: block;
}

.gravity-star {
  position: absolute;
  width: 18px;
  height: 18px;
  background: radial-gradient(circle, #fff6bf 0%, #ffd65e 62%, rgba(255, 214, 94, 0) 70%);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 56%, 79% 92%, 50% 70%, 21% 92%, 32% 56%, 2% 35%, 39% 35%);
  opacity: 0;
}

.gravity-celebration.show .gravity-star {
  animation: gravityStarBurst 1.8s ease-in-out infinite;
}

.gravity-star-1 { top: 18%; left: 18%; animation-delay: 0ms; }
.gravity-star-2 { top: 28%; left: 74%; animation-delay: 180ms; }
.gravity-star-3 { top: 42%; left: 48%; animation-delay: 320ms; }
.gravity-star-4 { top: 62%; left: 22%; animation-delay: 460ms; }
.gravity-star-5 { top: 68%; left: 72%; animation-delay: 620ms; }
.gravity-star-6 { top: 20%; left: 50%; animation-delay: 780ms; }

.gravity-target {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 2px dashed rgba(255, 240, 179, 0.86);
  background: radial-gradient(circle, rgba(255, 239, 158, 0.16), rgba(255, 239, 158, 0.04) 62%, transparent 70%);
  box-shadow:
    0 0 0 8px rgba(255, 234, 143, 0.08),
    0 0 26px rgba(255, 232, 137, 0.26);
  pointer-events: none;
}

.gravity-target__ghost {
  position: absolute;
  inset: 18%;
  width: 64%;
  height: 64%;
  object-fit: contain;
  opacity: 0.38;
  filter: grayscale(0.08) brightness(1.2);
}

.gravity-target__ring {
  position: absolute;
  inset: 12%;
  border-radius: 999px;
  border: 2px solid rgba(255, 247, 213, 0.72);
}

.gravity-target__success {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 3rem;
  font-weight: 900;
  opacity: 0;
  transform: scale(0.6);
}

.gravity-target__label {
  position: absolute;
  bottom: -24px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(10, 20, 40, 0.72);
  color: #fff6cf;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.gravity-target-active {
  border-color: rgba(151, 255, 188, 0.92);
  box-shadow:
    0 0 0 10px rgba(121, 255, 174, 0.12),
    0 0 30px rgba(121, 255, 174, 0.32);
}

.gravity-target-success {
  border-color: rgba(102, 243, 143, 0.98);
  background: radial-gradient(circle, rgba(111, 255, 162, 0.2), rgba(111, 255, 162, 0.05) 62%, transparent 70%);
  box-shadow:
    0 0 0 12px rgba(111, 255, 162, 0.16),
    0 0 34px rgba(111, 255, 162, 0.38);
}

.gravity-target-success .gravity-target__success {
  opacity: 1;
  transform: scale(1);
  transition: opacity 140ms ease, transform 140ms ease;
}

.gravity-win-badge {
  width: min(100%, 380px);
  gap: 10px;
  background:
    radial-gradient(circle at top, rgba(214, 235, 255, 0.95), rgba(214, 235, 255, 0) 36%),
    linear-gradient(180deg, #cbe7ff 0%, #74b9ff 48%, #2556c6 100%);
  color: #0b1c46;
}

.gravity-win-text {
  text-align: center;
  font-weight: 800;
  line-height: 1.4;
  color: #eaf4ff;
  text-shadow: 0 2px 12px rgba(5, 15, 42, 0.35);
}

.gravity-room::before,
.gravity-room::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(13, 31, 57, 0.18), rgba(13, 31, 57, 0.06));
}

.gravity-room::before {
  top: 14px;
}

.gravity-room::after {
  bottom: 14px;
}

.gravity-room-reversed {
  background:
    linear-gradient(180deg, rgba(255, 199, 99, 0.18), rgba(9, 18, 38, 0.2)),
    url("../../Images/space-background.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.gravity-object {
  --gravity-size: 80px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  display: block;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  transform-origin: center;
  will-change: transform;
  user-select: none;
  cursor: grab;
}

.gravity-object-dragging {
  cursor: grabbing;
  z-index: 4;
}

.gravity-object__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter:
    drop-shadow(0 16px 22px rgba(7, 13, 28, 0.5))
    drop-shadow(0 0 18px rgba(164, 215, 255, 0.22));
}

.gravity-object-dragging .gravity-object__image {
  filter:
    drop-shadow(0 22px 30px rgba(7, 13, 28, 0.62))
    drop-shadow(0 0 22px rgba(255, 231, 153, 0.32));
}

.gravity-status {
  min-height: 32px;
}

@keyframes gravityStarBurst {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.5) rotate(0deg);
  }
  30% {
    opacity: 1;
    transform: translateY(-10px) scale(1.05) rotate(35deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-36px) scale(0.7) rotate(90deg);
  }
}

@media (max-width: 560px) {
  .gravity-room {
    min-height: 440px;
  }

  .gravity-top .restart-btn {
    width: 100%;
  }

  .gravity-pill {
    min-width: 100%;
  }

  .gravity-switch {
    width: 76px;
    min-width: 76px;
    height: 76px;
    min-height: 76px;
    font-size: 0.92rem;
  }
}
