  :root {
    --bg: #eef6ff;
    --card: #ffffff;
    --ink: #253858;
    --accent: #4f8ef7;
    --good: #22b57d;
    --bad: #f76b6b;
    --shadow: 0 10px 24px rgba(37,56,88,0.12);
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, -apple-system, sans-serif;
    background: linear-gradient(160deg, #eef6ff 0%, #fef9f0 100%);
    color: var(--ink);
    min-height: 100vh;
  }
  .screen { display: none; min-height: 100vh; padding: 24px; }
  .screen.active { display: flex; flex-direction: column; align-items: center; }
  .wrap { max-width: 880px; width: 100%; }

  h1.title {
    font-size: 2.2rem;
    text-align: center;
    margin: 8px 0 4px;
  }
  h1.title span { color: var(--accent); }
  .subtitle { text-align: center; color: #6b7a99; margin-bottom: 28px; }

  .profile-row { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; margin-bottom: 24px; }
  .profile-card {
    background: var(--card); border-radius: 20px; padding: 18px; width: 140px;
    text-align: center; box-shadow: var(--shadow); cursor: pointer; border: 3px solid transparent;
    transition: transform .15s, border-color .15s;
  }
  .profile-card:hover { transform: translateY(-4px); border-color: var(--accent); }
  .avatar-circle {
    width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: 2.2rem; margin: 0 auto 10px; box-shadow: inset 0 -6px 10px rgba(0,0,0,0.08);
  }
  .profile-card .name { font-weight: 600; }
  .profile-card .stat { font-size: .78rem; color: #6b7a99; margin-top: 4px; }

  .btn {
    background: var(--accent); color: white; border: none; border-radius: 14px;
    padding: 12px 22px; font-size: 1rem; font-weight: 600; cursor: pointer;
    box-shadow: 0 6px 14px rgba(79,142,247,.35); transition: transform .1s;
  }
  .btn:hover { transform: translateY(-2px); }
  .btn.secondary { background: #e4ecfb; color: var(--accent); box-shadow: none; }
  .btn.good { background: var(--good); box-shadow: 0 6px 14px rgba(34,181,125,.35); }
  .center { text-align: center; }

  .card {
    background: var(--card); border-radius: 22px; padding: 26px; box-shadow: var(--shadow); width: 100%;
  }

  .avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin: 18px 0; }
  .avatar-pick {
    width: 100%; aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; cursor: pointer; border: 3px solid transparent; box-shadow: inset 0 -4px 8px rgba(0,0,0,0.08);
  }
  .avatar-pick.selected { border-color: var(--ink); transform: scale(1.08); }

  input[type=text] {
    width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid #dde6f7; font-size: 1rem; margin: 10px 0;
  }

  header.top {
    width: 100%; max-width: 880px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
  }
  .top .who { display: flex; align-items: center; gap: 10px; }
  .top .avatar-circle { width: 46px; height: 46px; font-size: 1.4rem; margin: 0; }
  .badge-count { background: #fff2cc; color: #92730a; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: .85rem; }

  .subject-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; width: 100%; }
  .subject-card {
    border-radius: 20px; padding: 18px; color: white; cursor: pointer; box-shadow: var(--shadow);
    transition: transform .15s; position: relative; overflow: hidden;
  }
  .subject-card:hover { transform: translateY(-4px) scale(1.02); }
  .subject-card .emoji { font-size: 2.4rem; }
  .subject-card .sname { font-weight: 700; font-size: 1.05rem; margin-top: 6px; }
  .subject-card .mascot { font-size: .78rem; opacity: .9; margin-top: 2px; }
  .progress-bar { height: 8px; background: rgba(255,255,255,.35); border-radius: 999px; margin-top: 12px; overflow: hidden; }
  .progress-fill { height: 100%; background: white; border-radius: 999px; }

  .quiz-q { font-size: 1.2rem; font-weight: 600; margin-bottom: 18px; }
  .choice {
    display: block; width: 100%; text-align: left; padding: 14px 16px; margin-bottom: 10px; border-radius: 14px;
    border: 2px solid #dde6f7; background: white; font-size: 1rem; cursor: pointer;
  }
  .choice:hover { background: #f3f7ff; }
  .choice.correct { background: #e3f9ef; border-color: var(--good); }
  .choice.wrong { background: #fdeaea; border-color: var(--bad); }
  .feedback { margin-top: 14px; font-weight: 600; }
  .feedback.good { color: var(--good); }
  .feedback.bad { color: var(--bad); }
  .quiz-progress { color: #6b7a99; font-size: .85rem; margin-bottom: 6px; }

  .badge-shelf { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
  .badge-pill {
    display: flex; align-items: center; gap: 8px; background: #fff8e6; border: 2px solid #ffe4a3;
    border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: .85rem;
  }
  .fireworks {
    position: fixed; inset: 0; pointer-events: none; display: flex; align-items: center; justify-content: center;
    font-size: 4rem; z-index: 50; animation: pop .9s ease-out forwards;
  }
  @keyframes pop { 0% { transform: scale(0.3); opacity: 0; } 40% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }

  .link-btn { background: none; border: none; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; }
  .row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }

/* --- extra styles for the deployed version --- */
.auth-tabs{display:flex;gap:8px;margin-bottom:16px;}
.auth-tab{flex:1;padding:10px;text-align:center;border-radius:12px;background:#e4ecfb;color:var(--accent);font-weight:600;cursor:pointer;}
.auth-tab.active{background:var(--accent);color:white;}
.error-msg{color:var(--bad);font-weight:600;margin-top:8px;}
.loading{text-align:center;color:#6b7a99;padding:40px;}
