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

:root {
  --purple: #7c5cff;
  --purple-dark: #5b3df0;
  --teal: #21c8a5;
  --amber: #ffb742;
  --red: #ff6b81;
  --ink: #2d2a45;
  --ink-soft: #6b678a;
  --card: #ffffff;
}

body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background: linear-gradient(160deg, #f3efff 0%, #e7f8f3 55%, #fff6e8 100%);
  background-attachment: fixed;
}

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

.hidden { display: none !important; }

.screen { max-width: 560px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }

.card {
  background: var(--card);
  border-radius: 22px;
  box-shadow: 0 8px 28px rgba(90, 70, 180, .12);
  padding: 1.6rem;
}

h1 { font-weight: 900; font-size: 1.5rem; }
.sub { color: var(--ink-soft); margin: .4rem 0 1rem; }

.btn {
  font-family: inherit; font-weight: 800; font-size: 1.05rem;
  border: none; border-radius: 16px; padding: .85rem 1.4rem;
  cursor: pointer; transition: transform .08s;
}
.btn:active { transform: scale(.96); }
.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: #fff; box-shadow: 0 5px 14px rgba(124, 92, 255, .35);
}
.btn-ghost { background: transparent; color: var(--purple-dark); padding: .5rem .6rem; }
.btn:disabled { opacity: .45; cursor: default; }

input {
  font-family: inherit; font-size: 1.3rem; font-weight: 700;
  border: 3px solid #e4e0f5; border-radius: 16px;
  padding: .8rem 1rem; width: 100%; color: var(--ink);
  outline: none;
}
input:focus { border-color: var(--purple); }

/* Login */
.login-card { margin-top: 14vh; text-align: center; }
.mascot { font-size: 3.5rem; }
#login-form { display: grid; gap: .8rem; margin-top: 1rem; }
.error { color: var(--red); font-weight: 700; margin-top: .8rem; }

/* Map */
.map-header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.badges { display: flex; gap: .5rem; }
.badge {
  background: #fff; border-radius: 999px; padding: .35rem .75rem;
  font-size: .95rem; box-shadow: 0 3px 10px rgba(90, 70, 180, .12);
  white-space: nowrap;
}

.trail { list-style: none; margin-top: 1rem; position: relative; }
.trail::before {
  content: ''; position: absolute; left: 27px; top: 10px; bottom: 10px;
  width: 6px; border-radius: 3px; background: #ded9f2;
}
.trail li {
  position: relative; display: flex; align-items: center; gap: .9rem;
  padding: .45rem 0 .45rem 0;
}
.node {
  width: 60px; height: 60px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 900; font-size: 1.15rem;
  z-index: 1; border: 4px solid #fff;
  box-shadow: 0 4px 12px rgba(90, 70, 180, .18);
}
.trail .done .node { background: var(--teal); color: #fff; }
.trail .current .node {
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: #fff; animation: pulse 1.6s infinite;
}
.trail .locked .node { background: #e9e6f6; color: #b4aed4; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 92, 255, .45); }
  50% { box-shadow: 0 0 0 12px rgba(124, 92, 255, 0); }
}
.node-info { flex: 1; }
.node-label { font-weight: 800; }
.trail .locked .node-label { color: #b4aed4; }
.node-stars { color: var(--amber); letter-spacing: 2px; }
.trail .btn-primary { padding: .55rem 1.1rem; font-size: .95rem; }

/* Play */
.play-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; gap: .4rem;
}
.block-title { font-weight: 900; text-align: center; }
.dots { display: flex; gap: 5px; justify-content: center; margin-top: .35rem; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #ded9f2; }
.dot.done { background: var(--teal); }
.dot.now { background: var(--purple); animation: pulse 1.6s infinite; }

.play-card { text-align: center; }
.question { font-size: 2.1rem; font-weight: 900; margin: .6rem 0 1.2rem; }
#answer-form { display: grid; gap: .8rem; }
#answer { text-align: center; font-size: 1.6rem; }

.feedback { min-height: 2.2rem; margin-top: 1rem; font-weight: 800; font-size: 1.1rem; }
.feedback.good { color: var(--teal); }
.feedback.bad { color: var(--red); }
.feedback.nudge { color: var(--amber); }
.feedback .hint-text {
  display: block; margin-top: .5rem; font-weight: 600; color: var(--ink-soft);
  font-size: .98rem;
}

.shake { animation: shake .4s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.howto {
  margin-top: 1.2rem; text-align: left; background: #f6f4ff;
  border-radius: 14px; padding: .8rem 1rem;
}
.howto summary { font-weight: 800; cursor: pointer; color: var(--purple-dark); }
.howto pre {
  background: #fff; border-radius: 10px; padding: .7rem .9rem; margin: .6rem 0;
  white-space: pre-wrap; font-size: .92rem; line-height: 1.5;
}
.howto p { margin: .5rem 0; line-height: 1.5; }

/* Block done */
.done-card { text-align: center; margin-top: 1rem; }
.done-emoji { font-size: 3.2rem; }
.stars-big { font-size: 2.4rem; letter-spacing: 6px; margin: .5rem 0; }
.done-card p { color: var(--ink-soft); margin-bottom: 1.2rem; }

@media (max-width: 420px) {
  .question { font-size: 1.7rem; }
  h1 { font-size: 1.25rem; }
}
