:root {
  color-scheme: dark;
  --bg-top: #35124f;
  --bg-bottom: #16091f;
  --panel: rgba(255, 255, 255, 0.09);
  --yellow: #ffd84a;
  --yellow-deep: #f4b728;
  --purple-ink: #241039;
}

* {
  box-sizing: border-box;
}

html {
  font-family: "Fredoka", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 216, 74, 0.22), transparent 30rem),
    linear-gradient(160deg, var(--bg-top), var(--bg-bottom) 72%);
}

button,
input,
a {
  font: inherit;
}

.stat-panel {
  min-height: 4.75rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.5rem;
  background: var(--panel);
  padding: 0.75rem;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.68);
}

.stat-value {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--yellow);
}

.combo-ticker {
  overflow: hidden;
  border: 1px solid rgba(255, 216, 74, 0.34);
  border-radius: 0.5rem;
  background: rgba(255, 216, 74, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.ticker-track {
  display: flex;
  min-height: 2.55rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 0.9rem;
  color: #ffef9f;
  font-size: 0.95rem;
  font-weight: 800;
  white-space: nowrap;
  animation: ticker-pulse 1.8s ease-in-out infinite;
}

#bestComboTickerText {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.85rem;
}

.meter-panel {
  min-height: 4.25rem;
  border: 1px solid rgba(255, 216, 74, 0.24);
  border-radius: 0.5rem;
  background: rgba(22, 9, 31, 0.54);
  padding: 0.75rem;
}

.meter-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #ffef9f;
}

.meter-count {
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.76);
}

.meter-dots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.meter-dot {
  height: 0.72rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.meter-dot.is-active {
  background: linear-gradient(180deg, var(--yellow), var(--yellow-deep));
  box-shadow: 0 0 1rem rgba(255, 216, 74, 0.28);
}

.meter-dot.is-danger.is-active {
  background: linear-gradient(180deg, #ff7b7b, #ef4444);
  box-shadow: 0 0 1rem rgba(239, 68, 68, 0.28);
}

.answer-input {
  width: 100%;
  min-height: 3.6rem;
  border: 2px solid rgba(255, 216, 74, 0.46);
  border-radius: 0.5rem;
  background: rgba(22, 9, 31, 0.82);
  padding: 0 1rem;
  color: white;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.answer-input:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 4px rgba(255, 216, 74, 0.14);
}

.primary-button,
.secondary-button,
.icon-button {
  border-radius: 0.5rem;
  font-weight: 700;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
  touch-action: manipulation;
}

.primary-button {
  min-height: 3.35rem;
  background: linear-gradient(180deg, var(--yellow), var(--yellow-deep));
  color: #23112f;
  box-shadow: 0 0.75rem 1.8rem rgba(244, 183, 40, 0.22);
}

.secondary-button {
  display: inline-flex;
  min-height: 3.1rem;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 216, 74, 0.38);
  background: rgba(255, 255, 255, 0.08);
  color: #ffef9f;
  text-decoration: none;
}

.icon-button {
  display: inline-grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 216, 74, 0.36);
  background: rgba(255, 255, 255, 0.09);
  color: var(--yellow);
  font-size: 1.5rem;
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.4) brightness(0.8);
  opacity: 0.7;
  transform: none;
}

.achievement-pill {
  border-radius: 999px;
  background: rgba(255, 216, 74, 0.18);
  padding: 0.45rem 0.75rem;
  color: #ffef9f;
  font-size: 0.85rem;
  font-weight: 700;
}

.loader {
  width: 3.2rem;
  height: 3.2rem;
  border: 0.35rem solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--yellow);
  border-radius: 999px;
  animation: spin 850ms linear infinite;
}

.score-loader {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 0.55rem;
  min-height: 4rem;
}

.score-loader span {
  width: 0.85rem;
  height: 1.6rem;
  border-radius: 999px;
  background: var(--yellow);
  animation: bounce-score 760ms ease-in-out infinite;
}

.score-loader span:nth-child(2) {
  animation-delay: 120ms;
}

.score-loader span:nth-child(3) {
  animation-delay: 240ms;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(12, 4, 18, 0.72);
  backdrop-filter: blur(8px);
}

.modal-backdrop.hidden {
  display: none;
}

.modal-panel {
  width: min(100%, 24rem);
  border-radius: 0.75rem;
  background: linear-gradient(180deg, #ffe76f, #ffc83d);
  padding: 1.4rem;
  text-align: center;
  box-shadow: 0 2rem 5rem rgba(0, 0, 0, 0.42);
  transform-origin: center;
  animation: pop-in 180ms ease-out both;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes bounce-score {
  0%,
  100% {
    transform: scaleY(0.55);
    opacity: 0.62;
  }

  50% {
    transform: scaleY(1.45);
    opacity: 1;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(0.75rem) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ticker-pulse {
  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(0.25rem);
  }
}

@media (min-width: 640px) {
  .stat-panel {
    min-height: 5.25rem;
  }

  .stat-value {
    font-size: 2.1rem;
  }
}
