.course-history {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(500px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  padding: 0;
  border: 0;
  border-left: 1px solid #dce5f1;
  border-radius: 14px 0 0 14px;
  color: var(--ink, #173657);
  box-shadow: -12px 0 45px #19355225;
  background: #fbfcff;
  overflow: hidden;
}
.course-history::backdrop {
  background: #17365735;
}
.course-history[open] {
  display: flex;
  flex-direction: column;
}
.history-header,
.history-footer {
  padding: 18px 24px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
}
.history-header {
  border-bottom: 1px solid #e3eaf4;
}
.history-header h2 {
  margin: 4px 0;
  font-size: 22px;
  font-weight: 600;
}
.history-header .help {
  margin: 0;
}
.history-header .icon-button {
  font-size: 13px;
  width: auto;
  padding: 8px;
}
.history-footer {
  border-top: 1px solid #e3eaf4;
}
.history-body {
  padding: 12px 24px 24px;
  overflow: auto;
  min-height: 0;
  flex: 1;
}
.history-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.history-filters button[aria-pressed='true'] {
  background: #edf3fc;
  color: #23468b;
  border-color: #91afd4;
}
.course-history .history-list {
  display: grid;
  gap: 9px;
  padding: 0;
  max-height: 220px;
  overflow: auto;
}
.history-record {
  width: 100%;
  display: block;
  border: 1px solid #dce5f2;
  padding: 14px;
  background: #fff;
  text-align: left;
  border-radius: 10px;
  color: inherit;
}
.history-record[aria-pressed='true'] {
  border-color: #8aa9d1;
  box-shadow: 0 0 0 2px #edf3fc;
}
.history-record strong {
  font-size: 14px;
  font-weight: 550;
}
.history-record small {
  display: block;
  color: #72849b;
  margin-top: 8px;
  font-size: 11px;
}
.history-detail {
  margin-top: 18px;
  background: white;
  border: 1px solid #dfe7f2;
  border-radius: 11px;
  padding: 18px;
}
.history-detail h3 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 550;
}
.history-detail > p {
  font-size: 13px;
  line-height: 1.9;
}
.history-breakdown {
  border: 1px solid #dce6f3;
  border-radius: 8px;
  margin: 15px 0;
  overflow: hidden;
}
.history-breakdown summary {
  padding: 12px;
  background: #f3f7fc;
  cursor: pointer;
  font-size: 13px;
  min-height: 44px;
}
.history-change {
  padding: 14px;
  border-top: 1px solid #e6edf7;
  font-size: 13px;
  line-height: 1.9;
}
.history-change strong {
  font-weight: 550;
  overflow-wrap: anywhere;
}
.history-kind {
  color: #54769f;
  background: #edf3fa;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 11px;
}
.history-lesson {
  margin-top: 12px;
  padding: 10px 0 0;
  border-top: 1px solid #edf1f7;
}
.history-lesson p {
  font-size: 12px;
  color: #6a809e;
  line-height: 1.9;
  margin: 6px 0;
}
.history-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 12px;
  border: 1px solid #e1e9f3;
  border-radius: 7px;
  overflow: hidden;
}
.history-comparison > div {
  padding: 12px;
  min-width: 0;
}
.history-comparison > div + div {
  border-left: 1px solid #e1e9f3;
  background: #f5f8fd;
}
.history-comparison p {
  margin: 6px 0;
  font-size: 13px;
  line-height: 1.9;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.history-comparison small {
  color: #7b8da4;
}
.history-record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
  align-items: center;
}
.history-impact {
  padding-left: 22px;
  font-size: 14px;
  line-height: 2;
}
.md-author-tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0;
  flex-wrap: wrap;
}
.md-author-tabs [aria-pressed='true'] {
  background: #edf3fc;
  color: #23468b;
  border-color: #96b3d7;
}
.md-question {
  border: 1px solid #dfe8f4;
  border-radius: 9px;
  padding: 15px;
  margin: 13px 0;
}
.md-question h4 {
  margin: 0 0 12px;
  font-weight: 550;
}
.md-correct {
  background: #edf6f6;
  color: #367278;
  padding: 7px;
  border-radius: 6px;
}
.md-answer {
  font-size: 13px;
  line-height: 1.9;
  background: #f4f7fc;
  padding: 12px;
  border-radius: 7px;
  margin-top: 12px;
}
.course-history button {
  min-height: 40px;
}
.course-history .badge {
  white-space: nowrap;
}
@media (max-width: 700px) {
  .course-history {
    width: 100%;
    border-radius: 0;
    border: 0;
  }
  .history-header,
  .history-footer {
    padding: 16px 18px;
  }
  .history-body {
    padding: 10px 18px 20px;
  }
  .history-header h2 {
    font-size: 20px;
  }
  .course-history button {
    min-height: 44px;
  }
  .history-footer .help {
    font-size: 11px;
    max-width: 150px;
  }
  .history-comparison {
    grid-template-columns: 1fr;
  }
  .history-comparison > div + div {
    border-left: 0;
    border-top: 1px solid #e1e9f3;
  }
  .history-detail {
    padding: 15px;
  }
  .history-record .row {
    gap: 7px;
  }
  .md-author-tabs button {
    flex: 1;
    min-height: 44px;
  }
  .history-record-actions > button {
    flex: 1;
  }
}
