:root {
  color-scheme: light;
  --ink:#15213b; --muted:#546078; --green:#11734d; --deep:#095a3c; --mint:#e0f3e8;
  --paper:#f6f7f3; --white:#fff; --line:#d9e1db; --lilac:#e8e7fb; --blue:#173ea8;
  --yellow:#ffdb75; --cream:#fff1c6; --error:#a31c32;
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
  line-height:1.5; color:var(--ink); background:var(--paper);
}
*, *::before, *::after { box-sizing:border-box; }
body { margin:0; min-height:100vh; }
button, input, select, textarea { font:inherit; }
button, summary, a { -webkit-tap-highlight-color:transparent; }
button { cursor:pointer; }
button:disabled { cursor:wait; opacity:.65; }
:focus-visible { outline:3px solid #275cd2; outline-offset:3px; }
[hidden] { display:none !important; }
a { color:var(--green); text-underline-offset:3px; }
h1,h2,h3,p { margin:0; }
h1 { font-size:clamp(1.9rem, 4vw, 3.15rem); line-height:1.1; letter-spacing:-.05em; }
h2 { font-size:1.34rem; letter-spacing:-.025em; line-height:1.2; }
h3 { font-size:1rem; line-height:1.35; }
.muted { color:var(--muted); }
.icon { width:1.15em; height:1.15em; vertical-align:middle; flex:none; }
.top {
  height:auto; min-height:4.5rem; padding:.75rem clamp(1rem, 3vw, 2.65rem);
  display:flex; align-items:center; justify-content:space-between; gap:.75rem;
  background:var(--white); border-bottom:1px solid var(--line);
}
.brand { color:var(--ink); display:inline-flex; gap:.58rem; align-items:center; font-size:1.24rem; font-weight:850; letter-spacing:-.04em; text-decoration:none; white-space:nowrap; }
.brand img { width:2.4rem; height:2.4rem; }
.actions { display:flex; align-items:center; flex-wrap:wrap; gap:.55rem; }
.btn {
  appearance:none; border:1px solid transparent; border-radius:.72rem; padding:.63rem .95rem; min-height:2.65rem;
  font-weight:750; background:var(--green); color:white; text-decoration:none;
  display:inline-flex; align-items:center; justify-content:center; gap:.45rem; line-height:1.25; text-align:center;
}
.btn:hover { background:var(--deep); }
.btn.outline { background:var(--white); color:var(--green); border-color:#9dbfaf; }
.btn.outline:hover { background:var(--mint); }
.btn.soft { background:var(--mint); color:var(--deep); }
.btn.soft:hover { background:#ccead9; }
.btn.plain { background:transparent; color:var(--muted); }
.btn.plain:hover { background:#edf1ee; color:var(--ink); }
.btn.small { padding:.45rem .65rem; font-size:.87rem; }
.btn.icon-only { padding:.5rem; min-width:2.55rem; }
.btn.danger { background:#fff0f0; color:var(--error); }
.btn.danger:hover { background:#ffdddd; }
.inline { border:0; background:none; color:var(--green); text-decoration:underline; text-underline-offset:.22em; padding:.35rem .1rem; font-weight:750; }
.panel { background:white; border:1px solid var(--line); border-radius:1.12rem; }
.access-wrap {
  display:grid; place-items:center; min-height:calc(100svh - 4.5rem); padding:1.35rem 1rem 2rem;
}
.access { width:min(100%, 31rem); padding:clamp(1.25rem, 4vw, 2.3rem); text-align:center; box-shadow:0 18px 52px #2133230b; }
.access-art { width:7.6rem; height:5.8rem; margin:0 auto .55rem; display:block; }
.access h1 { font-size:clamp(2rem, 6vw, 2.75rem); }
.access .intro { margin:.9rem 0 1rem; }
.tabs { display:grid; grid-template-columns:1fr 1fr; background:#efeff7; border-radius:.75rem; padding:.25rem; gap:.25rem; margin-top:1.25rem; }
.tab { border:0; background:transparent; color:var(--ink); font-weight:750; border-radius:.55rem; min-height:2.55rem; padding:.45rem .5rem; }
.tab[aria-pressed=true] { background:var(--green); color:white; }
.access .inline { margin-top:.85rem; font-size:.91rem; }
form { display:grid; gap:.8rem; text-align:left; }
label, legend { font-weight:750; font-size:.93rem; }
label { display:grid; gap:.25rem; }
input:not([type=radio]), select, textarea {
  width:100%; min-width:0; padding:.59rem .7rem; border:1px solid #bfcac5; border-radius:.58rem; min-height:2.7rem;
  background:white; color:var(--ink); font-weight:500;
}
input.code { text-transform:uppercase; font-size:1.2rem; letter-spacing:.12em; }
textarea { min-height:8rem; resize:vertical; }
.form-error { color:var(--error); font-size:.9rem; min-height:0; }
.form-error:empty { display:none; }
.shell { min-height:calc(100svh - 4.5rem); display:grid; grid-template-columns:13rem minmax(0,1fr); }
.rail { display:flex; flex-direction:column; gap:.55rem; background:white; border-right:1px solid var(--line); padding:1.15rem; }
.rail .btn { justify-content:flex-start; }
.main { padding:clamp(1.15rem, 3vw, 2.5rem); width:min(100%, 91rem); margin:0 auto; }
.page-head { display:flex; justify-content:space-between; align-items:flex-end; gap:1rem; flex-wrap:wrap; margin-bottom:1.5rem; }
.page-head p, .section-intro { margin-top:.42rem; }
.kicker { display:block; text-transform:uppercase; color:var(--green); font-weight:850; letter-spacing:.11em; font-size:.71rem; margin:0 0 .45rem; }
.class-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap:1rem; max-width:75rem; }
.class-tile { text-align:left; color:var(--ink); padding:1rem; display:flex; align-items:center; gap:.9rem; min-height:7rem; }
.class-tile:hover { border-color:#91ba9f; background:#fefffe; box-shadow:0 4px 14px #264c3510; }
.tile-icon { display:grid; flex:none; place-items:center; width:3.7rem; height:3.7rem; background:var(--lilac); color:var(--blue); border-radius:.95rem; font-size:1.75rem; }
.class-tile:nth-child(3n+2) .tile-icon { background:var(--cream); color:#624903; }
.class-tile:nth-child(3n+3) .tile-icon { background:var(--mint); color:var(--deep); }
.tile-body { display:grid; gap:.23rem; min-width:0; flex:1; }
.tile-body strong { font-size:1.1rem; overflow-wrap:anywhere; }
.tile-body small { color:var(--muted); }
.empty { padding:2rem 1.4rem; text-align:center; display:grid; place-items:center; gap:.7rem; }
.empty .tile-icon { margin-bottom:.15rem; }
.workspace { padding-top:1.2rem; }
.crumbs { display:flex; align-items:center; gap:.55rem; flex-wrap:wrap; margin-bottom:.75rem; font-size:.9rem; }
.crumbs strong { overflow-wrap:anywhere; }
.class-bar { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.6rem; margin-bottom:1rem; }
.badge { display:inline-flex; align-items:center; gap:.3rem; background:var(--lilac); color:#30306c; border-radius:.48rem; font-size:.79rem; padding:.24rem .58rem; font-weight:800; }
.badge.gold { background:var(--cream); color:#614703; }
.badge.green { background:var(--mint); color:var(--deep); }
.code-card { border:1px dashed #86b29b; background:#eef8ef; border-radius:.7rem; padding:.4rem .6rem .4rem .7rem; display:flex; align-items:center; flex-wrap:wrap; gap:.55rem; }
.code-card code { font-size:1.05rem; font-weight:850; letter-spacing:.09em; color:var(--deep); }
.editor-grid { display:grid; grid-template-columns:minmax(14.8rem, 28%) minmax(0,1fr); align-items:start; gap:.85rem; }
.units,.editor { padding:clamp(.8rem, 2vw, 1.3rem); min-width:0; }
.panel-head { display:flex; align-items:center; justify-content:space-between; gap:.6rem; flex-wrap:wrap; margin-bottom:.8rem; }
.unit { margin:.48rem 0; border:1px solid var(--line); border-radius:.65rem; overflow:hidden; }
.unit summary { font-weight:750; background:#f5f4fd; padding:.62rem .7rem; cursor:pointer; overflow-wrap:anywhere; }
.unit-inner { padding:.38rem; display:grid; gap:.2rem; }
.lesson-btn { text-align:left; justify-content:flex-start; width:100%; overflow-wrap:anywhere; }
.lesson-btn[aria-current=true] { color:var(--deep); background:var(--mint); }
.unit-actions { border-top:1px solid #eff1ee; margin-top:.3rem; padding-top:.25rem; }
.editor-top { display:flex; gap:.65rem; flex-wrap:wrap; align-items:flex-start; margin-bottom:1rem; }
.editor-top label { flex:1 1 16rem; }
.editor-top input { font-weight:800; font-size:clamp(1.15rem, 2vw, 1.65rem); letter-spacing:-.025em; }
.block-list { list-style:none; margin:0; padding:0; display:grid; gap:.55rem; }
.block { display:flex; flex-wrap:wrap; align-items:center; gap:.55rem; border:1px solid var(--line); padding:.7rem; border-radius:.72rem; }
.block-index { background:#f1f3f1; padding:.1rem .45rem; border-radius:.35rem; font-weight:850; color:var(--muted); }
.block-description { min-width:8rem; flex:1; overflow-wrap:anywhere; }
.block-description p { margin-top:.22rem; }
.insertions { margin-top:.85rem; }
.editor-save { border-top:1px solid var(--line); margin-top:1.05rem; padding-top:.85rem; justify-content:flex-end; }
.lesson-page { max-width:74rem; }
.lesson-page h1 { margin:.55rem 0 1.1rem; overflow-wrap:anywhere; }
.study-grid { display:grid; grid-template-columns:minmax(0, 1.14fr) minmax(0, .86fr); align-items:start; gap:1rem; }
.study-grid.single { grid-template-columns:minmax(0, 1fr); }
.study-section { overflow:hidden; }
.study-section > h2 { display:flex; align-items:center; gap:.6rem; padding:.9rem 1.1rem; background:var(--lilac); }
.study-section.practice > h2 { background:var(--yellow); }
.study-content { display:grid; gap:1rem; padding:1rem 1.1rem; }
.study-content .reading { font-size:1.08rem; white-space:pre-wrap; overflow-wrap:anywhere; }
.study-content figure { margin:0; display:grid; gap:.45rem; }
.study-content img, .study-content video, .study-content iframe { display:block; width:100%; border:0; border-radius:.6rem; max-height:28rem; }
.study-content iframe { aspect-ratio:16 / 9; background:#eef2ec; }
.study-content img { object-fit:contain; }
.study-content audio { width:100%; }
.study-content figcaption { font-weight:750; font-size:.92rem; }
.quiz + .quiz { border-top:1px solid var(--line); padding-top:1rem; }
.quiz h3 { font-size:1.14rem; overflow-wrap:anywhere; }
.options { display:flex; flex-wrap:wrap; gap:.5rem; margin:.7rem 0; }
.options label { position:relative; flex:1 1 5rem; }
.options input { position:absolute; inset:.6rem auto auto .55rem; }
.options span { display:flex; align-items:center; justify-content:center; border:1px solid #bfcac5; min-height:2.75rem; padding:.55rem .55rem .55rem 1.7rem; border-radius:.58rem; overflow-wrap:anywhere; cursor:pointer; }
.options input:checked + span { background:var(--mint); border-color:var(--green); color:var(--deep); }
.quiz .feedback { margin-top:.45rem; color:var(--deep); min-height:1.5rem; font-weight:700; }
.lesson-nav { justify-content:flex-end; margin-top:1rem; }
.student-unit { padding:1rem; margin-bottom:.75rem; }
.student-unit h2 { margin-bottom:.55rem; }
dialog { border:1px solid var(--line); border-radius:1.1rem; padding:1.2rem; color:var(--ink); width:min(calc(100% - 1.5rem), 33rem); max-height:calc(100svh - 1.5rem); box-shadow:0 18px 52px #13253b35; }
dialog.drawer { margin:auto 0 auto auto; height:100%; max-height:100%; border-radius:1.1rem 0 0 1.1rem; padding:1.45rem; }
dialog::backdrop { background:#17273655; }
dialog .actions { justify-content:flex-end; margin-top:.35rem; }
dialog p + .actions { margin-top:.8rem; }
dialog .panel-head { margin-bottom:1rem; }
.invite-result { margin-top:1rem; }
.notice { position:fixed; z-index:3; right:1rem; bottom:1rem; max-width:min(30rem,calc(100% - 2rem)); background:var(--deep); color:white; padding:.7rem 1rem; border-radius:.65rem; box-shadow:0 5px 20px #162a2240; font-weight:700; }
.notice.problem { background:#89243a; }
@media (max-width:790px) {
  .shell { grid-template-columns:1fr; }
  .rail { flex-direction:row; flex-wrap:wrap; border-right:0; border-bottom:1px solid var(--line); padding:.55rem 1rem; }
}
@media (max-width:660px) {
  .editor-grid,.study-grid { grid-template-columns:1fr; }
  .top { flex-wrap:wrap; }
  .top .actions { gap:.2rem; }
  .top .btn { padding:.45rem; font-size:.8rem; }
  .lesson-page .actions .btn { flex:1; }
  .access-wrap { place-items:start center; }
}
.activity-fields fieldset { display:grid; gap:.65rem; margin:0; padding:0; border:0; min-width:0; }
.student-unit .lesson-btn + .lesson-btn { margin-top:.35rem; }

dialog.rich-dialog { width:min(calc(100% - 1.5rem), 43rem); }
.rich-field { display:grid; gap:.48rem; }
#rich-label { font-weight:750; font-size:.93rem; }
.rich-toolbar { display:flex; flex-wrap:wrap; align-items:end; gap:.5rem .8rem; padding:.58rem; background:#f1f5f2; border:1px solid var(--line); border-radius:.7rem; }
.rich-style { display:flex; align-items:center; gap:.45rem; }
.rich-style select { min-width:8.3rem; min-height:2.65rem; padding:.4rem .48rem; }
.rich-tools { display:flex; gap:.15rem; }
.rich-button { display:grid; place-items:center; width:2.65rem; height:2.65rem; padding:0; border:1px solid transparent; border-radius:.55rem; background:transparent; color:var(--ink); line-height:1; }
.rich-button:hover { background:#fff; }
.rich-button[aria-pressed=true] { border-color:#84b99c; background:var(--mint); color:var(--deep); }
.rich-button .icon { width:1.18rem; height:1.18rem; }
.mark-bold { font-weight:850; }
.mark-italic { font-style:italic; }
.mark-underline { text-decoration:underline; }
.rich-input { min-height:12rem; max-height:min(46dvh, 28rem); overflow:auto; padding:.76rem; border:1px solid #bfcac5; border-radius:.62rem; background:white; overflow-wrap:anywhere; white-space:pre-wrap; }
#rich-help { font-size:.84rem; }
.rich-content .rich-line + .rich-line,
.rich-input .rich-line + .rich-line { margin-top:.28em; }
.rich-line { min-height:1.4em; }
.rich-heading { font-size:1.62rem; line-height:1.22; font-weight:850; }
.rich-subheading { font-size:1.25rem; line-height:1.3; font-weight:750; }
.rich-footnote { font-size:.86rem; color:var(--muted); }
.align-left { text-align:left; }
.align-center { text-align:center; }
.align-right { text-align:right; }
.align-justify { text-align:justify; }
@media (max-width:460px) {
  .rich-toolbar { gap:.35rem .45rem; }
  .rich-style { flex-basis:100%; }
  .rich-style select { width:auto; }
  .rich-input { min-height:8rem; }
}
