:root {
  --blue-950: #10233f;
  --blue-900: #17345f;
  --blue-800: #1f4d89;
  --blue-700: #2563b8;
  --blue-600: #2d7eea;
  --blue-100: #e8f1ff;
  --blue-050: #f4f8ff;
  --green-700: #1f7a5b;
  --green-100: #e6f6ef;
  --amber-700: #9a5a05;
  --amber-100: #fff1d7;
  --red-700: #b12b3b;
  --red-100: #ffe8ec;
  --ink: #172033;
  --muted: #657085;
  --line: #d9e2f1;
  --panel: #ffffff;
  --page: #f5f8fc;
  --shadow: 0 16px 36px rgba(20, 45, 85, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  background: var(--blue-950);
  color: #fff;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 4px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #fff;
  color: var(--blue-800);
  font-weight: 800;
}

.brand-title {
  font-weight: 750;
  line-height: 1.25;
}

.brand-subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.8);
  background: transparent;
  text-align: left;
  padding: 11px 12px;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  line-height: 1.6;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 68px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.topbar-title {
  font-size: 18px;
  font-weight: 750;
}

.topbar-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.content {
  padding: 26px 28px 44px;
  max-width: 1280px;
  width: 100%;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  background: linear-gradient(120deg, var(--blue-950), var(--blue-800));
}

.login-panel {
  background: #fff;
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-visual {
  display: grid;
  align-content: center;
  padding: 54px;
  color: #fff;
}

.login-visual h1 {
  max-width: 640px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.08;
  margin: 0 0 18px;
}

.login-visual p {
  max-width: 620px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.84);
}

.form {
  display: grid;
  gap: 14px;
}

.field label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 7px;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(45, 126, 234, 0.12);
}

.textarea {
  min-height: 220px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 700;
  background: var(--blue-700);
  color: #fff;
}

.btn:hover {
  background: var(--blue-800);
}

.btn.secondary {
  background: var(--blue-100);
  color: var(--blue-800);
}

.btn.light {
  background: #fff;
  color: var(--blue-800);
  border: 1px solid var(--line);
}

.btn.danger {
  background: var(--red-100);
  color: var(--red-700);
}

.btn.small {
  padding: 7px 10px;
  font-size: 13px;
}

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

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

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel.pad {
  padding: 20px;
}

.section-title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 780;
}

.muted {
  color: var(--muted);
}

.stat {
  display: grid;
  gap: 8px;
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--blue-800);
}

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

.lesson-title h2 {
  margin: 0;
  font-size: 28px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--blue-100);
  color: var(--blue-800);
  font-size: 12px;
  font-weight: 700;
}

.badge.green {
  background: var(--green-100);
  color: var(--green-700);
}

.badge.amber {
  background: var(--amber-100);
  color: var(--amber-700);
}

.module-list {
  display: grid;
  gap: 14px;
}

.module {
  padding: 18px;
}

.module-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.module h3 {
  margin: 0;
  font-size: 19px;
}

.module-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.content-block {
  background: var(--blue-050);
  border: 1px solid #dce9fb;
  border-radius: 8px;
  padding: 14px;
  line-height: 1.75;
  margin: 10px 0;
}

.diagram {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.image-prompt {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

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

.vocab {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

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

.vocab-word {
  font-weight: 800;
  color: var(--blue-900);
}

.vocab-example {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.speech-list,
.task-list,
.wrong-list {
  display: grid;
  gap: 10px;
}

.speech-item,
.task-item,
.wrong-item,
.question {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fff;
}

.question {
  margin-bottom: 12px;
}

.question-title {
  font-weight: 750;
  margin-bottom: 10px;
}

.options {
  display: grid;
  gap: 8px;
}

.option {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.progress-bar {
  height: 9px;
  background: #e7edf7;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue-700), #48a4f8);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.alert {
  border-radius: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.alert.error {
  border-color: #ffd0d7;
  background: var(--red-100);
  color: var(--red-700);
}

.alert.success {
  border-color: #c6eadb;
  background: var(--green-100);
  color: var(--green-700);
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
  }

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

  .grid.two,
  .grid.three,
  .vocab-grid {
    grid-template-columns: 1fr;
  }

  .login-page {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }
}
