:root {
  color-scheme: light dark;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #10131a, #17243f);
  padding: 0.75rem;
}

.app {
  width: min(680px, 100%);
  color: #f8f9ff;
  padding: max(0.25rem, env(safe-area-inset-top))
    max(0.25rem, env(safe-area-inset-right))
    max(0.25rem, env(safe-area-inset-bottom))
    max(0.25rem, env(safe-area-inset-left));
}

header {
  text-align: center;
}

header h1 {
  margin-bottom: 0.3rem;
  line-height: 1.15;
}

header p {
  opacity: 0.9;
  margin: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin: 1rem 0;
}

.stat {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.7rem;
  text-align: center;
}

.deck-area {
  perspective: 1200px;
}

.card {
  min-height: min(56vh, 420px);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  padding: 1.2rem;
  backdrop-filter: blur(8px);
  transition: transform 0.18s ease;
  touch-action: pan-y;
  user-select: none;
}

.card h2 {
  line-height: 1.35;
  margin-top: 0.4rem;
}

.card.swipe-left {
  transform: translateX(-120px) rotate(-8deg);
}

.card.swipe-right {
  transform: translateX(120px) rotate(8deg);
}

.chunk-label {
  font-size: 0.85rem;
  opacity: 0.75;
}

.buttons,
.controls {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1rem;
  cursor: pointer;
  font-weight: 700;
  min-height: 48px;
}

.btn.wrong {
  background: #ff7070;
  color: #320f0f;
}

.btn.right {
  background: #7bf6a0;
  color: #0e2b19;
}

.btn.secondary {
  background: #d0d6ff;
  color: #212a4a;
}

@media (max-width: 640px) {
  body {
    place-items: stretch;
    padding: 0.5rem;
  }

  .app {
    width: 100%;
    margin: 0 auto;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .card {
    min-height: 52vh;
    padding: 1rem;
  }

  .buttons {
    position: sticky;
    bottom: 0;
    background: rgba(16, 19, 26, 0.92);
    padding: 0.5rem;
    border-radius: 12px;
    backdrop-filter: blur(6px);
  }

  .btn {
    flex: 1;
  }
}

@media (max-width: 420px) {
  header h1 {
    font-size: 1.4rem;
  }

  .card h2 {
    font-size: 1.15rem;
  }

  .buttons {
    gap: 0.5rem;
  }
}
