:root {
  --bg: #0b0f14;
  --panel: #0f1621;
  --panel2: #0c121b;
  --text: #d6dee6;
  --muted: #93a4b3;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --green: #36d399;
  --green2: #22c55e;
  --danger: #ef4444;
  --yellow: #fbbf24;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue",
    Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --radius: 14px;
  --editor-font-size: 13px;
  --editor-line-height: 20px;
  --topbar-height: 74px;
  --sticky-gap: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background-color: var(--bg);
  background-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.0),
    rgba(0, 0, 0, 0.25)
  );
}

.app {
  position: relative;
}

/* Watermark */
.app::before {
  content: "LAERN PYTHON WITH SOPHONIE.DEV";
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  user-select: none;
  z-index: 0;

  font-family: var(--mono);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: clamp(18px, 3.2vw, 46px);
  color: rgba(54, 211, 153, 0.07);
  transform: rotate(-12deg);
  text-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.sidebar,
.main,
.scrim {
  position: relative;
  z-index: 1;
}

.app {
  height: 100vh;
  display: grid;
  grid-template-columns: 340px 1fr;
}

.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 50%), var(--panel2);
  min-width: 0;
  min-height: 0;
}

.sidebar__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 12px 14px;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.brand__mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(54, 211, 153, 0.18);
  border: 1px solid rgba(54, 211, 153, 0.35);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  display: grid;
  place-items: center;
  color: var(--green);
  font-weight: 800;
  user-select: none;
}

.brand__text {
  min-width: 0;
}

.brand__title {
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand__subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__close {
  display: none;
}

.sidebar__progress {
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.progress__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

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

.progress__value {
  font-weight: 700;
  color: var(--green);
}

.progress__bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.progress__barFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green), var(--green2));
  border-radius: 999px;
  transition: width 220ms ease;
}

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

.pill {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.pill--green {
  border-color: rgba(54, 211, 153, 0.35);
  background: rgba(54, 211, 153, 0.12);
  color: #bff3df;
}

.sidebar__nav {
  padding: 10px;
  overflow: auto;
  flex: 1;
}

.nav-section {
  margin: 10px 0 14px 0;
}

.nav-section__title {
  padding: 10px 10px 8px 10px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.nav-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  padding: 10px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: background 160ms ease, border-color 160ms ease, transform 120ms ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.nav-item--active {
  background: rgba(54, 211, 153, 0.10);
  border-color: rgba(54, 211, 153, 0.22);
}

.nav-item__left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.nav-item__title {
  font-weight: 650;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item__sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item__right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.dot--done {
  background: var(--green);
  border-color: rgba(54, 211, 153, 0.45);
}

.sidebar__footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

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

.link-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(54, 211, 153, 0.22);
  background: rgba(54, 211, 153, 0.08);
  color: rgba(201, 246, 230, 0.95);
  text-decoration: none;
  font-weight: 700;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease;
}

.link-pill:hover {
  background: rgba(54, 211, 153, 0.12);
  border-color: rgba(54, 211, 153, 0.34);
  transform: translateY(-1px);
}

.topbar__link {
  padding: 10px 12px;
  text-decoration: none;
}

.mono {
  font-family: var(--mono);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-height: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 15, 20, 0.72);
  backdrop-filter: blur(10px);
}

:root {
  --topbar-hint: 72px;
}

.topbar__menu {
  display: none;
}

.topbar__left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.topbar__title {
  font-weight: 750;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__subtitle {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__wm {
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(54, 211, 153, 0.75);
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
}

@media (max-width: 720px) {
  .topbar__wm {
    display: none;
  }
  .app::before {
    font-size: clamp(16px, 4.2vw, 28px);
    letter-spacing: 0.14em;
  }
  .topbar__link {
    display: none;
  }
}

.topbar__right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 14px;
  min-width: 0;
  align-items: start;
}

.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 50%), var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.panel__title {
  font-weight: 700;
  font-size: 13px;
  color: #eaf2fa;
}

.panel__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel__badge {
  font-size: 12px;
  color: #bff3df;
  border: 1px solid rgba(54, 211, 153, 0.25);
  background: rgba(54, 211, 153, 0.10);
  padding: 6px 10px;
  border-radius: 999px;
}

.panel__body {
  padding: 12px;
  min-width: 0;
}

.panel--tip .panel__body {
  color: #cfe0ee;
  line-height: 1.5;
}

/* Keep lesson “ID / tip” visible while page scrolls */
.panel--tip {
  position: sticky;
  top: 0;
  z-index: 4;
}

/* Keep console visible on desktop while scrolling */
@media (min-width: 981px) {
  .panel.editor,
  .panel.console {
    position: sticky;
    top: 0;
    align-self: start;
  }
}

.panel--badge .panel__body {
  display: grid;
  gap: 10px;
}

.badge {
  border-radius: 18px;
  padding: 16px;
  border: 1px solid rgba(54, 211, 153, 0.28);
  background: radial-gradient(600px 250px at 25% 0%, rgba(54, 211, 153, 0.20), transparent 60%),
    rgba(0, 0, 0, 0.18);
}

.badge__title {
  font-weight: 850;
  font-size: 18px;
}

.badge__subtitle {
  color: var(--muted);
  margin-top: 4px;
}

.badge__meta {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease;
  font-weight: 650;
  font-size: 13px;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0px);
}

.btn--primary {
  border-color: rgba(54, 211, 153, 0.30);
  background: rgba(54, 211, 153, 0.14);
  color: #c9f6e6;
}

.btn--primary:hover {
  background: rgba(54, 211, 153, 0.18);
  border-color: rgba(54, 211, 153, 0.38);
}

.btn--ghost {
  background: transparent;
}

.btn--sm {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.btn__dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(54, 211, 153, 0.15);
  vertical-align: middle;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

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

.status--ok {
  color: #bff3df;
}

.status--err {
  color: #fecaca;
}

.code-editor {
  position: relative;
  height: 420px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.18);
}

.code-editor__pre {
  margin: 0;
  height: 100%;
  overflow: auto;
}

.code-editor__pre code {
  display: block;
  min-height: 100%;
  padding: 14px;
  font-family: var(--mono);
  font-size: var(--editor-font-size);
  line-height: var(--editor-line-height);
  font-weight: 400;
  letter-spacing: 0;
  font-variant-ligatures: none;
  font-kerning: none;
  tab-size: 2;
  white-space: pre;
  outline: none;
  caret-color: var(--text);
}

.code-editor__pre code:focus {
  box-shadow: inset 0 0 0 1px rgba(54, 211, 153, 0.18);
}

.code-editor__pre code::selection {
  background: rgba(54, 211, 153, 0.22);
}

.console__body {
  padding: 0;
}

.console__pre {
  margin: 0;
  padding: 14px;
  height: 420px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  color: #d5e0ea;
  background: rgba(0, 0, 0, 0.22);
}

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 10;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .code-editor,
  .console__pre {
    height: 360px;
  }
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(360px, 92vw);
    transform: translateX(-102%);
    transition: transform 200ms ease;
    z-index: 11;
  }

  .sidebar--open {
    transform: translateX(0%);
  }

  .sidebar__close {
    display: inline-grid;
    place-items: center;
  }

  .topbar__menu {
    display: inline-grid;
    place-items: center;
  }
}

