:root {
  --bg: #f7f1dc;
  --ink: #273469;
  --accent: #f97316;
  --accent-soft: #ffd8a7;
  --card: #fffdf7;
  --line: #5a60a3;
  --ok: #176f3d;
  --warn: #8a1c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 80% -20%, #ffe4b8 0, transparent 42%),
    radial-gradient(circle at -10% 110%, #ffd9be 0, transparent 44%), var(--bg);
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(2px);
}

.bg-shape-one {
  width: 300px;
  height: 300px;
  background: #ffc86f55;
  top: -90px;
  right: -60px;
}

.bg-shape-two {
  width: 220px;
  height: 220px;
  background: #8cb2ff33;
  bottom: -80px;
  left: -70px;
}

.app {
  width: min(1100px, 94vw);
  margin: 1.6rem auto 2.8rem;
}

.hero h1,
.hero p,
.hero .eyebrow {
  margin: 0;
}

.eyebrow {
  font-family: "Quicksand", sans-serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  color: #4e56a1;
}

.hero h1 {
  font-family: "Quicksand", sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
}

.hero p {
  margin-top: 0.7rem;
  max-width: 68ch;
  line-height: 1.55;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  margin: 1rem 0 1.2rem;
}

button {
  border: 2px solid transparent;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  font-weight: 700;
  font-family: "Quicksand", sans-serif;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
}

button:nth-child(2) {
  background: #345995;
}

button:nth-child(3) {
  background: #e15700;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.07);
}

#feedback {
  margin: 0.2rem 0 0;
  font-weight: 600;
}

.workspace {
  position: relative;
  min-height: 760px;
  border: 2px solid #6d74b3;
  border-radius: 18px;
  background: linear-gradient(180deg, #fdf8ea 0%, #fffdf7 100%);
  padding: 1rem;
  box-shadow: 0 10px 35px #2f376822;
}

.links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.slot {
  position: absolute;
  width: min(14.2vw, 150px);
  min-height: 115px;
  border: 2px dashed #646db7;
  border-radius: 16px;
  background: #fffaf0bb;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.8rem 0.7rem 0.7rem;
}

.slot-label {
  position: absolute;
  top: 0.4rem;
  left: 0.6rem;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5a61a0;
  font-weight: 700;
}

.root {
  width: min(30vw, 260px);
  left: 50%;
  top: 5%;
  transform: translateX(-50%);
}

.child-a {
  left: 2%;
  top: 30%;
}

.child-b {
  left: 18%;
  top: 30%;
}

.child-c {
  left: 34%;
  top: 30%;
}

.child-d {
  left: 50%;
  top: 30%;
}

.child-e {
  left: 66%;
  top: 30%;
}

.child-f {
  left: 82%;
  top: 30%;
}

.sub-a {
  left: 2%;
  top: 66%;
}

.sub-b {
  left: 18%;
  top: 66%;
}

.sub-c {
  left: 34%;
  top: 66%;
}

.sub-d {
  left: 50%;
  top: 66%;
}

.sub-e {
  left: 66%;
  top: 66%;
}

.sub-f {
  left: 82%;
  top: 66%;
}

.slot.drag-over {
  background: var(--accent-soft);
  border-style: solid;
  border-color: var(--accent);
}

.page-card {
  width: 100%;
  min-height: 82px;
  background: var(--card);
  border: 2px solid #515aa0;
  border-radius: 12px;
  padding: 0.7rem;
  display: grid;
  gap: 0.25rem;
  cursor: grab;
  box-shadow: 0 6px 18px #3a427529;
  animation: rise-in 300ms ease both;
}

.page-card:active {
  cursor: grabbing;
}

.page-card h3,
.page-card p {
  margin: 0;
}

.page-card h3 {
  font-size: 0.88rem;
  font-family: "Quicksand", sans-serif;
}

.page-card p {
  font-size: 0.82rem;
  line-height: 1.35;
}

.page-card.card-lesson h3 {
  color: #1f4ea8;
}

.page-card.card-content h3 {
  color: #8a4b00;
}

.page-card.is-correct {
  border-color: #1f8f4f;
  background: #e9f9ee;
  box-shadow: 0 6px 18px #1f8f4f33;
}

.page-card.is-wrong {
  border-color: #c22b2b;
  background: #fff0f0;
  box-shadow: 0 6px 18px #c22b2b33;
}

.card-bank {
  margin-top: 1rem;
}

.card-bank h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 170px));
  gap: 0.8rem;
  min-height: 112px;
  padding: 0.6rem;
  border: 2px dashed #646db7;
  border-radius: 16px;
  background: #fffaf0;
  justify-content: start;
}

.status-ok {
  color: var(--ok);
}

.status-warn {
  color: var(--warn);
}

.activity-two {
  margin-top: 1.4rem;
  padding: 1rem;
  border: 2px solid #6d74b3;
  border-radius: 18px;
  background: linear-gradient(180deg, #fffdf7 0%, #f8f2df 100%);
  box-shadow: 0 10px 35px #2f37681a;
}

.download-wrap {
  margin-top: 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
}

.download-btn {
  background: linear-gradient(120deg, #e15700 0%, #ff7b00 100%);
  color: #fff;
  border: 3px solid #922f00;
  border-radius: 16px;
  font-family: "Quicksand", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.95rem 1.5rem;
  min-width: min(92vw, 360px);
  box-shadow: 0 12px 26px #a3360038;
}

.download-btn:hover,
.download-btn:focus-visible {
  transform: translateY(-1px) scale(1.01);
  filter: brightness(1.05);
}

.activity-two-header h2,
.activity-two-header p {
  margin: 0;
}

.activity-two-header h2 {
  font-family: "Quicksand", sans-serif;
  margin-bottom: 0.35rem;
}

.activity-two-header p + p {
  margin-top: 0.35rem;
}

#linkFeedback {
  font-weight: 700;
}

.code-lab {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  align-items: stretch;
}

.code-panel,
.preview-panel {
  display: flex;
  flex-direction: column;
  background: #fffaf0;
  border: 2px solid #646db7;
  border-radius: 14px;
  padding: 0.65rem;
}

.code-panel h3,
.preview-panel h3 {
  margin: 0 0 0.5rem;
  font-family: "Quicksand", sans-serif;
  font-size: 1rem;
}

#codeEditor {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-height: 370px;
  border: 2px solid #d5d9f5;
  border-radius: 10px;
  padding: 0.7rem;
  resize: none;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.87rem;
  line-height: 1.35;
  background: #fff;
  color: #1f2552;
}

#sitePreview {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-height: 370px;
  height: 370px;
  border: 2px solid #d5d9f5;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 860px) {
  .workspace {
    min-height: 890px;
  }

  .slot {
    width: 29vw;
    min-height: 108px;
  }

  .root {
    top: 5%;
  }

  .child-a {
    left: 4%;
    top: 22%;
  }

  .child-b {
    left: 35.5%;
    top: 22%;
  }

  .child-c {
    left: 67%;
    top: 22%;
  }

  .child-d {
    left: 4%;
    top: 43%;
  }

  .child-e {
    left: 35.5%;
    top: 43%;
  }

  .child-f {
    left: 67%;
    top: 43%;
  }

  .sub-a {
    left: 4%;
    top: 64%;
  }

  .sub-b {
    left: 35.5%;
    top: 64%;
  }

  .sub-c {
    left: 67%;
    top: 64%;
  }

  .sub-d {
    left: 4%;
    top: 85%;
  }

  .sub-e {
    left: 35.5%;
    top: 85%;
  }

  .sub-f {
    left: 67%;
    top: 85%;
  }
}

@media (max-width: 640px) {
  .workspace {
    min-height: 1680px;
    padding: 0.7rem;
  }

  .slot {
    width: calc(100% - 1.4rem);
    left: 0.7rem;
    right: 0.7rem;
    transform: none !important;
  }

  .root {
    top: 4%;
  }

  .child-a {
    top: 12%;
  }

  .child-b {
    top: 20%;
  }

  .child-c {
    top: 28%;
  }

  .child-d {
    top: 36%;
  }

  .child-e {
    top: 44%;
  }

  .child-f {
    top: 52%;
  }

  .sub-a {
    top: 60%;
  }

  .sub-b {
    top: 67%;
  }

  .sub-c {
    top: 74%;
  }

  .sub-d {
    top: 81%;
  }

  .sub-e {
    top: 88%;
  }

  .sub-f {
    top: 95%;
  }

  .code-lab {
    grid-template-columns: 1fr;
  }

  #codeEditor,
  #sitePreview {
    min-height: 320px;
  }
}
