/* NOLAP Classroom: sign-in scene (Mortoti, his intro, the white sheet). Tokens live in tokens.css. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0; min-height: 100dvh;
  font-family: var(--font); color: var(--ink); background: var(--bg);
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}

/* ================= scene: backdrop ================= */
.scene { position: relative; min-height: 100dvh; isolation: isolate; overflow: hidden; }
.bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.blob {
  position: absolute; border-radius: 50%; filter: blur(64px); opacity: .75;
  translate: calc(var(--mx, 0) * var(--d, 1) * -36px) calc(var(--my, 0) * var(--d, 1) * -28px);
  transition: translate .6s var(--ease-out);
  animation: drift 18s var(--ease-in-out) infinite alternate;
}
.blob-1 { --d: 1;   width: 52vmax; height: 52vmax; background: var(--blob-a); top: -16vmax; left: -14vmax; }
.blob-2 { --d: 1.6; width: 42vmax; height: 42vmax; background: var(--blob-b); bottom: -16vmax; right: -10vmax; animation-delay: -6s; }
.blob-3 { --d: .7;  width: 34vmax; height: 34vmax; background: var(--blob-c); top: 26%; left: 48%; opacity: .5; animation-delay: -12s; }
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.12); } }

/* ================= layout: mobile first ================= */
.login { position: relative; min-height: 100dvh; display: flex; flex-direction: column; }

.stage {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 16px 16px 8px;
}

/* speech bubble (Mortoti speaks first) */
.bubble {
  position: relative; width: min(100%, 320px); min-height: 86px;
  display: flex; align-items: center; justify-content: center;
  padding: 14px 18px; border-radius: 22px; text-align: center; text-wrap: balance;
  background: #fff; color: var(--ink);
  font-weight: 700; font-size: 1.02rem; line-height: 1.4;
  box-shadow: var(--shadow-float);
  opacity: 0; transform-origin: 50% 100%;
}
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -8px; width: 18px; height: 18px; margin-left: -9px;
  background: #fff; border-radius: 4px; transform: rotate(45deg);
}
.bubble.show { animation: bubble-pop .55s var(--ease-spring) both; }
@keyframes bubble-pop { from { opacity: 0; transform: scale(.55) translateY(14px); } to { opacity: 1; transform: none; } }

/* mascot spot: glow, floating badges, burst */
.spot {
  --m: clamp(120px, 21vh, 200px);
  position: relative; width: min(100%, 420px); height: calc(var(--m) * 1.3);
  display: grid; place-items: center;
}
.spot::before {
  content: ""; position: absolute; left: 50%; top: 52%; width: calc(var(--m) * 1.5); aspect-ratio: 1;
  translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 68%);
  animation: glow 4s ease-in-out infinite alternate;
}
@keyframes glow { to { scale: 1.1; opacity: .8; } }

.mascot { position: relative; width: var(--m); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mascot .mortoti { display: block; width: 100%; overflow: visible; animation: drop 1s var(--ease-spring) .1s both; }
@keyframes drop {
  0%   { transform: translateY(-190%) scaleY(1.12); opacity: 0; }
  50%  { opacity: 1; }
  68%  { transform: translateY(0) scale(1.08, .9); }
  84%  { transform: scale(.98, 1.03); }
  100% { transform: none; }
}

/* floating badges around Mortoti */
.fl {
  position: absolute; left: var(--x); top: var(--y); z-index: 2; pointer-events: none;
  translate: calc(-50% + var(--mx, 0) * var(--d, 1) * 18px) calc(-50% + var(--my, 0) * var(--d, 1) * 14px);
  transition: translate .5s var(--ease-out);
}
.fl-in {
  display: grid; place-items: center;
  animation:
    pop-in .6s var(--ease-spring) calc(1.15s + var(--k, 0) * 110ms) both,
    float var(--fd, 5s) ease-in-out calc(1.8s + var(--k, 0) * 110ms) infinite;
}
@keyframes pop-in { from { scale: 0; opacity: 0; } to { scale: 1; opacity: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(var(--r0, -4deg)); } 50% { transform: translateY(-12px) rotate(var(--r1, 4deg)); } }
.fl svg { width: 40px; height: 40px; filter: drop-shadow(0 8px 10px rgba(10,70,64, .22)); }
.fl-chip { padding: 8px 13px; border-radius: 14px; background: #fff; color: var(--blue-500); font-weight: 800; font-size: 1rem; box-shadow: var(--shadow-float); }
.fl-medal {
  width: 48px; height: 48px; border-radius: 50%; color: #4a2f00; font-weight: 800; font-size: .95rem;
  background: linear-gradient(160deg, #FFD36B, var(--gold)); box-shadow: 0 10px 20px -8px rgba(255, 176, 32, .8), inset 0 -3px 0 rgba(0, 0, 0, .1);
}

/* landing burst */
.burst { position: absolute; left: 50%; bottom: 14%; width: 0; height: 0; z-index: 3; pointer-events: none; }
.burst i {
  position: absolute; left: 0; top: 0; width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  border-radius: 50%; background: var(--c); animation: burst 1.15s var(--ease-out) forwards;
}
.burst i.star { border-radius: 0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
@keyframes burst {
  0%   { transform: translate(0, 0) scale(0); opacity: 1; }
  18%  { transform: translate(calc(var(--dx) * .35), calc(var(--dy) * .35)) scale(1); }
  100% { transform: translate(var(--dx), var(--dy)) scale(.2) rotate(200deg); opacity: 0; }
}

/* ================= the white sheet ================= */
.sheet {
  width: 100%; max-width: 520px; margin: 0 auto;
  padding: 26px 22px calc(22px + env(safe-area-inset-bottom));
  background: var(--card); border-radius: 34px 34px 0 0; box-shadow: var(--shadow-sheet);
  animation: sheet-in .9s var(--ease-out) .35s both;
}
@keyframes sheet-in { from { transform: translateY(105%); } }
.sheet-inner { width: 100%; max-width: 400px; margin: 0 auto; }

h1 { margin: 0; text-align: center; text-wrap: balance; font-size: clamp(1.55rem, 6.6vw, 1.85rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.tagline {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 8px 0 6px; color: var(--blue-500); font-weight: 800; font-size: 1.02rem;
}
.tagline::before, .tagline::after {
  content: ""; width: 13px; height: 13px; background: var(--gold);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: twinkle 2.4s ease-in-out infinite;
}
.tagline::after { animation-delay: 1.2s; }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(.6) rotate(45deg); } }
.lead { margin: 0 0 20px; text-align: center; text-wrap: balance; color: var(--ink-2); font-weight: 500; font-size: .98rem; line-height: 1.45; }

/* staggered entrance inside the sheet */
.rise { animation: rise .55s var(--ease-out) both; animation-delay: calc(.95s + var(--i, 0) * 80ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

/* ================= buttons ================= */
.btn {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; height: 58px; padding: 0 20px;
  border: 1px solid transparent; border-radius: var(--r-pill);
  font: inherit; font-weight: 800; font-size: 1.02rem; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out),
              background-color var(--dur-base), border-color var(--dur-base);
}
.btn:focus-visible, .mascot:focus-visible { outline: 3px solid var(--blue-200); outline-offset: 3px; }

.btn-primary {
  color: #fff; background: linear-gradient(180deg, #2FBFAE, var(--blue-500));
  box-shadow: var(--shadow-btn), inset 0 -3px 0 rgba(0, 0, 0, .12);
}
.btn-primary::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(110deg, transparent 32%, rgba(255, 255, 255, .4) 50%, transparent 68%) no-repeat;
  background-size: 250% 100%; background-position: 160% 0;
  animation: shine 4.5s var(--ease-in-out) 2.6s infinite;
}
@keyframes shine { 0% { background-position: 160% 0; } 35%, 100% { background-position: -60% 0; } }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 32px -10px rgba(14,159,142, .75), inset 0 -3px 0 rgba(0, 0, 0, .12); }
.btn-primary:active { transform: translateY(2px) scale(.985); box-shadow: 0 6px 14px -8px rgba(14,159,142, .7), inset 0 -1px 0 rgba(0, 0, 0, .12); }

.btn-outline { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { background: var(--blue-50); border-color: var(--blue-200); transform: translateY(-2px); }
.btn-outline:active { transform: scale(.985); }

.g-badge, .n-badge { width: 30px; height: 30px; flex: none; display: grid; place-items: center; }
.g-badge { background: #fff; border-radius: 50%; }
.g-badge svg { width: 18px; height: 18px; }
.n-badge { background: rgba(255, 255, 255, .14); border-radius: 9px; }
.n-badge img { display: block; width: 18px; height: 18px; }

.btn-navy {
  color: #fff; background: linear-gradient(180deg, #27396A, #14213D);
  box-shadow: 0 12px 26px -12px rgba(20, 33, 61, .75), inset 0 -3px 0 rgba(0, 0, 0, .25);
}
.btn-navy:hover { transform: translateY(-2px); box-shadow: 0 18px 32px -12px rgba(20, 33, 61, .8), inset 0 -3px 0 rgba(0, 0, 0, .25); }
.btn-navy:active { transform: translateY(2px) scale(.985); box-shadow: 0 6px 14px -8px rgba(20, 33, 61, .8), inset 0 -1px 0 rgba(0, 0, 0, .25); }

.free-tag {
  position: absolute; top: -11px; right: 16px; padding: 4px 11px; border-radius: var(--r-pill);
  background: var(--gold); color: #4a2f00; font-weight: 800; font-size: .74rem; letter-spacing: .01em;
  box-shadow: 0 6px 12px -4px rgba(255, 176, 32, .8); rotate: 4deg;
  animation: wiggle 3.2s ease-in-out 3s infinite;
}
@keyframes wiggle { 0%, 88%, 100% { rotate: 4deg; } 92% { rotate: -5deg; } 96% { rotate: 8deg; } }

.divider { display: flex; align-items: center; gap: 14px; margin: 20px 0; color: var(--ink-3); font-size: .92rem; font-weight: 600; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.fine { margin: 14px 0 0; text-align: center; text-wrap: balance; color: var(--ink-3); font-weight: 600; font-size: .88rem; }
.btn-ghost { width: auto; height: 46px; padding: 0 22px; font-size: .92rem; margin: 0 auto; }

.f-blue   { background: linear-gradient(160deg, #4ED0BF, #0E9F8E); }
.f-coral  { background: linear-gradient(160deg, #FF9DB0, #FF5C7A); }
.f-gold   { background: linear-gradient(160deg, #FFD36B, #FFA914); }
.f-orange { background: linear-gradient(160deg, #FFAE72, #FF7A2F); }
.f-violet { background: linear-gradient(160deg, #B39CFF, #7B61FF); }
.f-teal   { background: linear-gradient(160deg, #5FE3C4, #17B69A); }

.desktop-only { display: none; }

/* ---- phone sheet: grabber, feature chips, footer ---- */
.sheet { background: linear-gradient(180deg, #F2FBF9 0, #fff 120px); padding-top: 12px; }
.sheet::before { content: ""; display: block; width: 46px; height: 5px; margin: 0 auto 16px; border-radius: 99px; background: var(--blue-200); opacity: .7; }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 18px; }
.chips .chip:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px 6px 6px; border: 1px solid var(--blue-100); border-radius: var(--r-pill);
  background: var(--blue-50); color: var(--ink); font: inherit; font-weight: 700; font-size: .84rem; cursor: pointer; min-width: 0; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-base);
}
.chip:active { transform: scale(.94); background: var(--blue-100); }
.chip:focus-visible { outline: 3px solid var(--blue-200); outline-offset: 2px; }
.ci { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; color: #fff; box-shadow: 0 5px 10px -5px rgba(10,70,64, .55); }
.ci svg { width: 14px; height: 14px; }
.powered { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; color: var(--ink-3); font-size: .8rem; font-weight: 600; }
.powered img { display: block; width: 18px; height: 18px; }
.powered b { color: var(--ink); font-weight: 800; letter-spacing: .05em; }


/* ================= desktop: split screen ================= */
@media (min-width: 900px) {
  .login { flex-direction: row; }
  .stage { padding: 40px; gap: 22px; }
  .bubble { width: min(100%, 380px); font-size: 1.12rem; }
  .spot { --m: clamp(240px, 40vh, 380px); width: min(100%, 620px); }
  .fl svg { width: 52px; height: 52px; }
  .fl-chip { font-size: 1.2rem; padding: 10px 16px; border-radius: 16px; }
  .fl-medal { width: 60px; height: 60px; font-size: 1.1rem; }
  .login { align-items: flex-start; }
  .stage { position: sticky; top: 0; height: 100dvh; align-self: flex-start; }
  .sheet {
    flex: 0 0 min(46vw, 620px); max-width: none; margin: 0; min-height: 100dvh;
    display: flex; flex-direction: column;
    padding: 36px clamp(36px, 4.5vw, 72px) 26px;
    background: radial-gradient(80% 36% at 100% 0%, #E3F6F2, transparent 72%), var(--card);
    border-radius: 44px 0 0 44px; box-shadow: -30px 0 80px -30px rgba(10,70,64, .35);
    animation: sheet-in-x .9s var(--ease-out) .35s both;
  }
  .sheet-inner { margin-block: auto; padding-block: 8px; }
  .sheet::before, .chips, .mobile-only { display: none; }
  @keyframes sheet-in-x { from { transform: translateX(60px); opacity: 0; } }
  h1 { font-size: 2.3rem; }
  .btn { height: 60px; }

  /* what's inside */
  .features { display: block; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
  .features-title { margin: 0 0 8px; font-size: 1rem; font-weight: 800; color: var(--ink-2); }
  .feature-list { list-style: none; margin: 0; padding: 0; }
  .feature {
    display: flex; align-items: center; gap: 14px; margin: 0 -12px; padding: 10px 12px; border-radius: 16px;
    cursor: default; transition: background-color var(--dur-base), transform var(--dur-base) var(--ease-out);
  }
  .feature:hover { background: var(--blue-50); transform: translateX(5px); }
  .f-ico {
    width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 14px; color: #fff;
    box-shadow: 0 8px 16px -8px rgba(10,70,64, .5);
  }
  .f-ico svg { width: 22px; height: 22px; }
  .feature:hover .f-ico { animation: ico-wiggle .55s var(--ease-out); }
  @keyframes ico-wiggle { 0%, 100% { transform: rotate(0) scale(1); } 30% { transform: rotate(-10deg) scale(1.1); } 65% { transform: rotate(7deg) scale(1.1); } }
  .feature b { display: block; font-size: 1rem; font-weight: 800; line-height: 1.25; }
  .f-tag { display: block; margin-top: 2px; color: var(--blue-500); font-size: .8rem; font-weight: 800; }

  /* powered by */
  .powered {
    display: flex; align-items: center; justify-content: center; gap: 9px; font-size: .85rem;
    width: 100%; max-width: 400px; margin: 22px auto 0; padding-top: 16px; border-top: 1px solid var(--line);
    color: var(--ink-3); font-size: .85rem; font-weight: 600;
  }
  .powered img { width: 22px; height: 22px; }
  .powered b { color: var(--ink); font-weight: 800; letter-spacing: .05em; }
}

/* shorter desktop windows: tighter rows so the whole list still fits */
@media (min-width: 900px) and (max-height: 830px) {
  .features { margin-top: 20px; padding-top: 16px; }
  .feature { padding: 5px 12px; }
  .f-ico { width: 38px; height: 38px; border-radius: 12px; }
  .f-ico svg { width: 20px; height: 20px; }
  .sheet { padding-top: 26px; padding-bottom: 20px; }
  .powered { margin-top: 14px; padding-top: 12px; }
}
@media (min-width: 900px) and (max-height: 700px) {
  .features { margin-top: 14px; padding-top: 12px; }
  .features-title { margin-bottom: 4px; }
  .feature { padding: 3px 12px; gap: 12px; }
  .f-ico { width: 34px; height: 34px; border-radius: 11px; }
  .f-ico svg { width: 18px; height: 18px; }
  .feature b { font-size: .95rem; }
  .f-tag { margin-top: 0; font-size: .74rem; }
  .sheet { padding-top: 18px; padding-bottom: 14px; }
  h1 { font-size: 1.95rem; }
  .tagline { margin-bottom: 4px; }
  .lead { margin-bottom: 14px; }
  .btn { height: 54px; }
  .powered { margin-top: 10px; padding-top: 10px; }
}

/* short phones: keep everything on screen */
@media (max-height: 660px) and (max-width: 899px) {
  .chips { display: none; }
}
@media (max-height: 720px) and (max-width: 899px) {
  .stage { padding-top: 14px; gap: 8px; }
  .spot { --m: clamp(120px, 21vh, 190px); }
  .bubble { min-height: 68px; padding: 10px 14px; font-size: .95rem; }
  .sheet { padding-top: 18px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .tagline { margin: 6px 0 4px; }
  .lead { margin-bottom: 14px; font-size: .9rem; }
  .btn { height: 52px; }
  .divider { margin: 14px 0; }
  .fine { margin-top: 10px; }
}

.text-link {
  position: relative; display: block; width: max-content; margin: 16px auto 0; padding: 6px 4px;
  color: var(--blue-500); font-weight: 700; font-size: .95rem; text-decoration: none;
}
.text-link::after {
  content: ""; position: absolute; left: 4px; right: 4px; bottom: 2px; height: 2px; background: currentColor;
  transform: scaleX(0); transform-origin: left; transition: transform var(--dur-base) var(--ease-out);
}
.text-link:hover::after, .text-link:focus-visible::after { transform: scaleX(1); }
.text-link:focus-visible { outline: 3px solid var(--blue-200); outline-offset: 3px; border-radius: 6px; }

/* ================= plain notice page (errors) ================= */
.notice-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.notice-card {
  width: 100%; max-width: 440px; padding: 28px 24px 26px; text-align: center;
  background: #fff; border-radius: 28px; box-shadow: var(--shadow-sheet);
}
.notice-mascot { width: 150px; margin: 0 auto 6px; }
.notice-mascot .mortoti { display: block; width: 100%; overflow: visible; }
.notice-card h1 { margin-bottom: 8px; }
.reason { margin: 0 0 20px; }
.reason code { display: inline-block; max-width: 100%; padding: 8px 12px; border-radius: 12px; background: var(--blue-50);
  color: var(--ink-2); font-size: .8rem; line-height: 1.4; word-break: break-word; }

/* ================= reduced motion =================
   Keep the character alive (blink, float, expressions, typing). Remove the travel:
   drop-in, burst, parallax, drifting backdrop, sliding sheet. */
@media (prefers-reduced-motion: reduce) {
  .blob, .glow, .spot::before { animation: none; }
  .blob, .fl { translate: none; }
  .fl { translate: -50% -50%; }
  .mascot .mortoti { animation: fade-in .5s ease both; }
  .sheet { animation: fade-in .5s ease .2s both; }
  .rise { animation: fade-in .4s ease calc(.3s + var(--i, 0) * 40ms) both; }
  .fl-in { animation: fade-in .5s ease calc(.5s + var(--k, 0) * 60ms) both; }
  .burst { display: none; }
  .btn-primary::after, .free-tag, .tagline::before, .tagline::after { animation: none; }
  @keyframes fade-in { from { opacity: 0; } }
}

/* code-flavoured badges */
.fl-chip.code { font-family: var(--mono); letter-spacing: -.04em; }
