/* ============================================================
   TODDSTREET LEARNING — DEMO SITE
   Palette: dark purple ground, toddstreet orange accent,
   white cards, lavender-grey supporting text.
============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --purple: #241056;
  --purple-deep: #15083a;
  --purple-glow: #33196f;
  --orange: #ff810e;
  --orange-soft: #fff3e6;
  --ink: #23262f;
  --lav: #b3abd6;          /* lavender-grey text on purple */
  --lav-faint: rgba(255, 255, 255, 0.12);
  --card: #ffffff;
  --grey-bg: #f6f7f9;
  --grey-border: #e2e4ea;
  --muted: #6f7480;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: radial-gradient(1100px 700px at 50% -10%, var(--purple-glow) 0%, var(--purple) 45%, var(--purple-deep) 100%) fixed;
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 40px 20px;
}

.login-body { overflow-x: hidden; }

.logo-stage { position: relative; }

.login-logo {
  display: block;
  position: relative;
  z-index: 2;
  width: min(320px, 72vw);
  height: auto;
  animation: settle 0.6s ease, logoglow 2s ease 0.3s both;
}

@keyframes settle {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes logoglow {
  from { filter: brightness(0.6); }
  to   { filter: brightness(1.05); }
}

/* ---------- Spotlight on the logo ---------- */
/* Anchored to the logo so the beam always hits the bubble's
   top-right corner bend; the stems fade out into the dark. */
.spotlight-wrap {
  position: absolute;
  z-index: 1;
  width: 130%;
  aspect-ratio: 3307 / 2903;
  top: -56%;
  left: 21%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 18%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 18%);
}

.spotlight-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* the light pool: soft, translucent, flickers on, then keeps
   a gentle double-blink shimmer going */
.spot-beam {
  opacity: 0;
  filter: blur(5px);
  animation:
    lightson 1.7s ease-out 0.3s forwards,
    flickerloop 5s ease-in-out 2s infinite;
}

/* the lamp housing: crisp copy, soft-masked to the fixture and its glare */
.spot-lamp {
  -webkit-mask-image: radial-gradient(circle at 81% 13%, #000 18%, transparent 40%);
  mask-image: radial-gradient(circle at 81% 13%, #000 18%, transparent 40%);
  opacity: 0;
  animation: lampin 0.5s ease-out forwards;
}

@keyframes lampin { to { opacity: 1; } }

@keyframes lightson {
  0%   { opacity: 0; }
  40%  { opacity: 0.02; }
  50%  { opacity: 0.17; }
  58%  { opacity: 0.05; }
  68%  { opacity: 0.2; }
  100% { opacity: 0.18; }
}

/* dramatic ongoing flicker: hard double-blink, a mid-cycle
   stutter, and a late blink */
@keyframes flickerloop {
  0%   { opacity: 0.18; }
  3%   { opacity: 0.04; }
  6%   { opacity: 0.21; }
  9%   { opacity: 0.07; }
  13%  { opacity: 0.19; }
  42%  { opacity: 0.18; }
  45%  { opacity: 0.05; }
  48%  { opacity: 0.2; }
  72%  { opacity: 0.18; }
  75%  { opacity: 0.09; }
  78%  { opacity: 0.21; }
  100% { opacity: 0.18; }
}


@media (prefers-reduced-motion: reduce) {
  .login-logo { animation: none; }
  .spot-beam { animation: none; opacity: 0.15; }
  .spot-lamp { animation: none; opacity: 1; }
}

#login-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(340px, 86vw);
}

.code-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--lav);
}

#code {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 6px;
  text-align: center;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

#code::placeholder {
  color: rgba(255, 255, 255, 0.35);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 1px;
}

#code:focus {
  border-color: var(--orange);
  background: rgba(255, 255, 255, 0.12);
}

.login-error {
  font-size: 14px;
  color: #ffb0a6;
}

.shake { animation: shake 0.4s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* ---------- Shared ---------- */
.cta-btn {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 13px 34px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 6px 16px rgba(255, 129, 14, 0.35);
}

.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(255, 129, 14, 0.45);
}

.ghost-btn {
  background: var(--lav-faint);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s ease;
}

.ghost-btn:hover { background: rgba(255, 255, 255, 0.22); }

.header-actions { display: flex; gap: 10px; }

.ghost-btn.danger {
  background: rgba(220, 38, 38, 0.35);
  border-color: #f87171;
}

.site-foot {
  text-align: center;
  padding: 18px;
  font-size: 12px;
  color: var(--lav);
}

/* ---------- Dashboard ---------- */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 26px;
}

.dash-logo { height: 52px; width: auto; }

.dash-main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 22px 50px;
}

.hero { text-align: center; margin-bottom: 36px; }

.eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 10px;
}

.hero h1 {
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.5px;
  text-wrap: balance;
}

.hero-sub {
  margin: 12px auto 0;
  max-width: 560px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--lav);
}

/* ---------- Scoreboard ---------- */
.scoreboard {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 26px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 24px 28px;
  margin-bottom: 34px;
}

.score-total {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  min-width: 210px;
}

.score-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--lav);
}

.score-value {
  font-size: 56px;
  font-weight: 900;
  line-height: 1;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}

.score-hint { font-size: 12px; color: var(--lav); }

.badge-shelf {
  flex: 1;
  min-width: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.badge-slot { text-align: center; width: 112px; opacity: 0.5; }

.badge-medal {
  width: 66px;
  height: 66px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 31px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px dashed rgba(255, 255, 255, 0.35);
  filter: grayscale(1);
}

.badge-slot.earned { opacity: 1; }

.badge-slot.earned .badge-medal {
  background: radial-gradient(circle at 32% 26%, #ffe9a8, #f7b733 55%, #d78e00);
  border: 2px solid #ffd977;
  filter: none;
  box-shadow: 0 0 20px rgba(255, 200, 60, 0.55);
  animation: medalpop 0.55s ease;
}

@keyframes medalpop {
  from { transform: scale(0.4); }
  60%  { transform: scale(1.18); }
  to   { transform: scale(1); }
}

.badge-name { font-size: 13px; font-weight: 700; }
.badge-status { font-size: 11px; color: var(--lav); margin-top: 2px; }

@media (prefers-reduced-motion: reduce) {
  .badge-slot.earned .badge-medal { animation: none; }
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  background: var(--card);
  color: var(--ink);
  border-radius: 18px;
  padding: 26px 24px;
  text-decoration: none;
  box-shadow: 0 18px 45px rgba(8, 3, 30, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 26px 60px rgba(8, 3, 30, 0.55);
}

.tile-icon {
  font-size: 46px;
  line-height: 1;
  background: var(--orange-soft);
  border-radius: 16px;
  padding: 12px;
}

.phase-chip {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fff;
  background: var(--purple);
  border-radius: 999px;
  padding: 4px 12px;
}

.tile h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--purple);
  letter-spacing: -0.3px;
}

.tile-when {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--orange);
}

.tile p {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--muted);
  flex: 1;
}

.tile-cta { margin-top: 6px; padding: 11px 26px; font-size: 14.5px; }

.tile-note {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* locked tiles */
.tile.locked {
  filter: grayscale(1);
  opacity: 0.55;
  cursor: default;
}

.tile.locked .tile-cta {
  background: var(--muted);
  box-shadow: none;
}

.lock-flag {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #fff;
  background: rgba(35, 38, 47, 0.75);
  border-radius: 999px;
  padding: 5px 12px;
}

@media (max-width: 560px) {
  .dash-logo { height: 40px; }
  .tiles { grid-template-columns: 1fr; }
}
