:root {
  --ink: #19212a;
  --muted: #657080;
  --paper: #fffaf0;
  --panel: #ffffff;
  --line: #d9e0e8;
  --blue: #2563eb;
  --blue-dark: #1e3a8a;
  --green: #1b8a5a;
  --yellow: #f3b431;
  --coral: #e45f56;
  --sky: #d9efff;
  --shadow: 0 18px 50px rgba(24, 33, 42, .12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(180deg, #f7fbff 0%, #fffaf0 48%, #f4fbf4 100%);
}

button,
a {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 54px);
  border-bottom: 1px solid rgba(25, 33, 42, .08);
  background: rgba(255, 250, 240, .92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, var(--blue), var(--green));
  box-shadow: 0 8px 22px rgba(37, 99, 235, .22);
}

.brand strong,
.brand small {
  display: block;
  white-space: nowrap;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topnav a {
  color: var(--ink);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
}

.topnav a:hover,
.topnav a:focus-visible {
  background: #fff;
  outline: 2px solid transparent;
}

.app-section {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(320px, 1.05fr);
  gap: clamp(24px, 4vw, 52px);
  align-items: center;
  min-height: calc(100vh - 72px);
  padding: clamp(28px, 5vw, 56px) 0;
}

.hero-copy {
  max-width: 600px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 70px);
  line-height: 1.02;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 54ch;
  color: #4d5967;
  font-size: 19px;
  line-height: 1.62;
}

.hero-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.button,
.icon-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
}

.button.primary {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 10px 24px rgba(37, 99, 235, .22);
}

.button.ghost {
  color: var(--blue-dark);
  background: #fff;
  border: 1px solid var(--line);
}

.icon-button {
  width: 48px;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  background: #fff;
  border: 1px solid var(--line);
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.hero-art {
  position: relative;
}

.hero-art img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.lesson-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
  gap: 22px;
  align-items: start;
  padding: 36px 0 26px;
}

.lesson-panel,
.activity-panel {
  border: 1px solid rgba(25, 33, 42, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow);
}

.lesson-panel {
  padding: clamp(18px, 3vw, 28px);
}

.activity-panel {
  padding: 24px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.12;
}

.section-heading.compact h2 {
  font-size: 26px;
}

.deck-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.deck-tab {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #2c3745;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

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

.flashcard {
  position: relative;
  overflow: visible;
  display: grid;
  grid-template-columns: minmax(150px, 230px) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
  min-height: 250px;
  padding: 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e7f5ff, #fff4d6 50%, #f4fbf4);
  border: 1px solid rgba(25, 33, 42, .08);
}

.flash-visual {
  display: grid;
  place-items: center;
  min-height: 210px;
  padding: 18px;
  border-radius: 8px;
  color: #fff;
  font-size: clamp(64px, 10vw, 110px);
  font-weight: 900;
  text-align: center;
  background: linear-gradient(135deg, var(--coral), var(--yellow));
  transition: box-shadow .2s;
  user-select: none;
}

@keyframes celebrate-bounce {
  0%   { transform: scale(1)    rotate(0deg); }
  15%  { transform: scale(1.35) rotate(-8deg); }
  30%  { transform: scale(1.2)  rotate(6deg); }
  45%  { transform: scale(1.3)  rotate(-5deg); }
  60%  { transform: scale(1.1)  rotate(3deg); }
  75%  { transform: scale(1.18) rotate(-2deg); }
  100% { transform: scale(1)    rotate(0deg); }
}

@keyframes celebrate-glow {
  0%   { box-shadow: 0 0 0   0   rgba(243,180,49,0); }
  30%  { box-shadow: 0 0 36px 14px rgba(243,180,49,.55); }
  100% { box-shadow: 0 0 0   0   rgba(243,180,49,0); }
}

.flash-visual.celebrate {
  animation:
    celebrate-bounce .8s cubic-bezier(.36,.07,.19,.97) forwards,
    celebrate-glow   .8s ease forwards;
}

@keyframes star-fly {
  0%   { transform: translateY(0)   scale(1);   opacity: 1; }
  60%  { opacity: 1; }
  100% { transform: translateY(-90px) scale(1.4); opacity: 0; }
}

.confetti-star {
  position: absolute;
  bottom: 18px;
  pointer-events: none;
  animation: star-fly .9s ease-out forwards;
}

.flash-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.card-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.flash-copy h3 {
  margin: 0;
  font-size: clamp(46px, 8vw, 88px);
  line-height: .95;
}

.flash-copy p {
  margin: 10px 0 0;
  color: #475467;
  font-size: 20px;
}

.flash-copy .example {
  color: var(--blue-dark);
  font-weight: 800;
}

.card-actions {
  justify-content: center;
  margin-top: 16px;
}

.question {
  margin: 4px 0 14px;
  color: #384454;
  font-size: 19px;
  font-weight: 800;
}

.answers {
  display: grid;
  gap: 10px;
}

.answer {
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  text-align: left;
  font-weight: 800;
}

.answer:hover,
.answer:focus-visible {
  border-color: var(--blue);
  outline: 2px solid rgba(37, 99, 235, .22);
}

.answer.correct {
  border-color: rgba(27, 138, 90, .5);
  background: #e8f7ef;
}

.answer.wrong {
  border-color: rgba(228, 95, 86, .5);
  background: #fff0ef;
}

.feedback {
  min-height: 28px;
  margin: 14px 0 18px;
  color: var(--muted);
  font-weight: 800;
}

.progress-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
  background: #f7f9fc;
  border: 1px solid var(--line);
}

.progress-box > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.progress-label {
  color: var(--muted);
  font-weight: 800;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3e8ef;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--yellow));
  transition: width .25s ease;
}

.word-bank,
.roadmap {
  padding: 38px 0;
}

.word-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.word-item,
.roadmap-grid article {
  border: 1px solid rgba(25, 33, 42, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .88);
}

.word-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 86px;
  padding: 12px;
}

.word-tile {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  color: #fff;
  font-size: 30px;
  font-weight: 900;
  background: var(--blue);
}

.word-item strong,
.word-item span {
  display: block;
}

.word-item span {
  color: var(--muted);
  margin-top: 2px;
}

.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.roadmap-grid article {
  padding: 18px;
}

.roadmap-grid span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
  background: var(--green);
}

.roadmap-grid h3 {
  margin: 14px 0 8px;
  font-size: 19px;
}

.roadmap-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 920px) {
  .hero,
  .lesson-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .word-list,
  .roadmap-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .topnav {
    width: 100%;
    justify-content: space-between;
  }

  .topnav a {
    padding-inline: 8px;
  }

  h1 {
    font-size: 38px;
  }

  .hero-copy > p:not(.eyebrow) {
    font-size: 17px;
  }

  .deck-tabs,
  .flashcard,
  .word-list,
  .roadmap-grid {
    grid-template-columns: 1fr;
  }

  .flash-visual {
    min-height: 150px;
  }

  .flash-copy h3 {
    font-size: 54px;
  }
}
