:root {
  color-scheme: light;
  --paper: #f6f7f2;
  --surface: #fff;
  --ink: #1b2924;
  --muted: #738078;
  --line: #e1e6df;
  --green: #245c45;
  --green-dark: #174331;
  --green-wash: #e8f1ea;
  --amber: #d69a34;
  --coral: #c76851;
  --shadow: 0 18px 55px rgb(27 41 36 / 12%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(#dce4dc 0.65px, transparent 0.65px);
  background-size: 15px 15px;
}

button, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 94%);
}

.brand, .topbar-right, .profile-button { display: flex; align-items: center; }
.brand { gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark, .dialog-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px 9px 9px 3px;
  color: #fff;
  background: var(--green);
  font-family: Georgia, serif;
  font-size: 16px;
  font-weight: 700;
}
.brand-name { font-family: Georgia, "Times New Roman", serif; font-size: 17px; }
.topbar-right { gap: 25px; }
.course-label, .eyebrow, .breadcrumb, .lesson-kicker {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}
.profile-button {
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
}
.profile-button:hover { border-color: #a8b8aa; }
.profile-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.profile-change { margin-left: 4px; color: var(--muted); }

.app-layout { display: grid; min-height: calc(100vh - 68px); grid-template-columns: 250px minmax(0, 1fr); }
.sidebar {
  position: relative;
  display: flex;
  min-height: calc(100vh - 68px);
  flex-direction: column;
  padding: 33px 17px 20px;
  border-right: 1px solid var(--line);
  background: rgb(255 255 255 / 72%);
}
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 10px 15px; }
.week-count, .material-count { color: var(--muted); font-size: 11px; }
.week-list { display: grid; gap: 3px; }
.week-button {
  display: flex;
  min-height: 42px;
  width: 100%;
  align-items: center;
  gap: 11px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.week-button:hover { background: #edf2ec; }
.week-button[aria-current="page"] { color: var(--green-dark); background: var(--green-wash); font-weight: 650; }
.week-number {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: #fff;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.week-button[aria-current="page"] .week-number { border-color: #c8ddcd; color: var(--green); }
.week-label { font-size: 13px; }
.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: auto 7px 0;
  padding: 17px 4px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  line-height: 1.45;
}
.sidebar-foot-mark {
  color: var(--coral);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
}

.main-content { min-width: 0; padding: 32px clamp(24px, 5.6vw, 82px) 80px; }
.content-inner { width: min(100%, 970px); margin: 0 auto; }
.breadcrumb { display: flex; align-items: center; gap: 9px; font-size: 9px; }
.breadcrumb-divider { color: #bcc6bc; }
.lesson-heading {
  display: flex;
  min-height: 178px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 27px 0 31px;
  border-bottom: 1px solid var(--line);
}
.lesson-kicker { margin: 0 0 12px; color: var(--green); }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
h1 { max-width: 700px; margin: 0; font-size: clamp(29px, 3vw, 40px); line-height: 1.13; }
.lesson-description { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.lesson-stamp {
  display: flex;
  width: 78px;
  height: 78px;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: rotate(5deg);
  border: 1px solid #ddc48e;
  border-radius: 50%;
  color: #98712b;
}
.lesson-stamp span { font-size: 8px; font-weight: 700; letter-spacing: 1.3px; }
.lesson-stamp strong { font-family: Georgia, serif; font-size: 27px; font-weight: 500; }

.materials-section { padding-top: 29px; }
.materials-topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tabs {
  display: flex;
  min-height: 43px;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.tab-button {
  position: relative;
  min-height: 42px;
  flex: 0 0 auto;
  padding: 0 13px;
  border: 0;
  color: #66736b;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}
.tab-button:hover { color: var(--green-dark); }
.tab-button[aria-selected="true"] { color: var(--green-dark); font-weight: 650; }
.tab-button[aria-selected="true"]::after {
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 2px;
  background: var(--green);
  content: "";
}
.tab-index { margin-right: 7px; color: #9aa59b; font-size: 10px; font-variant-numeric: tabular-nums; }

.reader {
  min-height: 270px;
  padding: 27px 4px 55px;
  animation: appear 280ms ease both;
}
.reader-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.reader-meta h2 { margin: 0; font-size: 22px; }
.reader-filename { overflow: hidden; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.markdown-body { max-width: 790px; font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { color: var(--ink); line-height: 1.3; }
.markdown-body h1 { margin: 0 0 18px; font-size: 29px; }
.markdown-body h2 { margin: 30px 0 11px; font-size: 23px; }
.markdown-body h3 { margin: 23px 0 8px; font-family: Georgia, serif; font-size: 18px; font-weight: 500; }
.markdown-body p { margin: 12px 0; }
.markdown-body a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.markdown-body blockquote { margin: 19px 0; padding: 10px 17px; border-left: 3px solid var(--amber); color: #52645a; background: #f0f2ea; }
.markdown-body ul, .markdown-body ol { padding-left: 24px; }
.markdown-body li { margin: 4px 0; padding-left: 3px; }
.markdown-body code { padding: 2px 5px; border-radius: 3px; color: #9b4b38; background: #f5ece7; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
.markdown-body pre { overflow: auto; margin: 18px 0; padding: 17px 19px; border: 1px solid #d9e2da; border-radius: 5px; color: #eaf1e9; background: #1f3029; line-height: 1.6; }
.markdown-body pre code { padding: 0; color: inherit; background: none; font-size: 12px; }
.markdown-body table { width: 100%; margin: 17px 0; border-collapse: collapse; font-size: 13px; }
.markdown-body th, .markdown-body td { padding: 9px 11px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.markdown-body th { background: #edf2ec; }
.markdown-body hr { height: 1px; margin: 25px 0; border: 0; background: var(--line); }
.empty-state { padding: 50px 15px; color: var(--muted); text-align: center; }
.loading-state { color: var(--muted); }

.profile-dialog {
  width: min(calc(100% - 32px), 405px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.profile-dialog::backdrop { background: rgb(21 36 29 / 48%); backdrop-filter: blur(3px); }
.dialog-mark { width: 38px; height: 38px; margin-bottom: 24px; }
.profile-dialog .eyebrow { margin: 0 0 10px; color: var(--green); }
.profile-dialog h2 { margin: 0 0 25px; font-size: 29px; }
.profile-dialog label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 650; }
.profile-dialog input { width: 100%; height: 43px; padding: 0 12px; border: 1px solid #cfd8cf; border-radius: 4px; outline-color: var(--green); }
.dialog-hint { margin: 10px 0 22px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.enter-button { display: flex; width: 100%; min-height: 43px; align-items: center; justify-content: space-between; padding: 0 14px; border: 0; border-radius: 4px; color: #fff; background: var(--green); cursor: pointer; font-size: 13px; font-weight: 600; }
.enter-button:hover { background: var(--green-dark); }
.enter-button span { font-size: 18px; }

noscript { display: block; padding: 20px; color: var(--coral); text-align: center; }
@keyframes appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
  .topbar { height: 60px; padding: 0 17px; }
  .course-label { display: none; }
  .app-layout { min-height: calc(100vh - 60px); grid-template-columns: 1fr; }
  .sidebar { min-height: auto; padding: 16px 16px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-heading { padding: 0 3px 9px; }
  .week-list { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 13px; scrollbar-width: thin; }
  .week-button { width: auto; min-height: 37px; flex: 0 0 auto; gap: 7px; padding: 0 8px; }
  .week-number { width: 22px; height: 22px; }
  .week-label { font-size: 12px; }
  .sidebar-foot { display: none; }
  .main-content { padding: 24px 19px 55px; }
  .lesson-heading { min-height: 150px; padding: 22px 0; }
  .lesson-stamp { width: 60px; height: 60px; }
  .lesson-stamp strong { font-size: 22px; }
  .tabs { margin-right: -19px; padding-right: 19px; }
  .reader { padding-top: 22px; }
}

@media (max-width: 430px) {
  .profile-button { gap: 6px; padding: 7px; font-size: 11px; }
  .brand-name { font-size: 15px; }
  .lesson-stamp { display: none; }
  .reader-meta { align-items: flex-start; flex-direction: column; }
  .profile-dialog { padding: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}