:root {
  --ink: #18212f;
  --muted: #667085;
  --line: #d9e1ea;
  --panel: #ffffff;
  --soft: #f5f8fb;
  --accent: #187f72;
  --accent-strong: #0d5f56;
  --warn: #be5b20;
  --bad: #b42318;
  --good: #147a45;
  --blue: #3267d6;
  --gold: #d99a18;
  --rose: #c33f6a;
  --shadow: 0 20px 60px rgba(30, 45, 70, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(120deg, rgba(24, 127, 114, 0.12), transparent 34%),
    linear-gradient(240deg, rgba(50, 103, 214, 0.1), transparent 38%),
    #eef3f7;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(560px, 1fr) 300px;
  gap: 18px;
  max-width: 1680px;
  min-height: calc(100vh - 56px);
  margin: 0 auto;
}

.sidebar,
.practice-panel,
.insights-panel {
  min-width: 0;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(217, 225, 234, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar,
.insights-panel {
  padding: 18px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.practice-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}

.insights-panel {
  display: grid;
  align-content: start;
  gap: 18px;
}

.insight-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.insight-primary {
  padding-bottom: 2px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 2.15rem;
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.45rem;
  line-height: 1.15;
}

h3 {
  margin-bottom: 8px;
}

.control-group {
  display: grid;
  gap: 7px;
}

label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

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

select {
  min-height: 38px;
  padding: 0 10px;
}

input {
  min-height: 36px;
  padding: 0 10px;
}

textarea {
  display: none;
  resize: vertical;
  min-height: 150px;
  padding: 16px;
  line-height: 1.5;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.mode-toggle button {
  min-height: 36px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.mode-toggle button.active {
  color: #fff;
  background: var(--ink);
}

.content-gate {
  margin: -8px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(190, 91, 32, 0.3);
  border-radius: 8px;
  color: var(--warn);
  background: rgba(190, 91, 32, 0.08);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.content-gate.internal {
  border-color: rgba(50, 103, 214, 0.28);
  color: var(--blue);
  background: rgba(50, 103, 214, 0.08);
}

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

.metric-grid div,
.learner-card,
.account-card,
.sprint-card,
.lesson-card,
.recommendation,
.quest-card,
.badge-item,
.weakness-item,
.attempt-item,
.feedback-panel,
.celebration-panel,
.summary-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metric-grid div {
  padding: 12px;
}

.metric-grid span {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
}

.metric-grid p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.learner-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(217, 154, 24, 0.16), transparent 42%),
    #fff;
}

.account-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.account-card h2 {
  font-size: 1rem;
}

.account-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.account-fields {
  display: grid;
  gap: 7px;
}

.account-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.account-actions button {
  min-height: 36px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.sprint-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(50, 103, 214, 0.13), transparent 46%),
    #fff;
}

.learner-topline,
.sprint-topline,
.quest-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.learner-topline h2 {
  font-size: 1.3rem;
}

.sprint-topline h2 {
  font-size: 1.15rem;
}

.learner-topline span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: #7a4c00;
  background: rgba(217, 154, 24, 0.18);
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

#sprint-combo {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--blue);
  background: rgba(50, 103, 214, 0.13);
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.xp-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e8edf3;
}

#xp-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--rose));
  transition: width 220ms ease;
}

#xp-next {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

#sprint-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.sprint-fill {
  background: linear-gradient(90deg, var(--blue), var(--accent));
}

#start-sprint {
  min-height: 40px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-weight: 800;
}

.streak-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: var(--soft);
}

.streak-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.streak-chip p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.ghost-button,
.ghost-link,
.secondary-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
}

.ghost-button,
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 8px;
  font-weight: 800;
}

.ghost-link {
  text-decoration: none;
}

.practice-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.icon-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-size: 1.25rem;
  font-weight: 800;
}

.focus-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 64px;
  padding: 12px 16px;
  border: 1px solid rgba(24, 127, 114, 0.24);
  border-radius: 8px;
  background: rgba(24, 127, 114, 0.08);
}

.focus-strip .eyebrow {
  margin-bottom: 3px;
}

.focus-strip strong {
  display: block;
  font-size: 1rem;
  line-height: 1.25;
}

.focus-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.focus-strip.focus {
  border-color: rgba(50, 103, 214, 0.26);
  background: rgba(50, 103, 214, 0.08);
}

.focus-strip.focus span {
  color: var(--blue);
}

.focus-strip.reinforcement {
  border-color: rgba(190, 91, 32, 0.28);
  background: rgba(190, 91, 32, 0.08);
}

.focus-strip.reinforcement span {
  color: var(--warn);
}

.focus-strip.sprint {
  border-color: rgba(217, 154, 24, 0.34);
  background: rgba(217, 154, 24, 0.1);
}

.focus-strip.sprint span {
  color: #7a4c00;
}

.question-card {
  display: grid;
  gap: 20px;
  min-height: 480px;
  padding: 30px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(24, 127, 114, 0.08), transparent 48%),
    #fff;
  border: 1px solid var(--line);
}

.lesson-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.lesson-topline,
.lesson-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lesson-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lesson-topline h3,
.lesson-layout h4 {
  margin-bottom: 0;
}

.lesson-topline span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 32px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(24, 127, 114, 0.12);
  font-weight: 800;
}

#lesson-toggle {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.lesson-body {
  display: grid;
  gap: 14px;
}

.lesson-body[hidden] {
  display: none;
}

.lesson-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
}

.lesson-layout section,
.lesson-layout aside,
.quick-check {
  border-radius: 8px;
  background: var(--soft);
}

.lesson-layout section {
  padding: 18px;
}

.lesson-layout aside {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px;
}

.lesson-layout p,
.quick-check p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.lesson-chip {
  display: inline-flex;
  width: fit-content;
  min-height: 26px;
  align-items: center;
  margin-bottom: 12px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--blue);
  background: rgba(50, 103, 214, 0.12);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: capitalize;
}

#lesson-objectives {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: #344054;
  line-height: 1.4;
}

.lesson-vocab {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.lesson-vocab span {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.quick-check {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
}

.quick-check strong {
  line-height: 1.4;
}

.lesson-actions {
  justify-content: flex-end;
}

.lesson-actions button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 800;
}

#lesson-practice {
  color: #fff;
  background: var(--ink);
}

.card-topline,
.action-row,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-topline span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

#difficulty-pill {
  color: var(--accent-strong);
  background: rgba(24, 127, 114, 0.12);
}

#mode-pill {
  color: var(--blue);
  background: rgba(50, 103, 214, 0.12);
}

#question-text {
  margin: 0;
  font-size: 1.78rem;
  font-weight: 800;
  line-height: 1.3;
}

.passage-text {
  display: none;
  margin: 0;
  padding: 18px;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  color: #344054;
  background: rgba(245, 248, 251, 0.9);
  font-size: 1.05rem;
  font-style: normal;
  line-height: 1.55;
}

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

.option-button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  font-weight: 700;
  line-height: 1.35;
}

.option-button.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 127, 114, 0.14);
}

.option-button.correct {
  border-color: var(--good);
  background: rgba(20, 122, 69, 0.1);
}

.option-button.incorrect {
  border-color: var(--bad);
  background: rgba(180, 35, 24, 0.08);
}

.action-row {
  align-self: end;
  justify-content: flex-start;
}

.action-row button {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 800;
}

#submit-answer {
  color: #fff;
  background: var(--accent);
}

.next-inline {
  margin-left: auto;
}

.next-inline[hidden] {
  display: none;
}

.feedback-panel {
  padding: 16px 18px;
}

.celebration-panel {
  padding: 18px;
  border-color: rgba(217, 154, 24, 0.5);
  background:
    linear-gradient(135deg, rgba(217, 154, 24, 0.18), rgba(195, 63, 106, 0.1)),
    #fff;
  box-shadow: 0 16px 38px rgba(122, 76, 0, 0.13);
}

.celebration-panel h3 {
  margin-bottom: 6px;
}

.celebration-panel p:last-child {
  margin-bottom: 0;
  color: #5b4631;
  line-height: 1.45;
}

.summary-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
  border-color: rgba(50, 103, 214, 0.28);
  background:
    linear-gradient(135deg, rgba(50, 103, 214, 0.1), transparent 46%),
    #fff;
}

.summary-panel[hidden] {
  display: none;
}

.summary-topline,
.summary-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.summary-topline h3 {
  margin-bottom: 0;
}

#summary-xp {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  color: #7a4c00;
  background: rgba(217, 154, 24, 0.18);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.summary-grid div {
  padding: 14px;
  border-radius: 8px;
  background: var(--soft);
}

.summary-grid span {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
}

.summary-grid p,
#summary-copy {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.summary-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.summary-details div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-details strong {
  line-height: 1.35;
}

.summary-actions button {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 800;
}

#summary-drill {
  color: #fff;
  background: var(--ink);
}

#feedback-copy {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.quest-card {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.quest-row span {
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.quest-card p,
.badge-item p,
.mastery-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.quest-fill {
  background: var(--accent);
}

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

.badge-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 9px;
  padding: 10px;
  opacity: 0.58;
}

.badge-item span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--muted);
  background: var(--soft);
  font-weight: 800;
}

.badge-item strong {
  display: block;
  margin-bottom: 3px;
}

.badge-item.earned {
  opacity: 1;
  border-color: rgba(217, 154, 24, 0.45);
  background: rgba(217, 154, 24, 0.08);
}

.badge-item.earned span {
  color: #fff;
  background: var(--gold);
}

.badge-summary {
  margin: 0;
  padding: 2px 4px 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

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

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

.weakness-item {
  padding: 12px;
}

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

.attempt-item.correct {
  border-color: rgba(20, 122, 69, 0.24);
}

.attempt-item.incorrect {
  border-color: rgba(190, 91, 32, 0.28);
}

.weakness-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  margin-bottom: 5px;
}

.attempt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  margin-bottom: 5px;
}

.weakness-row strong {
  min-width: 0;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.attempt-row strong {
  min-width: 0;
  overflow: hidden;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weakness-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.attempt-row span {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

.attempt-item.incorrect .attempt-row span {
  color: var(--warn);
}

.attempt-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.attempt-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
}

.attempt-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid rgba(36, 88, 147, 0.16);
  border-radius: 999px;
  background: rgba(36, 88, 147, 0.07);
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
}

.attempt-badge.warning {
  border-color: rgba(190, 91, 32, 0.26);
  background: rgba(190, 91, 32, 0.1);
  color: var(--warn);
}

.bar {
  overflow: hidden;
  height: 8px;
  margin-top: 9px;
  border-radius: 999px;
  background: #e9eef4;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--warn);
}

.recommendation {
  padding: 14px;
}

.recommendation strong {
  display: block;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.recommendation p {
  margin-bottom: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.recommendation button {
  width: 100%;
  min-height: 40px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-weight: 800;
}

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

  .workspace {
    grid-template-columns: 240px minmax(520px, 1fr);
    gap: 16px;
  }

  .insights-panel {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .insight-primary {
    grid-column: span 2;
  }

  .lesson-layout {
    grid-template-columns: 1fr;
  }

  .question-card {
    min-height: 460px;
    padding: 26px;
  }

  #question-text {
    font-size: 1.62rem;
  }
}

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

  .sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .sidebar > :first-child,
  .control-group,
  .mode-toggle,
  .content-gate {
    grid-column: auto;
  }

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

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

  .sidebar {
    display: flex;
  }

  .workspace,
  .insights-panel {
    grid-template-columns: 1fr;
  }

  .workspace {
    min-height: auto;
  }

  #question-text {
    font-size: 1.25rem;
  }

  .question-card {
    min-height: 360px;
    padding: 20px;
  }

  textarea {
    min-height: 120px;
  }

  .card-topline,
  .action-row,
  .lesson-topline,
  .lesson-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .next-inline {
    margin-left: 0;
  }

  .lesson-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .focus-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .focus-strip span {
    width: fit-content;
  }

  .lesson-actions button {
    width: 100%;
  }

  .summary-topline,
  .summary-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid,
  .summary-details {
    grid-template-columns: 1fr;
  }

  .summary-actions button {
    width: 100%;
  }
}
