:root {
  --bg: #f5f6f1;
  --ink: #1d2935;
  --muted: #657181;
  --line: #d9dfd8;
  --surface: #ffffff;
  --surface-2: #eef4f7;
  --blue: #285f9f;
  --green: #1f8068;
  --gold: #b7791f;
  --red: #b94a48;
  --shadow: 0 18px 40px rgba(29, 41, 53, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 0 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 16px;
  letter-spacing: 0;
}

.date-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.date-controls label,
.note-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

input[type="date"] {
  min-height: 42px;
  padding: 0 12px;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  font-weight: 800;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr)) minmax(220px, 2fr);
  gap: 12px;
  margin-bottom: 18px;
}

.metric,
.progress-wrap,
.calendar-panel,
.today-panel,
.notes-panel,
.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric,
.progress-wrap {
  min-height: 88px;
  padding: 16px;
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

.metric strong {
  font-size: 24px;
  line-height: 1;
}

.progress-wrap {
  display: grid;
  align-content: center;
  gap: 10px;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e9e4;
}

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

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

.main-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

body.focus-mode .app-shell {
  width: 100%;
  padding: 0;
}

body.focus-mode .topbar,
body.focus-mode .dashboard,
body.focus-mode .calendar-panel,
body.focus-mode .notes-panel,
body.focus-mode .phase-strip,
body.focus-mode .lesson-tabs {
  display: none;
}

body.focus-mode .main-grid {
  display: block;
}

body.focus-mode .today-panel {
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--bg);
}

body.focus-mode .lesson-page {
  min-height: 100vh;
  padding: 24px;
}

body.focus-mode .learning-card {
  width: min(1080px, 100%);
  min-height: calc(100vh - 48px);
  margin: 0 auto;
  align-content: start;
}

.calendar-panel,
.notes-panel {
  padding: 16px;
}

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

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

.day-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  max-height: 650px;
  overflow: auto;
  padding-right: 2px;
}

.day-button {
  display: grid;
  place-items: center;
  gap: 1px;
  aspect-ratio: 1;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
  padding: 2px;
  font-size: 11px;
  font-weight: 850;
}

.day-button strong,
.day-button span {
  display: block;
  line-height: 1;
}

.day-button span {
  font-size: 8px;
  font-weight: 750;
}

.day-button.current {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(40, 95, 159, 0.18);
}

.day-button.complete {
  background: #e3f3ee;
  border-color: #a9d6c8;
  color: var(--green);
}

.day-button.partial {
  background: #fff4dc;
  border-color: #e7c273;
  color: var(--gold);
}

.phase-strip {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  min-height: 166px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(40, 95, 159, 0.12), transparent 45%),
    var(--surface-2);
}

.phase-copy {
  display: grid;
  align-content: center;
  gap: 10px;
}

#phase-badge {
  width: fit-content;
  border-radius: 999px;
  background: rgba(31, 128, 104, 0.12);
  color: var(--green);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
}

#focus-title {
  max-width: 620px;
  font-size: clamp(26px, 4vw, 42px);
}

.study-scene {
  position: relative;
  flex: 0 0 170px;
  min-height: 120px;
}

.card-stack,
.timer-mark,
.graph-mark {
  position: absolute;
  border-radius: 8px;
}

.card-stack {
  right: 28px;
  bottom: 20px;
  width: 105px;
  height: 76px;
  background: #fff;
  border: 2px solid rgba(29, 41, 53, 0.15);
  box-shadow:
    -12px -10px 0 #dceef8,
    -24px -20px 0 #e7f2ea;
  transform: rotate(-4deg);
}

.timer-mark {
  right: 12px;
  top: 16px;
  width: 50px;
  height: 50px;
  border: 7px solid rgba(183, 121, 31, 0.34);
  border-top-color: var(--gold);
  border-radius: 999px;
}

.graph-mark {
  left: 10px;
  bottom: 22px;
  width: 70px;
  height: 54px;
  background:
    linear-gradient(to top, var(--green) 0 36%, transparent 36%),
    linear-gradient(to top, rgba(40, 95, 159, 0.8) 0 62%, transparent 62%),
    linear-gradient(to top, rgba(183, 121, 31, 0.75) 0 82%, transparent 82%);
  background-size: 18px 100%, 18px 100%, 18px 100%;
  background-position: 0 0, 26px 0, 52px 0;
  background-repeat: no-repeat;
}

.content-stack {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.content-stack + .content-stack {
  padding-top: 0;
}

.lesson-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 16px 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.lesson-tab {
  flex: 0 0 auto;
  min-height: 38px;
  border-color: #cbd7df;
  background: #f7fafb;
  color: #35536a;
}

.lesson-tab.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.lesson-tab.complete::after {
  content: "✓";
  margin-left: 6px;
  font-weight: 900;
}

.lesson-page {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.focus-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.card {
  padding: 16px;
}

.page-card {
  display: grid;
  gap: 16px;
}

.page-hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  border-radius: 8px;
  background: #f2f7f9;
  padding: 16px;
}

.page-kicker,
.question-type {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.mission-meter {
  display: grid;
  place-items: center;
  min-width: 118px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px;
  text-align: center;
}

.mission-meter strong {
  color: var(--green);
  font-size: 34px;
  line-height: 1;
}

.mission-meter span,
.mission-grid span,
.recall-steps span,
.strategy-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.mission-grid,
.recall-steps,
.writing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.round-track {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.round-track span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
  padding: 9px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.round-track span.active {
  border-color: var(--blue);
  background: #e8f1f8;
  color: var(--blue);
}

.round-track span.done {
  border-color: #a9d6c8;
  background: #e3f3ee;
  color: var(--green);
}

.mission-grid div,
.recall-steps div,
.strategy-card,
.cloze-box {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 12px;
}

.mission-grid strong,
.recall-steps strong {
  color: var(--ink);
  font-size: 20px;
}

.section-head {
  margin-top: 4px;
}

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

.card-head,
.trainer-actions,
.score-head,
.material-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tag-row,
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag,
.pill {
  border-radius: 999px;
  background: #edf4f7;
  color: #244964;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 850;
}

.pill.green {
  background: #e3f3ee;
  color: var(--green);
}

.pill.gold {
  background: #fff4dc;
  color: var(--gold);
}

.schedule-list,
.task-list,
.resource-list {
  display: grid;
  gap: 8px;
}

.schedule-list div,
.task-row {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  border-radius: 8px;
  background: #fbfcfb;
  padding: 8px 10px;
}

.schedule-list time {
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
}

.task-row {
  grid-template-columns: 34px 1fr auto;
  border: 1px solid var(--line);
}

.task-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--green);
}

.task-row.done {
  border-color: #a9d6c8;
  background: #f0faf6;
}

.task-title {
  margin: 0 0 3px;
  font-weight: 850;
}

.task-detail {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.minutes {
  border-radius: 999px;
  background: #e9eef2;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 850;
}

.flashcard {
  display: grid;
  gap: 12px;
  min-height: 210px;
  border: 1px solid #cbd8e4;
  border-radius: 8px;
  background: #f8fbfd;
  padding: 18px;
}

.flashcard.vivid {
  background:
    linear-gradient(135deg, rgba(31, 128, 104, 0.1), transparent 48%),
    #f8fbfd;
}

.flashword {
  font-size: clamp(34px, 6vw, 56px);
  font-weight: 900;
  line-height: 1;
}

.definition {
  color: var(--ink);
  line-height: 1.5;
}

.word-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

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

.word-facts dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.word-facts dd {
  margin: 3px 0 0;
  font-weight: 850;
}

.example-line {
  margin: 0;
  border-left: 4px solid var(--green);
  background: #fff;
  padding: 10px 12px;
  font-weight: 750;
}

.practice-box {
  display: grid;
  gap: 12px;
}

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

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.word-bank button {
  min-height: 34px;
  padding: 0 9px;
  color: var(--muted);
  font-size: 12px;
}

.word-bank button.active {
  border-color: var(--blue);
  color: var(--blue);
}

.word-bank button.known {
  border-color: #a9d6c8;
  background: #e3f3ee;
  color: var(--green);
}

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

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

.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.good {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.warn {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

.danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.sentence-box {
  border: 1px solid #d8e1d8;
  border-radius: 8px;
  background: #fbfcfb;
  padding: 16px;
  font-size: 20px;
  line-height: 1.5;
  font-weight: 750;
}

.sentence-box.hidden {
  color: transparent;
  text-shadow: 0 0 12px rgba(29, 41, 53, 0.24);
  user-select: none;
}

.sentence-stage {
  display: grid;
  gap: 10px;
}

.cloze-box span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.question-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 12px;
}

.vivid-question {
  border-left: 5px solid var(--blue);
}

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

.reading-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 12px;
}

.passage-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 16px;
}

.passage-card p {
  margin: 0 0 12px;
  line-height: 1.65;
}

.passage-card p:last-child {
  margin-bottom: 0;
}

.strategy-card {
  align-content: start;
}

.writing-prompt {
  border-left: 5px solid var(--gold);
  border-radius: 8px;
  background: #fffaf0;
  padding: 16px;
  font-size: 20px;
  font-weight: 850;
  line-height: 1.4;
}

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

.writing-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.writing-grid textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: 12px;
  text-transform: none;
  line-height: 1.45;
}

.writing-done {
  margin-top: 0;
}

.choice.correct {
  border-color: #99cbbd;
  background: #e3f3ee;
}

.choice.wrong {
  border-color: #ddb2af;
  background: #fff0ef;
}

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

.score-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.score-grid input {
  min-width: 0;
  min-height: 40px;
  padding: 0 9px;
}

.score-head strong {
  color: var(--green);
  font-size: 30px;
}

.notes-panel textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
}

.mini-plan,
.source-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.mini-plan ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.4;
}

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

.source-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  padding: 9px 10px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
}

.source-link span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.source-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 1160px) {
  .dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .calendar-panel {
    order: 2;
  }

  .notes-panel {
    order: 3;
  }
}

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

  .topbar,
  .phase-strip,
  .card-head,
  .score-head,
  .material-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .date-controls {
    width: 100%;
    justify-content: flex-start;
  }

  input[type="date"] {
    flex: 1 1 160px;
  }

  .dashboard,
  .score-grid,
  .choice-grid,
  .mission-grid,
  .recall-steps,
  .round-track,
  .page-jumps,
  .reading-layout,
  .writing-grid,
  .word-facts {
    grid-template-columns: 1fr;
  }

  .page-hero {
    flex-direction: column;
  }

  .mission-meter {
    width: 100%;
    min-height: 92px;
  }

  .study-scene {
    display: none;
  }

  .schedule-list div,
  .task-row {
    grid-template-columns: 1fr;
  }

  .task-row {
    grid-template-columns: 34px 1fr;
  }

  .minutes {
    grid-column: 2;
    justify-self: start;
  }
}
