:root {
  --font-display: "Cinzel", "Bodoni Moda", "Didot", "Times New Roman", serif;
  --font-body: "Spectral", "Iowan Old Style", "Palatino Linotype", serif;
  --bg-a: #070b1d;
  --bg-b: #171740;
  --bg-c: #244c77;
  --fog: rgba(217, 226, 255, 0.18);
  --panel-border: rgba(210, 218, 255, 0.34);
  --text-main: #f2f5ff;
  --accent: #95d0ff;
  --accent-soft: rgba(149, 208, 255, 0.35);
  --shadow: rgba(1, 4, 18, 0.75);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background-color: #070b1d;
  overscroll-behavior: none;
}

body {
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  color: var(--text-main);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 16% 20%, rgba(255, 255, 255, 0.09) 0, transparent 38%),
    radial-gradient(circle at 83% 30%, rgba(255, 255, 255, 0.06) 0, transparent 33%),
    linear-gradient(155deg, var(--bg-a), var(--bg-b) 44%, var(--bg-c));
}

.sky-layer,
.mist-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.sky-layer {
  background-image:
    radial-gradient(2px 2px at 24% 31%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1px 1px at 67% 12%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(2px 2px at 86% 73%, rgba(255, 255, 255, 0.65), transparent),
    radial-gradient(1px 1px at 9% 82%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(2px 2px at 47% 61%, rgba(255, 255, 255, 0.62), transparent);
  opacity: 0.45;
  animation: drift 26s linear infinite;
}

.mist-layer {
  background:
    radial-gradient(140% 80% at 50% 115%, var(--fog), transparent),
    radial-gradient(120% 75% at 50% -25%, rgba(255, 255, 255, 0.08), transparent);
  mix-blend-mode: screen;
  animation: mist 12s ease-in-out infinite alternate;
}

.hud {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  z-index: 20;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: none;
}

.hud-pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(210, 218, 255, 0.45);
  background: rgba(6, 10, 30, 0.55);
  color: rgba(230, 236, 255, 0.96);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 8px 20px rgba(1, 4, 18, 0.4);
}

.hint-pill {
  border-color: rgba(182, 245, 217, 0.55);
  background: rgba(10, 26, 34, 0.78);
}

.shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.arena {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
}

.gif-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
}

.pickup-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 11;
}

.time-card {
  position: absolute;
  width: clamp(110px, 20vw, 170px);
  height: clamp(90px, 16vw, 130px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(18, 20, 53, 0.45));
  box-shadow:
    0 12px 30px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  transform-origin: center center;
  user-select: none;
  touch-action: none;
  cursor: grab;
  will-change: transform;
}

#card-days {
  background: linear-gradient(180deg, rgba(122, 177, 255, 0.22), rgba(18, 20, 53, 0.5));
}

#card-hours {
  background: linear-gradient(180deg, rgba(132, 205, 255, 0.2), rgba(18, 20, 53, 0.5));
}

#card-minutes {
  background: linear-gradient(180deg, rgba(155, 226, 239, 0.2), rgba(18, 20, 53, 0.5));
}

#card-seconds {
  background: linear-gradient(180deg, rgba(182, 245, 217, 0.2), rgba(18, 20, 53, 0.5));
}

.time-card.dragging {
  cursor: grabbing;
  box-shadow:
    0 16px 34px var(--shadow),
    0 0 24px rgba(149, 208, 255, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.time-card.boosted {
  box-shadow:
    0 14px 32px var(--shadow),
    0 0 18px rgba(155, 226, 239, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.time-card.boosted-hold {
  box-shadow:
    0 14px 32px var(--shadow),
    0 0 28px rgba(182, 245, 217, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
  animation: boostPulse 780ms ease-in-out infinite alternate;
}

.value {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.1rem);
  color: var(--accent);
  line-height: 1;
  text-shadow: 0 0 12px var(--accent-soft);
  font-variant-numeric: tabular-nums;
}

.unit-tag {
  position: absolute;
  top: 8px;
  left: 10px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(210, 218, 255, 0.45);
  background: rgba(6, 10, 30, 0.42);
  color: rgba(230, 236, 255, 0.92);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-body);
  line-height: 1.1;
  pointer-events: none;
}

.gif-surprise {
  position: absolute;
  width: clamp(150px, 24vw, 280px);
  height: auto;
  border-radius: 12px;
  box-shadow:
    0 10px 26px rgba(1, 4, 18, 0.56),
    0 0 24px rgba(149, 208, 255, 0.2);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.8) rotate(-5deg);
  animation: gifPop 2300ms ease forwards;
}

.score-pop {
  position: absolute;
  color: #d7f4ff;
  font-size: 0.82rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(149, 208, 255, 0.55);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: scorePop 850ms ease-out forwards;
}

.pickup {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(210, 218, 255, 0.55);
  background: radial-gradient(circle, rgba(188, 240, 255, 0.8), rgba(42, 92, 131, 0.32));
  box-shadow:
    0 0 20px rgba(155, 226, 239, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  display: grid;
  place-items: center;
  color: #081022;
  font-size: 0.9rem;
  font-weight: 700;
  transform: translate(-50%, -50%);
  animation: pickupFloat 1.5s ease-in-out infinite alternate;
  pointer-events: none;
}

.pickup.slow {
  color: #0d2c33;
}

.pickup.mega {
  color: #2a1a09;
}

.pickup.magnet {
  color: #1b0f30;
}

.pickup-warning {
  position: absolute;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 1px solid rgba(182, 245, 217, 0.65);
  box-shadow: 0 0 34px rgba(182, 245, 217, 0.35);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: pickupWarning 980ms ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
  .sky-layer,
  .mist-layer {
    animation: none !important;
  }

  .time-card.boosted-hold {
    animation: none !important;
  }

  .pickup,
  .score-pop {
    animation: none !important;
  }
}

@keyframes drift {
  from {
    transform: translateY(0) scale(1);
  }
  to {
    transform: translateY(-7px) scale(1.01);
  }
}

@keyframes mist {
  from {
    opacity: 0.58;
  }
  to {
    opacity: 0.9;
  }
}

@keyframes gifPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72) rotate(-8deg);
  }
  14% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(3deg);
  }
  82% {
    opacity: 1;
    transform: translate(-50%, -58%) scale(1) rotate(-1deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -64%) scale(0.94) rotate(0deg);
  }
}

@keyframes boostPulse {
  from {
    filter: saturate(1);
  }
  to {
    filter: saturate(1.15);
  }
}

@keyframes scorePop {
  from {
    opacity: 0;
    transform: translate(-50%, -44%) scale(0.8);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -130%) scale(1);
  }
}

@keyframes pickupFloat {
  from {
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    transform: translate(-50%, -58%) scale(1.05);
  }
}

@keyframes pickupWarning {
  from {
    opacity: 0.88;
    transform: translate(-50%, -50%) scale(0.55);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }
}
