:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #667085;
  --line: #d8dee8;
  --green: #1d8a5a;
  --teal: #137b83;
  --blue: #2f65c8;
  --red: #bd3b3b;
  --shadow: 0 12px 32px rgba(24, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  border-radius: 7px;
  background: var(--green);
  color: white;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
}

button.secondary {
  background: var(--blue);
}

button.ghost {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--text);
  padding: 10px 12px;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.login-panel {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 26px;
}

.login-panel h1,
.topbar h1 {
  margin: 0;
  font-size: clamp(26px, 5vw, 36px);
  letter-spacing: 0;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.shell {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 22px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.error {
  min-height: 24px;
  color: var(--red);
}

.control-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.readonly-field {
  min-height: 43px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f9fafb;
  color: var(--text);
  padding: 10px 12px;
  font-weight: 800;
}

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

.metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.metrics strong {
  display: block;
  font-size: 24px;
}

.metrics span {
  color: var(--muted);
  font-size: 13px;
}

.task-stack {
  display: grid;
  gap: 16px;
}

.task-card,
.empty-state {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--green);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
}

.task-card.english {
  border-top-color: var(--blue);
}

.task-card.case {
  border-top-color: var(--teal);
}

.empty-state {
  border-top-color: var(--teal);
}

.mission-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.task-card h2,
.panel h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.task-card p,
.empty-state p {
  margin: 0;
  color: var(--muted);
}

.empty-state pre,
.coach-prompt pre {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f9fafb;
  padding: 12px;
  white-space: pre-wrap;
}

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

.knowledge-point {
  margin-top: 6px !important;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #edf5f2;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  padding: 5px 10px;
}

.lesson-section {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.lesson-section h3 {
  margin: 0;
  font-size: 15px;
}

.lesson-body {
  color: var(--text);
  white-space: pre-wrap;
}

.lesson-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.coach-prompt {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.coach-prompt summary {
  cursor: pointer;
  font-weight: 800;
}

.result-box {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 14px;
  margin-top: 16px;
}

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

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.entry-form {
  display: grid;
  gap: 12px;
}

.section-title {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--text);
  font-weight: 800;
}

.actions {
  display: flex;
  gap: 10px;
}

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

.history-row,
.mastery-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
}

.history-row span,
.mastery-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.score-pill {
  min-width: 42px;
  border-radius: 999px;
  background: #edf5f2;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  padding: 4px 8px;
  text-align: center;
}

[hidden] {
  display: none !important;
}

@media (max-width: 860px) {
  .shell {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
  }

  .control-strip,
  .metrics,
  .workspace {
    grid-template-columns: 1fr;
  }

  .task-header {
    display: grid;
  }

  .actions {
    flex-direction: column;
  }
}
