/* ============================================
   Schloss Heessen Projektwoche — Style System
   Mobile-first, fun & lively design
   ============================================ */

/* --- CSS Variables --- */
:root {
  --coral: #FF6B6B;
  --coral-light: #FFE0E0;
  --teal: #4ECDC4;
  --teal-light: #D4F7F4;
  --gold: #FFE66D;
  --gold-light: #FFF9E0;
  --purple: #A78BFA;
  --purple-light: #EDE4FF;
  --bg: #FFF8F0;
  --card-bg: #FFFFFF;
  --text: #2D2D2D;
  --text-light: #6B6B6B;
  --text-muted: #999;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --font-heading: 'Fredoka', sans-serif;
  --font-body: 'Nunito', sans-serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

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

#app-root {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* --- Top Bar --- */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.back-btn {
  width: 40px; height: 40px;
  border: none; border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.back-btn:hover { background: var(--coral-light); color: var(--coral); }
.back-btn:active { transform: scale(0.92); }
.back-btn.hidden { visibility: hidden; pointer-events: none; }

.screen-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.lang-switcher {
  display: flex; gap: 4px;
}

.lang-btn {
  width: 40px; height: 40px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: transparent;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.lang-btn:hover { background: var(--bg); }
.lang-btn.active { border-color: var(--coral); background: var(--coral-light); }

/* --- Screens --- */
.screen {
  flex: 1;
  display: none;
  flex-direction: column;
  padding: 20px 16px 32px;
  animation: screenIn 0.35s ease-out;
}
.screen.active { display: flex; }

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

/* --- Hero Section (Home) --- */
.hero {
  text-align: center;
  padding: 32px 8px 24px;
}

.hero-emoji {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: float 3s ease-in-out infinite;
}

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

.hero-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--coral), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-light);
  margin-bottom: 4px;
}

.hero-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Module Grid (Home) --- */
.module-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 8px 0 24px;
}

.module-card {
  background: var(--card-bg);
  border: none;
  border-radius: var(--radius-md);
  padding: 24px 16px 20px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.module-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--card-color);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.module-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.module-card:active { transform: scale(0.97); }

.module-emoji { font-size: 2.5rem; }
.module-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.module-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* --- Home Footer --- */
.home-footer {
  text-align: center;
  padding: 8px 0;
}
.home-footer p {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

/* --- Info Cards --- */
.card-deck {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  perspective: 800px;
}

.info-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 380px;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow-y: auto;
  max-height: 65vh;
}

.info-card-icon {
  font-size: 4rem;
  margin-bottom: 12px;
  display: block;
}

.info-card-tag {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.info-card-tag.culture { background: var(--teal-light); color: #0D9488; }
.info-card-tag.antiracism { background: var(--coral-light); color: var(--coral); }
.info-card-tag.funfact { background: var(--gold-light); color: #B8860B; }

.info-card h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  margin-bottom: 10px;
}

.info-card p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-light);
}

.info-card .card-didyouknow {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text);
  font-style: italic;
}
.info-card .card-didyouknow::before {
  content: '💡 ';
  font-style: normal;
}

/* Card Navigation */
.card-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; padding: 20px 0 8px;
}

.card-nav-btn {
  width: 44px; height: 44px;
  border: none; border-radius: 50%;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.card-nav-btn:hover { background: var(--coral-light); color: var(--coral); }
.card-nav-btn:active { transform: scale(0.92); }
.card-nav-btn:disabled { opacity: 0.3; cursor: default; }

.card-counter {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--text-muted);
  min-width: 48px;
  text-align: center;
}

/* --- Quiz --- */
.quiz-container, .match-container, .guess-container {
  flex: 1;
  display: flex; flex-direction: column;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.quiz-state, .match-state, .guess-state {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
}

.quiz-state.hidden, .match-state.hidden, .guess-state.hidden { display: none; }

.quiz-illustration, .match-illustration, .guess-illustration {
  font-size: 4rem;
  margin-bottom: 8px;
}

/* --- Buttons --- */
.btn-primary {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--coral);
  border: none;
  border-radius: 50px;
  padding: 14px 36px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255,107,107,0.35);
  transition: all var(--transition);
}
.btn-primary:hover { background: #FF5252; transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.97); }

/* --- Quiz Active --- */
.quiz-progress {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}

.quiz-progress-bar {
  flex: 1; height: 8px;
  background: #EEE; border-radius: 4px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--coral), var(--purple));
  border-radius: 4px;
  transition: width 0.4s ease;
}

#quiz-progress-text {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--text-muted);
  min-width: 40px;
}

.quiz-question {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  text-align: center;
  margin: 8px 0 16px;
  line-height: 1.5;
}

.quiz-options {
  width: 100%;
  display: flex; flex-direction: column; gap: 10px;
}

.quiz-option {
  width: 100%;
  padding: 16px 20px;
  background: var(--card-bg);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.quiz-option:hover { border-color: var(--coral); background: var(--coral-light); }
.quiz-option:active { transform: scale(0.98); }

.quiz-option.correct {
  border-color: #22C55E; background: #F0FFF4; color: #166534;
  animation: pulse-green 0.5s ease;
}
.quiz-option.wrong {
  border-color: #EF4444; background: #FFF5F5; color: #991B1B;
  animation: shake 0.4s ease;
}

@keyframes pulse-green {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Quiz Result */
.quiz-result-emoji {
  font-size: 5rem;
}

#quiz-result-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
}

#quiz-result-score {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--coral), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#quiz-result-msg {
  font-size: 0.9rem;
  color: var(--text-light);
  text-align: center;
}

/* --- Matching Game --- */
.match-columns {
  width: 100%;
  display: flex; gap: 12px;
}

.match-column {
  flex: 1;
  display: flex; flex-direction: column; gap: 10px;
}

.match-item {
  padding: 14px 12px;
  background: var(--card-bg);
  border: 2px solid #EEE;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  min-height: 54px;
  display: flex; align-items: center; justify-content: center;
  user-select: none;
}
.match-item:hover { border-color: var(--teal); }
.match-item.selected {
  border-color: var(--coral);
  background: var(--coral-light);
  transform: scale(1.03);
  box-shadow: var(--shadow-md);
}
.match-item.matched {
  border-color: #22C55E; background: #F0FFF4;
  opacity: 0.7; pointer-events: none;
}
.match-item.wrong-flash {
  border-color: #EF4444; background: #FFF5F5;
  animation: shake 0.4s ease;
}

.match-feedback {
  min-height: 24px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}
.match-feedback.correct { color: #22C55E; }
.match-feedback.wrong { color: #EF4444; }

.match-result-emoji { font-size: 4rem; }
#match-result-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
}
#match-result-score {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--coral);
}

/* --- Picture Guess --- */
.guess-progress-dots {
  display: flex; gap: 8px;
}
.guess-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #DDD;
  transition: background 0.3s;
}
.guess-dot.done { background: var(--teal); }
.guess-dot.current { background: var(--coral); }

.guess-image {
  font-size: 5rem;
  text-align: center;
  padding: 24px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  min-height: 120px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 4px;
}

.guess-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

.guess-options {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.guess-option {
  padding: 14px;
  background: var(--card-bg);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.guess-option:hover { border-color: var(--coral); }
.guess-option:disabled { pointer-events: none; }
.guess-option.correct { border-color: #22C55E; background: #F0FFF4; }
.guess-option.wrong { border-color: #EF4444; background: #FFF5F5; }

.guess-feedback {
  font-family: var(--font-heading);
  font-size: 1rem;
  text-align: center;
  padding: 8px;
}
.guess-feedback.correct { color: #22C55E; }
.guess-feedback.wrong { color: #EF4444; }
.guess-feedback.hidden { display: none; }

.guess-result-emoji { font-size: 4rem; }
#guess-result-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
}
#guess-result-score {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--coral);
}

/* --- Toast --- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--text);
  color: #fff;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.toast.show {
  opacity: 1; transform: translateX(-50%) translateY(-8px);
}
.toast.hidden { display: none; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #DDD; border-radius: 2px; }

/* --- Responsive: Desktop tweaks --- */
@media (min-width: 481px) {
  #app-root {
    border-left: 1px solid rgba(0,0,0,0.06);
    border-right: 1px solid rgba(0,0,0,0.06);
    box-shadow: var(--shadow-lg);
  }
  .module-grid { gap: 16px; }
}
