/* ---------- Harriet's Word Safari ---------- */

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

:root {
  --green: #2eb872;
  --green-dark: #1f8f57;
  --green-soft: #e3f7ec;
  --orange: #ff8a3d;
  --orange-dark: #e06a1c;
  --orange-soft: #fff0e3;
  --ink: #3b3024;
  --ink-soft: #7a6a55;
  --card: #fffdf7;
}

html, body { height: 100%; }

button { -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Fredoka', 'Comic Sans MS', sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #cdeffd 0%, #fdf3d8 55%, #d8f3dc 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.screen {
  width: 100%;
  max-width: 600px;
  padding: 24px 16px 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hidden { display: none !important; }

.card {
  background: var(--card);
  border-radius: 28px;
  box-shadow: 0 10px 30px rgba(80, 60, 20, 0.15);
  padding: 28px 24px;
  width: 100%;
  text-align: center;
}

/* ---------- Start screen ---------- */

.start-card { margin-top: 6vh; }

.start-mascots span {
  font-size: 44px;
  display: inline-block;
  margin: 0 4px;
}

.bob { animation: bob 1.6s ease-in-out infinite; }

/* The hand-drawn capybara (no emoji exists for the world's chillest rodent) */
.capy { display: inline-block; vertical-align: bottom; }
.capy svg { display: block; }
.start-capy svg { width: 88px; height: auto; margin: 0 2px; }
.parade .capy svg { width: 68px; height: auto; }
.mascot svg { width: 92px; height: auto; margin: 0 auto 4px; }
.result-mascots span svg { width: 58px; height: auto; }

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

h1 {
  font-size: clamp(34px, 9vw, 52px);
  font-weight: 700;
  line-height: 1.05;
  margin: 12px 0 14px;
  background: linear-gradient(90deg, var(--green-dark), var(--orange-dark));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  font-size: 17px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 22px;
}

.word-count {
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink-soft);
}

.big-btn {
  font-family: inherit;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, var(--green), var(--green-dark));
  border: none;
  border-radius: 999px;
  padding: 14px 34px;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--green-dark), 0 10px 18px rgba(46, 184, 114, 0.35);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

/* Hover effects only on devices with a real pointer — on touch screens the
   last tapped spot keeps its hover state, which made the same position
   look pre-selected on the next question */
@media (hover: hover) {
  .big-btn:hover { transform: translateY(-2px); }
}

.big-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--green-dark);
}

/* Walking animal parade along the bottom */
.parade {
  position: fixed;
  bottom: 8px;
  left: 0;
  width: 100%;
  height: 64px;
  overflow: hidden;
  pointer-events: none;
}

.parade span {
  position: absolute;
  bottom: 0;
  left: -80px;
  font-size: 46px;
  animation-name: walk;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes walk {
  0%   { transform: translateX(0) scaleX(-1); }
  49%  { transform: translateX(calc(100vw + 90px)) scaleX(-1); }
  50%  { transform: translateX(calc(100vw + 90px)) scaleX(1); }
  100% { transform: translateX(0) scaleX(1); }
}

/* ---------- Quiz screen ---------- */

.progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.progress .paw {
  font-size: 20px;
  line-height: 1;
  padding: 6px;
  border-radius: 50%;
  filter: grayscale(1);
  opacity: 0.35;
  transition: all 0.3s ease;
}

.progress .paw.current { opacity: 0.8; transform: scale(1.15); }

.progress .paw.right {
  filter: none;
  opacity: 1;
  background: var(--green-soft);
  box-shadow: 0 0 0 2px var(--green);
}

.progress .paw.wrong {
  filter: none;
  opacity: 1;
  background: var(--orange-soft);
  box-shadow: 0 0 0 2px var(--orange);
}

.mascot {
  font-size: 58px;
  line-height: 1;
  margin-bottom: 6px;
  display: inline-block;
  animation: bob 2s ease-in-out infinite;
}

.mascot.happy { animation: jump 0.6s ease; }

@keyframes jump {
  0%   { transform: translateY(0) rotate(0); }
  30%  { transform: translateY(-26px) rotate(-12deg); }
  60%  { transform: translateY(0) rotate(8deg); }
  80%  { transform: translateY(-8px) rotate(0); }
  100% { transform: translateY(0); }
}

.prompt {
  color: var(--ink-soft);
  font-size: 15px;
  margin-bottom: 10px;
}

.word-box {
  font-size: clamp(30px, 8vw, 42px);
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 3px dashed var(--green);
  border-radius: 18px;
  padding: 12px 18px;
  margin-bottom: 20px;
}

.options {
  display: grid;
  gap: 10px;
  text-align: left;
}

.option {
  font-family: inherit;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
  border: 2px solid #e8dfd0;
  border-radius: 16px;
  padding: 13px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.option .letter {
  flex: 0 0 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (hover: hover) {
  .option:hover:not(:disabled) {
    transform: translateY(-2px);
    border-color: var(--green);
  }
}

.option:disabled { cursor: default; }

.option.correct {
  background: var(--green-soft);
  border-color: var(--green);
  animation: pulse 0.5s ease;
}

.option.correct .letter { background: var(--green); color: #fff; }

.option.wrong {
  background: var(--orange-soft);
  border-color: var(--orange);
  animation: shake 0.45s ease;
}

.option.wrong .letter { background: var(--orange); color: #fff; }

.option.faded { opacity: 0.45; }

@keyframes pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

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

.praise {
  margin-top: 16px;
  font-size: 22px;
  font-weight: 700;
  color: var(--green-dark);
  animation: pop 0.4s ease;
}

@keyframes pop {
  0%   { transform: scale(0.4); opacity: 0; }
  70%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- Wrong-answer pop-up ---------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(59, 48, 36, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 40;
}

.modal-card {
  background: var(--card);
  border: 3px solid var(--orange);
  border-radius: 24px;
  padding: 24px 22px 20px;
  width: min(92vw, 480px);
  max-height: 88vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  animation: pop 0.35s ease;
}

.modal-title {
  font-weight: 700;
  font-size: 22px;
  color: var(--orange-dark);
  margin-bottom: 10px;
}

.modal-word { font-size: 20px; margin-bottom: 6px; }
.modal-word strong { color: var(--green-dark); font-size: 24px; }

.modal-def {
  font-size: 19px;
  font-weight: 600;
  background: var(--green-soft);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 10px;
}

.modal-example {
  font-size: 16px;
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 14px;
}

.modal-example strong { color: var(--orange-dark); }

/* A perfectly still capybara supervises the reading */
.modal-capy { margin-bottom: 4px; }
.modal-capy svg { width: 68px; height: auto; display: block; margin: 0 auto; }
.modal-capy.hop svg { animation: jump 0.6s ease; }

/* The Very Naughty Capybara's telling-off */
.modal-card.naughty {
  border-color: #d9534f;
  animation: pop 0.35s ease, wiggle 0.5s ease 0.35s;
}

.modal-card.naughty .modal-title { color: #c0392b; }
.modal-card.naughty .modal-capy svg { width: 84px; }

.modal-scold {
  font-size: 16px;
  font-weight: 600;
  color: #c0392b;
  background: #fdecea;
  border-radius: 14px;
  padding: 9px 14px;
  margin-bottom: 10px;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-1.5deg); }
  75% { transform: rotate(1.5deg); }
}

.retest-text {
  font-size: 17px;
  line-height: 1.5;
  margin-bottom: 18px;
}

.result-note {
  font-size: 16px;
  color: var(--green-dark);
  font-weight: 600;
  margin: -8px 0 20px;
}

.big-btn:disabled {
  background: #b9b2a6;
  box-shadow: 0 6px 0 #9a937f;
  cursor: default;
  transform: none;
}

/* While locked, the button slowly fills with green to show reading time
   passing — calm enough not to pull her eyes off the explanation */
.big-btn.locked,
.big-btn.locked:hover {
  background-color: #b9b2a6;
  background-image: linear-gradient(180deg, var(--green), var(--green-dark));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  box-shadow: 0 6px 0 #9a937f;
  transform: none;
  animation-name: btn-fill;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes btn-fill {
  to { background-size: 100% 100%; }
}

/* ---------- Result screen ---------- */

.result-card { margin-top: 5vh; }

.result-mascots span {
  font-size: 40px;
  display: inline-block;
  margin: 0 3px;
  animation: pop 0.5s ease backwards;
}

h2 {
  font-size: 30px;
  font-weight: 700;
  margin: 10px 0 16px;
  color: var(--green-dark);
}

.score-circle {
  width: 130px;
  height: 130px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--green), var(--green-dark));
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(46, 184, 114, 0.4);
  animation: pop 0.5s ease;
}

.score-circle span { font-size: 48px; font-weight: 700; line-height: 1; }
.score-circle small { font-size: 14px; opacity: 0.9; }

.result-message {
  font-size: 19px;
  margin-bottom: 20px;
  line-height: 1.4;
}

.missed {
  text-align: left;
  background: var(--orange-soft);
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 20px;
}

.missed h3 { font-size: 17px; margin-bottom: 10px; color: var(--orange-dark); }

.missed li {
  list-style: none;
  margin-bottom: 10px;
  font-size: 15px;
  line-height: 1.4;
}

.missed li strong { color: var(--orange-dark); }
.missed li em { color: var(--ink-soft); display: block; font-size: 14px; }

/* ---------- Confetti ---------- */

#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}

#confetti span {
  position: absolute;
  top: -50px;
  font-size: 26px;
  animation: fall linear forwards;
}

@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); }
}

@media (max-width: 420px) {
  .card { padding: 22px 16px; }
  .option { font-size: 15.5px; }
}
