:root {
  --bg: #0b1020;
  --panel: rgba(255, 255, 255, 0.06);
  --panel2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);
  --muted2: rgba(255, 255, 255, 0.56);
  --accent: #7c3aed;
  --accent2: #22c55e;
  --danger: #ef4444;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.42);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans",
    "Liberation Sans", sans-serif;
  background: var(--bg);
}

.gifBg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.15;
  z-index: 0;
  pointer-events: none;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 16, 33, 0.55);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
}

.brandLink {
  color: inherit;
  text-decoration: none;
}

.brandLink:hover .brandSubtitle {
  color: rgba(255, 255, 255, 0.82);
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.9), rgba(59, 130, 246, 0.7));
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 800;
}

.brandTitle {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.brandSubtitle {
  font-size: 12px;
  color: var(--muted);
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.selectWrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.selectLabel {
  color: var(--muted);
  font-size: 12px;
}

.select {
  appearance: none;
  outline: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 650;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.12s ease, border-color 0.12s ease;
  user-select: none;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn:active {
  transform: translateY(1px);
}

.btnPrimary {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.95), rgba(59, 130, 246, 0.85));
  border-color: rgba(255, 255, 255, 0.16);
}

.btnPrimary:hover {
  background: linear-gradient(135deg, rgba(124, 58, 237, 1), rgba(59, 130, 246, 0.95));
}

.btnGhost {
  background: rgba(255, 255, 255, 0.04);
}

.home {
  padding: 18px;
  max-width: 1200px;
  margin: 0 auto;
}

.homeHero {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.homeHeroGrid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  align-items: center;
}

.homeTitle {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.1;
}

.homeLead {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.homeCtas {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.homeSectionTitle {
  margin: 18px 0 10px;
  font-size: 16px;
  font-weight: 900;
}

.lessonsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.lessonCard {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 14px;
  transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease;
}

.lessonCard:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}

.lessonCardTop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.lessonCardTitle {
  font-weight: 900;
}

.lessonCardLang {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.2);
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
}

.lessonCardDesc {
  margin-top: 8px;
  color: var(--muted);
}

.lessonCardMeta {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted2);
}

@media (max-width: 860px) {
  .homeHeroGrid {
    grid-template-columns: 1fr;
  }
  .homeCtas {
    justify-content: flex-start;
  }
}

.layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 14px;
  padding: 14px;
  height: 100%;
  min-height: 0;
}

.lessonCol,
.workCol {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 0;
}

.lessonCol {
  display: grid;
  grid-template-rows: auto 1fr;
}

.lessonTop {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.lessonKicker {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.lessonTitle {
  margin: 6px 0 6px;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: 0.2px;
}

.lessonDesc {
  color: var(--muted);
}

.lessonMetaRow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.lessonMeta {
  color: var(--muted2);
  font-size: 12px;
}

.pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
}

.lessonBody {
  overflow: auto;
  min-height: 0;
  padding: 0 16px 16px;
}

.dot {
  opacity: 0.6;
}

.card {
  margin: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel2);
}

.cardTitle {
  font-weight: 800;
  margin-bottom: 6px;
}

.cardText {
  color: var(--muted);
}

.steps {
  padding: 14px 0 6px;
}

.theory {
  padding-top: 14px;
  color: var(--muted);
}

.theory h2 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.92);
}

.theory p {
  margin: 0 0 10px;
}

.theory .codeLine {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.9);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.theory ul {
  margin: 8px 0 12px 18px;
  padding: 0;
}

.theory li {
  margin: 6px 0;
}

.step {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 12px;
  margin-top: 10px;
}

.stepHeader {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.stepTitle {
  font-weight: 750;
}

.stepTag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.stepBody {
  margin-top: 8px;
  color: var(--muted);
}

.stepBody code,
.modalContent code {
  padding: 2px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.9);
}

.tip {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
}

.challenge {
  margin-top: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 12px 10px;
}

.challengeHeader {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.challengeTitle {
  font-weight: 900;
}

.challengeTag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(124, 58, 237, 0.32);
  background: rgba(124, 58, 237, 0.14);
  color: rgba(255, 255, 255, 0.85);
}

.challengeText {
  color: var(--muted);
}

.challengeActions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.verdict {
  margin-top: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.14);
  padding: 12px 12px 10px;
}

.verdictHeader {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.verdictTitle {
  font-weight: 900;
}

.verdictBadge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.78);
}

.verdictBadgeOk {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
  color: rgba(255, 255, 255, 0.88);
}

.verdictBadgeErr {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
  color: rgba(255, 255, 255, 0.88);
}

.verdictBadgeWarn {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
  color: rgba(255, 255, 255, 0.88);
}

.verdictText {
  color: var(--muted);
}

.tipTitle {
  font-weight: 800;
  margin-bottom: 8px;
}

.tipText {
  color: var(--muted);
}

kbd {
  font: 12px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.25);
  color: rgba(255, 255, 255, 0.9);
}

.editorWrap {
  min-height: 0;
  overflow: hidden;
}

.CodeMirror {
  height: 100%;
  font-size: 13px;
  background: rgba(10, 16, 33, 0.52) !important;
}

.workCol {
  padding: 10px;
}

.workGrid {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr 240px;
  gap: 10px;
}

.editorPane,
.ioPane {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  min-height: 0;
  display: grid;
}

.editorPane {
  grid-template-rows: auto 1fr auto auto;
}

.editorPane .verdict {
  margin: 0;
  border-radius: 0;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.14);
  padding: 10px 12px;
}

.editorHeader {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.editorTabs {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.tab {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(255, 255, 255, 0.86);
}

.tabActive {
  border-color: rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.12);
}

.tabHint {
  color: rgba(255, 255, 255, 0.55);
}

.editorFooter {
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.ioPane {
  grid-template-rows: auto 1fr;
}

.ioHeader {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.ioTabs {
  display: flex;
  gap: 8px;
}

.ioTab {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(255, 255, 255, 0.82);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
}

.ioTabActive {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.ioActions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ioBody {
  min-height: 0;
  overflow: hidden;
  display: grid;
}

.previewWrap,
.consoleWrap {
  min-height: 0;
  overflow: hidden;
}

.previewWrap {
  padding: 10px;
}

iframe {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: white;
  border-radius: 12px;
}

.consoleWrap {
  background: rgba(0, 0, 0, 0.22);
}

.console {
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  height: 100%;
  color: rgba(255, 255, 255, 0.86);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.isHidden {
  display: none;
}

.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
}

.badgeOk {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
}

.badgeWarn {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
}

.badgeErr {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
}

.linkBtn {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.84);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.linkBtn:hover {
  color: rgba(255, 255, 255, 0.95);
}

.iconBtn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
}

.iconBtn:hover {
  background: rgba(255, 255, 255, 0.09);
}

.modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 1000;
}

.modalOverlay[hidden] {
  display: none;
}

.modal {
  width: min(720px, 100%);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(16, 22, 44, 0.92);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modalHeader {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modalTitle {
  font-weight: 900;
}

.modalBody {
  padding: 14px;
}

.modalContent {
  color: var(--muted);
}

.modalFooter {
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 380px 1fr;
  }
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .brand {
    min-width: unset;
  }
}


.chooseLangGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.chooseLangCard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease;
  position: relative;
  z-index: 1001;
}

.chooseLangCard:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(124, 58, 237, 0.45);
}

.chooseLangIcon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chooseLangName {
  font-weight: 800;
  font-size: 15px;
}

.chooseLangCount {
  font-size: 12px;
  color: var(--muted2);
}

.lessonSection {
  margin-bottom: 24px;
}

.lessonSectionTitle {
  font-size: 13px;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
  padding-left: 2px;
}

.chooseLangBack {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s ease, color 0.12s ease;
}

.chooseLangBack:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

/* ── Mobile ── */
@media (max-width: 600px) {
  html, body {
    min-height: 100%;
    height: auto;
  }

  .app {
    min-height: 100vh;
    height: auto;
  }

  .topbar {
    padding: 10px 14px;
  }

  .brand { min-width: unset; gap: 8px; }
  .brandTitle { font-size: 13px; }
  .brandSubtitle { font-size: 11px; }
  .logo { width: 34px; height: 34px; font-size: 13px; }

  .actions .btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  .home { padding: 12px; }

  .homeHeroGrid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .homeTitle { font-size: 22px; }

  .homeCtas {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .lessonsGrid { grid-template-columns: 1fr; }

  .chooseLangGrid { grid-template-columns: 1fr 1fr; }

  .modalOverlay { align-items: flex-end; padding: 0; }
  .modal { width: 100%; border-radius: 14px 14px 0 0; }

  /* Lesson page */
  .layout {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto !important;
    padding: 8px;
    gap: 8px;
    height: auto !important;
    min-height: unset;
    overflow: visible;
  }

  .lessonCol,
  .workCol {
    height: auto !important;
    min-height: unset;
    overflow: visible;
  }

  .lessonCol {
    max-height: 45vh;
    overflow-y: auto;
  }

  .workGrid {
    grid-template-rows: 320px 180px;
    height: auto;
  }
}

.lessonCardWrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lessonCardSectionDesc {
  margin: 0;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  width: 100%;
}
