:root {
  --bg: #fff;
  --ink: #111;
  --yellow: #ffbb1c;
  --yd: #c98600;
  --blue: #2a8cff;
  --bd: #1a6fd8;
  --muted: #444;
  --slab: "Roboto Slab", Georgia, serif;
  --mono: "Fira Code", Consolas, monospace;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
  scroll-padding-top: 4.6rem;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--slab);
  line-height: 1.6;
  overflow-x: hidden;
}
a {
  color: inherit;
}
body.loading {
  overflow: hidden;
}

/* ===== Само първият слайд е черен ===== */
.top {
  position: relative;
  overflow: hidden;
  background: #000;
  color: #fff;
  min-height: calc(100vh - 4.6rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
  padding: 3rem 1rem 4rem;
  text-align: center;
  background:
    radial-gradient(
      ellipse at 50% 40%,
      rgba(42, 140, 255, 0.25),
      transparent 65%
    ),
    #000;
}
#bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.top > *:not(canvas) {
  position: relative;
  z-index: 1;
}
.top h1 {
  margin: 0;
  display: inline-block;
  font: 800 clamp(2.4rem, 9vw, 6.4rem)/1.05 var(--slab);
  color: var(--yellow);
  text-shadow:
    3px 0 #b36b00,
    -2px 0 #d99500,
    0 2px #b36b00;
  filter: url(#glitch);
  transform: rotate(-1deg);
}
.top h1 span {
  display: inline-block;
  animation: drop 0.9s cubic-bezier(0.2, 1.6, 0.4, 1) both;
  animation-delay: calc(var(--i) * 55ms);
}
@keyframes drop {
  from {
    opacity: 0;
    translate: 0 -80px;
    rotate: -25deg;
    scale: 0.4;
  }
  to {
    opacity: 1;
    translate: 0 0;
    rotate: 0deg;
    scale: 1;
  }
}
.lp-sub {
  margin: 0;
  max-width: 30ch;
  font: 400 clamp(1.1rem, 3vw, 1.6rem)/1.4 var(--slab);
  color: #cfd6e2;
  animation: pop 0.8s 1.3s cubic-bezier(0.2, 1.8, 0.4, 1) both;
}
.lp-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
}
.lp-chips a {
  padding: 0.35rem 1rem;
  border-radius: 8px;
  font: 400 clamp(1rem, 2.6vw, 1.4rem) var(--slab);
  text-decoration: none;
  color: #fff;
  background: var(--blue);
  animation:
    pop 0.7s cubic-bezier(0.2, 1.8, 0.4, 1) both,
    float2 4s ease-in-out infinite;
  animation-delay: calc(1.5s + var(--k) * 110ms), calc(var(--k) * -0.7s);
}
.lp-chips a:nth-child(even) {
  background: var(--yellow);
  color: #000;
}
.lp-chips a:hover,
.lp-chips a:focus-visible {
  scale: 1.12;
  outline: 2px solid #fff;
  outline-offset: 3px;
}
@keyframes float2 {
  50% {
    translate: 0 -10px;
    rotate: 2deg;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    scale: 0;
    translate: 0 30px;
  }
  to {
    opacity: 1;
    scale: 1;
    translate: 0 0;
  }
}
.lp-cta {
  margin-top: 0.6rem;
  padding: 0.8rem 2.6rem;
  border-radius: 14px;
  background: var(--yellow);
  color: #000;
  font: 800 clamp(1.3rem, 3.6vw, 1.8rem) var(--slab);
  text-decoration: none;
  box-shadow: 0 8px 0 #a07800;
  rotate: -2deg;
  animation: pop 0.8s 2.2s cubic-bezier(0.2, 1.8, 0.4, 1) both;
  transition:
    translate 0.15s,
    box-shadow 0.15s;
}
.lp-cta:hover,
.lp-cta:focus-visible {
  translate: 0 4px;
  box-shadow: 0 4px 0 #a07800;
  outline: 2px solid #fff;
  outline-offset: 4px;
}
.lp-scroll {
  position: absolute !important;
  bottom: 0.4rem;
  left: 50%;
  translate: -50% 0;
  font: 700 2.6rem/1 var(--mono);
  color: var(--blue);
  text-decoration: none;
  animation: nudge 1.6s ease-in-out infinite;
}
@keyframes nudge {
  50% {
    translate: -50% 12px;
  }
}

/* Меню (бяло) */
nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  padding: 0.9rem 0.5rem;
  border-bottom: 1px solid #e3e3e3;
}
nav ul {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 900px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
}
body > nav a,
body > nav button {
  display: block;
  padding: 0.4rem 1.1rem;
  border-radius: 8px;
  font: 400 clamp(1rem, 2.6vw, 1.6rem)/1.3 var(--slab);
  text-decoration: none;
  color: #fff;
  background: var(--bd);
  border: 0;
  cursor: pointer;
  transition: transform 0.15s;
  animation: pop 0.7s cubic-bezier(0.2, 1.8, 0.4, 1) both;
  animation-delay: calc(0.9s + var(--n) * 110ms);
}
body > nav li:nth-child(odd) a,
body > nav li:nth-child(odd) button {
  background: var(--yellow);
  color: #000;
}
nav li:nth-child(1) a {
  transform: rotate(-2deg);
}
nav li:nth-child(2) a {
  transform: rotate(2deg);
}
nav li:nth-child(3) a {
  transform: rotate(-1deg);
}
nav li:nth-child(4) a {
  transform: rotate(3deg);
}
nav li:nth-child(5) a {
  transform: rotate(-2deg);
}
nav li:nth-child(6) a {
  transform: rotate(1.5deg);
}
body > nav a:hover,
body > nav a:focus-visible,
body > nav button:hover,
body > nav button:focus-visible {
  transform: rotate(0) scale(1.08);
  outline: 2px solid #000;
  outline-offset: 2px;
}

/* Интро */
#nachalo {
  min-height: 60vh;
  display: grid;
  place-items: center;
  padding: 2.5rem 1rem;
  text-align: center;
  scroll-snap-align: start;
}
#nachalo h2 {
  position: absolute;
  left: -9999px;
}
#nachalo p {
  display: inline-block;
  margin: 0;
  padding: 1rem 1.6rem;
  max-width: 900px;
  background: var(--bd);
  color: #fff;
  border-radius: 12px;
  font: 700 clamp(1.15rem, 3.4vw, 1.9rem)/1.35 var(--slab);
  animation:
    sway 5s ease-in-out infinite alternate,
    pop 0.9s 0.4s cubic-bezier(0.2, 1.8, 0.4, 1) both;
}
@keyframes sway {
  from {
    rotate: -1.5deg;
  }
  to {
    rotate: 1.5deg;
  }
}

/* Слайдове (бели) */
.lessons {
  position: relative;
}
.slide {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 5rem 1.25rem;
  overflow: hidden;
  scroll-snap-align: start;
  background: #fff;
  border-top: 2px solid color-mix(in srgb, var(--c) 55%, transparent);
  background:
    radial-gradient(
      ellipse at 50% 45%,
      color-mix(in srgb, var(--c) 16%, transparent),
      transparent 68%
    ),
    #fff;
}
.slide::before {
  content: attr(data-bg);
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  white-space: nowrap;
  font: 800 clamp(9rem, 34vw, 28rem)/1 var(--slab);
  color: transparent;
  -webkit-text-stroke: 2px color-mix(in srgb, var(--c) 45%, transparent);
  opacity: 0.4;
  pointer-events: none;
  animation: drift 10s ease-in-out infinite alternate;
}
@keyframes drift {
  from {
    translate: -54% -50%;
  }
  to {
    translate: -46% -50%;
  }
}
.slide .lesson {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 900px;
}
@media (min-width: 900px) {
  .slide .lesson {
    zoom: 1.3;
  }
}
.deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.lesson {
  position: relative;
  min-height: 230px;
  scroll-margin-top: 90px;
}
.lesson img {
  position: absolute;
  display: block;
  height: auto;
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 12px 12px rgba(0, 0, 0, 0.25));
}
.lesson .big {
  position: absolute;
  margin: 0;
}
.lesson a.go {
  position: absolute;
  z-index: 10;
  text-decoration: none;
  cursor: pointer;
  padding: 0.4rem 0.9rem;
  margin: -0.4rem -0.9rem;
  transition:
    scale 0.2s,
    filter 0.2s;
}
.lesson a.go:hover,
.lesson a.go:focus-visible {
  filter: brightness(0.9);
  scale: 1.1;
  outline: 2px dashed currentColor;
  outline-offset: 6px;
}
@keyframes float {
  0%,
  100% {
    translate: 0 0;
    rotate: -3deg;
  }
  50% {
    translate: 0 -16px;
    rotate: 4deg;
  }
}
.js .lesson {
  opacity: 0;
  translate: 0 80px;
  scale: 0.92;
}
.js .lesson.in {
  opacity: 1;
  translate: 0 0;
  scale: 1;
  transition:
    opacity 0.8s,
    translate 0.9s cubic-bezier(0.2, 1.4, 0.4, 1),
    scale 0.9s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.big {
  animation: bob 3.2s ease-in-out infinite alternate;
}
@keyframes bob {
  from {
    translate: 0 0;
  }
  to {
    translate: 0 -8px;
  }
}

#HTMLB img {
  left: 0;
  top: 0;
  width: 120px;
}
#HTMLB .big {
  left: 26%;
  top: -10px;
  font: 700 clamp(4rem, 12vw, 8rem)/1 var(--slab);
  color: var(--yd);
  filter: url(#wobble);
  text-shadow:
    3px 3px 0 #ffe29a,
    6px 6px 0 #ffd05a;
}
#HTMLB a.go {
  left: 4%;
  top: 170px;
  font: 400 clamp(1.5rem, 4vw, 2.3rem)/1 var(--slab);
  color: var(--yd);
  transform: rotate(14deg);
  transform-origin: left top;
}
#cssz img {
  left: 0;
  top: 10px;
  width: 150px;
}
#cssz .big {
  left: 30%;
  top: 0;
  font:
    800 clamp(4rem, 12vw, 7.5rem)/1 "Rubik",
    sans-serif;
  color: var(--bd);
  filter: url(#wobble);
  text-shadow:
    3px 3px 0 #bcd9ff,
    6px 6px 0 #8dbfff;
}
#cssz a.go {
  left: 14%;
  top: 185px;
  font:
    500 clamp(2rem, 6vw, 3.6rem)/1 "Rubik",
    sans-serif;
  color: var(--bd);
  transform: rotate(3deg);
}
#cssz a.go b {
  font:
    700 1em/1 "Marck Script",
    cursive;
}
#jsv img {
  left: 0;
  top: 0;
  width: 130px;
}
#jsv .big {
  right: 0;
  top: 0;
  font:
    400 clamp(2.4rem, 8vw, 4.8rem)/1.1 "Pacifico",
    cursive;
  color: var(--yd);
  text-shadow:
    2px 2px 0 #ffe29a,
    4px 4px 0 #ffd05a;
}
#jsv a.go {
  left: 28%;
  top: 170px;
  padding: 0.5rem 1.4rem;
  margin: 0;
  background: var(--yellow);
  color: #000;
  border-radius: 10px;
  font: 400 clamp(1.6rem, 5vw, 2.6rem)/1.2 var(--slab);
  transform: rotate(-3deg);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.2);
}
#csharpb {
  min-height: 340px;
}
#csharpb img {
  left: 0;
  top: 0;
  width: 150px;
}
#csharpb .big {
  left: 32%;
  top: -20px;
  font:
    400 clamp(5rem, 16vw, 10rem)/1 "Great Vibes",
    cursive;
  color: var(--bd);
  text-shadow: 3px 3px 0 #bcd9ff;
}
#csharpb a.go {
  left: 14%;
  top: 215px;
  width: min(520px, 80%);
  padding: 2.8rem 1rem;
  margin: 0;
  text-align: center;
  font:
    700 clamp(2rem, 6vw, 3.4rem)/1 "Marck Script",
    cursive;
  color: var(--yellow);
  background:
    linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)),
    repeating-linear-gradient(0deg, #0f1a2a 0 14px, #16263c 14px 16px);
  border-radius: 4px;
  transform: rotate(3deg);
  box-shadow: 0 12px 0 rgba(0, 0, 0, 0.25);
}
#pytn {
  min-height: 300px;
}
#pytn img {
  left: 0;
  top: 0;
  width: 150px;
}
#pytn .big {
  left: 30%;
  top: 0;
  font: 500 clamp(1.3rem, 4.6vw, 2.8rem)/1.2 var(--mono);
  color: var(--yd);
  transform: rotate(-8deg);
  transform-origin: left bottom;
}
#pytn a.go {
  left: 14%;
  top: 225px;
  font: 400 clamp(1.1rem, 3.6vw, 2rem)/1.2 var(--mono);
  color: var(--bd);
  transform: rotate(5deg);
}

/* Декорации */
.deco {
  perspective: 900px;
}
.orbit {
  position: absolute;
  right: 9%;
  top: 48%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  animation: spin 16s linear infinite;
}
.orbit span {
  position: absolute;
  translate: -50% -50%;
  transform: rotateY(calc(var(--k) * 60deg)) translateZ(190px);
  font: 500 1.1rem var(--mono);
  color: #000;
  background: var(--yellow);
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  box-shadow: 0 0 18px #ffbb1c99;
}
@keyframes spin {
  to {
    transform: rotateX(-12deg) rotateY(360deg);
  }
}
.blob {
  position: absolute;
  width: 280px;
  height: 280px;
  filter: blur(28px);
  opacity: 0.55;
  animation:
    morph 7s ease-in-out infinite alternate,
    roam 11s ease-in-out infinite alternate;
}
.b1 {
  left: 5%;
  top: 12%;
  background: linear-gradient(135deg, #2a8cff, #1456b8);
}
.b2 {
  right: 6%;
  top: 45%;
  background: linear-gradient(135deg, #ffbb1c, #d99500);
  animation-delay: -3s;
}
.b3 {
  left: 40%;
  bottom: -8%;
  background: linear-gradient(135deg, #2a8cff, #1456b8);
  animation-delay: -5s;
  width: 220px;
  height: 220px;
}
@keyframes morph {
  0% {
    border-radius: 60% 40% 30% 70%/60% 30% 70% 40%;
  }
  50% {
    border-radius: 30% 60% 70% 40%/50% 60% 30% 60%;
  }
  100% {
    border-radius: 50% 50% 40% 60%/40% 70% 30% 60%;
  }
}
@keyframes roam {
  to {
    translate: 60px -50px;
    rotate: 40deg;
  }
}
.ball {
  position: absolute;
  left: var(--x);
  bottom: 6%;
  width: var(--w);
  height: var(--w);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff3b0, #ffbb1c 50%, #a07800);
  box-shadow: 0 0 20px #ffbb1c88;
  animation: bounce var(--d) cubic-bezier(0.3, 0.9, 0.4, 1) infinite alternate;
}
@keyframes bounce {
  from {
    translate: 0 0;
    scale: 1 0.8;
  }
  to {
    translate: 0 -62vh;
    scale: 1 1;
  }
}
.rain b {
  position: absolute;
  left: var(--x);
  top: -30%;
  font: 500 1rem/1.5 var(--mono);
  color: var(--bd);
  opacity: 0.35;
  animation: fall var(--d) linear var(--dl) infinite;
}
@keyframes fall {
  to {
    translate: 0 160vh;
  }
}
.term {
  position: absolute;
  right: 6%;
  bottom: 9%;
  width: min(330px, 40%);
  background: #0d1117;
  border: 1px solid #2a8cff66;
  border-radius: 12px;
  padding: 2.2rem 1rem 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  animation: float 5s ease-in-out infinite;
}
.term i {
  position: absolute;
  top: 0.8rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2a8cff;
}
.term i:nth-child(1) {
  left: 0.9rem;
}
.term i:nth-child(2) {
  left: 1.9rem;
  background: #ffbb1c;
}
.term i:nth-child(3) {
  left: 2.9rem;
  background: #fff;
}
.term pre {
  margin: 0;
  min-height: 5.5rem;
  font: 400 0.85rem/1.6 var(--mono);
  color: #ffbb1c;
  white-space: pre-wrap;
}
.term pre::after {
  content: "▌";
  animation: blink 1s steps(2) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Прогрес и точки */
#bar {
  position: fixed;
  left: 0;
  top: 0;
  height: 4px;
  width: 100%;
  transform-origin: left;
  transform: scaleX(0);
  background: linear-gradient(90deg, #ffbb1c, #2a8cff);
  z-index: 30;
}
#dots {
  position: fixed;
  right: 14px;
  top: 50%;
  translate: 0 -50%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 30;
}
#dots a {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #0004;
  background: #fff8;
  transition: 0.25s;
}
#dots a.on {
  background: var(--c, #000);
  border-color: var(--c, #000);
  scale: 1.5;
}

/* Урок 1 */
.startlesson {
  text-align: center;
  max-width: 1000px;
}
.st-title {
  margin: 0;
  font: 800 clamp(1.8rem, 5vw, 3.2rem)/1.15 var(--slab);
  color: var(--bd);
  text-shadow: 2px 2px 0 #bcd9ff;
  rotate: -1deg;
}
.st-sub {
  margin: 0.8rem 0 2rem;
  font: 400 clamp(1rem, 2.6vw, 1.3rem) var(--slab);
  color: var(--muted);
}
.dlgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.4rem;
}
.dlcard {
  position: relative;
  text-align: left;
  padding: 1.3rem 1.3rem 1rem;
  border-radius: 16px;
  background: #fff;
  border: 2px solid var(--blue);
  box-shadow: 0 8px 0 #cfe3ff;
  rotate: var(--r);
  transition:
    rotate 0.25s,
    scale 0.25s;
}
.dlcard:hover {
  rotate: 0deg;
  scale: 1.03;
}
.dlcard .ico {
  position: absolute;
  right: 1rem;
  top: 0.6rem;
  font: 700 2.2rem var(--mono);
  color: var(--yd);
  animation: float 6s ease-in-out infinite;
}
.dlcard h3 {
  margin: 0 0 0.3rem;
  font: 700 1.35rem var(--slab);
  color: var(--bd);
  max-width: 75%;
}
.dlcard p {
  margin: 0 0 0.9rem;
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 85%;
}
.dlcard a.dl {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  border-radius: 9px;
  background: var(--bd);
  color: #fff;
  font: 700 1rem var(--slab);
  text-decoration: none;
}
.dlcard a.dl:hover,
.dlcard a.dl:focus-visible {
  background: #0f56ab;
  outline: 2px dashed #000;
  outline-offset: 4px;
}
.dlcard label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}
.dlcard input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--bd);
}
.dlcard:has(input:checked) {
  background: #e6f0fd;
}
.st-prog {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 520px;
  margin: 2rem auto 0;
}
.st-bar {
  flex: 1;
  height: 14px;
  border-radius: 9px;
  background: #0001;
  overflow: hidden;
}
.st-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--bd);
  transition: width 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}
#stcount {
  font: 700 1rem var(--mono);
  color: var(--bd);
  min-width: 5.5rem;
  text-align: right;
}

#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: #fff;
  transition:
    opacity 0.5s,
    visibility 0.5s;
}
#loader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
#loader span {
  font: 500 clamp(3rem, 14vw, 7rem)/1 var(--mono);
  color: var(--yd);
}
#loader i {
  font-style: normal;
  animation: ld 1s ease-in-out infinite;
  opacity: 0.15;
}
#loader i:nth-child(2) {
  animation-delay: 0.15s;
}
#loader i:nth-child(3) {
  animation-delay: 0.3s;
}
#loader i:nth-child(4) {
  animation-delay: 0.45s;
}
@keyframes ld {
  40% {
    opacity: 1;
  }
}

@media (max-width: 700px) {
  .lesson {
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9rem;
  }
  .lesson img,
  .lesson .big,
  .lesson a.go {
    position: static;
    max-width: 100%;
    text-align: left !important;
  }
  .lesson img {
    width: 100px !important;
  }
  #csharpb a.go {
    width: 100%;
    padding: 2rem 1rem;
  }
  .dlgrid {
    grid-template-columns: 1fr;
  }
  #dots {
    display: none;
  }
  .slide {
    min-height: 85vh;
  }
  .slide::before {
    font-size: 9rem;
  }
  .deco:not(:has(.blob, .ball, .rain)) {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .js .lesson {
    opacity: 1;
    translate: none;
    scale: 1;
  }
}

/* ===== Светла / тъмна тема ===== */
:root {
  --line: #d9e0ee;
  --panel: #f1f4fa;
  --chrome: #e3e8f1;
}
html[data-theme="dark"] {
  --bg: #000;
  --ink: #fff;
  --muted: #c3c8d2;
  --yd: #ffbb1c;
  --bd: #2a8cff;
  --line: #2b3140;
  --panel: #10131a;
  --chrome: #1a1e27;
}
html[data-theme="dark"] nav {
  border-bottom-color: #222;
}
html[data-theme="dark"] nav a:hover,
html[data-theme="dark"] nav a:focus-visible {
  outline-color: #fff;
}
html[data-theme="dark"] .slide {
  background:
    radial-gradient(
      ellipse at 50% 45%,
      color-mix(in srgb, var(--c) 24%, transparent),
      transparent 68%
    ),
    #000;
}
html[data-theme="dark"] .dlcard {
  background: rgba(42, 140, 255, 0.07);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] .dlcard:has(input:checked) {
  background: rgba(42, 140, 255, 0.2);
}
html[data-theme="dark"] .dlcard a.dl:hover {
  outline-color: #fff;
}
html[data-theme="dark"] #loader {
  background: #000;
}
html[data-theme="dark"] #dots a {
  border-color: #fff8;
  background: #0008;
}
html[data-theme="dark"] .st-bar {
  background: #ffffff22;
}
html[data-theme="dark"] .st-title {
  text-shadow: 2px 2px 0 #12306b;
}
html[data-theme="dark"] :is(#HTMLB, #cssz, #jsv, #csharpb) .big {
  text-shadow:
    2px 2px 0 rgba(0, 0, 0, 0.6),
    4px 4px 0 rgba(0, 0, 0, 0.5),
    6px 6px 8px rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] #cssz .big {
  text-shadow:
    0 0 18px #2a8cff,
    3px 3px 0 #06206b;
}
html[data-theme="dark"] #jsv a.go {
  box-shadow: 0 12px 0 rgba(0, 0, 0, 0.45);
}
html[data-theme="dark"] .lesson img {
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.6));
}
.themebtn {
  font: 700 0.95rem var(--slab);
  cursor: pointer;
  border: 2px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
}
.themebtn:hover {
  background: var(--ink);
  color: var(--bg);
}
#theme {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 40;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

/* ===== Сайт в сайта (прозорец като браузър) ===== */
#app {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  padding: 2vh 2vw;
  display: none;
}
#app.open {
  display: block;
}
.win {
  height: 100%;
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.tabs {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  background: var(--chrome);
  padding: 0.6rem 0.9rem 0;
}
.dots3 {
  display: flex;
  gap: 7px;
  padding-bottom: 0.9rem;
}
.dots3 i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f57;
}
.dots3 i:nth-child(2) {
  background: #febc2e;
}
.dots3 i:nth-child(3) {
  background: #28c840;
}
.tab {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  max-width: 340px;
  min-width: 0;
  background: var(--bg);
  padding: 0.5rem 0.6rem 0.5rem 1rem;
  border-radius: 10px 10px 0 0;
  font: 500 0.92rem var(--slab);
}
.tab span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tab button {
  border: 0;
  background: none;
  color: inherit;
  font: 700 1.2rem/1 var(--slab);
  cursor: pointer;
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
}
.tab button:hover {
  background: var(--panel);
}
.tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--line);
}
.nb {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: var(--panel);
  color: var(--ink);
  font: 700 1.1rem var(--slab);
  cursor: pointer;
}
.nb:hover {
  background: var(--line);
}
.url {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border-radius: 999px;
  padding: 0.35rem 1rem;
  font: 400 0.88rem var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewport {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 200px minmax(0, 1.1fr) minmax(0, 1fr);
}
.viewport > * {
  min-height: 0;
  overflow: auto;
}
#side {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 0.8rem;
  border-right: 1px solid var(--line);
  background: var(--panel);
}
#side a {
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.95rem;
}
#side a:hover {
  background: var(--line);
}
#side a.on {
  background: var(--ac);
  color: #000;
  font-weight: 700;
}
#side .sh {
  font: 800 1.2rem var(--slab);
  margin: 0.2rem 0.8rem 0.4rem;
}
#side .back {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}
#crs {
  padding: 1.5rem 1.8rem 3rem;
  font-size: 1rem;
  line-height: 1.7;
}
#crs h1 {
  font: 800 clamp(1.6rem, 3vw, 2.2rem)/1.2 var(--slab);
  margin: 0 0 0.6rem;
}
#crs h2 {
  font: 800 1.6rem/1.25 var(--slab);
  margin: 1rem 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 4px solid var(--ac);
}
#crs h3 {
  font: 700 1.15rem var(--slab);
  margin: 1.4rem 0 0.4rem;
}
#crs p {
  margin: 0.4rem 0;
}
#crs .intro {
  color: var(--muted);
}
#crs code {
  font-family: var(--mono);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 0.05em 0.35em;
  border-radius: 5px;
  font-size: 0.9em;
}
#crs mark {
  background: var(--yellow);
  color: #000;
}
.codebox {
  margin: 0.7rem 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.codebox pre {
  margin: 0;
  padding: 0.9rem 1rem;
  background: #0d1117;
  color: #e6edf3;
  font: 400 0.88rem/1.55 var(--mono);
  overflow: auto;
  white-space: pre;
}
.cb {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  background: var(--panel);
}
.btn {
  display: inline-block;
  border: 0;
  border-radius: 8px;
  padding: 0.45rem 1rem;
  background: var(--ac, #ffbb1c);
  color: #000;
  font: 700 0.92rem var(--slab);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover {
  filter: brightness(1.1);
}
.btn.ghost {
  background: var(--line);
  color: var(--ink);
}
.tip,
.task {
  margin: 0.9rem 0;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border-left: 6px solid var(--ac);
}
.tip {
  background: var(--panel);
}
.task {
  background: color-mix(in srgb, var(--ac) 14%, transparent);
}
.pn {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
}
.q {
  margin: 1rem 0;
  padding: 0.7rem 1rem;
  border: 2px solid var(--line);
  border-radius: 10px;
}
.q legend {
  font-weight: 700;
  padding: 0 0.4rem;
}
.q label {
  display: block;
  padding: 0.2rem 0;
  cursor: pointer;
}
.q.ok {
  border-color: #28a05a;
  background: rgba(40, 160, 90, 0.12);
}
.q.bad {
  border-color: #d9434f;
  background: rgba(217, 67, 79, 0.12);
}
#res {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 10px;
  font: 700 1.15rem/1.6 var(--slab);
}
#res.good {
  background: rgba(40, 160, 90, 0.18);
}
#res.badr {
  background: rgba(217, 67, 79, 0.18);
}
#tester {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden !important;
}
.th {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--line);
}
.th .tb {
  margin-left: auto;
  display: flex;
  gap: 0.4rem;
}
#tl {
  color: var(--muted);
  font-size: 0.85rem;
}
#code {
  flex: 0 0 42%;
  width: 100%;
  resize: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0.9rem 1rem;
  background: #0d1117;
  color: #e6edf3;
  font: 400 0.9rem/1.55 var(--mono);
  tab-size: 2;
  outline: none;
}
#code:focus {
  box-shadow: inset 0 0 0 2px var(--ac);
}
#out {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#prev {
  flex: 1;
  min-height: 120px;
  width: 100%;
  border: 0;
  background: #fff;
}
#cons {
  margin: 0;
  flex: 0 0 32%;
  overflow: auto;
  padding: 0.7rem 1rem;
  background: #000;
  color: #8df0b0;
  font: 400 0.88rem/1.5 var(--mono);
  white-space: pre-wrap;
}
#out.nopv #cons {
  flex: 1;
}
#out.nopv #prev {
  display: none;
}
@media (max-width: 900px) {
  #app {
    padding: 0;
  }
  .win {
    border-radius: 0;
  }
  .viewport {
    display: block;
    overflow: auto;
  }
  #side {
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0.6rem;
  }
  #side a {
    white-space: nowrap;
  }
  #side .sh {
    display: none;
  }
  #crs {
    overflow: visible;
    padding: 1.2rem 1rem;
  }
  #tester {
    height: 640px;
    border-left: 0;
    border-top: 2px solid var(--line);
  }
  .tab {
    max-width: 60%;
  }
}

.tk-c {
  color: #8b949e;
  font-style: italic;
}
.tk-s {
  color: #a5d6ff;
}
.tk-n {
  color: #79c0ff;
}
.tk-t {
  color: #7ee787;
}
.tk-k {
  color: #ff7b72;
}
.pbar {
  height: 8px;
  margin: 0 0.8rem 0.6rem;
  border-radius: 8px;
  background: var(--line);
  overflow: hidden;
}
.pbar i {
  display: block;
  height: 100%;
  background: var(--ac);
  transition: width 0.4s;
}
#side .gr {
  margin: 0.4rem 0.8rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 8px;
  top: 8px;
  z-index: 999;
  background: #fff;
  color: #000;
  padding: 0.5rem 1rem;
  border-radius: 8px;
}
@media print {
  #app,
  nav,
  #theme,
  #bar,
  #dots {
    display: none !important;
  }
}

/* Игра */
.gamezone {
  max-width: 900px;
  margin: 0 auto;
  padding: 4rem 1.25rem 5rem;
  text-align: center;
  scroll-margin-top: 70px;
}
.gamezone h2 {
  font: 800 clamp(1.8rem, 5vw, 3rem)/1.15 var(--slab);
  color: var(--bd);
  margin: 0 0 0.4rem;
}
.gsub,
.ghelp {
  color: var(--muted);
  max-width: 60ch;
  margin: 0 auto 1.4rem;
}
.ghelp {
  font-size: 0.9rem;
  margin-bottom: 0;
}
.gwrap {
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid var(--yellow);
  box-shadow:
    0 12px 0 rgba(0, 0, 0, 0.2),
    0 0 40px rgba(42, 140, 255, 0.25);
}
.gwrap canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
}

/* Академия и профили */
.account-section {
  padding: 1rem;
  background:
    radial-gradient(ellipse at 90% 0, rgba(42, 140, 255, 0.13), transparent 42%),
    var(--panel);
}
.account-dialog {
  width: min(960px, calc(100% - 1.5rem));
  max-width: none;
  max-height: min(90vh, 900px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}
.account-dialog::backdrop {
  background: rgba(7, 12, 22, 0.72);
  backdrop-filter: blur(4px);
}
.account-dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.account-dialog-head h2 {
  margin: 0;
  color: var(--bd);
  font-size: clamp(1.25rem, 4vw, 1.8rem);
  line-height: 1.2;
}
.account-dialog-head .account-kicker {
  margin: 0 0 0.25rem;
}
.account-dialog-close {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.8rem/1 var(--slab);
  cursor: pointer;
}
.account-dialog-close:hover,
.account-dialog-close:focus-visible {
  border-color: var(--bd);
  outline: 2px solid var(--bd);
  outline-offset: 2px;
}
.account-dialog .account-section {
  background: transparent;
}
.account-wrap {
  max-width: 1050px;
  margin: 0 auto;
}
.account-wrap > h2 {
  margin: 0;
  color: var(--bd);
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.15;
}
.account-wrap > p {
  max-width: 70ch;
}
.account-kicker {
  margin: 0 0 0.5rem;
  color: var(--yd);
  font: 700 0.85rem var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.portal-auth,
.portal-dashboard {
  margin-top: 1.5rem;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg);
  box-shadow: 0 12px 35px rgba(20, 40, 80, 0.1);
}
.portal-auth {
  max-width: 620px;
}
.portal-tabs,
.portal-user,
.user-role {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}
.portal-tabs {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.portal-user {
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}
.portal-user h3 {
  margin: 0.3rem 0 0;
  font-size: 1.5rem;
}
.portal-user small,
.user-role small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.role-pill,
.custom-tag {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 0.18rem 0.7rem;
  background: var(--yellow);
  color: #111;
  font: 700 0.78rem var(--slab);
}
.portal-block {
  margin-top: 1.5rem;
}
.portal-block h3 {
  margin-bottom: 0.5rem;
}
.portal-form {
  display: grid;
  gap: 0.8rem;
  margin: 1rem 0;
}
.portal-form label {
  display: grid;
  gap: 0.3rem;
  font-weight: 700;
}
.portal-form input,
.portal-form textarea,
.portal-form select,
.user-role select {
  width: 100%;
  min-height: 42px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem var(--slab);
}
.portal-form textarea {
  min-height: 90px;
  resize: vertical;
}
.portal-form input:focus-visible,
.portal-form textarea:focus-visible,
.portal-form select:focus-visible,
.user-role select:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
.portal-form .check-label {
  display: flex;
  align-items: center;
}
.portal-form .check-label input {
  width: auto;
  min-height: 0;
}
.teacher-form,
.portal-test,
.subject-card,
.grade-card,
.user-role {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.teacher-form h4,
.portal-test h4 {
  margin: 0;
}
.subject-card {
  margin: 0.8rem 0;
}
.subject-card > summary {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 800;
}
.portal-lesson {
  margin: 0.8rem 0;
  padding: 0.9rem;
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: var(--bg);
}
.portal-lesson h4,
.portal-lesson p {
  margin: 0.2rem 0 0.6rem;
}
.portal-lesson pre {
  overflow-x: auto;
  padding: 0.8rem;
  border-radius: 8px;
  background: #10131a;
  color: #eaf0ff;
  font: 0.88rem/1.5 var(--mono);
  white-space: pre-wrap;
}
.portal-test {
  margin: 0.8rem 0;
}
.assessment-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}
.assessment-card h4 {
  margin: 0.65rem 0;
}
.assessment-card > details {
  margin-top: 0.8rem;
}
.assessment-card > details > summary,
.easy-editor > summary {
  cursor: pointer;
}
.assessment-card .portal-test {
  margin-top: 0.8rem;
}
.submission-card {
  margin: 0.8rem 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.submission-card p {
  overflow-wrap: anywhere;
}
.portal-question,
.question-editor {
  margin: 0.8rem 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.portal-question label {
  display: block;
  margin: 0.35rem 0;
  cursor: pointer;
}
.portal-question input {
  accent-color: var(--blue);
}
.portal-notice {
  margin: 0.6rem 0;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  background: #e4f7ec;
  color: #14532d;
}
.portal-notice.is-error {
  background: #fff0ed;
  color: #9a2618;
}
.grade-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.7rem;
}
.grade-card b,
.grade-card span,
.grade-card small {
  display: block;
}
.grade-card small {
  color: var(--muted);
}
.admin-tools {
  padding-top: 1rem;
  border-top: 2px solid var(--line);
}
.user-role {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(100px, 160px) auto;
  margin: 0.6rem 0;
}
.user-role button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.user-search {
  display: grid;
  gap: 0.35rem;
  max-width: 520px;
  font-weight: 700;
}
.user-search input {
  min-height: 42px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem var(--slab);
}
.user-search input:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
.lesson-lock {
  max-width: 600px;
  margin: 10vh auto;
  padding: 2rem;
  border-radius: 16px;
  background: var(--panel);
  text-align: center;
}
.lesson-lock > span {
  font-size: 3rem;
}
.portal-dashboard {
  max-width: 1180px;
  overflow: hidden;
  animation: portal-enter 0.38s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes portal-enter {
  from {
    opacity: 0;
    translate: 0 12px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}
.school-menu {
  position: sticky;
  top: 0.5rem;
  z-index: 2;
  display: flex;
  gap: 0.35rem;
  margin: 1rem -0.5rem;
  padding: 0.45rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
}
.school-menu-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0.5rem 0.85rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: 700 0.92rem var(--slab);
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    translate 0.18s ease;
}
.school-menu-item > span {
  color: var(--bd);
  font-size: 1.1rem;
}
.school-menu-item:hover {
  background: var(--panel);
  translate: 0 -1px;
}
.school-menu-item.active {
  background: var(--bd);
  color: #fff;
}
.school-menu-item.active > span {
  color: var(--yellow);
}
.school-page {
  min-height: 300px;
  animation: page-enter 0.24s ease both;
}
@keyframes page-enter {
  from {
    opacity: 0.4;
    translate: 0 5px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}
.welcome-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.4rem;
  padding: clamp(1.1rem, 4vw, 2.2rem);
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 80% 0, rgba(255, 255, 255, 0.32), transparent 45%),
    linear-gradient(125deg, #1a6fd8, #347ed5 55%, #5e65c4);
  color: #fff;
}
.welcome-card h3 {
  margin: 0.55rem 0 0.35rem;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
}
.welcome-card p {
  max-width: 55ch;
  margin: 0;
  color: #f0f5ff;
}
.welcome-card .role-pill {
  background: var(--yellow);
}
.welcome-stats {
  display: flex;
  gap: 0.6rem;
}
.welcome-stats > div {
  display: grid;
  min-width: 78px;
  place-items: center;
  padding: 0.75rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
}
.welcome-stats b {
  font-size: 1.55rem;
  line-height: 1.2;
}
.welcome-stats span {
  font-size: 0.72rem;
}
.quick-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 1rem 0;
}
.quick-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 68px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  font: 700 0.95rem var(--slab);
  cursor: pointer;
  transition:
    translate 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.quick-link:hover {
  translate: 0 -3px;
  border-color: var(--blue);
  box-shadow: 0 8px 20px rgba(42, 140, 255, 0.13);
}
.quick-link span {
  color: var(--bd);
  font-size: 1.2rem;
}
.section-heading {
  margin-bottom: 1rem;
}
.section-heading h3 {
  margin: 0.5rem 0 0.2rem;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
}
.section-heading p {
  margin: 0;
  color: var(--muted);
}
.text-button {
  padding: 0.25rem 0;
  border: 0;
  background: transparent;
  color: var(--bd);
  font: 700 0.9rem var(--slab);
  cursor: pointer;
}
.join-card,
.parent-code-card,
.classroom-card,
.homework-card,
.empty-card {
  margin: 1rem 0;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  animation: page-enter 0.25s ease both;
}
.join-card {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 0.8fr);
  align-items: center;
  gap: 1rem;
}
.parent-code-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 100% 0, rgba(255, 187, 28, 0.15), transparent 45%),
    var(--panel);
}
.parent-code-card h3 {
  margin: 0.35rem 0 0;
}
.parent-code-card p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.parent-code-card .text-button {
  white-space: nowrap;
}
.join-card h3,
.classroom-card h3 {
  margin: 0.45rem 0 0;
}
.join-form {
  grid-template-columns: 1fr auto;
  align-items: end;
}
.join-form label {
  min-width: 0;
}
.classroom-card > header,
.homework-card > header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.classroom-page {
  --classroom-accent: #1a6fd8;
}
.classroom-page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.classroom-page-heading h3 {
  margin: 0.55rem 0 0.2rem;
  font-size: clamp(1.45rem, 3vw, 2rem);
}
.classroom-page-heading p {
  margin: 0;
  color: var(--muted);
}
.classroom-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1.2rem 0 1.4rem;
}
.classroom-overview > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: 0 5px 18px rgba(18, 43, 80, 0.04);
}
.classroom-overview span {
  color: var(--muted);
  font-size: 0.9rem;
}
.classroom-overview b {
  color: var(--classroom-accent);
  font-size: 1.6rem;
  line-height: 1;
}
.classroom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr));
  align-items: start;
  gap: 1rem;
}
.classroom-grid .classroom-card {
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--line) 82%, var(--classroom-accent));
  background: var(--bg);
  box-shadow: 0 10px 30px rgba(18, 43, 80, 0.07);
}
.classroom-card-head {
  align-items: center;
  padding: 1.2rem 1.25rem;
  background:
    radial-gradient(ellipse at 100% 0, rgba(42, 140, 255, 0.1), transparent 52%),
    var(--panel);
}
.classroom-title {
  min-width: 0;
}
.classroom-eyebrow,
.class-code-panel > div > span {
  color: var(--bd);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
}
.classroom-title h4 {
  margin: 0.3rem 0 0.2rem;
  font-size: 1.25rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.classroom-title p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.classroom-metrics {
  display: flex;
  flex: 0 0 auto;
  gap: 0.45rem;
}
.classroom-metrics span {
  display: grid;
  min-width: 74px;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--muted);
  text-align: center;
  font-size: 0.72rem;
}
.classroom-metrics b {
  color: var(--ink);
  font-size: 1rem;
}
.class-code-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid color-mix(in srgb, var(--classroom-accent) 24%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--classroom-accent) 5%, var(--bg));
}
.class-code-panel p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.class-code-panel .class-code {
  min-width: 132px;
  border-color: color-mix(in srgb, var(--classroom-accent) 32%, var(--line));
}
.classroom-card .classroom-editor,
.classroom-card .classroom-roster {
  margin: 0 1.25rem 1rem;
}
.classroom-card .classroom-editor {
  padding: 0.65rem 0.75rem;
}
.classroom-roster {
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}
.classroom-subheading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.65rem;
}
.classroom-subheading h5 {
  margin: 0;
  font-size: 0.98rem;
}
.classroom-subheading > span {
  color: var(--muted);
  font-size: 0.78rem;
}
.roster-list {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr));
}
.roster-person {
  min-width: 0;
  border: 1px solid var(--line);
}
.roster-person b {
  display: block;
  overflow-wrap: anywhere;
}
.roster-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0.85rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.87rem;
}
.classroom-create {
  flex: 0 0 auto;
  min-width: 190px;
  margin: 0;
  background: var(--bg);
  box-shadow: 0 5px 18px rgba(18, 43, 80, 0.05);
}
.classroom-create form {
  min-width: min(100%, 290px);
}
.classroom-empty {
  text-align: center;
}
.class-code {
  display: grid;
  justify-items: center;
  min-width: 120px;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: scale 0.16s ease;
}
.class-code:hover {
  scale: 1.04;
}
.class-code b {
  color: var(--bd);
  font: 800 1.2rem var(--mono);
  letter-spacing: 0.06em;
}
.class-code span {
  font-size: 0.75rem;
}
.teacher-code-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 1rem 0;
  padding: 0.9rem;
  border: 1px dashed var(--blue);
  border-radius: 12px;
  background: var(--bg);
}
.teacher-code-panel > span {
  font-weight: 700;
}
.teacher-code-panel p {
  flex-basis: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.roster-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.55rem;
}
.roster-person {
  display: block;
  padding: 0.65rem;
  border-radius: 9px;
  background: var(--bg);
}
.roster-person small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.classroom-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.easy-editor {
  margin: 0.8rem 0;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.easy-editor > summary {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
  list-style: none;
}
.easy-editor > summary::-webkit-details-marker {
  display: none;
}
.easy-editor > summary small {
  display: block;
  color: var(--muted);
  font-weight: 400;
}
.editor-plus {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: var(--bd);
  color: #fff;
  font-size: 1.25rem;
  transition: rotate 0.18s ease;
}
.easy-editor[open] .editor-plus {
  rotate: 45deg;
}
.homework-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr));
  gap: 0.8rem;
}
.homework-card {
  margin: 0;
}
.homework-card h4 {
  margin: 0.25rem 0;
  font-size: 1.2rem;
}
.homework-card time,
.homework-subject,
.submission-count {
  color: var(--muted);
  font-size: 0.82rem;
}
.homework-subject {
  color: var(--bd);
  font-weight: 700;
}
.homework-submit,
.submission-card {
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}
.submission-card {
  margin-top: 0.8rem;
}
.submission-card > div:first-child small {
  display: block;
  color: var(--muted);
}
.submission-card > p,
.submission-result > p {
  padding: 0.7rem;
  border-radius: 8px;
  background: var(--bg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.grading-fields {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.5rem;
}
.grading-fields label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.85rem;
}
.grading-fields input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--ink);
}
.teacher-note {
  margin: 0.6rem 0;
  padding: 0.9rem;
  border-left: 4px solid var(--yellow);
  border-radius: 8px;
  background: var(--panel);
}
.teacher-note p {
  margin: 0.4rem 0;
}
.teacher-note small {
  color: var(--muted);
}
.lesson-media {
  display: block;
  max-width: min(100%, 620px);
  max-height: 360px;
  margin: 0.7rem 0;
  border-radius: 10px;
}
.video-frame {
  width: min(100%, 620px);
  aspect-ratio: 16 / 9;
  border: 0;
  background: #10131a;
}
.image-media {
  width: fit-content;
  overflow: hidden;
}
.image-media img {
  display: block;
  max-width: min(100%, 620px);
  max-height: 360px;
  object-fit: contain;
}
.media-link {
  display: inline-flex;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  background: var(--panel);
  color: var(--bd);
  font-weight: 700;
}
.public-learning {
  margin-top: 1rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
}
.public-learning h3 {
  margin: 0.5rem 0 0.2rem;
}
.public-courses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem;
  margin: 1rem 0;
}
.public-course {
  display: grid;
  gap: 0.3rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  text-decoration: none;
  transition:
    translate 0.18s ease,
    border-color 0.18s ease;
}
.public-course:hover {
  translate: 0 -2px;
  border-color: var(--blue);
}
.public-course span {
  color: var(--muted);
  font-size: 0.8rem;
}
.public-subject {
  margin: 0.55rem 0;
  padding: 0.7rem;
  border-radius: 9px;
  background: var(--panel);
}
.public-subject summary {
  cursor: pointer;
  font-weight: 700;
}
.public-subject article {
  margin-top: 0.7rem;
  padding: 0.65rem;
  border-radius: 8px;
  background: var(--bg);
}
.public-subject pre {
  max-width: 100%;
  overflow: auto;
  padding: 0.65rem;
  border-radius: 8px;
  background: #10131a;
  color: #eaf0ff;
  white-space: pre-wrap;
}
@media (max-width: 700px) {
  .welcome-card {
    grid-template-columns: 1fr;
  }
  .welcome-stats {
    width: 100%;
  }
  .welcome-stats > div {
    flex: 1;
  }
  .join-card {
    grid-template-columns: 1fr;
  }
  .parent-code-card {
    grid-template-columns: 1fr auto;
  }
  .parent-code-card > div {
    grid-column: 1 / -1;
  }
  .quick-links {
    grid-template-columns: 1fr;
  }
  .quick-link {
    min-height: 52px;
  }
  .classroom-card > header,
  .homework-card > header {
    flex-direction: column;
  }
  .classroom-page-heading {
    flex-direction: column;
  }
  .classroom-create {
    width: 100%;
  }
  .classroom-create form {
    min-width: 0;
  }
  .classroom-card > .classroom-card-head {
    align-items: stretch;
  }
  .classroom-metrics {
    width: 100%;
  }
  .classroom-metrics span {
    flex: 1;
  }
  .class-code-panel {
    align-items: stretch;
    flex-direction: column;
  }
  .class-code-panel .class-code {
    width: 100%;
  }
}
@media (max-width: 480px) {
  .school-menu {
    margin-inline: -0.8rem;
    border-radius: 0;
    border-right: 0;
    border-left: 0;
  }
  .school-menu-item {
    min-height: 38px;
    padding-inline: 0.65rem;
    font-size: 0.82rem;
  }
  .school-menu-item > span {
    display: none;
  }
  .join-form,
  .grading-fields {
    grid-template-columns: 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  .portal-dashboard,
  .school-page,
  .join-card,
  .classroom-card,
  .homework-card {
    animation: none;
  }
  .school-menu-item,
  .quick-link,
  .editor-plus,
  .public-course,
  .class-code {
    transition: none;
  }
}
@media (max-width: 600px) {
  .portal-user,
  .user-role {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }
  .portal-user {
    align-items: flex-start;
  }
  .account-section {
    padding-inline: 0.7rem;
  }
  background: #05070d;
}
.gamezone canvas:focus-visible {
  outline: 3px solid var(--bd);
  outline-offset: -3px;
}
.gbtns {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  margin: 1.4rem 0 1rem;
}
