:root {
  color-scheme: dark;
  --bg-a: #0a0f1f;
  --bg-b: #0f1630;
  --card: rgba(20, 30, 60, 0.6);
  --text: #eef4ff;
  --muted: #9aa9d7;
  --neon-cyan: #00f2ff;
  --neon-blue: #3a7bff;
  --neon-green: #3dff9c;
  --neon-red: #ff4d6d;
  --neon-orange: #ffb347;
  --neon-purple: #8968ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-a), var(--bg-b));
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow-x: hidden;
}

.bg-radial {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0, 242, 255, 0.16) 0%, rgba(0, 0, 0, 0) 48%);
  pointer-events: none;
}

.app-shell {
  width: min(100%, 420px);
  z-index: 1;
}

.card {
  position: relative;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid rgba(0, 255, 255, 0.3);
  box-shadow: 0 0 20px rgba(0, 242, 255, 0.22), 0 22px 55px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  padding: 1.15rem;
}

.screen {
  display: none;
  animation: fadeIn 220ms ease;
}

.screen.active {
  display: block;
}

.home-head,
.game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.eyebrow {
  margin: 0;
  color: var(--neon-cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
}

h1,
h2 {
  margin: 0.35rem 0;
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-shadow: 0 0 5px var(--neon-cyan), 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan);
}

h1 {
  font-size: clamp(0.95rem, 5vw, 1.45rem);
}

#home-title,
#game-title,
#challenge-title {
  white-space: nowrap;
  line-height: 1.02;
  max-width: 100%;
  letter-spacing: 0.03em;
}

h2 {
  font-size: clamp(0.82rem, 4.1vw, 1rem);
  opacity: 0.9;
}

.description {
  margin: 0.15rem 0 0.85rem;
  color: var(--muted);
}

.pro-badge {
  font-family: "Orbitron", sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.09em;
  padding: 0.25rem 0.52rem;
  border-radius: 999px;
  background: rgba(0, 242, 255, 0.15);
  color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 255, 0.4);
}

.streak-panel {
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(0, 242, 255, 0.16), rgba(137, 104, 255, 0.16));
  box-shadow: inset 0 0 0 1px rgba(0, 242, 255, 0.3), 0 0 14px rgba(0, 242, 255, 0.2);
  padding: 0.52rem 0.9rem;
  margin: 0.55rem 0 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.streak-panel.compact {
  margin-top: 0.7rem;
}

.stat-label {
  margin: 0;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #b2dfff;
  font-family: "Orbitron", sans-serif;
}

.stat-value {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 700;
  font-family: "Orbitron", sans-serif;
  text-shadow: 0 0 8px rgba(0, 242, 255, 0.45);
}

.streak-boost {
  animation: streakPulse 420ms ease;
}

.streak-hot .stat-label,
.streak-hot .stat-value {
  text-shadow: 0 0 10px rgba(0, 242, 255, 0.65);
}

.streak-fire .stat-label,
.streak-fire .stat-value {
  color: #ffe6b8;
  text-shadow: 0 0 9px rgba(255, 198, 87, 0.7);
}

.limit-note {
  margin: 0.2rem 0 0.8rem;
  color: #aebce8;
  font-size: 0.84rem;
  display: none;
}

.plays-left {
  margin: 0.2rem 0 0.72rem;
  color: #b7cbff;
  font-size: 0.82rem;
}

.lock-note {
  color: var(--neon-orange);
  text-shadow: 0 0 10px rgba(255, 179, 71, 0.4);
}

.question-label {
  margin: 0.25rem 0 0.7rem;
  color: #d7e6ff;
}

.input-label {
  display: block;
  margin-bottom: 0.28rem;
  color: #99addf;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
}

button,
input {
  width: 100%;
  border-radius: 12px;
  border: none;
  padding: 0.82rem;
  font-family: inherit;
  font-size: 1rem;
}

input {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  margin-bottom: 0.75rem;
  transition: box-shadow 150ms ease;
}

input::placeholder {
  color: #94a6d6;
}

input:focus {
  outline: none;
  box-shadow: 0 0 0 1px rgba(0, 242, 255, 0.45), 0 0 12px rgba(0, 242, 255, 0.25);
}

button {
  cursor: pointer;
  font-weight: 700;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

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

.play-hero {
  min-height: 74px;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-blue));
  color: #051430;
  box-shadow: 0 0 12px rgba(0, 242, 255, 0.5), 0 0 28px rgba(58, 123, 255, 0.35);
  margin-bottom: 0.85rem;
}

.play-hero:hover:not(:disabled) {
  box-shadow: 0 0 18px rgba(0, 242, 255, 0.72), 0 0 36px rgba(58, 123, 255, 0.55);
}

.action-pair,
.action-single {
  display: grid;
  gap: 0.62rem;
}

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

.action-single {
  grid-template-columns: minmax(0, 1fr);
}

.challenge-complete-replace {
  grid-column: 1 / -1;
  margin-top: 0;
}

.btn-submit {
  background: rgba(255, 255, 255, 0.1);
  color: #e8efff;
}

.btn-challenge {
  background: linear-gradient(90deg, #00f2ff, #8968ff);
  color: #031129;
  box-shadow: 0 0 14px rgba(0, 242, 255, 0.45), 0 0 24px rgba(137, 104, 255, 0.35);
}

.btn-challenge:hover:not(:disabled) {
  filter: brightness(1.04);
  box-shadow: 0 0 20px rgba(0, 242, 255, 0.7), 0 0 30px rgba(137, 104, 255, 0.55);
}

.x-btn-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
}

.x-icon {
  width: 1.2rem;
  height: 1.2rem;
  flex: 0 0 auto;
}

.btn-challenge.dimmed {
  opacity: 0.7;
  filter: saturate(0.75);
  box-shadow: 0 0 8px rgba(0, 242, 255, 0.2);
}

.btn-challenge.highlighted {
  background: linear-gradient(90deg, #00f2ff, #8968ff, #3dff9c);
  box-shadow: 0 0 18px rgba(0, 242, 255, 0.78), 0 0 28px rgba(61, 255, 156, 0.45);
  animation: challengePulse 0.5s ease-in-out infinite alternate;
}

.share-row {
  margin-top: 0.55rem;
}

.btn-subtle {
  background: rgba(255, 255, 255, 0.07);
  color: #b8c6e8;
}

.result-card {
  border-radius: 14px;
  padding: 0.75rem 0.82rem;
  margin: 0.3rem 0 0.12rem;
  background: rgba(255, 255, 255, 0.06);
}

.result-title {
  margin: 0;
  font-size: 1.42rem;
  font-weight: 700;
  font-family: "Orbitron", sans-serif;
}

.result-detail {
  margin: 0.18rem 0 0;
  color: #d8e4ff;
  font-size: 0.9rem;
}

.result-card.correct .result-title {
  color: var(--neon-green);
  text-shadow: 0 0 8px rgba(61, 255, 156, 0.6);
  animation: correctPop 260ms ease;
}

.result-card.wrong .result-title {
  color: var(--neon-red);
  text-shadow: 0 0 8px rgba(255, 77, 109, 0.5);
}

.result-card.wrong .result-detail.answer {
  color: var(--neon-orange);
  text-shadow: 0 0 8px rgba(255, 179, 71, 0.45);
}

.result-card.lock .result-title {
  color: var(--neon-orange);
  text-shadow: 0 0 8px rgba(255, 179, 71, 0.5);
}

.feedback {
  min-height: 1.4rem;
  margin: 0.28rem 0 0.1rem;
  font-weight: 700;
}

.feedback.correct {
  color: var(--neon-green);
  text-shadow: 0 0 8px rgba(61, 255, 156, 0.45);
}

.feedback.wrong {
  color: var(--neon-red);
  text-shadow: 0 0 8px rgba(255, 77, 109, 0.42);
}

.text-button {
  display: inline-block;
  margin-top: 0.35rem;
  border: none;
  background: transparent;
  color: #9fb0de;
  text-decoration: underline;
  padding: 0.12rem 0;
}

.home-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.6rem;
  min-height: 46px;
  width: 100%;
  border-radius: 12px;
  padding: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.home-link-button[hidden] {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 0.56rem 0.9rem;
  border-radius: 999px;
  background: rgba(0, 242, 255, 0.14);
  color: #d7fbff;
  box-shadow: 0 0 14px rgba(0, 242, 255, 0.4);
  font-size: 0.86rem;
  z-index: 20;
}

.toast.show {
  animation: toastIn 240ms ease, toastOut 240ms ease 1.6s forwards;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 22, 0.72);
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 1rem;
}

.modal-overlay[hidden] {
  display: none;
}

.cap-modal {
  width: min(100%, 360px);
  border-radius: 16px;
  background: rgba(20, 30, 60, 0.92);
  border: 1px solid rgba(0, 242, 255, 0.35);
  box-shadow: 0 0 20px rgba(0, 242, 255, 0.25);
  padding: 1rem;
}

.cap-modal h3 {
  margin: 0 0 0.5rem;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.06em;
}

.cap-modal p {
  margin: 0.2rem 0;
  color: #c9d8ff;
  font-size: 0.92rem;
}

.modal-actions {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.6rem;
}

.round-fade {
  animation: roundFade 200ms ease;
}

.card.wrong-hit {
  animation: wrongFlash 200ms ease;
}

.card.wrong-shake {
  animation: cardShake 300ms ease;
}

.card.correct-glow {
  animation: correctGlow 220ms ease;
}

.hit-icon {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  text-shadow: 0 0 14px rgba(255, 77, 109, 0.72);
  pointer-events: none;
}

.hit-icon.pop {
  animation: iconPop 280ms ease;
}

.shake {
  animation: shake 320ms linear;
}

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

@keyframes streakPulse {
  0% { box-shadow: inset 0 0 0 1px rgba(0, 242, 255, 0.3), 0 0 12px rgba(0, 242, 255, 0.2); }
  50% { box-shadow: inset 0 0 0 1px rgba(0, 242, 255, 0.7), 0 0 28px rgba(0, 242, 255, 0.6); }
  100% { box-shadow: inset 0 0 0 1px rgba(0, 242, 255, 0.3), 0 0 12px rgba(0, 242, 255, 0.2); }
}

@keyframes correctPop {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes correctGlow {
  0% {
    box-shadow: 0 0 0 rgba(61, 255, 156, 0);
  }
  100% {
    box-shadow: 0 0 24px rgba(61, 255, 156, 0.35), 0 22px 55px rgba(0, 0, 0, 0.5);
  }
}

@keyframes wrongFlash {
  0% {
    background: var(--card);
  }
  50% {
    background: rgba(80, 18, 30, 0.72);
  }
  100% {
    background: var(--card);
  }
}

@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@keyframes iconPop {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
  30% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
}

@keyframes challengePulse {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.02);
  }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(-50%) translateY(8px); }
}

@keyframes roundFade {
  from { opacity: 0.8; }
  to { opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@media (max-width: 480px) {
  #home-title,
  #game-title,
  #challenge-title {
    font-size: 0.9rem;
    letter-spacing: 0.02em;
  }

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