:root {
  color-scheme: dark;
  --bg: #090b10;
  --bg-raised: #0d1017;
  --panel: #11151e;
  --panel-soft: #151a24;
  --panel-editor: #252730;
  --line: #252c39;
  --line-strong: #354155;
  --ink: #edf2f7;
  --muted: #9aa8bb;
  --faint: #6f7e92;
  --blue: #38bdf8;
  --blue-soft: rgba(56, 189, 248, 0.13);
  --blue-ink: #062536;
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.12);
  --amber: #fbbf24;
  --red: #fb7185;
  --purple: #a78bfa;
  --radius: 8px;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 280px),
    linear-gradient(120deg, rgba(56, 189, 248, 0.055), transparent 34%),
    linear-gradient(260deg, rgba(74, 222, 128, 0.045), transparent 36%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.66;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(56, 189, 248, 0.28);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.signin-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.signin-card {
  width: min(500px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 21, 30, 0.94);
  box-shadow: var(--shadow);
}

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

.brand.large {
  margin-bottom: 34px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #42d6ce;
  color: #061014;
  font-weight: 950;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  line-height: 1.1;
}

.brand span,
.eyebrow,
.signin-note span,
.system-status span,
.metric span,
.task-card span,
.task-card p,
.section-head p,
.topic-card p {
  color: var(--muted);
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.signin-copy h1,
.hero-panel h1,
.section-head h1 {
  margin: 0;
  color: #f8fafc;
  letter-spacing: 0;
}

.signin-copy h1 {
  font-size: clamp(2.45rem, 7vw, 3.9rem);
  line-height: 0.98;
}

.signin-copy p,
.hero-panel p,
.section-head p {
  margin: 12px 0 0;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.65;
}

.signin-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.login-unavailable {
  padding: 10px 12px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: var(--radius);
  background: rgba(251, 191, 36, 0.08);
  color: #fde68a;
  font-weight: 800;
}

.signin-note {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.signin-note strong,
.signin-note span {
  font-size: 0.88rem;
}

.app-shell {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 18px 22px 28px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: -18px -22px 18px;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(37, 44, 57, 0.84);
  background: rgba(9, 11, 16, 0.9);
  backdrop-filter: blur(18px);
}

.auth-panel,
.toolbar-actions,
.generate-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-chip {
  max-width: 320px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-weight: 900;
  white-space: nowrap;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.primary {
  background: var(--blue);
  color: var(--blue-ink);
}

.secondary {
  border: 1px solid rgba(74, 222, 128, 0.26);
  background: var(--green-soft);
  color: #bbf7d0;
}

.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
}

.ghost:hover,
.mini-button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
}

.student-view {
  display: grid;
  gap: 16px;
}

.screen {
  display: none;
}

.screen.active {
  display: grid;
  gap: 16px;
}

.screen-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.difficulty-select,
.search-input,
.program-input {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0c1017;
  color: var(--ink);
}

.difficulty-select {
  height: 40px;
  padding: 0 12px;
  font-weight: 850;
}

.hero-panel,
.topic-panel,
.task-browser,
.editor-panel,
.feedback-panel,
.metric,
.score-card,
.result-item,
.glossary-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 21, 30, 0.92);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.035);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 340px);
  gap: 22px;
  align-items: stretch;
  padding: 22px;
}

.hero-panel h1 {
  max-width: 860px;
  font-size: clamp(2rem, 4vw, 3.55rem);
  line-height: 1;
}

.system-status {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.system-status div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.system-status strong {
  display: block;
  margin-top: 4px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 92px;
  padding: 16px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: #f8fafc;
  font-size: 1.85rem;
  line-height: 1;
}

.topic-panel,
.task-browser,
.feedback-panel {
  padding: 16px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h1,
.section-head h2 {
  margin: 0;
  color: #f8fafc;
}

.section-head h2 {
  font-size: 1.08rem;
}

.topic-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.topic-card,
.task-card {
  position: relative;
  overflow: hidden;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--ink);
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.topic-card {
  min-height: 154px;
  padding: 14px;
}

.topic-card::before,
.task-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: transparent;
}

.topic-card:hover,
.topic-card.active,
.task-card:hover,
.task-card.active {
  border-color: #3d88a9;
  background: #111925;
}

.topic-card:hover,
.task-card:hover {
  transform: translateY(-1px);
}

.topic-card.active::before,
.task-card.active::before {
  background: var(--blue);
}

.topic-card strong,
.topic-card small,
.topic-card p {
  display: block;
}

.topic-card strong {
  margin-top: 12px;
  color: #f8fafc;
  font-size: 1.02rem;
}

.topic-card small,
.topic-card p {
  margin-top: 8px;
}

.topic-card p {
  min-height: 42px;
  font-size: 0.86rem;
  line-height: 1.45;
}

.topic-code,
.pill,
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.14);
  color: #ddd6fe;
  font-weight: 900;
  white-space: nowrap;
}

.progress-track {
  height: 7px;
  margin-top: 14px;
  border-radius: 999px;
  background: #1d2430;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.full-width {
  width: 100%;
}

.search-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
}

.search-input::placeholder {
  color: var(--faint);
}

.task-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-height: 72vh;
  overflow: auto;
  padding-right: 4px;
}

.task-list.big {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  max-height: none;
  padding-right: 0;
}

.task-card {
  min-height: 178px;
  padding: 14px 14px 15px;
}

.task-card-top,
.tag-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.task-card-top {
  justify-content: space-between;
  margin-bottom: 12px;
}

.task-card strong {
  display: block;
  color: #f8fafc;
  font-size: 1.02rem;
}

.task-card p {
  min-height: 44px;
  margin: 8px 0 14px;
  line-height: 1.45;
}

.difficulty,
.tag-row span,
.task-card-top span:last-child {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.difficulty {
  color: #bae6fd;
  background: var(--blue-soft);
}

.tag-row .complete {
  background: var(--green-soft);
  color: #bbf7d0;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}

.coding-layout {
  display: grid;
  grid-template-columns: minmax(540px, 1.06fr) minmax(420px, 0.84fr);
  gap: 16px;
  align-items: stretch;
}

.editor-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  padding: 0;
}

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

.editor-toolbar strong {
  display: block;
  color: #f8fafc;
  font-size: 1rem;
}

.task-brief {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}

.task-brief p {
  margin: 0 0 12px;
  color: #dbeafe;
  line-height: 1.55;
}

.rubric {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rubric span {
  padding: 6px 8px;
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: #bae6fd;
  font-size: 0.8rem;
  font-weight: 850;
}

.ide-pane,
.run-panel {
  min-height: 500px;
  height: clamp(500px, calc(100vh - 255px), 740px);
}

.ide-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--panel-editor);
}

.ide-tabbar {
  min-height: 45px;
  display: flex;
  align-items: flex-end;
  border-bottom: 1px solid #414856;
  background: #2b2d36;
}

.file-tab {
  min-height: 45px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-right: 1px solid #414856;
  color: #f8fafc;
  font-weight: 950;
}

.file-tab.active {
  border-bottom: 3px solid #2dd4bf;
}

.code-wrap {
  min-height: 0;
  overflow: hidden;
  background: var(--panel-editor);
}

#codeEditor {
  width: 100%;
  min-height: 0;
  color: #eef7ff;
  background: var(--panel-editor);
  border: 0;
  resize: none;
  outline: none;
  tab-size: 4;
}

.CodeMirror {
  height: 100%;
  min-height: 0;
  font-family: "Cascadia Code", Consolas, "Liberation Mono", monospace;
  font-size: 0.95rem;
  line-height: 1.55;
  background: var(--panel-editor) !important;
  color: #f8fafc;
}

.CodeMirror-gutters {
  background: var(--panel-editor) !important;
  border-right: 0;
}

.CodeMirror-linenumber {
  color: #aeb7c7;
}

.CodeMirror-cursor {
  border-left-color: #2dd4bf;
}

.CodeMirror-activeline-background {
  background: rgba(255, 255, 255, 0.045) !important;
}

.cm-s-material-darker span.cm-keyword {
  color: #93c5fd;
}

.cm-s-material-darker span.cm-string {
  color: #86efac;
}

.cm-s-material-darker span.cm-number {
  color: #fbbf24;
}

.cm-s-material-darker span.cm-def,
.cm-s-material-darker span.cm-variable {
  color: #f8fafc;
}

.cm-s-material-darker span.cm-builtin {
  color: #67e8f9;
}

.CodeMirror-hints {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #111827;
  color: var(--ink);
  font-family: "Cascadia Code", Consolas, "Liberation Mono", monospace;
  box-shadow: var(--shadow);
}

.CodeMirror-hint {
  padding: 6px 10px;
  color: var(--ink);
}

li.CodeMirror-hint-active {
  background: var(--blue);
  color: var(--blue-ink);
}

.ide-footer {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  border-top: 1px solid #414856;
  background: #2b2d36;
}

.ide-footer span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.ide-run {
  min-width: 76px;
  background: #8de6df;
  color: #03121c;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  background: #262933;
}

.tab {
  height: 44px;
  border-radius: 0;
  border-bottom: 3px solid transparent;
  background: #262933;
  color: #cbd5e1;
  font-weight: 900;
}

.tab.active {
  color: #f8fafc;
  border-bottom-color: #2dd4bf;
  background: #2b2d36;
}

.feedback-pane {
  display: none;
}

.feedback-pane.active {
  display: block;
  height: 100%;
}

.score-card,
.result-item {
  padding: 14px;
  line-height: 1.5;
}

.run-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.input-panel {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.output-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--panel);
}

.run-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.output-panel .run-section-head {
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.run-section-head strong {
  color: #f8fafc;
  font-size: 0.9rem;
}

.run-section-head span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.mini-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.input-rows {
  display: grid;
  gap: 8px;
  max-height: 232px;
  overflow: auto;
  padding-right: 4px;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(96px, 170px) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.input-row span {
  min-width: 0;
  overflow: hidden;
  color: #bae6fd;
  font-size: 0.78rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.program-input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  outline: none;
  font-family: "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

.program-input:focus,
.search-input:focus,
.difficulty-select:focus {
  border-color: #2dd4bf;
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
}

.terminal-output {
  min-height: 0;
  height: 100%;
  margin: 0;
  padding: 14px;
  background: var(--panel);
  color: #d1fae5;
  white-space: pre-wrap;
  overflow: auto;
  font-family: "Cascadia Code", Consolas, "Liberation Mono", monospace;
  line-height: 1.55;
}

.glossary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.glossary-card {
  padding: 14px;
}

.glossary-card div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.glossary-card strong {
  color: #f8fafc;
  font-size: 1rem;
}

.glossary-card span {
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.glossary-card p,
.score-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.score-card {
  margin-bottom: 12px;
}

.score-card span,
.result-item span {
  color: var(--muted);
}

.result-list {
  display: grid;
  gap: 8px;
}

.result-item code {
  display: inline-block;
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #e0f2fe;
}

.result-item.pass {
  border-color: rgba(74, 222, 128, 0.34);
  background: var(--green-soft);
}

.result-item.fail {
  border-color: rgba(251, 113, 133, 0.38);
  background: rgba(251, 113, 133, 0.08);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: 380px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #05070b;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.landing-page {
  min-height: 100vh;
  padding: 18px 22px 34px;
}

.landing-nav {
  width: min(1240px, 100%);
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 28px;
}

.landing-actions,
.hero-actions,
.app-nav,
.code-screen-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.landing-hero,
.landing-grid,
.pricing-panel {
  width: min(1240px, 100%);
  margin: 0 auto;
}

.landing-hero {
  min-height: 540px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
  gap: 22px;
  align-items: stretch;
}

.landing-copy,
.product-preview,
.pricing-panel,
.teacher-hero,
.studio-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 21, 30, 0.92);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.035);
}

.landing-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 5vw, 54px);
}

.landing-copy h1 {
  max-width: 820px;
  margin: 0;
  color: #f8fafc;
  font-size: clamp(2.5rem, 5vw, 5rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.landing-copy p {
  max-width: 680px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.hero-actions {
  margin-top: 28px;
}

.product-preview {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
}

.preview-top,
.preview-grid,
.preview-ide {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.preview-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.preview-top span,
.preview-grid span,
.price-card span,
.price-card small,
.stack-item span,
.monitor-row span,
.editor-subtitle {
  color: var(--muted);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  overflow: hidden;
}

.preview-grid div {
  padding: 14px;
  border-right: 1px solid var(--line);
}

.preview-grid div:last-child {
  border-right: 0;
}

.preview-grid strong,
.price-card strong {
  display: block;
  margin-top: 5px;
  color: #f8fafc;
  font-size: 1.8rem;
}

.preview-ide {
  overflow: hidden;
}

.preview-ide div {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: #f8fafc;
  font-weight: 900;
}

.preview-ide pre {
  margin: 0;
  padding: 16px;
  color: #183b2c;
  font-family: "Cascadia Code", Consolas, "Liberation Mono", monospace;
  line-height: 1.65;
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.landing-grid article,
.price-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  padding: 16px;
}

.landing-grid strong {
  color: #f8fafc;
}

.landing-grid p,
.pricing-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.pricing-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: center;
  margin-top: 16px;
  padding: 22px;
}

.pricing-panel h2 {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(1.7rem, 3vw, 2.7rem);
}

.price-card {
  display: grid;
  gap: 8px;
}

.nav-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-weight: 900;
}

.nav-button.active {
  border-color: #3d88a9;
  color: #f8fafc;
  background: var(--blue-soft);
}

.coin-chip,
.coin {
  border: 1px solid rgba(251, 191, 36, 0.34);
  background: rgba(251, 191, 36, 0.1);
  color: #fde68a;
}

.coin-chip {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: var(--radius);
  font-weight: 950;
}

.teacher-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 360px);
  gap: 18px;
  padding: 22px;
}

.teacher-hero h1 {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1;
}

.teacher-hero p {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.teacher-system {
  display: grid;
  gap: 10px;
}

.teacher-system div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.teacher-system span {
  color: var(--muted);
}

.teacher-system strong {
  display: block;
  margin-top: 4px;
}

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

.studio-panel {
  padding: 16px;
}

.studio-panel.wide {
  grid-column: 1 / -1;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  gap: 10px;
  margin-bottom: 12px;
}

.content-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.compact-form {
  grid-template-columns: 1fr;
}

.text-area {
  min-height: 94px;
  padding: 12px;
  resize: vertical;
}

.stack-list,
.monitor-table {
  display: grid;
  gap: 8px;
}

.stack-item,
.monitor-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.stack-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.stack-item strong,
.monitor-row strong {
  display: block;
  color: #f8fafc;
}

.stack-item a,
.stack-item small,
.monitor-row small {
  color: #bae6fd;
  font-weight: 900;
}

.monitor-row {
  grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(64px, 0.3fr)) auto;
  align-items: center;
}

.raspberry-ide {
  min-height: 500px;
  height: clamp(500px, calc(100vh - 255px), 740px);
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
}

.file-rail {
  min-width: 0;
  padding: 12px;
  border-right: 1px solid #414856;
  background: #20232c;
}

.rail-title {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.file-pill {
  width: 100%;
  min-height: 34px;
  margin-bottom: 8px;
  padding: 0 10px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 850;
}

.file-pill.active {
  background: rgba(45, 212, 191, 0.12);
  color: #ccfbf1;
}

.raspberry-ide .ide-pane {
  min-height: 0;
  height: auto;
}

.hint-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: var(--radius);
  background: rgba(251, 191, 36, 0.08);
  color: #fde68a;
  line-height: 1.55;
}

@media (max-width: 1180px) {
  .coding-layout {
    grid-template-columns: 1fr;
  }

  .landing-hero,
  .teacher-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .app-header,
  .hero-panel,
  .section-head,
  .screen-top {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

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

  .task-list.big {
    grid-template-columns: 1fr;
  }

  .landing-grid,
  .pricing-panel,
  .teacher-grid {
    grid-template-columns: 1fr;
  }

  .monitor-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px;
  }

  .app-header {
    margin: -14px -14px 14px;
    padding: 12px 14px;
  }

  .signin-card,
  .hero-panel,
  .topic-panel,
  .task-browser,
  .feedback-panel,
  .landing-copy,
  .product-preview,
  .pricing-panel,
  .teacher-hero,
  .studio-panel {
    padding: 14px;
  }

  .signin-copy h1,
  .hero-panel h1 {
    font-size: 2.2rem;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .auth-panel,
  .toolbar-actions,
  .generate-controls,
  .signin-actions,
  .landing-actions,
  .hero-actions,
  .app-nav,
  .class-controls,
  .join-form,
  .form-grid,
  .content-form {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .button,
  .difficulty-select,
  .user-chip {
    width: 100%;
  }

  .editor-toolbar,
  .ide-footer {
    align-items: stretch;
    flex-direction: column;
  }

  #codeEditor,
  .CodeMirror {
    font-size: 0.86rem;
  }

  .ide-pane,
  .run-panel {
    min-height: 420px;
    height: 520px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .raspberry-ide {
    grid-template-columns: 1fr;
  }

  .file-rail {
    border-right: 0;
    border-bottom: 1px solid #414856;
  }

  .landing-page {
    padding: 14px;
  }
}

/* Light commercial theme */
:root {
  color-scheme: light;
  --bg: #f3f4ee;
  --bg-raised: #fbfcf7;
  --panel: #ffffff;
  --panel-soft: #f6f8f1;
  --panel-editor: #f7f4ea;
  --line: #d9dfd2;
  --line-strong: #b9c5b7;
  --ink: #18211c;
  --muted: #667265;
  --faint: #899486;
  --blue: #1597c7;
  --blue-soft: rgba(21, 151, 199, 0.11);
  --blue-ink: #f5fbff;
  --green: #188a58;
  --green-soft: rgba(24, 138, 88, 0.1);
  --amber: #b7791f;
  --red: #c2415a;
  --purple: #6d5bd0;
  --shadow: 0 18px 42px rgba(40, 52, 38, 0.12);
}

body {
  color: var(--ink);
  background: var(--bg);
}

body::before {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), transparent 300px),
    linear-gradient(120deg, rgba(21, 151, 199, 0.08), transparent 34%),
    linear-gradient(260deg, rgba(24, 138, 88, 0.07), transparent 36%);
}

.landing-copy,
.product-preview,
.pricing-panel,
.teacher-hero,
.studio-panel,
.hero-panel,
.topic-panel,
.task-browser,
.editor-panel,
.feedback-panel,
.metric,
.signin-card,
.score-card,
.result-item,
.glossary-card {
  background: rgba(255, 255, 255, 0.88);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.app-header {
  background: rgba(243, 244, 238, 0.9);
  border-bottom-color: var(--line);
}

.brand-mark {
  background: #45d6c8;
  color: #07211d;
}

.brand strong,
.landing-copy h1,
.teacher-hero h1,
.hero-panel h1,
.section-head h1,
.section-head h2,
.metric strong,
.topic-card strong,
.task-card strong,
.stack-item strong,
.monitor-row strong,
.glossary-card strong,
.editor-toolbar strong,
.run-section-head strong,
.preview-grid strong,
.price-card strong {
  color: #17211b;
}

.eyebrow,
.glossary-card span {
  color: #16714d;
}

.primary {
  background: #1597c7;
  color: #ffffff;
}

.secondary {
  border-color: rgba(24, 138, 88, 0.24);
  background: rgba(24, 138, 88, 0.1);
  color: #0f653e;
}

.ghost,
.nav-button,
.mini-button,
.user-chip {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border-color: var(--line);
}

.nav-button.active {
  border-color: rgba(21, 151, 199, 0.42);
  color: #07506d;
  background: rgba(21, 151, 199, 0.12);
}

.coin-chip,
.coin {
  border-color: rgba(183, 121, 31, 0.28);
  background: rgba(183, 121, 31, 0.1);
  color: #7a4d0d;
}

.system-status div,
.teacher-system div,
.topic-card,
.task-card,
.stack-item,
.monitor-row,
.landing-grid article,
.price-card,
.preview-top,
.preview-grid,
.preview-ide,
.empty-state {
  background: var(--bg-raised);
  border-color: var(--line);
}

.topic-card:hover,
.topic-card.active,
.task-card:hover,
.task-card.active {
  background: #f3f9fb;
  border-color: rgba(21, 151, 199, 0.42);
}

.topic-code,
.pill,
.count-pill {
  background: rgba(109, 91, 208, 0.11);
  color: #4d3aa8;
}

.difficulty,
.rubric span {
  background: rgba(21, 151, 199, 0.11);
  color: #07506d;
}

.tag-row span,
.task-card-top span:last-child {
  background: rgba(24, 33, 28, 0.06);
  color: #5a675d;
}

.search-input,
.difficulty-select,
.program-input {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.search-input::placeholder,
.program-input::placeholder {
  color: #96a092;
}

.raspberry-ide,
.ide-pane,
.code-wrap,
#codeEditor,
.CodeMirror,
.CodeMirror-gutters {
  background: var(--panel-editor) !important;
}

.file-rail,
.ide-tabbar,
.ide-footer,
.tabs,
.tab {
  background: #ece8dc;
  border-color: #d4ccbc;
}

.file-tab,
.tab.active {
  color: #17211b;
}

.file-pill {
  color: #6f715f;
}

.file-pill.active {
  background: rgba(21, 151, 199, 0.13);
  color: #07506d;
}

.CodeMirror {
  color: #17211b;
}

.CodeMirror-linenumber {
  color: #8b8f83;
}

.CodeMirror-activeline-background {
  background: rgba(21, 151, 199, 0.08) !important;
}

.cm-s-material-darker span.cm-keyword {
  color: #0f6696;
}

.cm-s-material-darker span.cm-string {
  color: #157a49;
}

.cm-s-material-darker span.cm-number {
  color: #9a5b00;
}

.cm-s-material-darker span.cm-def,
.cm-s-material-darker span.cm-variable {
  color: #17211b;
}

.cm-s-material-darker span.cm-builtin {
  color: #0b7b8e;
}

.run-panel,
.input-panel,
.output-panel,
.terminal-output {
  background: #fbfcf7;
  border-color: var(--line);
}

.terminal-output {
  color: #183b2c;
}

.hint-box {
  background: rgba(183, 121, 31, 0.1);
  border-color: rgba(183, 121, 31, 0.25);
  color: #6d460d;
}

.result-item.pass {
  background: rgba(24, 138, 88, 0.1);
  border-color: rgba(24, 138, 88, 0.22);
}

.result-item.fail {
  background: rgba(194, 65, 90, 0.08);
  border-color: rgba(194, 65, 90, 0.22);
}

.toast {
  background: #ffffff;
  color: var(--ink);
}

/* Final light polish: readable, calm, not washed out */
:root {
  --bg: #eef2ea;
  --bg-raised: #ffffff;
  --panel: #ffffff;
  --panel-soft: #f7f9f3;
  --panel-editor: #f3efe4;
  --line: #ccd6c8;
  --line-strong: #9fb0a0;
  --ink: #17211b;
  --muted: #536154;
  --faint: #7c897c;
  --blue: #178fc2;
  --blue-soft: rgba(23, 143, 194, 0.12);
  --green: #157a4b;
  --green-soft: rgba(21, 122, 75, 0.11);
  --shadow: 0 16px 36px rgba(42, 55, 38, 0.12);
}

body::before {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), transparent 300px),
    linear-gradient(120deg, rgba(23, 143, 194, 0.06), transparent 32%),
    linear-gradient(260deg, rgba(21, 122, 75, 0.055), transparent 36%);
}

.landing-copy h1 {
  max-width: 760px;
  font-size: clamp(2.65rem, 4.2vw, 4.45rem);
  line-height: 1.03;
}

.landing-copy {
  padding: clamp(24px, 4vw, 46px);
}

.landing-hero {
  min-height: 500px;
  grid-template-columns: minmax(0, 0.96fr) minmax(360px, 0.7fr);
}

.landing-grid strong,
.pricing-panel h2,
.preview-ide div {
  color: #17211b;
}

.landing-grid p,
.pricing-panel p,
.landing-copy p,
.teacher-hero p,
.hero-panel p,
.section-head p {
  color: #536154;
}

.landing-grid article,
.price-card,
.preview-top,
.preview-grid,
.preview-ide {
  background: #ffffff;
}

.preview-ide pre,
.terminal-output {
  color: #173527;
}

.preview-ide pre {
  background: #fbfcf7;
}

.preview-ide div,
.ide-tabbar,
.ide-footer,
.file-rail,
.tabs,
.tab {
  background: #e7e2d5;
}

.cm-s-material-darker span.cm-comment {
  color: #7c897c;
}

.run-section-head span,
.editor-subtitle,
.brand span,
.preview-top span,
.preview-grid span,
.price-card span,
.price-card small,
.stack-item span,
.monitor-row span {
  color: #536154;
}

.landing-grid article strong {
  display: block;
  margin-bottom: 8px;
}

.pricing-panel h2 {
  font-size: clamp(1.7rem, 2.7vw, 2.55rem);
}

.login-panel {
  display: grid;
  gap: 12px;
  max-width: 520px;
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(42, 55, 38, 0.1);
}

.login-panel strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.login-panel span,
.login-unavailable {
  color: var(--muted);
}

.google-slot {
  min-height: 40px;
}

.login-unavailable {
  padding: 12px;
  border: 1px solid rgba(183, 121, 31, 0.28);
  border-radius: var(--radius);
  background: rgba(183, 121, 31, 0.1);
}

.class-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.class-controls,
.join-form {
  display: grid;
  gap: 10px;
}

.class-controls {
  grid-template-columns: minmax(0, 1fr) auto auto;
  margin-bottom: 10px;
}

.join-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.danger {
  border-color: rgba(194, 65, 90, 0.24);
  color: #9d2441;
}

.role-toggle,
.studio-tabs {
  display: inline-flex;
  width: fit-content;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #eef3ea;
}

.role-option,
.studio-tab {
  min-height: 36px;
  padding: 0 14px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted);
  font-weight: 950;
}

.role-option.active,
.studio-tab.active {
  background: var(--blue);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(23, 143, 194, 0.18);
}

.class-menu {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.class-summary {
  color: var(--muted);
  font-weight: 800;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field > span {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 950;
}

.builder-form {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.form-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 12px;
}

.text-area.tall {
  min-height: 130px;
}

.code-area {
  font-family: "Consolas", "SFMono-Regular", monospace;
}

.studio-tabs {
  margin-bottom: 14px;
}

.studio-tab-panel {
  display: none;
}

.studio-tab-panel.active {
  display: block;
}

.stack-item.active-stack {
  border-color: rgba(23, 143, 194, 0.42);
  background: rgba(23, 143, 194, 0.08);
}

.teacher-hero h1,
.stack-item strong,
.monitor-row strong,
.studio-panel h2,
.subsection-head h3 {
  color: var(--ink);
}

.stack-item a,
.stack-item small,
.monitor-row small {
  color: #0b698e;
}

@media (max-width: 700px) {
  .form-pair,
  .class-controls,
  .join-form {
    grid-template-columns: 1fr;
  }

  .role-toggle,
  .studio-tabs {
    width: 100%;
  }

  .role-option,
  .studio-tab {
    flex: 1;
  }
}
