/* 4kids.cybersecq.com — Junior Agent Academy design system
   Palette: sky #EAF3FF · ink #1E2A4A · grape #5B7CFA→#8A5CF6 · sun #FFC93C · mint #2FBF8F · coral #FF6B6B */
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@600;700&family=Nunito:ital,wght@0,400;0,700;0,900&display=swap');

:root {
  --sky: #EAF3FF; --ink: #1E2A4A; --muted: #5B6B8C;
  --grape1: #5B7CFA; --grape2: #8A5CF6;
  --sun: #FFC93C; --mint: #2FBF8F; --coral: #FF6B6B;
  --card: #ffffff; --radius: 20px;
  --shadow: 0 6px 18px rgba(30, 42, 74, .10);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Nunito', 'Segoe UI', sans-serif;
  background: var(--sky); color: var(--ink);
  padding: 12px; line-height: 1.55; min-height: 100vh;
}
.wrap { max-width: 980px; margin: 0 auto; }
h1, h2, h3, .btn, .lang-btn { font-family: 'Comfortaa', 'Nunito', sans-serif; }
h1 { font-size: clamp(1.4rem, 4.5vw, 2.2rem); }
h2 { font-size: clamp(1.15rem, 3.5vw, 1.5rem); margin-bottom: 10px; }
h3 { margin-bottom: 8px; }
p { margin-bottom: 8px; }
ul { margin: 0 0 10px 22px; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.home-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); color: var(--ink); text-decoration: none;
  padding: 10px 16px; border-radius: 999px; font-weight: 900;
  box-shadow: var(--shadow); min-height: 48px;
}
.star-pill {
  background: var(--sun); color: #6b4d00; padding: 10px 16px;
  border-radius: 999px; font-weight: 900; box-shadow: var(--shadow); min-height: 48px;
  display: inline-flex; align-items: center;
}
.lang-switch { display: inline-flex; background: var(--card); border-radius: 999px; box-shadow: var(--shadow); overflow: hidden; }
.lang-btn {
  border: 0; background: transparent; padding: 12px 16px; cursor: pointer;
  font-weight: 700; font-size: 0.95rem; color: var(--muted); min-height: 48px; min-width: 56px;
}
.lang-btn.active { background: linear-gradient(135deg, var(--grape1), var(--grape2)); color: #fff; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--grape1), var(--grape2));
  color: #fff; border-radius: var(--radius); padding: 26px 20px;
  text-align: center; box-shadow: var(--shadow); margin-bottom: 20px;
}
.hero p { opacity: .92; margin-top: 6px; }
.hero a { color: #fff; }

/* Cards */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }

.module {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  text-align: center; box-shadow: var(--shadow); position: relative;
  display: flex; flex-direction: column; gap: 6px;
  transition: transform .2s ease;
}
.module:hover { transform: translateY(-4px); }
.module .icon { font-size: 2.4rem; }
.module .desc { color: var(--muted); font-size: .92rem; flex: 1; }
.module.locked { opacity: .55; filter: grayscale(.4); }
.module.locked::after {
  content: '🔒'; position: absolute; top: 10px; right: 12px; font-size: 1.4rem;
}
.badge { border-radius: 999px; padding: 4px 12px; font-size: .8rem; font-weight: 900; align-self: center; }
.badge.todo { background: #eef2fb; color: var(--muted); }
.badge.done { background: #d9f6ea; color: #0d7a54; }

.level {
  border-left: 6px solid var(--grape1); background: #f6f9ff;
  border-radius: 14px; padding: 16px; margin-bottom: 20px;
}
.level.l2 { border-color: var(--sun); }
.level.l3 { border-color: var(--coral); }
.level h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(135deg, var(--grape1), var(--grape2)); color: #fff;
  border: 0; border-radius: 999px; padding: 12px 22px; font-size: 1rem; font-weight: 700;
  cursor: pointer; text-decoration: none; min-height: 48px;
  transition: transform .15s ease; touch-action: manipulation;
}
.btn:hover { transform: scale(1.04); }
.btn:focus-visible, .lang-btn:focus-visible, .choice:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.btn.ghost { background: #eef2fb; color: var(--ink); }
.btn.good { background: var(--mint); }
.btn.bad { background: var(--coral); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Inputs */
input[type=text], input[type=password] {
  width: 100%; max-width: 360px; padding: 13px 14px; font-size: 1rem;
  border: 2px solid #d6e0f5; border-radius: 12px; margin: 8px 0; font-family: inherit;
}
input:focus { outline: 3px solid var(--sun); border-color: var(--grape1); }

/* Choice buttons (quizzes) */
.choice {
  display: block; width: 100%; text-align: left; background: #f6f9ff;
  border: 2px solid #d6e0f5; border-radius: 14px; padding: 14px; margin: 8px 0;
  font-size: 1rem; font-family: inherit; cursor: pointer; min-height: 48px;
  transition: border-color .15s ease, background .15s ease;
}
.choice:hover { border-color: var(--grape1); }
.choice.right { background: #d9f6ea; border-color: var(--mint); }
.choice.wrong { background: #ffe3e3; border-color: var(--coral); }

/* Feedback */
.feedback { font-weight: 900; margin: 8px 0; min-height: 1.4em; }
.feedback.ok { color: #0d7a54; }
.feedback.no { color: #c0392b; }
.hint-text { display: none; color: var(--muted); font-style: italic; background: #fff8e1; border-radius: 12px; padding: 12px; margin-top: 8px; }
.hint-text.show { display: block; }

/* Progress */
.pbar { background: #dfe8fa; border-radius: 999px; height: 16px; overflow: hidden; margin: 12px 0; }
.pbar > div { background: linear-gradient(90deg, var(--mint), var(--grape1)); height: 100%; width: 0; border-radius: 999px; transition: width .5s ease; }

/* Win box */
#winBox { text-align: center; border: 3px solid var(--sun); background: #fffbea; }
#winBox h2 { color: #a06a00; }

/* Confetti */
.confetti {
  position: fixed; top: -40px; z-index: 999; pointer-events: none;
  animation: fall 2.6s ease-in forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: .6; }
}
@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
  .module, .btn { transition: none; }
}

/* Chat bubbles (Chat Guardian) */
.chat-log { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.bubble { max-width: 85%; padding: 12px 14px; border-radius: 16px; }
.bubble.them { background: #eef2fb; align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.me { background: linear-gradient(135deg, var(--grape1), var(--grape2)); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

/* Color boxes */
.color-box { width: 92px; height: 92px; border-radius: 16px; display: inline-block; margin: 6px; cursor: pointer; border: 3px solid #fff; box-shadow: var(--shadow); }

.footer { text-align: center; color: var(--muted); padding: 20px 8px; font-size: .9rem; }
.footer a { color: var(--grape1); }

.big-emoji { font-size: 2rem; }
.mono { font-family: 'Courier New', monospace; font-weight: bold; background: #f0f2f8; padding: 2px 8px; border-radius: 8px; }

@media (max-width: 560px) {
  body { padding: 8px; }
  .topbar { justify-content: center; }
  .grid { grid-template-columns: 1fr; }
  .color-box { width: 76px; height: 76px; }
}
