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

:root {
  --gold:    #FFD93D;
  --teal:    #4ECDC4;
  --purple:  #C77DFF;
  --green:   #06FFA5;
  --red:     #FF6B6B;
  --blue:    #4FC3F7;
  --bg-dark: #0B0C2A;
  --bg-dark2: #1a0535;
  --glass-bg: rgba(255,255,255,0.12);
  --glass-border: rgba(255,255,255,0.25);
  --text: #ffffff;
  --text-muted: rgba(255,255,255,0.65);
  --radius: 24px;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-dark2) 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px 16px 48px;
  overflow-x: hidden;
}

/* ===== Star dots background ===== */
#stars-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.star-dot {
  position: absolute;
  width: 3px;
  height: 3px;
  background: white;
  border-radius: 50%;
  animation: twinkle var(--twinkle-dur, 3s) ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50%       { opacity: 1;    transform: scale(1.4); }
}

/* ===== Confetti Canvas ===== */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 999;
  pointer-events: none;
  display: none;
}

/* ===== App Container ===== */
#app {
  width: 100%;
  max-width: 560px;
  position: relative;
  z-index: 1;
}

/* ===== Game Header ===== */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  margin-bottom: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  backdrop-filter: blur(10px);
}

.game-header.hidden { display: none; }

.header-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--gold);
}

#header-progress-info {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 700;
}

/* ===== Screens ===== */
.screen {
  display: none;
  animation: fadeIn 0.4s ease;
}

.screen.active {
  display: block;
}

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

/* ===== Card (Glassmorphism) ===== */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 32px 28px;
}

/* ===== Start Screen ===== */
.start-card {
  text-align: center;
}

.rocket-mascot {
  font-size: 72px;
  margin-bottom: 12px;
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50%       { transform: translateY(-18px) rotate(5deg); }
}

.title-glow {
  font-family: 'Fredoka One', cursive;
  font-size: 3.4rem;
  font-weight: 400;
  color: var(--gold);
  letter-spacing: 4px;
  text-shadow:
    0 0 10px rgba(255,217,61,0.8),
    0 0 30px rgba(255,217,61,0.5),
    0 0 60px rgba(255,217,61,0.3);
  margin-bottom: 10px;
  animation: glow-pulse 2.5s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { text-shadow: 0 0 10px rgba(255,217,61,0.8), 0 0 30px rgba(255,217,61,0.5); }
  50%       { text-shadow: 0 0 20px rgba(255,217,61,1),   0 0 60px rgba(255,217,61,0.8), 0 0 90px rgba(255,217,61,0.4); }
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.star-goal {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gold);
  background: rgba(255,217,61,0.15);
  border: 1px solid rgba(255,217,61,0.4);
  border-radius: 12px;
  padding: 8px 20px;
  display: inline-block;
  margin-bottom: 28px;
}

.info-boxes {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
}

.info-box {
  flex: 1;
  border-radius: 16px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-box.blue   { background: rgba(79,195,247,0.15); border: 2px solid rgba(79,195,247,0.5); }
.info-box.purple { background: rgba(199,125,255,0.15); border: 2px solid rgba(199,125,255,0.5); }

.info-box .label       { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.7; color: var(--text); }
.info-box .example     { font-size: 1.05rem; font-weight: 800; }
.info-box .example-small { font-size: 0.85rem; font-weight: 600; opacity: 0.8; }
.info-box.blue .example   { color: var(--blue); }
.info-box.purple .example { color: var(--purple); }

/* ===== Mascot ===== */
.mascot-area {
  text-align: center;
  position: relative;
  margin-bottom: 8px;
}

.mascot-bubble-wrap {
  position: relative;
  height: 48px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.mascot-bubble {
  background: rgba(255,255,255,0.18);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 8px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  position: absolute;
  white-space: nowrap;
  animation: popIn 0.25s ease;
}

.mascot-bubble.hidden { display: none; }

.mascot-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: rgba(255,255,255,0.18);
  border-bottom: none;
}

.mascot {
  font-size: 56px;
  display: inline-block;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 4px 12px rgba(79,195,247,0.4));
}

.mascot.react {
  animation: mascot-bounce 0.4s ease;
}

@keyframes mascot-bounce {
  0%, 100% { transform: scale(1); }
  40%       { transform: scale(1.3) rotate(-8deg); }
  70%       { transform: scale(0.9) rotate(4deg); }
}

/* ===== Progress Bar ===== */
.progress-bar-container {
  margin-bottom: 16px;
  position: relative;
}

.progress-bar-track {
  width: 100%;
  height: 14px;
  background: rgba(255,255,255,0.12);
  border-radius: 99px;
  overflow: visible;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--purple));
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 0%;
  box-shadow: 0 0 10px rgba(78,205,196,0.5);
}

.progress-rocket {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) translateX(-50%);
  font-size: 20px;
  transition: left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  left: 0%;
  filter: drop-shadow(0 2px 6px rgba(79,195,247,0.6));
  pointer-events: none;
}

/* ===== Level Overlay ===== */
.level-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,12,42,0.92);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popIn 0.3s ease;
}

.level-overlay.hidden { display: none; }

.level-overlay-content {
  text-align: center;
}

.level-overlay-text {
  font-family: 'Fredoka One', cursive;
  font-size: 2.4rem;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255,217,61,0.8);
  line-height: 1.5;
}

/* ===== Quiz Card ===== */
.quiz-card {
  position: relative;
}

.present-section {
  text-align: center;
  margin-bottom: 8px;
}

.label-small {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 8px;
}

.present-word {
  font-family: 'Fredoka One', cursive;
  font-size: 2.4rem;
  font-weight: 400;
  color: var(--gold);
  background: rgba(255,217,61,0.12);
  border: 1px solid rgba(255,217,61,0.35);
  border-radius: 16px;
  padding: 14px 28px;
  display: inline-block;
  min-width: 200px;
  text-shadow: 0 0 12px rgba(255,217,61,0.4);
}

.arrow-down {
  text-align: center;
  font-size: 1.8rem;
  color: var(--teal);
  margin: 12px 0;
  text-shadow: 0 0 8px rgba(78,205,196,0.6);
}

/* ===== Form Groups ===== */
.forms-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
}

.form-group {
  border-radius: 16px;
  padding: 16px;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  background: rgba(255,255,255,0.07);
  border: 2px solid transparent;
  border-left-width: 4px;
}

.form-group.idle-blue   { border-left-color: var(--blue); background: rgba(79,195,247,0.08); }
.form-group.idle-purple { border-left-color: var(--purple); background: rgba(199,125,255,0.08); }

.form-group.correct {
  border-left-color: var(--green);
  background: rgba(6,255,165,0.08);
  box-shadow: 0 0 12px rgba(6,255,165,0.2);
}

.form-group.wrong {
  border-left-color: var(--red);
  background: rgba(255,107,107,0.08);
  animation: shake 0.4s ease;
}

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

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.blue-label   { color: var(--blue); }
.purple-label { color: var(--purple); }

.nummer {
  font-size: 1rem;
  font-weight: 900;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.subject-prefix {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text);
  min-width: 36px;
}

.verb-input {
  flex: 1;
  font-family: 'Nunito', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 10px 14px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: rgba(255,255,255,0.1);
  color: #ffffff;
  caret-color: var(--teal);
  min-height: 48px;
}

.verb-input::placeholder {
  color: rgba(255,255,255,0.35);
}

.verb-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79,195,247,0.25);
  background: rgba(255,255,255,0.14);
}

.verb-input:disabled {
  background: transparent;
  border-color: transparent;
  padding-left: 0;
  cursor: default;
  color: rgba(255,255,255,0.9);
}

.feedback {
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: 8px;
  min-height: 20px;
}

.feedback.correct-msg { color: var(--green); }
.feedback.wrong-msg   { color: var(--red); }

/* ===== Error / Hint Message ===== */
.error-msg {
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
  background: rgba(255,107,107,0.15);
  border: 1px solid rgba(255,107,107,0.4);
  color: var(--red);
}

.error-msg.hint {
  background: rgba(255,217,61,0.15);
  border-color: rgba(255,217,61,0.4);
  color: var(--gold);
}

.error-msg.hidden { display: none; }

/* ===== Buttons ===== */
.btn-row {
  display: flex;
  gap: 12px;
}

.btn {
  font-family: 'Nunito', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  padding: 14px 28px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
  flex: 1;
  min-height: 48px;
  color: white;
}

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

.btn.btn-big {
  width: 100%;
  font-size: 1.25rem;
  padding: 18px;
}

.btn.btn-primary {
  background: linear-gradient(135deg, #6C63FF, var(--teal));
  box-shadow: 0 4px 16px rgba(108,99,255,0.45);
}

.btn.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(108,99,255,0.65);
  transform: translateY(-2px);
}

.btn.btn-success {
  background: linear-gradient(135deg, var(--green), var(--teal));
  box-shadow: 0 4px 16px rgba(6,255,165,0.35);
}

.btn.btn-success:hover {
  box-shadow: 0 6px 24px rgba(6,255,165,0.55);
  transform: translateY(-2px);
}

.btn.btn-secondary {
  background: rgba(255,255,255,0.12);
  border: 1px solid var(--glass-border);
  color: var(--text);
}

.btn.btn-secondary:hover {
  background: rgba(255,255,255,0.2);
}

.btn.hidden { display: none; }

/* ===== Success Overlay ===== */
.success-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11,12,42,0.88);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popIn 0.3s ease;
  z-index: 10;
}

.success-overlay.hidden { display: none; }

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.success-content { text-align: center; }

.success-emoji {
  font-size: 80px;
  animation: spin 0.5s ease;
}

@keyframes spin {
  from { transform: rotate(-20deg) scale(0.5); }
  to   { transform: rotate(0deg)  scale(1); }
}

.success-text {
  font-family: 'Fredoka One', cursive;
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--green);
  margin-top: 12px;
  text-shadow: 0 0 12px rgba(6,255,165,0.6);
}

/* ===== Result Screen ===== */
.result-card {
  text-align: center;
}

.trophy {
  font-size: 80px;
  margin-bottom: 8px;
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

.result-card h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 2.4rem;
  font-weight: 400;
  color: var(--gold);
  margin-bottom: 12px;
}

.result-stars {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 8px;
  text-shadow: 0 0 12px rgba(255,217,61,0.5);
}

.result-badge {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--teal);
}

.result-score {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.result-list {
  text-align: left;
  margin-bottom: 28px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.result-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
}

.result-item.ok   { border-left: 3px solid var(--green); }
.result-item.fail { border-left: 3px solid var(--red); }

.result-item .icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.result-item .info { flex: 1; line-height: 1.5; }
.result-item .verb { font-weight: 900; font-size: 1rem; color: var(--gold); }
.result-item .item-stars { color: var(--gold); font-weight: 800; font-size: 0.9rem; }
.result-item .attempts { font-size: 0.78rem; color: var(--text-muted); }

.result-card .btn { margin-top: 8px; }
.result-card .btn + .btn { margin-top: 12px; }

/* ===== Responsive ===== */
@media (max-width: 420px) {
  .card { padding: 24px 16px; }
  .present-word { font-size: 1.9rem; }
  .title-glow { font-size: 2.6rem; }
  .info-boxes { flex-direction: column; }
  body { padding: 12px 16px 40px; }
}
