/* ============================
   IRREGULAR VERBS PWA
   Bright, playful kids design
   ============================ */

:root {
  --bg: #f0f4ff;
  --bg-card: #ffffff;
  --surface: #e8ecf8;
  --surface-dark: #d0d6ea;
  --purple: #7c5cfc;
  --purple-light: #a78bfa;
  --purple-dark: #5b3fd4;
  --pink: #f472b6;
  --pink-light: #fbcfe8;
  --orange: #fb923c;
  --orange-light: #fed7aa;
  --yellow: #fbbf24;
  --yellow-light: #fef3c7;
  --green: #34d399;
  --green-light: #d1fae5;
  --green-dark: #059669;
  --blue: #60a5fa;
  --blue-light: #dbeafe;
  --red: #f87171;
  --red-light: #fee2e2;
  --cyan: #22d3ee;
  --text: #1e1b4b;
  --text-dim: #6b7280;
  --radius: 24px;
  --radius-sm: 16px;
  --shadow: 0 4px 24px rgba(124, 92, 252, 0.12), 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 40px rgba(124, 92, 252, 0.18), 0 4px 12px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --font-display: 'Fredoka', sans-serif;
  --font-body: 'Nunito', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* Fun background pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 20%, rgba(124, 92, 252, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(244, 114, 182, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(251, 191, 36, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Floating shapes decoration */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle 3px at 15% 15%, var(--purple-light) 100%, transparent 100%),
    radial-gradient(circle 4px at 85% 25%, var(--pink) 100%, transparent 100%),
    radial-gradient(circle 3px at 75% 75%, var(--yellow) 100%, transparent 100%),
    radial-gradient(circle 5px at 20% 85%, var(--green) 100%, transparent 100%),
    radial-gradient(circle 3px at 50% 10%, var(--orange) 100%, transparent 100%),
    radial-gradient(circle 4px at 92% 60%, var(--cyan) 100%, transparent 100%);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

/* ======= CONFETTI ======= */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* ======= HEADER ======= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
  padding: 16px 20px 20px;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 480px;
  margin: 0 auto;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--purple);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo span {
  background: linear-gradient(135deg, var(--pink), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-emoji {
  font-size: 1.5rem;
  -webkit-text-fill-color: initial;
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--yellow-light);
  border: 2.5px solid var(--yellow);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  padding: 8px 16px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.streak-badge:hover {
  transform: scale(1.05);
}

.streak-badge:active {
  transform: scale(0.95);
}

.streak-icon {
  font-size: 1.1rem;
}

/* ======= NAV TABS ======= */
.tabs {
  display: flex;
  gap: 8px;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 14px;
  position: relative;
  z-index: 10;
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-card);
  border: 2.5px solid var(--surface);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: var(--shadow-sm);
}

.tab.active {
  background: var(--purple);
  border-color: var(--purple);
  color: white;
  box-shadow: 0 4px 16px rgba(124, 92, 252, 0.35);
  transform: translateY(-1px);
}

.tab:active {
  transform: scale(0.95);
}

.tab-emoji {
  font-size: 1.1rem;
}

/* ======= WEEK SELECTOR ======= */
.week-selector {
  display: flex;
  gap: 8px;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: relative;
  z-index: 10;
}

.week-selector::-webkit-scrollbar { display: none; }

.week-btn {
  flex-shrink: 0;
  background: var(--bg-card);
  border: 2.5px solid var(--surface);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 10px 20px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.week-btn:active {
  transform: scale(0.95);
}

.week-btn.active {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  border-color: var(--purple);
  color: white;
  box-shadow: 0 4px 16px rgba(124, 92, 252, 0.3);
}

.week-btn.all-weeks {
  background: var(--yellow-light);
  border-color: var(--yellow);
  color: var(--text);
}

.week-btn.all-weeks.active {
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  border-color: var(--orange);
  color: white;
}

/* ======= CONTENT ======= */
.content {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 120px;
  z-index: 10;
}

.panel { display: none; }
.panel.active { display: block; animation: fadeIn 0.35s ease; }

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

/* ======= STUDY MODE ======= */
.card-counter {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.flashcard-area {
  perspective: 1200px;
  margin-bottom: 24px;
}

.flashcard {
  width: 100%;
  aspect-ratio: 3 / 2.4;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
  transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  padding: 24px;
  overflow: hidden;
}

.flashcard-front {
  background: linear-gradient(145deg, #ffffff, #f8f6ff);
  border: 3px solid var(--purple-light);
  box-shadow: var(--shadow-lg),
    inset 0 0 0 1px rgba(124, 92, 252, 0.05);
}

.flashcard-back {
  background: linear-gradient(145deg, var(--green-light), #a7f3d0);
  border: 3px solid var(--green);
  transform: rotateY(180deg);
  box-shadow: var(--shadow-lg);
}

.card-emoji {
  font-size: 2rem;
  margin-bottom: 4px;
}

.card-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--purple-light);
}

.flashcard-back .card-label {
  color: var(--green-dark);
}

.card-word {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 12vw, 4rem);
  font-weight: 700;
  color: var(--purple-dark);
  text-align: center;
  line-height: 1.1;
}

.flashcard-back .card-word {
  color: var(--green-dark);
}

.card-hint {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  opacity: 0.6;
  margin-top: 4px;
}

/* Decorative corners */
.flashcard-front::before,
.flashcard-front::after,
.flashcard-back::before,
.flashcard-back::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  opacity: 0.15;
}

.flashcard-front::before { top: 16px; left: 16px; background: var(--pink); width: 32px; height: 32px; }
.flashcard-front::after { bottom: 16px; right: 16px; background: var(--yellow); width: 28px; height: 28px; }
.flashcard-back::before { top: 16px; right: 16px; background: var(--cyan); width: 28px; height: 28px; }
.flashcard-back::after { bottom: 16px; left: 16px; background: var(--yellow); width: 24px; height: 24px; }

/* Wiggle animation on card change */
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-1.5deg); }
  75% { transform: rotate(1.5deg); }
}

.flashcard.wiggle .flashcard-inner {
  animation: wiggle 0.35s ease;
}

/* Card navigation */
.card-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.btn-nav, .btn-shuffle {
  background: var(--bg-card);
  border: 2.5px solid var(--surface);
  color: var(--purple);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
  font-size: 1.5rem;
}

.btn-nav:active, .btn-shuffle:active {
  transform: scale(0.88);
}

.btn-nav:hover, .btn-shuffle:hover {
  border-color: var(--purple-light);
  background: var(--surface);
}

.btn-shuffle {
  width: 52px;
  height: 52px;
  color: var(--orange);
  border-color: var(--orange-light);
  background: var(--orange-light);
  font-size: 1.3rem;
}

/* Direction toggle */
.direction-toggle {
  display: flex;
  gap: 6px;
  background: var(--bg-card);
  border: 2.5px solid var(--surface);
  border-radius: var(--radius-sm);
  padding: 5px;
  box-shadow: var(--shadow-sm);
}

.dir-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 12px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.dir-btn.active {
  background: var(--purple);
  color: white;
  box-shadow: 0 2px 8px rgba(124, 92, 252, 0.3);
}

.dir-btn:active {
  transform: scale(0.95);
}

/* ======= QUIZ MODE ======= */
.quiz-progress {
  height: 10px;
  background: var(--surface);
  border-radius: 5px;
  margin-bottom: 14px;
  overflow: hidden;
  border: 2px solid var(--surface-dark);
}

.quiz-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  border-radius: 5px;
  width: 0%;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quiz-score {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--purple);
  margin-bottom: 20px;
}

.quiz-card {
  background: var(--bg-card);
  border: 3px solid var(--surface);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.quiz-emoji {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.quiz-label {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.quiz-word {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 10vw, 3.2rem);
  font-weight: 700;
  color: var(--purple);
  margin-bottom: 28px;
}

.quiz-form {
  display: flex;
  gap: 10px;
}

.quiz-input {
  flex: 1;
  background: var(--surface);
  border: 3px solid var(--surface-dark);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: all 0.2s;
}

.quiz-input::placeholder {
  color: var(--text-dim);
  opacity: 0.5;
}

.quiz-input:focus {
  border-color: var(--purple);
  background: white;
  box-shadow: 0 0 0 4px rgba(124, 92, 252, 0.15);
}

.quiz-input.correct {
  border-color: var(--green);
  background: var(--green-light);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.2);
}

.quiz-input.wrong {
  border-color: var(--red);
  background: var(--red-light);
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.15);
  animation: shake 0.4s ease;
}

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

.quiz-submit {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  border: none;
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 16px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(124, 92, 252, 0.3);
}

.quiz-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 92, 252, 0.4);
}

.quiz-submit:active {
  transform: scale(0.95);
}

.quiz-submit.next-btn {
  background: linear-gradient(135deg, var(--orange), var(--yellow));
  box-shadow: 0 4px 16px rgba(251, 146, 60, 0.3);
}

.quiz-feedback {
  margin-top: 18px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  min-height: 28px;
}

.quiz-feedback.correct {
  color: var(--green-dark);
}

.quiz-feedback.wrong {
  color: var(--red);
}

.btn-restart {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: var(--bg-card);
  border: 2.5px solid var(--surface);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 16px;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.btn-restart:hover {
  background: var(--surface);
  color: var(--text);
}

.btn-restart:active {
  transform: scale(0.97);
}

.restart-emoji {
  font-size: 1.2rem;
}

.quiz-direction-toggle {
  margin-bottom: 0;
}

/* ======= ALL VERBS LIST ======= */
.verbs-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.verb-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-card);
  border: 2.5px solid var(--surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  animation: slideUp 0.35s ease backwards;
  box-shadow: var(--shadow-sm);
}

.verb-row:nth-child(n) {
  animation-delay: calc(var(--i, 0) * 0.05s);
}

.verb-row-header {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  border-color: var(--purple);
}

.verb-cell {
  padding: 16px 18px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.verb-cell:first-child {
  color: var(--purple);
  border-right: 2px solid var(--surface);
}

.verb-cell:last-child {
  color: var(--text);
}

.verb-row-header .verb-cell {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: white !important;
  padding: 12px 18px;
  border-right-color: rgba(255,255,255,0.2) !important;
}

.week-label-row {
  margin-top: 20px;
  margin-bottom: 6px;
}

.week-label-row:first-child {
  margin-top: 0;
}

.week-label-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--purple);
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.week-label-emoji {
  font-size: 1.2rem;
}

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

/* ======= RESULTS MODAL ======= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 27, 75, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.modal {
  background: var(--bg-card);
  border: 3px solid var(--surface);
  border-radius: var(--radius);
  padding: 40px 28px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bounceIn {
  from { opacity: 0; transform: scale(0.7); }
  60% { transform: scale(1.05); }
  to { opacity: 1; transform: scale(1); }
}

.modal-emoji {
  font-size: 4rem;
  margin-bottom: 12px;
  line-height: 1;
  animation: bounce 0.6s ease 0.3s;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--purple);
  margin-bottom: 8px;
}

.modal-score {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
}

.modal-details {
  text-align: left;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 24px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 4px;
}

.modal-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.modal-detail-row.wrong-row {
  color: var(--red);
  background: var(--red-light);
}

.modal-detail-row.correct-row {
  color: var(--green-dark);
  background: var(--green-light);
}

.modal-btn {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  border: none;
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  padding: 18px 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  box-shadow: 0 4px 16px rgba(124, 92, 252, 0.3);
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(124, 92, 252, 0.4);
}

.modal-btn:active {
  transform: scale(0.96);
}

/* ======= MEDIA QUERIES ======= */
@media (min-width: 520px) {
  .content, .header-inner, .tabs, .week-selector {
    max-width: 500px;
  }
}

@media (min-width: 768px) {
  .app-header { padding: 24px 24px 28px; }
  .flashcard { aspect-ratio: 3 / 2; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-dark); border-radius: 3px; }

/* Selection */
::selection {
  background: var(--purple-light);
  color: white;
}
