:root {
  --bg-0: #0f1f32;
  --bg-1: #15233f;
  --bg-2: #251433;
  --bg-3: #08111d;
  --text: #f6f9ff;
  --muted: #b7c4de;
  --accent: #ff9f1c;
  --accent-2: #2ec4ff;
  --accent-3: #ff5d8f;
  --card: rgba(13, 21, 35, 0.74);
  --border: rgba(255, 255, 255, 0.18);
  --grid-line: rgba(255, 255, 255, 0.05);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 159, 28, 0.28), transparent 36%),
    radial-gradient(circle at 90% 10%, rgba(46, 196, 255, 0.24), transparent 38%),
    radial-gradient(circle at 50% 102%, rgba(255, 93, 143, 0.22), transparent 42%),
    linear-gradient(135deg, var(--bg-0), var(--bg-1) 44%, var(--bg-2));
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

body {
  position: relative;
  overflow-x: hidden;
  background-color: var(--bg-3);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black, transparent 82%);
  opacity: 0.33;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(18px);
  pointer-events: none;
  opacity: 0.25;
  animation: float 12s ease-in-out infinite;
}

.orb-a {
  width: 28rem;
  height: 28rem;
  background: #ff7a18;
  top: -8rem;
  left: -5rem;
}

.orb-b {
  width: 22rem;
  height: 22rem;
  background: #00d4ff;
  bottom: -7rem;
  right: -3rem;
  animation-delay: -4s;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
  opacity: 0.13;
}

.app {
  position: relative;
  z-index: 2;
  width: min(1100px, 92vw);
  margin: 1.5rem auto 3rem;
  display: grid;
  gap: 1rem;
}

.hero {
  text-align: center;
  animation: rise 0.7s ease-out both;
  position: relative;
  padding: 1.25rem 1rem 0.4rem;
}

.hero-sigil {
  position: relative;
  width: min(18rem, 42vw);
  aspect-ratio: 1;
  margin: 0 auto 0.6rem;
  display: grid;
  place-items: center;
}

.hero-ring {
  position: absolute;
  border-radius: 50%;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-ring-a {
  background: conic-gradient(from 180deg, rgba(46, 196, 255, 0.4), transparent 26%, rgba(255, 159, 28, 0.38) 55%, transparent 72%, rgba(255, 93, 143, 0.45));
  filter: blur(0.2px);
  animation: slowSpin 18s linear infinite;
}

.hero-ring-b {
  inset: 11%;
  background: radial-gradient(circle at center, transparent 56%, rgba(255, 255, 255, 0.14) 57%, transparent 60%),
    conic-gradient(from 40deg, transparent, rgba(255, 255, 255, 0.14), transparent 46%, rgba(46, 196, 255, 0.32), transparent 70%, rgba(255, 159, 28, 0.35), transparent);
  animation: slowSpinReverse 22s linear infinite;
}

.hero-core {
  width: 42%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.18), transparent 40%),
    linear-gradient(145deg, rgba(46, 196, 255, 0.2), rgba(255, 159, 28, 0.2) 55%, rgba(255, 93, 143, 0.22));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 0 22px rgba(255, 255, 255, 0.08),
    0 0 30px rgba(46, 196, 255, 0.22);
  font: 400 clamp(3.5rem, 8vw, 5.5rem) "Bebas Neue", sans-serif;
  color: #f7fbff;
  text-shadow: 0 0 18px rgba(46, 196, 255, 0.38);
}

.pi-day-badge {
  display: inline-block;
  margin: 0;
  padding: 0.33rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: linear-gradient(90deg, rgba(255, 159, 28, 0.3), rgba(46, 196, 255, 0.25));
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: shimmer 3.6s linear infinite;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 10px 20px rgba(0, 0, 0, 0.18);
}

.kicker {
  margin: 0;
  margin-top: 10px;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0.2rem 0 0;
  font: 400 clamp(2.4rem, 6vw, 4.8rem) "Bebas Neue", sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ffe1bc, #ff9f1c 34%, #8feeff 70%, #ffd0ea);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  margin: 0.45rem auto 0;
  max-width: 40rem;
  color: var(--muted);
}

.theme-note {
  margin: 0.6rem 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.milestone-trail {
  margin-top: 0.8rem;
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.milestone-trail span {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  backdrop-filter: blur(8px);
  box-shadow: 0 20px 34px rgba(0, 0, 0, 0.3);
  animation: rise 0.8s ease-out both;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 22%, transparent 78%, rgba(46, 196, 255, 0.08));
}

.controls {
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
  justify-content: space-between;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 159, 28, 0.12), transparent 28%),
    radial-gradient(circle at 100% 100%, rgba(46, 196, 255, 0.12), transparent 32%);
}

.field {
  display: grid;
  gap: 0.35rem;
}

label {
  font-size: 0.83rem;
  color: var(--muted);
}

input {
  width: 14rem;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(7, 14, 22, 0.88);
  color: var(--text);
  font-size: 1rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.buttons {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.72rem 1.2rem;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(90deg, var(--accent), #ffd166);
  color: #101820;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

button:hover:enabled {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(255, 122, 24, 0.35);
  filter: saturate(1.1);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--border);
}

.stats {
  padding: 0.9rem 1rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.stat {
  padding: 0.8rem;
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 40%),
    rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.value {
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  font-weight: 700;
}

.progress-wrap {
  padding: 1rem;
  background: linear-gradient(90deg, rgba(46, 196, 255, 0.04), rgba(255, 159, 28, 0.06), rgba(255, 93, 143, 0.04));
}

.bar-track {
  height: 17px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
}

.bar-track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 28px, rgba(255, 255, 255, 0.08) 28px 29px);
  pointer-events: none;
}

.bar-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--accent-3));
  box-shadow: 0 0 18px rgba(46, 196, 255, 0.55);
  transition: width 0.12s linear;
}

.digits {
  padding: 1rem;
  background:
    radial-gradient(circle at 12% 18%, rgba(46, 196, 255, 0.08), transparent 26%),
    radial-gradient(circle at 88% 80%, rgba(255, 159, 28, 0.08), transparent 30%);
}

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

.stream-header h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pill {
  border-radius: 999px;
  padding: 0.25rem 0.62rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid var(--border);
}

.pill.idle {
  color: var(--muted);
}

.pill.running {
  color: #001520;
  background: linear-gradient(90deg, #8de8ff, #9dffd8);
}

.pill.done {
  color: #1b1300;
  background: linear-gradient(90deg, #ffd79f, #ffefaf);
}

.facts {
  padding: 1rem;
  background:
    radial-gradient(circle at top right, rgba(255, 93, 143, 0.12), transparent 26%),
    radial-gradient(circle at bottom left, rgba(46, 196, 255, 0.08), transparent 32%);
}

.fact-text {
  margin: 0;
  min-height: 3.6rem;
  font-size: clamp(1.04rem, 2.2vw, 1.2rem);
  color: #f9fcff;
  line-height: 1.5;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.fact-text.fade {
  opacity: 0;
  transform: translateY(4px);
}

.fact-text.fact-pop {
  animation: factPop 0.38s ease;
}

#digitView {
  margin: 0;
  min-height: 16rem;
  max-height: 52vh;
  overflow: auto;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at center, rgba(46, 196, 255, 0.06), transparent 56%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    repeating-linear-gradient(180deg, rgba(0, 212, 255, 0.04), rgba(0, 212, 255, 0.04) 1px, transparent 1px, transparent 22px);
  color: #f5fbff;
  font: 500 0.98rem/1.35 "Space Grotesk", monospace;
  word-wrap: break-word;
  white-space: pre-wrap;
  box-shadow: inset 0 0 30px rgba(46, 196, 255, 0.05);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(14px);
  }
}

@keyframes shimmer {
  0% {
    filter: brightness(0.96);
  }
  50% {
    filter: brightness(1.15);
  }
  100% {
    filter: brightness(0.96);
  }
}

@keyframes factPop {
  0% {
    letter-spacing: 0.01em;
    text-shadow: 0 0 0 rgba(46, 196, 255, 0);
  }
  50% {
    letter-spacing: 0.025em;
    text-shadow: 0 0 16px rgba(46, 196, 255, 0.38);
  }
  100% {
    letter-spacing: 0.01em;
    text-shadow: 0 0 0 rgba(46, 196, 255, 0);
  }
}

@keyframes slowSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes slowSpinReverse {
  from {
    transform: rotate(360deg);
  }
  to {
    transform: rotate(0deg);
  }
}

@media (max-width: 760px) {
  .hero-sigil {
    width: min(14rem, 54vw);
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  input {
    width: 100%;
  }

  .field {
    width: 100%;
  }

  .controls {
    align-items: stretch;
  }
}
