* {
  box-sizing: border-box;
}

:root {
  --ink: #172033;
  --muted: #5b6b7f;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --teal: #0f766e;
  --green: #22c55e;
  --paper: #ffffff;
  --soft: #f4f8fb;
  --line: #d7e6f2;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.11);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255,255,255,.88), rgba(244,248,251,.96)),
    radial-gradient(circle at top right, rgba(34,197,94,.16), transparent 34%),
    radial-gradient(circle at bottom left, rgba(37,99,235,.12), transparent 34%),
    #f6fafc;
  font-family: "Rubik", Arial, sans-serif;
  line-height: 1.55;
}

img,
video {
  max-width: 100%;
}

.shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
}

.kicker {
  margin-bottom: 10px;
  color: var(--teal);
  font-size: .98rem;
  font-weight: 900;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.1rem, 4vw, 4rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1.2;
  letter-spacing: 0;
}

.goal {
  color: #243246;
  font-size: clamp(1.02rem, 1.5vw, 1.2rem);
  font-weight: 500;
}

.muted {
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
  line-height: 1.1;
  text-decoration: none;
  box-shadow: 0 10px 20px rgba(37,99,235,.18);
}

.btn:hover,
.btn:focus-visible {
  background: var(--blue-dark);
  outline: none;
}

.btn.secondary {
  color: var(--blue-dark);
  background: #fff;
  border-color: #c7daec;
  box-shadow: none;
}

.btn.secondary:hover,
.btn.secondary:focus-visible {
  background: #eef6ff;
}

.minecraft-shot {
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(151, 178, 201, .6);
  border-radius: 20px;
  background: #dfeef8;
  box-shadow: var(--shadow);
}

.minecraft-shot img {
  display: block;
  width: 100%;
  height: clamp(240px, 34vw, 390px);
  object-fit: cover;
}

.shot-caption {
  padding: 10px 14px 12px;
  color: var(--muted);
  background: rgba(255,255,255,.92);
  font-size: .94rem;
  font-weight: 700;
}

.grid,
.grid-4,
.steps {
  display: grid;
  gap: 16px;
}

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

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.steps {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 10px 26px rgba(23,32,51,.07);
}

.card.highlight {
  background: linear-gradient(180deg, #ffffff, #f1f8ff);
}

.card.build-first {
  border-color: rgba(34,197,94,.34);
  background: linear-gradient(180deg, #ffffff, #f2fff6);
}

.card p,
.card li {
  color: #334155;
}

.card ul {
  margin: 10px 0 0;
  padding-inline-start: 1.2rem;
}

.makecode-workspace[hidden] {
  display: none !important;
}

.agent-academy-cta {
  border: 2px solid rgba(37, 99, 235, .42);
  background:
    linear-gradient(135deg, rgba(219, 234, 254, .92), rgba(240, 253, 250, .94)),
    #ffffff;
  box-shadow: 0 18px 40px rgba(37, 99, 235, .14);
}

.agent-academy-cta .tag {
  background: #dbeafe;
  border-color: rgba(37, 99, 235, .28);
  color: #1d4ed8;
}

.agent-academy-cta h2 {
  font-size: clamp(1.45rem, 4vw, 2.15rem);
  margin-bottom: 8px;
}

.agent-academy-cta p {
  font-size: 1.08rem;
  font-weight: 750;
}

.agent-academy-flow {
  margin-top: 8px;
  padding: 10px 12px;
  border-right: 5px solid var(--green);
  border-radius: 8px;
  background: #ecfdf3;
  color: #14532d !important;
}

.agent-academy-primary-link {
  width: min(100%, 320px);
  justify-content: center;
  font-size: 1.08rem;
  margin-top: 8px;
}

.agent-academy {
  overflow: hidden;
  border: 1px solid rgba(15, 118, 110, .26);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(23,32,51,.07);
}

.academy-intro,
.academy-reference {
  padding: 18px;
}

.academy-shell {
  width: min(1380px, calc(100% - 28px));
}

.academy-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.agent-academy-page .agent-academy {
  min-height: calc(100vh - 155px);
}

.academy-intro {
  border-bottom: 1px solid #d6e9e6;
  background: #f8fffd;
}

.academy-reference {
  border-top: 1px solid #d6e9e6;
}

.academy-lab {
  display: grid;
  grid-template-columns: minmax(220px, .74fr) minmax(430px, 1.25fr) minmax(370px, 1fr);
  min-height: 620px;
}

.academy-exercises,
.academy-code-panel,
.academy-sim-panel {
  min-width: 0;
  padding: 14px;
}

.academy-exercises,
.academy-code-panel {
  border-left: 1px solid #d6e9e6;
}

.academy-exercises h3,
.academy-panel-head h3,
.academy-reference h3 {
  margin: 0;
  font-size: 1.05rem;
}

#academyExerciseList {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

#academyExerciseList button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 5px 9px;
  width: 100%;
  min-height: 86px;
  padding: 10px;
  border: 1px solid #d6e9e6;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: right;
}

#academyExerciseList button.active {
  border-color: var(--blue);
  background: #eef6ff;
  box-shadow: 0 10px 20px rgba(37,99,235,.12);
}

#academyExerciseList span {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  grid-row: span 2;
  border-radius: 999px;
  color: #fff;
  background: var(--teal);
  font-weight: 900;
}

#academyExerciseList strong,
#academyExerciseList small {
  min-width: 0;
}

#academyExerciseList small {
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.35;
}

.academy-panel-head {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.academy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.academy-actions .btn {
  min-height: 34px;
  padding: 7px 11px;
  font-size: .9rem;
}

.academy-editor-frame {
  min-height: 430px;
  border: 1px solid #cfe2f3;
  border-radius: 8px;
  background: #f8fafc;
}

.academy-blockly {
  width: 100%;
  height: 430px;
  min-height: 430px;
}

.academy-python,
#academyCode {
  width: 100%;
  min-height: 390px;
  height: 430px;
  margin: 0;
  resize: vertical;
  border: 0;
  border-radius: 8px;
  padding: 13px;
  background: #0f172a;
  color: #e2e8f0;
  font: 500 .92rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  outline: none;
  text-align: left;
}

.academy-mode-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid #c7daec;
  border-radius: 999px;
  background: #fff;
}

.academy-mode-tabs button {
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: transparent;
  color: var(--blue-dark);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.academy-mode-tabs button.active {
  background: var(--blue);
  color: #fff;
}

.academy-feedback {
  min-height: 42px;
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid #d6e9e6;
  border-radius: 8px;
  background: #f8fffd;
  color: var(--muted);
  font-weight: 800;
}

.academy-feedback.pass {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.academy-feedback.fail {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

#academyCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 64 / 42;
  border: 4px solid #1f2937;
  border-radius: 8px;
  background: #5f9f3b;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .16), 0 14px 24px rgba(15, 23, 42, .14);
  image-rendering: pixelated;
}

.academy-implementation-note {
  margin: 10px 0 0;
  padding: 9px 11px;
  border-right: 5px solid var(--green);
  border-radius: 8px;
  background: #ecfdf3;
  color: #14532d;
  font-weight: 850;
  line-height: 1.45;
}

#academyProgress {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 900;
}

.academy-checks {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.academy-checks div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-weight: 800;
}

.academy-checks span {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-weight: 900;
}

.academy-checks .pass {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.academy-checks .pass span {
  background: #22c55e;
  color: #fff;
}

.academy-checks .fail {
  border-color: #fed7aa;
  background: #fff7ed;
}
}

.academy-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.academy-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid #d6e9e6;
  border-radius: 8px;
  background: #f8fffd;
}

.academy-step-number {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #fff;
  background: var(--teal);
  font-weight: 900;
}

.academy-step h3 {
  margin-bottom: 6px;
  font-size: 1.02rem;
}

.academy-step p,
.academy-step strong {
  display: block;
  margin: 0 0 8px;
}

.academy-code-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.academy-code-lines code {
  display: inline-flex;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid #cfe1ed;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font-size: .86rem;
  white-space: normal;
}

.academy-step details {
  margin: 8px 0;
}

.academy-step summary {
  color: var(--blue-dark);
  cursor: pointer;
  font-weight: 900;
}

.academy-step pre {
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: .86rem;
  line-height: 1.45;
  text-align: left;
}

.exit-ticket-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.exit-ticket-form label {
  display: grid;
  gap: 7px;
  color: var(--blue-dark);
  font-weight: 900;
}

.exit-ticket-question {
  display: block;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e3a8a;
  padding: 10px 12px;
  line-height: 1.55;
}

.exit-ticket-form input,
.exit-ticket-form textarea {
  width: 100%;
  border: 2px solid #c7daec;
  border-radius: 14px;
  padding: 12px 14px;
  background: #fbfdff;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.exit-ticket-form textarea {
  min-height: 110px;
  resize: vertical;
}

.exit-ticket-form input:focus,
.exit-ticket-form textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .1);
}

.exit-ticket-form button {
  width: fit-content;
  cursor: pointer;
}

.exit-ticket-form button:disabled {
  cursor: wait;
  opacity: .72;
}

.makecode-workspace {
  display: grid;
  gap: 14px;
}

.makecode-editor-frame {
  min-height: 460px;
}

.makecode-code {
  margin: 0;
  min-height: 460px;
  overflow: auto;
  border: 1px solid #c7daec;
  border-radius: 14px;
  background: #0f172a;
  color: #dbeafe;
  padding: 16px;
  text-align: left;
  white-space: pre;
  font: 700 .95rem/1.55 "Courier New", Consolas, monospace;
}

.makecode-code[hidden] {
  display: none;
}

.craftom-blockly {
  width: 100%;
  height: 460px;
  border: 1px solid #c7daec;
  border-radius: 16px;
  background: #f8fbff;
  overflow: hidden;
}

.makecode-mode-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.makecode-mode-tabs button {
  border: 1px solid #c7daec;
  border-radius: 999px;
  background: #fff;
  color: var(--blue-dark);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 9px 14px;
}

.makecode-mode-tabs button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.submit-status {
  min-height: 1.4em;
  margin: 0;
  color: var(--teal);
  font-weight: 900;
}

.tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 8px;
  padding: 6px 10px;
  border: 1px solid #cce0f1;
  border-radius: 999px;
  color: var(--teal);
  background: #f2fbff;
  font-size: .88rem;
  font-weight: 900;
}

.rule {
  margin-top: 12px;
  padding: 12px 14px;
  border-right: 5px solid var(--green);
  border-radius: 14px;
  color: #14532d;
  background: #ecfdf3;
  font-weight: 800;
}

.lesson-card {
  display: grid;
  gap: 10px;
}

.lesson-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  object-fit: cover;
  background: #dfeef8;
}

.num {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-inline-end: 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
}

.wide-card {
  grid-column: 1 / -1;
}

.video-section {
  grid-template-columns: minmax(0, 860px);
  justify-content: center;
}

.video-card {
  padding: 16px;
}

.lesson-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.lesson-nav a {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid #bdd8f4;
  border-radius: 999px;
  background: #fff;
  color: var(--blue);
  font-weight: 900;
  text-decoration: none;
}

.lesson-nav a.active {
  color: #fff;
  background: var(--blue);
}

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

.detail-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

.detail-box h2 {
  font-size: 1.2rem;
}

.lesson-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 16px;
  background: #111;
}

.worksheet-lines {
  display: grid;
  gap: 10px;
}

.line {
  min-height: 54px;
  border: 2px dashed #c7daec;
  border-radius: 12px;
  background: #f8fcff;
}

.challenge-lesson-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.challenge-lesson-map a {
  display: grid;
  gap: 5px;
  min-height: 132px;
  padding: 12px;
  border: 1px solid #c7daec;
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
}

.challenge-lesson-map a.active {
  border-color: var(--blue);
  background: #eef6ff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, .12);
}

.challenge-lesson-map span {
  color: var(--blue-dark);
  font-weight: 900;
}

.challenge-lesson-map strong {
  font-size: 1.03rem;
}

.challenge-lesson-map small {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .academy-top,
  .hero,
  .grid,
  .grid-4,
  .steps,
  .detail-grid,
  .academy-steps,
  .academy-lab,
  .challenge-lesson-map {
    grid-template-columns: 1fr;
  }

  .academy-exercises,
  .academy-code-panel {
    border-left: 0;
    border-bottom: 1px solid #d6e9e6;
  }

  .academy-top {
    display: grid;
  }

  .shell {
    width: min(100% - 24px, 720px);
    padding-top: 18px;
  }

  .minecraft-shot img {
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 18px, 520px);
    padding-bottom: 82px;
  }

  .card {
    padding: 14px;
  }

  .actions,
  .challenge-actions,
  .challenge-nav {
    gap: 8px;
  }

  .btn,
  .challenge-nav a {
    min-height: 38px;
    padding: 9px 12px;
    font-size: .9rem;
  }
}
