    /* ── SCREENS ── */
    .screen {
      display: none;
      height: 100vh;
      width: 100%;
      flex-direction: column;
      position: relative;
    }

    .screen.active {
      display: flex;
    }

    /* ── AUTH SCREENS ── */
    :root { --auth-c0: #0C2A52; --auth-c1: #154488; --auth-c2: #1E5AA6; }
    #auth-screen {
      background: linear-gradient(165deg, var(--auth-c0) 0%, var(--auth-c1) 55%, var(--auth-c2) 100%);
      align-items: center;
      justify-content: center;
      padding: 24px;
      overflow: hidden;
    }

    #auth-screen::before {
      content: "";
      position: absolute;
      inset: 0;
      pointer-events: none;
      background: radial-gradient(circle at 50% 12%, rgba(255, 255, 255, .22) 0%, transparent 45%);
    }

    #auth-screen>* {
      position: relative;
      z-index: 1;
    }

    @keyframes setupBounce {

      0%,
      100% {
        transform: translateY(0) rotate(-3deg);
      }

      50% {
        transform: translateY(-8px) rotate(3deg);
      }
    }

    .auth-logo {
      font-size: 56px;
      margin-bottom: 8px;
      text-align: center;
      filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .15));
      animation: setupBounce 2.5s ease-in-out infinite;
    }

    .auth-logo-img {
      width: 156px;
      max-width: 46vw;
      height: auto;
      display: block;
      margin: 0 auto;
      filter: drop-shadow(0 4px 18px rgba(0,0,0,.35));
    }

    .auth-credits {
      font-family: var(--display);
      font-weight: 900;
      font-size: 15px;
      color: #fff;
      text-align: center;
      line-height: 1.5;
      max-width: 300px;
      text-shadow: 0 2px 14px rgba(6, 24, 50, .45);
      letter-spacing: .01em;
    }

    @keyframes goodJobPop {
      0%   { transform: translate(-50%, -50%) scale(.5); opacity: 0; }
      55%  { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
      75%  { transform: translate(-50%, -50%) scale(.97); }
      100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    }

    .goodjob-overlay {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%) scale(.5);
      z-index: 12000;
      pointer-events: none;
      animation: goodJobPop .45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
      text-align: center;
    }

    .goodjob-box {
      background: linear-gradient(135deg, #0ea5e9, #0284c7);
      border: 3px solid #FFC83D;
      border-radius: 24px;
      padding: 22px 38px;
      box-shadow: 0 0 40px rgba(14,165,233,.55), 0 8px 32px rgba(0,0,0,.45);
    }

    .goodjob-title {
      font-family: var(--display);
      font-size: 38px;
      font-weight: 900;
      color: #FFC83D;
      letter-spacing: -.5px;
      text-shadow: 0 2px 12px rgba(0,0,0,.35);
    }

    .goodjob-sub {
      font-family: var(--display);
      font-size: 22px;
      font-weight: 700;
      color: #fff;
      margin-top: 6px;
    }

    /* Bigger, more prominent +stat floats shown immediately on purchase */
    .float-big {
      font-size: 54px !important;
      font-weight: 900 !important;
      font-family: var(--display) !important;
      letter-spacing: -1px !important;
      text-shadow: 0 4px 0 rgba(0,0,0,.35), 0 0 32px rgba(34,197,94,.95), 0 0 60px rgba(34,197,94,.5) !important;
      animation: floatBigPop 2.2s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
      pointer-events: none !important;
    }
    @keyframes floatBigPop {
      0%   { opacity:0; transform: scale(0.4) translateY(0); }
      12%  { opacity:1; transform: scale(1.35) translateY(-8px); }
      22%  { transform: scale(0.95) translateY(-16px); }
      35%  { transform: scale(1.08) translateY(-26px); opacity: 1; }
      80%  { transform: scale(1.0)  translateY(-70px); opacity: 1; }
      100% { transform: scale(0.9)  translateY(-110px); opacity: 0; }
    }

    /* Discount choice menu — appears before minigame launches */
    @keyframes discountMenuIn {
      0%   { opacity: 0; transform: translateY(18px) scale(.92); }
      100% { opacity: 1; transform: translateY(0) scale(1); }
    }
    .discount-menu-overlay {
      position: fixed; top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0,0,0,.58); backdrop-filter: blur(4px);
      z-index: 11500; display: flex; align-items: center; justify-content: center;
    }
    .discount-menu-box {
      background: linear-gradient(145deg, #0f3460, #0a2240);
      border: 2.5px solid rgba(255,200,61,.65);
      border-radius: 26px; padding: 30px 28px 26px;
      box-shadow: 0 0 60px rgba(14,165,233,.35), 0 14px 48px rgba(0,0,0,.65);
      text-align: center; max-width: 310px; width: 86%;
      animation: discountMenuIn .3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }
    .discount-menu-icon { font-size: 42px; margin-bottom: 6px; }
    .discount-menu-title {
      font-family: var(--display); font-size: 24px; font-weight: 900; color: #FFC83D;
      margin-bottom: 8px;
    }
    .discount-menu-sub {
      font-family: var(--display); font-size: 14px; color: rgba(255,255,255,.82);
      margin-bottom: 22px; line-height: 1.5;
    }
    .discount-menu-btns { display: flex; flex-direction: column; gap: 10px; }
    .discount-play-btn {
      background: linear-gradient(145deg, #22c55e, #16a34a);
      color: #fff; font-family: var(--display); font-weight: 900; font-size: 17px;
      padding: 14px 20px; border-radius: 18px; border: 2px solid rgba(255,255,255,.35);
      box-shadow: 0 5px 0 #0f7a2a, 0 8px 24px rgba(34,197,94,.45);
      cursor: pointer; transition: transform .12s, box-shadow .12s; width: 100%;
    }
    .discount-play-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #0f7a2a; }
    .discount-skip-btn {
      background: rgba(255,255,255,.08);
      color: rgba(255,255,255,.65); font-family: var(--display); font-weight: 700; font-size: 14px;
      padding: 10px 18px; border-radius: 14px; border: 1.5px solid rgba(255,255,255,.18);
      cursor: pointer; transition: opacity .15s; width: 100%;
    }
    .discount-skip-btn:active { opacity: .6; }

    .auth-title {
      font-size: 38px;
      font-weight: 900;
      color: #fff;
      letter-spacing: -.5px;
      text-align: center;
      font-family: var(--display);
      text-shadow: 0 2px 14px rgba(6, 24, 50, .45);
    }

    .auth-subtitle {
      font-size: 15px;
      color: rgba(231, 240, 255, .9);
      margin-top: 6px;
      font-weight: 700;
      text-align: center;
    }

    .auth-card {
      width: 100%;
      max-width: 380px;
      margin-top: 24px;
      background: rgba(18, 48, 88, .52);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-radius: var(--radius-lg);
      padding: 24px 22px;
      border: 1px solid var(--border-strong);
      box-shadow: 0 24px 60px rgba(0, 12, 32, .45);
    }

    .auth-btn-group {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .auth-main-btn {
      width: 100%;
      padding: 16px;
      border: none;
      border-radius: var(--radius-md);
      font-size: 17px;
      font-weight: 900;
      cursor: pointer;
      transition: transform .15s var(--ease-bounce), box-shadow .15s;
      font-family: var(--display);
    }

    .auth-main-btn:active {
      transform: scale(.97);
    }

    .auth-btn-signin {
      background: linear-gradient(135deg, #FFC83D, #E8A92B);
      color: #243042;
      box-shadow: 0 5px 0 #c08820, 0 8px 20px rgba(0, 0, 0, .15);
    }

    .auth-btn-signup {
      background: rgba(255, 255, 255, .92);
      color: #3E9E4E;
      box-shadow: 0 5px 0 rgba(255, 255, 255, .4), 0 8px 20px rgba(0, 0, 0, .12);
    }

    .auth-btn-guest {
      background: rgba(255, 255, 255, .14);
      color: #fff;
      border: 2px solid rgba(255, 255, 255, .45) !important;
      box-shadow: none;
      font-size: 15px;
      padding: 13px;
    }

    .auth-divider {
      text-align: center;
      color: rgba(231, 240, 255, .85);
      font-size: 12px;
      font-weight: 700;
      margin: 4px 0;
      letter-spacing: .05em;
    }

    /* The class-code route is the one schools use, so it leads the stack. */
    .auth-btn-join {
      background: linear-gradient(135deg, #46D67E, #2FA65E);
      color: #06210f;
      box-shadow: 0 5px 0 #1f7a44, 0 8px 20px rgba(0, 0, 0, .15);
    }

    #signin-screen,
    #signup-screen,
    #join-screen,
    #pick-screen,
    #pic-screen,
    #prek-pet-screen {
      background: linear-gradient(165deg, var(--auth-c0) 0%, var(--auth-c1) 55%, var(--auth-c2) 100%);
      align-items: center;
      justify-content: flex-start;
      padding: 20px;
      padding-top: max(40px, 8vh);
      overflow-y: auto;
    }

    .auth-form-note {
      font-size: 13px;
      line-height: 1.5;
      color: rgba(231, 240, 255, .85);
      text-align: center;
      margin: -8px 0 18px;
    }

    /* A 6-letter code, spaced out so a child can check it against the card. */
    .code-input {
      text-transform: uppercase;
      letter-spacing: 10px;
      text-align: center;
      font-size: 26px !important;
      font-weight: 900;
      font-family: var(--display);
    }

    /* Tappable first names — no typing anywhere in the pre-K route. */
    .name-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
      gap: 10px;
      margin-bottom: 14px;
    }

    .name-card {
      padding: 18px 12px;
      border-radius: var(--radius-md);
      border: 2px solid rgba(255, 255, 255, .35);
      background: rgba(255, 255, 255, .12);
      color: #fff;
      font-family: var(--display);
      font-weight: 800;
      font-size: 19px;
      cursor: pointer;
      min-height: 66px;
    }

    .name-card:active { transform: scale(.96); }
    .name-card.sel { background: rgba(70, 214, 126, .3); border-color: #46D67E; }

    /* Picture password: three slots that fill as the child taps the icons. */
    .pic-slots {
      display: flex;
      justify-content: center;
      gap: 12px;
      margin-bottom: 18px;
    }

    .pic-slot {
      width: 58px;
      height: 58px;
      border-radius: var(--radius-md);
      border: 2px dashed rgba(255, 255, 255, .45);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 30px;
      background: rgba(255, 255, 255, .08);
    }

    .pic-slot.filled { border-style: solid; border-color: #46D67E; background: rgba(70, 214, 126, .18); }

    .pic-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 10px;
    }

    .pic-icon {
      aspect-ratio: 1;
      font-size: 34px;
      border-radius: var(--radius-md);
      border: 2px solid rgba(255, 255, 255, .3);
      background: rgba(255, 255, 255, .12);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .pic-icon:active { transform: scale(.93); }

    #pic-screen.wrong .pic-slots { animation: picShake .4s; }

    @keyframes picShake {
      0%, 100% { transform: translateX(0); }
      25% { transform: translateX(-9px); }
      75% { transform: translateX(9px); }
    }

    #signin-screen::before,
    #signup-screen::before {
      content: "";
      position: absolute;
      inset: 0;
      pointer-events: none;
      background: radial-gradient(circle at 50% 10%, rgba(255, 255, 255, .18) 0%, transparent 45%);
    }

    #signin-screen>*,
    #signup-screen>* {
      position: relative;
      z-index: 1;
    }

    .auth-form-card {
      width: 100%;
      max-width: 380px;
      background: rgba(18, 24, 46, .5);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-radius: var(--radius-lg);
      padding: 22px 20px;
      border: 1px solid var(--border-strong);
      box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
    }

    .auth-form-title {
      font-size: 24px;
      font-weight: 900;
      color: white;
      margin-bottom: 18px;
      text-align: center;
      font-family: var(--display);
      text-shadow: 0 2px 8px rgba(0, 0, 0, .15);
    }

    .auth-input-label {
      font-size: 12px;
      font-weight: 800;
      color: rgba(231, 240, 255, .95);
      letter-spacing: .08em;
      text-transform: uppercase;
      display: block;
      margin-bottom: 7px;
    }

    .auth-input {
      width: 100%;
      background: rgba(255, 255, 255, .95);
      border: 2px solid transparent;
      border-radius: var(--radius-md);
      padding: 13px 15px;
      font-size: 15px;
      font-weight: 700;
      color: #243042;
      outline: none;
      margin-bottom: 16px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
      font-family: var(--body);
    }

    .auth-input:focus {
      border-color: #FFC83D;
      box-shadow: 0 0 0 3px rgba(255, 200, 61, .4);
    }

    .auth-input::placeholder {
      color: #9AA8C4;
      font-weight: 600;
    }

    .auth-error {
      color: #fff;
      background: rgba(220, 38, 38, .75);
      border-radius: 8px;
      padding: 6px 10px;
      font-size: 12px;
      font-weight: 700;
      margin-top: -10px;
      margin-bottom: 10px;
      display: none;
    }

    .auth-submit-btn {
      width: 100%;
      background: linear-gradient(135deg, #FFC83D, #E8A92B);
      color: #243042;
      border: none;
      border-radius: var(--radius-md);
      padding: 15px;
      font-size: 16px;
      font-weight: 900;
      box-shadow: 0 5px 0 #c08820, 0 8px 24px rgba(0, 0, 0, .15);
      cursor: pointer;
      transition: transform .15s, box-shadow .15s;
      font-family: var(--display);
    }

    .auth-submit-btn:active {
      transform: translateY(3px);
      box-shadow: 0 2px 0 #c08820;
    }

    .auth-back-btn {
      background: transparent;
      border: 2px solid rgba(255, 255, 255, .5);
      color: white;
      border-radius: var(--radius-md);
      padding: 10px 18px;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      margin-bottom: 16px;
      font-family: var(--display);
      display: inline-block;
    }

    .pet-select-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 10px;
      margin-bottom: 24px;
    }

    .pet-select-btn {
      background: rgba(255, 255, 255, .2);
      border: 2px solid rgba(255, 255, 255, .35);
      border-radius: var(--radius-md);
      padding: 14px 6px;
      transition: all .25s var(--ease-bounce);
      text-align: center;
    }

    .pet-select-btn.selected {
      background: rgba(255, 255, 255, .95);
      border: 3px solid #FFC83D;
      transform: scale(1.06);
      box-shadow: 0 6px 20px rgba(255, 200, 61, .45);
    }

    .pet-select-btn.selected .label {
      color: #243042;
    }

    #profile-avatar-grid .pet-select-btn,
    #signup-pet-grid .pet-select-btn {
      background: #f1f5f9;
      border: 2px solid #e2e8f0;
      border-radius: 12px;
      padding: 8px 4px;
      font-size: 24px;
      cursor: pointer;
      transition: all .18s ease;
      aspect-ratio: 1;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    #profile-avatar-grid .pet-select-btn.selected,
    #signup-pet-grid .pet-select-btn.selected {
      background: #fff8e1;
      border: 2px solid #FFC83D;
      transform: scale(1.1);
      box-shadow: 0 4px 12px rgba(255, 200, 61, .3);
    }

    .pet-select-btn .emoji {
      font-size: 30px;
      margin-bottom: 4px;
      display: block;
    }

    .pet-select-btn .label {
      font-size: 10px;
      font-weight: 800;
      color: rgba(255, 255, 255, .95);
    }

    /* Privacy notice under the auth card. Deliberately quiet — a child should not
       be drawn away from the sign-in buttons by it — but the link itself is
       underlined and full-contrast, because a legal notice a parent cannot find
       is not a notice. */
    .auth-legal {
      margin: 18px auto 0;
      max-width: 340px;
      text-align: center;
      font-family: var(--body);
      font-size: 12px;
      line-height: 1.5;
      color: var(--ink-subtle);
    }

    .auth-legal-link {
      color: var(--ink-muted);
      font-weight: 700;
      text-decoration: underline;
      text-underline-offset: 2px;
      white-space: nowrap;
    }

    .auth-legal-link:hover,
    .auth-legal-link:focus-visible {
      color: var(--ink);
    }
