* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.8) 1px, transparent 1px),
    radial-gradient(circle, rgba(255,255,255,0.45) 1px, transparent 1px);
  background-size: 80px 80px, 140px 140px;
  background-position: 0 0, 30px 50px;
  opacity: 0.26;
  animation: drift 28s linear infinite;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-80px, 80px, 0);
  }
}

.auth-tab.active {
  background: linear-gradient(135deg, #ffd166, #ff4f8b);
  color: #111827;
  box-shadow: 0 18px 45px rgba(255, 79, 139, 0.28);
}

.app-input {
  width: 100%;
  border-radius: 1rem;
  border: 1px solid #d1d5db;
  background: #ffffff;
  padding: 0.95rem 1rem;
  color: #111827 !important;
  -webkit-text-fill-color: #111827;
  caret-color: #111827;
  font-size: 16px;
  line-height: 1.5;
  outline: none;
  transition: border 160ms ease, box-shadow 160ms ease, background 160ms ease;
  appearance: none;
}

.app-input::placeholder {
  color: #6b7280;
}

.app-input:focus {
  border-color: rgba(103, 232, 249, 0.8);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(103, 232, 249, 0.14);
}

.app-input:-webkit-autofill,
.app-input:-webkit-autofill:hover,
.app-input:-webkit-autofill:focus,
.app-input:-webkit-autofill:active {
  -webkit-text-fill-color: #111827 !important;
  caret-color: #111827;
  box-shadow: 0 0 0 1000px #ffffff inset !important;
  border-color: rgba(103, 232, 249, 0.6);
  transition: background-color 9999s ease-in-out 0s;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.review-btn {
  border: 0;
  border-radius: 1rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.primary-btn {
  background: linear-gradient(135deg, #ffd166, #ff4f8b);
  color: #111827;
  padding: 1rem 1.25rem;
  box-shadow: 0 18px 45px rgba(255, 79, 139, 0.30);
}

.auth-submit-btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0.75rem;
  background: #3b82f6;
  color: #ffffff !important;
  padding: 0.85rem 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 16px 36px rgba(59, 130, 246, 0.32);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.auth-submit-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.auth-submit-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.86);
  padding: 0.78rem 1rem;
}

.danger-btn {
  background: rgba(244, 63, 94, 0.22);
  border: 1px solid rgba(251, 113, 133, 0.30);
  color: #ffe4e6;
  padding: 0.78rem 1rem;
}

.review-btn {
  color: white;
  min-height: 3.6rem;
  padding: 0.9rem 1rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

.primary-btn:hover,
.secondary-btn:hover,
.danger-btn:hover,
.review-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.primary-btn:disabled,
.secondary-btn:disabled,
.danger-btn:disabled,
.review-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  filter: grayscale(0.2);
}

.card-scene {
  width: min(100%, 620px);
  height: 380px;
  perspective: 1300px;
}

.word-card {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 2rem;
  transform-style: preserve-3d;
  transition: transform 650ms cubic-bezier(.2, .8, .2, 1);
  cursor: pointer;
  outline: none;
}

.word-card.is-flipped {
  transform: rotateY(180deg);
}

.word-card:focus-visible {
  box-shadow: 0 0 0 5px rgba(103, 232, 249, 0.35);
}

.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 2rem;
  padding: 2rem;
  backface-visibility: hidden;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.35);
}

.card-face::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle, rgba(255,255,255,0.32), transparent 38%);
  transform: rotate(22deg);
  pointer-events: none;
}

.card-front {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)),
    linear-gradient(135deg, #1d4ed8, #7c3aed 46%, #db2777);
}

.card-back {
  color: #0f172a;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.75), rgba(255,255,255,0.35)),
    linear-gradient(135deg, #fef3c7, #fbcfe8 50%, #bae6fd);
  transform: rotateY(180deg);
}

#aiBox::-webkit-scrollbar {
  width: 8px;
}

#aiBox::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.20);
  border-radius: 999px;
}

@media (max-width: 640px) {
  .card-scene {
    height: 320px;
  }

  .card-face {
    padding: 1.35rem;
  }
}
