/* === Alap === */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --success: #10b981;
  --success-light: #34d399;
  --error: #ef4444;
  --warning: #f59e0b;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  overscroll-behavior: none;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; border: none; }

/* === Home === */
.hero {
  text-align: center;
  color: white;
  padding: 24px 12px 32px;
}
.hero-emoji { font-size: 64px; margin-bottom: 8px; }
.hero h1 { font-size: 32px; margin-bottom: 4px; text-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.subtitle { font-size: 16px; opacity: 0.9; margin-bottom: 24px; }

.stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}
.stat {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 12px 16px;
  min-width: 90px;
  color: white;
}
.stat-num { display: block; font-size: 24px; font-weight: bold; }
.stat-lbl { font-size: 11px; opacity: 0.9; }

.modules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.module-card {
  background: var(--card);
  border-radius: 20px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  border: 2px solid transparent;
}
.module-card:active { transform: scale(0.97); }
.module-card:hover { box-shadow: var(--shadow-lg); border-color: var(--primary-light); }
.m-emoji { font-size: 40px; margin-bottom: 8px; }
.m-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.m-desc { font-size: 12px; color: var(--text-light); line-height: 1.3; }
.weil-card { background: linear-gradient(135deg, #fef3c7, #fde68a); }

.foot { text-align: center; padding: 20px 0 40px; color: white; }
.foot .hint { margin-top: 12px; font-size: 13px; opacity: 0.85; }
.ghost-btn {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 13px;
}

/* === Modul nézet === */
.screen { animation: fadein 0.3s; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.back-btn {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}
.back-btn:active { transform: scale(0.95); }

.module-header {
  color: white;
  text-align: center;
  margin-bottom: 16px;
}
.module-header h2 { font-size: 22px; margin-bottom: 4px; }
.module-header p { font-size: 13px; opacity: 0.85; }

.progress-bar {
  background: rgba(255,255,255,0.2);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin: 12px 0;
}
.progress-fill {
  background: white;
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s;
}

.card {
  background: var(--card);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 16px;
}

/* === Flashcard === */
.flashcard {
  position: relative;
  perspective: 1000px;
  min-height: 280px;
  margin-bottom: 16px;
}
.flashcard-inner {
  position: absolute;
  inset: 0;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  cursor: pointer;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  background: var(--card);
  border-radius: 24px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.flashcard-back { transform: rotateY(180deg); background: linear-gradient(135deg, #ddd6fe, #fbcfe8); }
.fc-word { font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.fc-cat { font-size: 12px; color: var(--text-light); text-transform: uppercase; letter-spacing: 1px; }
.fc-extra { font-size: 14px; color: var(--text-light); margin-top: 8px; font-style: italic; }
.fc-tap { position: absolute; bottom: 16px; left: 0; right: 0; font-size: 12px; color: var(--text-light); }
.fc-plural { font-size: 14px; color: var(--text-light); margin-top: 4px; }

.flash-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.btn {
  padding: 14px 24px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow);
  transition: transform 0.1s;
}
.btn:active { transform: scale(0.96); }
.btn.primary { background: var(--primary); color: white; }
.btn.success { background: var(--success); color: white; }
.btn.danger { background: var(--error); color: white; }
.btn.large { padding: 18px 32px; font-size: 18px; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Kvíz === */
.question {
  background: var(--card);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 16px;
}
.q-text { font-size: 20px; font-weight: 700; margin-bottom: 20px; line-height: 1.4; text-align: center; }
.q-tip { font-size: 13px; color: var(--text-light); text-align: center; margin-bottom: 16px; font-style: italic; }
.q-options { display: flex; flex-direction: column; gap: 10px; }
.q-option {
  background: white;
  border: 2px solid var(--border);
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 16px;
  text-align: left;
  transition: all 0.15s;
  color: var(--text);
}
.q-option:hover { border-color: var(--primary-light); }
.q-option:active { transform: scale(0.98); }
.q-option.correct { background: var(--success); color: white; border-color: var(--success); animation: pop 0.4s; }
.q-option.wrong { background: var(--error); color: white; border-color: var(--error); animation: shake 0.4s; }
.q-option.disabled { opacity: 0.5; pointer-events: none; }

@keyframes pop {
  0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.feedback {
  margin-top: 16px;
  padding: 14px;
  border-radius: 14px;
  text-align: center;
  font-weight: 600;
  animation: fadein 0.3s;
}
.feedback.right { background: #d1fae5; color: #065f46; }
.feedback.wrong { background: #fee2e2; color: #991b1b; }

/* === Article picker === */
.article-word { font-size: 36px; font-weight: 700; margin-bottom: 24px; text-align: center; }
.article-buttons { display: flex; gap: 12px; justify-content: center; }
.article-btn {
  flex: 1;
  padding: 24px;
  border-radius: 20px;
  background: white;
  font-size: 24px;
  font-weight: 700;
  border: 3px solid var(--border);
  color: var(--text);
  transition: all 0.15s;
}
.article-btn[data-art="der"] { color: #2563eb; }
.article-btn[data-art="die"] { color: #dc2626; }
.article-btn[data-art="das"] { color: #16a34a; }
.article-btn:active { transform: scale(0.95); }
.article-btn.correct { background: var(--success); color: white !important; border-color: var(--success); }
.article-btn.wrong { background: var(--error); color: white !important; border-color: var(--error); }

/* === Szabályok === */
.rule {
  background: var(--card);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.rule h3 { color: var(--primary); margin-bottom: 10px; font-size: 17px; }
.rule p { line-height: 1.6; white-space: pre-line; font-size: 15px; color: var(--text); }

/* === Mondat-építő === */
.builder-target {
  background: white;
  min-height: 80px;
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 16px;
  border: 2px dashed var(--border);
}
.builder-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  justify-content: center;
}
.word-chip {
  background: var(--primary);
  color: white;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s;
  box-shadow: var(--shadow);
}
.word-chip:active { transform: scale(0.95); }
.word-chip.in-target { background: var(--primary-dark); }
.word-chip.placeholder { background: rgba(255,255,255,0.3); color: rgba(255,255,255,0); pointer-events: none; }

.hu-hint { color: white; text-align: center; margin-bottom: 12px; font-size: 14px; opacity: 0.9; font-style: italic; }

/* === dass gyakorlás === */
.dass-input-wrap { margin: 12px 0; }
.dass-label { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 6px; font-weight: 600; }
.dass-input {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  font-size: 16px;
  font-family: inherit;
}
.dass-input:focus { outline: none; border-color: var(--primary); }

/* === Eredmény === */
.result-screen {
  background: var(--card);
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.result-emoji { font-size: 72px; margin-bottom: 12px; }
.result-title { font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.result-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 20px 0;
}
.result-stat {
  flex: 1;
  background: var(--bg);
  padding: 14px 8px;
  border-radius: 14px;
}
.result-stat-num { font-size: 24px; font-weight: 700; color: var(--primary); }
.result-stat-lbl { font-size: 12px; color: var(--text-light); }

.confetti { position: fixed; pointer-events: none; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; z-index: 999; }
.confetto {
  position: absolute;
  width: 12px;
  height: 12px;
  top: -20px;
  animation: fall 2.5s ease-in forwards;
}
@keyframes fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 26px; }
  .modules { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 10px 12px; min-width: 80px; }
  .stat-num { font-size: 20px; }
}
