:root {
  color-scheme: light;
  --paper: #faf9fb;
  --surface: #ffffff;
  --ink: #29232b;
  --muted: #665d69;
  --line: #e7dfe7;
  --rose: #f9dbe7;
  --rose-ink: #702e4a;
  --blush: #fdf0f5;
  --sage: #e7f3e9;
  --sage-ink: #285541;
  --accent: #903d60;
  --desk: #f4f2f5;
  --shadow: 0 3px 14px #3925320a;
  font: 16px/1.5 system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
* { box-sizing: border-box }
body { margin: 0 }
a { color: var(--accent); text-underline-offset: .2em }
button, input, select, textarea { font: inherit; color: inherit }
button, select, input:not([type="checkbox"]) { min-height: 44px }
button, select, input, textarea { border: 1px solid var(--line); border-radius: .55rem; background: var(--surface) }
button { padding: .5rem .85rem; cursor: pointer; font-weight: 620 }
button:hover { border-color: var(--accent) }
button.primary { background: var(--rose); color: var(--rose-ink); border-color: transparent }
button.danger { color: var(--rose-ink); background: var(--rose) }
input:not([type="checkbox"]), select { padding: .45rem .6rem; width: 100%; min-width: 0 }
input[type="file"] { max-width: 100% }
input[type="color"] { max-width: 5rem }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px }
[hidden] { display: none !important }
.skip { position: fixed; top: .6rem; left: .6rem; padding: .6rem; background: var(--surface); z-index: 4; transform: translateY(-180%) }
.skip:focus { transform: none }
.sidebar { background: var(--surface); border-bottom: 1px solid var(--line); padding: .65rem .85rem .5rem }
.brand { display: inline-flex; gap: .55rem; align-items: center; min-height: 44px; margin-bottom: .35rem; font: 720 1.26rem/1.1 system-ui, sans-serif; text-decoration: none; color: var(--ink) }
.brand-mark { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .55rem; background: var(--rose); color: var(--rose-ink); font-size: 1.15rem }
nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .15rem }
nav a { display: grid; justify-items: center; align-content: center; min-height: 44px; padding: .18rem .1rem; color: var(--muted); text-decoration: none; border-radius: .55rem; font-size: .72rem; white-space: nowrap }
nav a span:first-child { font-size: 1rem; line-height: 1.1 }
nav a[aria-current], nav a:hover { background: var(--rose); color: var(--rose-ink) }
.local { display: none; color: var(--muted); font-size: .83rem }
.local i { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: #54846b; margin-inline-end: .3rem }
main { min-width: 0; padding: 1.15rem .9rem 3rem; max-width: 104rem; width: 100%; margin-inline: auto }
main:focus { outline: none }
h1, h2 { font-family: system-ui, sans-serif; line-height: 1.14; letter-spacing: -.025em }
h1 { margin: 0; font-size: clamp(2.15rem, 5vw, 3.65rem); overflow-wrap: anywhere }
h2 { margin: 0 0 .85rem; font-size: 1.35rem }
p { margin: .55rem 0 0 }
.page-header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .85rem 1rem; margin-bottom: 1.3rem }
.page-header p { color: var(--muted) }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem }
.overview, .dashboard-lists { display: grid; gap: .9rem; margin-bottom: .9rem }
.panel, .hero, .warning { background: var(--surface); border: 1px solid var(--line); border-radius: .9rem; padding: 1rem; min-width: 0; box-shadow: var(--shadow) }
.panel + .panel { margin-top: .9rem }
.overview .panel, .dashboard-lists .panel { margin-top: 0 }
.hero { position: relative; display: flex; align-items: center; min-height: 11rem; overflow: hidden; background: var(--sage); color: var(--sage-ink) }
.hero h2 { font-size: clamp(1.45rem, 3.6vw, 2.45rem) }
.hero-content { width: min(100%, 29rem); position: relative; z-index: 1 }
.hero a { display: inline-block; margin-top: .7rem; color: inherit; font-weight: 650 }
.notebook { display: none }
.tint { background: var(--blush) }
.section-title { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .25rem .55rem }
.section-title a { font-size: .88rem }
.progress-label { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-size: .93rem; overflow-wrap: anywhere }
.progress-label strong { white-space: nowrap; font-size: .88rem }
progress { display: block; appearance: none; width: 100%; height: .55rem; margin: .45rem 0 .6rem; border: 0; border-radius: 1rem; overflow: hidden; background: var(--line); color: var(--subject, #54846b) }
progress::-webkit-progress-bar { background: var(--line) }
progress::-webkit-progress-value { background: var(--subject, #54846b); border-radius: inherit }
progress::-moz-progress-bar { background: var(--subject, #54846b); border-radius: inherit }
.subject + .subject { border-top: 1px solid var(--line) }
summary { cursor: pointer; min-height: 44px; padding-block: .55rem; font-weight: 650 }
.subject summary .progress-label { display: inline-flex; width: calc(100% - 1.6rem) }
.chapters { padding: .1rem 0 .35rem 1rem }
.chapters .progress-label { margin-bottom: .4rem }
.empty, .meta { color: var(--muted) }
.empty { padding-block: .55rem }
.rows { list-style: none; padding: 0; margin: 0 }
.rows li { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: .65rem 0; border-bottom: 1px solid var(--line) }
.rows li:last-child { border-bottom: none }
.row-copy { flex: 1 1 8rem; min-width: 0; overflow-wrap: anywhere }
.doc-row .row-copy > a { font-weight: 675 }
.meta { font-size: .82rem }
.doc-icon, .exercise-mark { display: grid; place-items: center; width: 2rem; height: 2rem; flex: 0 0 auto; border-radius: .5rem; background: var(--blush) }
.doc-icon[data-kind="note"] { background: var(--rose) }
.exercise-mark { width: 1.15rem; height: 1.15rem; background: none; border: 1px solid var(--muted); border-radius: .27rem; font-size: .78rem }
.exercise-mark.done { background: var(--sage); color: var(--sage-ink) }
.exercise-row button { margin-left: auto }
.warning { margin-bottom: .9rem; background: var(--rose); color: var(--rose-ink); overflow-wrap: anywhere }
.warning ul { padding-inline-start: 1.3rem }
.undo { margin-top: .75rem; background: var(--sage); color: var(--sage-ink); border-radius: .6rem; padding: .65rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center }
.filters { display: flex; flex-wrap: wrap; gap: .65rem; margin-bottom: .8rem }
.filters label { flex: 1 1 10rem }
.filters label:has(input[type="search"]) { flex-grow: 3 }
label { display: grid; gap: .25rem; font-weight: 620; min-width: 0; overflow-wrap: anywhere }
.back { display: inline-flex; align-items: center; min-height: 44px }
.workspace .page-header h1 { font-size: clamp(1.8rem, 4vw, 2.8rem) }
.document-links { margin: -.35rem 0 1rem }
.document-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .65rem; background: var(--sage); color: var(--sage-ink); border-radius: .45rem; overflow-wrap: anywhere }
.editor { min-width: 0; border: 1px solid var(--line); border-radius: .78rem; background: var(--surface); box-shadow: var(--shadow) }
.edit-tools { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .7rem; padding: .55rem; background: var(--surface); border-radius: .78rem .78rem 0 0; border-bottom: 1px solid var(--line) }
.format-tools, .ribbon-group { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem }
.format-tools { gap: .45rem .7rem }
.ribbon-group button { padding: .35rem .55rem; min-width: 44px; font-size: .86rem; font-weight: 630 }
.appearance-tools select { width: auto; font-size: .86rem }
.text-color summary { display: flex; align-items: center; gap: .4rem; padding: .35rem .55rem; border: 1px solid var(--line); border-radius: .55rem; font-size: .86rem; list-style: none }
.text-color summary::-webkit-details-marker { display: none }
.text-color summary::after { content: ''; width: .32rem; height: .32rem; margin-inline-start: .2rem; border: solid currentColor; border-width: 0 1px 1px 0; transform: translateY(-2px) rotate(45deg) }
.text-color summary:hover, .text-color[open] summary { border-color: var(--accent) }
.color-sample { width: .85rem; height: .85rem; border-radius: .2rem; background: var(--ink) }
.color-palette { position: absolute; z-index: 2; left: .55rem; margin-top: .35rem; width: min(18rem, 76vw); padding: .65rem; background: var(--surface); border: 1px solid var(--line); border-radius: .65rem; box-shadow: 0 8px 24px #39253220 }
.color-swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: .18rem }
.color-swatches button { display: grid; place-items: center; padding: .25rem; border-color: transparent }
.color-swatches button span { width: 1.55rem; height: 1.55rem; background: var(--swatch); border-radius: .35rem }
.custom-color { display: flex; flex-wrap: wrap; align-items: end; gap: .35rem; padding-top: .5rem; border-top: 1px solid var(--line); font-size: .82rem }
.custom-color label { flex: 1 1 8rem }
.custom-color input { font: 1rem ui-monospace, monospace }
.history-tools button, .text-tools button { font-size: 1rem }
.style-tools button { background: var(--blush); color: var(--rose-ink); border-color: transparent; white-space: nowrap }
.style-tools button:hover { border-color: var(--accent) }
.style-tools [data-value="h1"] { font-size: 1.04rem; font-weight: 780 }
.style-tools [data-value="h2"] { font-size: .98rem; font-weight: 720 }
.document-tools { margin-inline-start: auto; gap: .35rem }
.toc { position: relative; z-index: 1; font-size: .86rem }
.toc summary { padding-inline: .5rem; color: var(--accent) }
.toc ul { position: absolute; right: 0; top: 100%; margin: .25rem 0 0; padding: .35rem .75rem; width: min(15rem, 56vw); max-height: 50vh; overflow-y: auto; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: .55rem; box-shadow: 0 8px 24px #39253220 }
.toc li { margin-inline-start: calc(.5rem * var(--indent)); overflow-wrap: anywhere }
.toc a { display: inline-flex; align-items: center; min-height: 44px }
.editor-body { padding: .6rem; background: var(--desk) }
.edit-field { display: block; min-height: max(66vh, 27rem); max-width: 52rem; width: 100%; margin-inline: auto; padding: 1.25rem 1rem; border: 1px solid var(--line); border-radius: .15rem; background: #fff; box-shadow: 0 3px 8px #39253210; line-height: 1.6 }
.edit-field > :first-child { margin-top: 0 }
.edit-field[contenteditable]:focus, textarea.edit-field:focus { outline: 1px solid #bd7093; outline-offset: -1px }
textarea.edit-field { font-family: ui-monospace, monospace; resize: vertical }
.edit-field font[size="1"] { font-size: 8pt }
.edit-field font[size="2"] { font-size: 10pt }
.edit-field font[size="3"] { font-size: 12pt }
.edit-field font[size="4"] { font-size: 14pt }
.edit-field font[size="5"] { font-size: 18pt }
.edit-field font[size="6"] { font-size: 24pt }
.edit-field font[size="7"] { font-size: 36pt }
.save-line { padding: .5rem .85rem; border-top: 1px solid var(--line); color: var(--sage-ink); background: var(--sage); border-radius: 0 0 .78rem .78rem; font-size: .82rem }
.markdown { overflow-wrap: anywhere }
.markdown h1 { font-size: 1.9rem }
.markdown h2 { font-size: 1.5rem }
.markdown :is(h1,h2,h3,h4,h5,h6) { margin: 1.05em 0 .4em; scroll-margin-top: 1rem }
.markdown p { margin: .55em 0 }
.markdown table { display: block; width: fit-content; max-width: 100%; overflow: auto; border-collapse: collapse }
.markdown th, .markdown td { padding: .35rem .55rem; border: 1px solid var(--line) }
.markdown pre { overflow: auto; padding: .75rem; background: var(--paper); border-radius: .4rem }
.markdown code { font: .9em ui-monospace, monospace }
.markdown blockquote { margin-inline: 0; padding-inline-start: 1rem; border-inline-start: 3px solid var(--line); color: var(--muted) }
.markdown img { max-width: 100%; height: auto }
.course-exercises { margin: 1rem auto 0; max-width: 52rem }
dialog { width: min(36rem, calc(100% - 1.25rem)); max-height: 90dvh; padding: 1.25rem; border: 1px solid var(--line); border-radius: .9rem; color: var(--ink); background: var(--surface) }
dialog::backdrop { background: #281a1877 }
dialog label, dialog fieldset { margin-block: .65rem }
dialog fieldset { min-width: 0; border: 1px solid var(--line); border-radius: .55rem }
dialog legend { max-width: 100%; overflow-wrap: anywhere }
.dialog-actions { justify-content: end; margin-top: 1rem }
.import-review { max-height: 54dvh; overflow-y: auto; padding-inline: .2rem }
.transfer .actions { margin-top: 1rem }
#notice { position: fixed; z-index: 3; right: .8rem; bottom: .8rem; pointer-events: none; max-width: min(27rem, calc(100% - 1.6rem)); color: var(--ink); background: var(--surface); border-radius: .65rem; box-shadow: var(--shadow); overflow-wrap: anywhere }
#notice.visible { padding: .75rem 1rem; border: 1px solid var(--line) }
#notice:not(.visible) { clip-path: inset(50%); width: 1px; height: 1px }
@media (min-width: 650px) {
  main { padding: 1.75rem 1.5rem 3rem }
  .text-color { position: relative; z-index: 2 }
  .color-palette { left: 0 }
  .sidebar { padding-inline: 1.5rem }
  nav { max-width: 37rem }
  nav a { font-size: .9rem; display: flex; justify-content: center; gap: .45rem }
  .overview { grid-template-columns: 1.5fr 1fr }
  .dashboard-lists { grid-template-columns: 1fr 1fr }
  .panel, .hero { padding: 1.25rem }
}
@media (min-width: 880px) {
  .shell { display: grid; grid-template-columns: 12.25rem minmax(0, 1fr); min-height: 100dvh }
  .sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 1.5rem .8rem; border-bottom: 0; border-right: 1px solid var(--line) }
  .brand { margin: 0 .4rem 1.5rem }
  nav { display: grid; grid-template-columns: 1fr; gap: .35rem }
  nav a { justify-content: start; padding: .55rem .65rem }
  nav a span:first-child { width: 1.25rem; text-align: center }
  .local { display: block; margin: auto .65rem 0 }
  main { padding: 2rem clamp(1.35rem, 3vw, 3.5rem) 2rem }
  .editor-body { padding: 1.6rem }
  .edit-field { padding: clamp(2.4rem, 5vw, 4.5rem) }
}
@media (min-width: 1160px) {
  .hero { min-height: 13rem; padding-inline: 1.65rem }
  .hero-content { max-width: 67% }
  .notebook { display: block; position: absolute; width: 6rem; height: 7.3rem; right: 2.1rem; top: 1.9rem; transform: rotate(12deg); border: 1px solid #c492a7; border-left: .55rem solid #a95675; border-radius: .25rem .5rem .5rem .25rem; background: #f9dbe7; box-shadow: .2rem .25rem #aac8b2, .4rem .55rem #c9dfce }
  .notebook div { position: absolute; inset: .85rem .65rem; border: 1px solid #c492a7; border-radius: .2rem; background: repeating-linear-gradient(#fff5f9 0 .65rem, #e8c1d1 .68rem .72rem) }
}
