@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@500;600;700;800;900&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

* {
  box-sizing: border-box;
}

:root {
  --blue: #1e88e5;
  --blue-dark: #1565c0;
  --bg: #eaf6ff;
  --ink: #1b2a41;
  --card-bg: #ffffff;
  --gold: #ffb300;
  --gold-border: #e65100;
  --green: #43a047;
  --orange: #fb8c00;
  --font-main: "Plus Jakarta Sans", "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Nunito", "Plus Jakarta Sans", sans-serif;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---- Credit Icon (C in a circle) ---- */
.credit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffd54f;
  border: 2px solid #1b2a41;
  color: #1b2a41;
  font-weight: 900;
  font-size: 13px;
  line-height: 1;
  font-family: var(--font-display);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15);
  vertical-align: middle;
}

.credit-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.22);
  padding: 5px 12px;
  border-radius: 999px;
  color: #fff;
}

.credit-badge.dark {
  background: #fff8e1;
  color: var(--ink);
  border: 2px solid var(--ink);
}

/* ---- Top Bar ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--blue);
  padding: 10px 22px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar .left,
.topbar .right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: block;
  width: 54px;
  height: 54px;
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #fff;
  flex-shrink: 0;
}

.penguin {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform: scale(1.45);
}

.brand-title {
  color: #fff;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.speech-bubble {
  position: relative;
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  max-width: 200px;
  line-height: 1.3;
  box-shadow: 2px 3px 0 rgba(0,0,0,0.15);
}

.speech-bubble::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 9px 6px 0;
  border-style: solid;
  border-color: transparent var(--ink) transparent transparent;
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-btn,
.auth-btn {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border-radius: 10px;
  padding: 8px 16px;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid transparent;
  transition: transform 0.12s, background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-btn:hover,
.nav-btn.active {
  background: rgba(255, 255, 255, 0.34);
  border-color: #fff;
}

.auth-btn {
  background: transparent;
  border-color: #fff;
}

.auth-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.auth-btn.solid {
  background: #fff;
  color: var(--blue);
}

.user-name {
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
}

.profile-avatar-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid #fff;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transition: transform 0.15s;
}

.profile-avatar-btn:hover {
  transform: scale(1.08);
}

/* ---- Containers ---- */
.container {
  max-width: 1180px;
  width: 100%;
  flex: 1;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.hidden {
  display: none !important;
}

/* ---- Logged Out Landing Page (PDF 2 Page 1) ---- */
.hero-logged-out {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 26px;
  padding: 36px 28px;
  margin-bottom: 36px;
  box-shadow: 0 8px 0 rgba(27, 42, 65, 0.12);
  text-align: center;
}

.hero-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}

.hero-penguin-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.math-board {
  background: #f8fbff;
  border: 3px solid var(--ink);
  border-radius: 20px;
  padding: 20px 32px;
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: 1.9rem;
  font-weight: 900;
  text-align: right;
  line-height: 1.25;
  box-shadow: 4px 4px 0 var(--ink);
}

.math-board hr {
  border: none;
  border-top: 3px solid var(--ink);
  margin: 6px 0;
}

.hero-tagline {
  font-size: 1.45rem;
  font-weight: 800;
  max-width: 560px;
  margin: 26px auto 18px;
}

.scroll-down-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 800;
  color: var(--blue-dark);
  cursor: pointer;
  background: none;
  border: none;
  font-size: 1rem;
}

.scroll-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  font-size: 1.2rem;
}

.locked-section h2 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 24px;
}

.locked-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}

.locked-card {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 22px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(27, 42, 65, 0.15);
  transition: transform 0.15s;
}

.locked-card:hover {
  transform: translateY(-4px);
}

.padlock-svg {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  display: block;
}

.locked-card h3 {
  margin: 8px 0 4px;
  font-size: 1.35rem;
}

/* ---- Signed-in Home Dashboard (PDF 1 Page 1) ---- */
.welcome-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 20px;
  padding: 16px 24px;
  margin-bottom: 24px;
  box-shadow: 0 5px 0 rgba(27, 42, 65, 0.12);
}

.welcome-bar h1 {
  margin: 0;
  font-size: 1.85rem;
}

.streak-pill,
.lessons-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.05rem;
  background: #fff3e0;
  border: 2px solid var(--ink);
  padding: 8px 16px;
  border-radius: 999px;
}

.lessons-pill {
  background: #e8f5e9;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 180px 1.2fr 1fr 1.15fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.dash-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sketch-card {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 5px 0 rgba(27, 42, 65, 0.14);
  text-align: center;
  position: relative;
}

.sketch-card.clickable {
  cursor: pointer;
  transition: transform 0.14s;
}

.sketch-card.clickable:hover {
  transform: translateY(-4px);
}

.sketch-card h3 {
  margin: 0 0 10px;
  font-size: 1.3rem;
}

.cta-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 20px;
  font: inherit;
  font-weight: 800;
  background: var(--orange);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
}

.cta-btn:hover {
  filter: brightness(1.05);
}

/* Multiples path on home */
.node-path {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px 0;
  flex-wrap: wrap;
}

.math-node {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  background: #e3f2fd;
}

.node-line {
  width: 16px;
  height: 3px;
  background: var(--ink);
}

/* Egg progress path */
.egg-road {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 4px;
}

.egg-node {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  background: #fff;
  padding: 4px;
}

.egg-node.done {
  background: #c8e6c9;
}

/* Leaderboard Tabs & Table */
.lb-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.lb-tab {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 6px 11px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: #f4faff;
  cursor: pointer;
  transition: background 0.12s;
}

.lb-tab.active {
  background: var(--blue);
  color: #fff;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.95rem;
}

.lb-table th,
.lb-table td {
  border: 2px solid var(--ink);
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
}

.lb-table td:last-child {
  text-align: right;
}

.lb-table tr.you-row {
  background: #fff59d;
  font-weight: 900;
}

.you-callout {
  font-size: 0.85rem;
  font-weight: 800;
  color: #d84315;
  margin-top: 6px;
}

/* ---- Friends Page (PDF 1 Page 3) ---- */
.friends-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 6px 0 rgba(27, 42, 65, 0.14);
}

@media (max-width: 900px) {
  .friends-board {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .friends-board {
    grid-template-columns: 1fr;
  }
}

.friends-col {
  border-right: 3px solid var(--ink);
  padding: 18px 14px;
  min-height: 420px;
}

.friends-col:last-child {
  border-right: none;
}

.friends-col h2 {
  margin: 0 0 16px;
  font-size: 1.25rem;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 10px;
}

.friend-card {
  background: #f4faff;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
}

.friend-top {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  margin-bottom: 8px;
}

.friend-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.friend-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
}

.mini-btn {
  font: inherit;
  padding: 5px 12px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
}

.mini-btn:hover {
  background: #e3f2fd;
}

.mini-btn.danger:hover {
  background: #ffebee;
}

.empty-note {
  color: #607d8b;
  font-style: italic;
  font-weight: 600;
  margin-top: 12px;
}

/* ---- Shop Modal (PDF 2 Page 2) ---- */
.shop-box {
  max-width: 780px !important;
}

.shop-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.shop-item {
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  padding: 14px;
  text-align: center;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.shop-item .badge-popular {
  color: #d84315;
  font-weight: 900;
  font-size: 0.8rem;
}

/* ---- Learn Roadmap (PDF 1 Page 2) ---- */
.learn-roadmap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-top: 24px;
}

.road-connector {
  width: 14px;
  height: 48px;
  background: #fff;
  border-left: 3px solid var(--ink);
  border-right: 3px solid var(--ink);
}

.road-circle {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px;
  text-align: center;
  font-weight: 800;
  position: relative;
  box-shadow: 0 6px 0 rgba(27,42,65,0.14);
}

/* ---- Games: Tic-Tac-Toe & Counting Grass ---- */
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 100px);
  grid-template-rows: repeat(3, 100px);
  gap: 10px;
  justify-content: center;
  margin: 20px auto;
}

.ttt-cell {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 18px;
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 rgba(27,42,65,0.15);
}

.ttt-cell:hover {
  background: #f1f9ff;
}

.grass-field {
  background: #c8e6c9;
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 24px;
  font-size: 2rem;
  letter-spacing: 6px;
  max-width: 440px;
  margin: 16px auto;
  min-height: 120px;
}

/* ---- Modals ---- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
}

.modal-box {
  position: relative;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 22px;
  padding: 28px;
  width: 100%;
  max-width: 380px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 0 rgba(27,42,65,0.25);
}

.modal-box h2 {
  margin-top: 0;
  text-align: center;
}

.close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: #fff;
  border: 2px solid var(--ink);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px;
  font: inherit;
  font-weight: 700;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px;
  cursor: pointer;
}

.google:hover {
  background: #f5f5f5;
}

.or {
  text-align: center;
  color: #666;
  margin: 14px 0;
  font-size: 0.9rem;
  font-weight: 600;
}

form input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  font: inherit;
}

.submit {
  width: 100%;
  padding: 10px 16px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.error {
  color: #c62828;
  font-size: 0.9rem;
  min-height: 1.2em;
  font-weight: 700;
}

.switch {
  text-align: center;
  margin: 0;
}

/* ---- Footer ---- */
footer {
  text-align: center;
  padding: 18px 20px;
  margin-top: auto;
  font-size: 0.92rem;
  font-weight: 700;
  color: #455a64;
  border-top: 2px solid rgba(27, 42, 65, 0.12);
  background: rgba(255, 255, 255, 0.65);
}

footer p {
  margin: 0;
}
