:root {
  --bg: #0f1115;
  --surface: #171a20;
  --surface-2: #1f2430;
  --surface-3: #272d39;
  --text: #eff3f8;
  --muted: #aeb8c7;
  --border: #313848;
  --accent: #6ee7d8;
  --accent-2: #8ddf73;
  --warning: #ffb84d;
  --danger: #ff7e7e;
  --shadow: 0 16px 50px rgba(0,0,0,.32);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(180deg, #0c0f14, #10131a 30%, #10141c);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, input, select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: var(--surface-3);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
}
button.primary {
  background: var(--accent);
  color: #10211e;
  font-weight: 700;
}
button.secondary {
  background: transparent;
  border: 1px solid var(--border);
}
button.ghost {
  background: transparent;
  color: var(--muted);
}
button.small {
  padding: 8px 12px;
  font-size: 14px;
}
button.linkish {
  background: transparent;
  color: var(--accent);
  padding: 0;
}
input, select {
  width: 100%;
  background: #10141d;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
#app {
  min-height: 100%;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 28px;
  background: rgba(12, 15, 20, .85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}
.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #a6f46b, #51b0e6);
  color: #0e1820;
  font-weight: 800;
}
.brand-copy {
  display: flex;
  flex-direction: column;
}
.brand-copy strong {
  font-size: 26px;
  line-height: 1;
}
.brand-copy span {
  color: var(--muted);
  font-size: 12px;
}
.topnav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.topnav .nav-item {
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--muted);
}
.topnav .nav-item.active {
  background: rgba(110,231,216,.1);
  color: var(--text);
}
.topnav .nav-item:hover {
  background: rgba(255,255,255,.05);
  color: var(--text);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.role-pill, .avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}
.role-pill {
  padding: 8px 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  gap: 8px;
  color: var(--muted);
}
.role-pill strong { color: var(--text); }
.avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #d998ff, #8f5bd8);
  font-weight: 700;
}
.page {
  padding: 28px;
  max-width: 1520px;
  margin: 0 auto;
}
.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.02;
  margin: 0 0 10px 0;
}
.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  max-width: 860px;
}
.grid {
  display: grid;
  gap: 18px;
}
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card.soft {
  box-shadow: none;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card h2, .card h3, .card h4 {
  margin: 0;
}
.kpi {
  font-size: 36px;
  font-weight: 800;
  margin-top: 10px;
}
.muted { color: var(--muted); }
.small { font-size: 14px; }
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.05);
  color: var(--muted);
  font-size: 13px;
}
.chip.good { color: #b1ffd2; background: rgba(69, 199, 124, .12); }
.chip.warn { color: #ffd59f; background: rgba(255, 184, 77, .12); }
.chip.info { color: #bfeef2; background: rgba(110,231,216,.12); }
.chip.danger { color: #ffc2c2; background: rgba(255,126,126,.12); }
.split {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
}
.sidebar .section-title {
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.list-item {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.list-item.active {
  border-color: rgba(110,231,216,.4);
  background: rgba(110,231,216,.08);
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.table th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.table tr:hover td {
  background: rgba(255,255,255,.02);
}
.accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.accordion-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,255,255,.02);
}
.accordion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}
.accordion-body {
  padding: 0 20px 18px;
  display: none;
}
.accordion-item.open .accordion-body {
  display: block;
}
.route-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.route-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,.025);
}
.route-card:hover {
  border-color: rgba(110,231,216,.4);
  transform: translateY(-1px);
}
.ide {
  display: grid;
  grid-template-columns: 280px minmax(0,1fr) 380px;
  gap: 12px;
  min-height: calc(100vh - 140px);
}
.panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.02);
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.file-tree, .lesson-panel, .editor-shell {
  height: 100%;
}
.file-tree .file, .tab-bar .tab {
  display: flex;
  align-items: center;
  gap: 10px;
}
.file-tree .file {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.file-tree .file.active {
  background: rgba(110,231,216,.08);
}
.tab-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.tab {
  background: rgba(255,255,255,.04);
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--muted);
}
.tab.active {
  background: rgba(110,231,216,.1);
  color: var(--text);
}
.editor {
  padding: 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.75;
  color: #d9e3f1;
  white-space: pre-wrap;
}
.lesson-tabs {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.lesson-tabs button.active {
  background: rgba(110,231,216,.12);
  color: var(--text);
}
.lesson-content {
  padding: 16px;
  display: none;
}
.lesson-content.active {
  display: block;
}
.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}
.progress-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #70e5a0);
}
.notice {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(110,231,216,.25);
  background: rgba(110,231,216,.08);
}
.notice.warn {
  border-color: rgba(255,184,77,.25);
  background: rgba(255,184,77,.08);
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
}
.stat-box {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.stat-box strong {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.stat-box span {
  font-size: 28px;
  font-weight: 800;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(720px, 100%);
  background: #11161f;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal .body {
  padding: 20px;
}
.modal .footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px 20px;
}
.home-hero {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 22px;
  align-items: stretch;
}
.preview-block {
  min-height: 260px;
  background: radial-gradient(circle at top left, rgba(110,231,216,.18), transparent 35%), rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
}
.preview-block .mini-window {
  height: 180px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  display: grid;
  grid-template-columns: 160px 1fr 220px;
  gap: 10px;
  padding: 12px;
  margin-top: 16px;
}
.preview-col {
  border-radius: 12px;
  background: rgba(255,255,255,.04);
}
.footer-note {
  color: var(--muted);
  font-size: 13px;
  margin-top: 24px;
  text-align: center;
}
.empty-state {
  padding: 32px;
  border: 1px dashed rgba(255,255,255,.15);
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
}
@media (max-width: 1200px) {
  .grid.cols-4, .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ide { grid-template-columns: 240px minmax(0,1fr); }
  .ide .right-rail { grid-column: 1 / -1; }
}
@media (max-width: 980px) {
  .split, .home-hero, .route-grid, .grid.cols-2, .grid.cols-3, .grid.cols-4, .stat-row { grid-template-columns: 1fr; }
  .hero { flex-direction: column; }
  .topbar { flex-wrap: wrap; }
  .ide { grid-template-columns: 1fr; }
}
