/* ============================================================
   TABLICZKA MNOŻENIA – główny arkusz stylów
   Motyw: kosmiczna przygoda, żywe kolory, przyjazne dzieciom
   ============================================================ */

/* --- Zmienne koloru i typografii --- */
:root {
  --bg:        #0d0d2b;
  --surface:   #1a1a4e;
  --card:      #22226a;
  --accent:    #f7c948;
  --green:     #4ade80;
  --red:       #f87171;
  --blue:      #60a5fa;
  --text:      #f0f0ff;
  --muted:     #9090cc;
  --radius:    18px;
  --font-head: 'Fredoka One', cursive;
  --font-body: 'Nunito', sans-serif;
}

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

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

/* --- Animowane gwiazdki w tle --- */
.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  animation: twinkle var(--d, 3s) infinite alternate;
  opacity: 0;
}
@keyframes twinkle {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: var(--op, 0.8); transform: scale(1.2); }
}

/* --- Layout --- */
.container {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

h1 {
  font-family: var(--font-head);
  font-size: clamp(2rem, 6vw, 3rem);
  text-align: center;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(247,201,72,0.5);
  margin-bottom: 2rem;
  letter-spacing: 1px;
}

/* --- Panele --- */
.config-panel,
.game-panel,
.victory-panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.07);
}

.hidden { display: none !important; }

/* --- Config --- */
.config-panel h2 {
  font-family: var(--font-head);
  font-size: 1.4rem;
  color: var(--blue);
  margin-bottom: 1.5rem;
  text-align: center;
}

.config-row {
  margin-bottom: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.config-row label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--muted);
}
.range-inputs {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.range-inputs span { font-size: 1.3rem; font-weight: 900; color: var(--accent); }

input[type="number"],
input[type="text"] {
  background: var(--card);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.6rem 0.9rem;
  transition: border-color 0.2s;
  width: 100%;
}
.range-inputs input[type="number"] { width: 80px; text-align: center; }

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(247,201,72,0.2);
}

/* --- Statystyki --- */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
}
.stats span {
  background: var(--card);
  border-radius: 30px;
  padding: 0.35rem 0.9rem;
}

/* --- Pytanie --- */
.question-box {
  text-align: center;
  margin-bottom: 1.5rem;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
}
.question {
  font-family: var(--font-head);
  font-size: clamp(2.5rem, 10vw, 4rem);
  color: var(--accent);
  line-height: 1.1;
  transition: transform 0.15s;
}
.question.pop {
  animation: pop 0.3s ease;
}
@keyframes pop {
  0%   { transform: scale(0.8); opacity: 0; }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

/* --- Reakcja --- */
.reaction {
  font-size: 1.3rem;
  font-weight: 700;
  min-height: 2rem;
  transition: opacity 0.3s;
}
.reaction.correct { color: var(--green); }
.reaction.wrong   { color: var(--red); }

/* --- Rząd odpowiedzi --- */
.answer-row {
  display: flex;
  gap: 0.7rem;
  margin-bottom: 1rem;
}
.answer-row input {
  flex: 1;
  font-size: 1.2rem;
  text-align: center;
  font-weight: 900;
}

/* --- Przyciski --- */
.btn {
  font-family: var(--font-head);
  font-size: 1.1rem;
  border: none;
  border-radius: 12px;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s, filter 0.2s;
  letter-spacing: 0.5px;
}
.btn:hover  { filter: brightness(1.15); transform: translateY(-2px); }
.btn:active { transform: translateY(0); box-shadow: none; }

.btn-start {
  display: block;
  width: 100%;
  margin-top: 1.2rem;
  background: var(--accent);
  color: #1a1a00;
  font-size: 1.3rem;
  padding: 1rem;
  box-shadow: 0 6px 20px rgba(247,201,72,0.4);
}
.btn-check {
  background: var(--green);
  color: #003300;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(74,222,128,0.4);
}
.btn-reset {
  display: block;
  width: 100%;
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 0.9rem;
  margin-top: 0.3rem;
}

/* --- Victory --- */
.victory-panel {
  text-align: center;
  animation: fadeIn 0.6s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}
.trophy {
  font-size: 5rem;
  animation: bounce 1s infinite alternate;
}
@keyframes bounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-12px); }
}
.victory-panel h2 {
  font-family: var(--font-head);
  font-size: 2.2rem;
  color: var(--accent);
  margin: 0.5rem 0;
}
.victory-sub { color: var(--muted); margin-bottom: 1rem; }
.mission-reward {
  background: var(--card);
  border-radius: 14px;
  padding: 1rem 1.5rem;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--blue);
  margin-bottom: 1.5rem;
  display: none;
}
.mission-reward.visible { display: block; }

/* --- Konfetti --- */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -20px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* --- Info section --- */
.info-section {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 2rem auto 3rem;
  padding: 0 1.5rem;
}
.info-section h3 {
  font-family: var(--font-head);
  color: var(--blue);
  font-size: 1.3rem;
  margin: 1.5rem 0 0.7rem;
}
.info-section p { color: var(--muted); line-height: 1.7; font-size: 0.95rem; }
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-bottom: 0.5rem;
}
.info-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.05);
}
.info-card strong { color: var(--text); }

.footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.8rem;
  color: rgba(144,144,204,0.5);
}

/* --- Responsywność --- */
@media (max-width: 480px) {
  .info-grid { grid-template-columns: 1fr; }
  .answer-row { flex-direction: column; }
  .btn-check { width: 100%; }
}
