:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece4;
  --text: #1d2321;
  --muted: #66706c;
  --line: #e0dcd2;
  --accent: #1f6f5c;
  --accent-ink: #ffffff;
  --accent-soft: #dcefe8;
  --done: #2e8a5f;
  --warn: #a8461d;
  --warn-soft: #fbe7dc;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 16px rgb(0 0 0 / .05);
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121615;
    --surface: #1a1f1e;
    --surface-2: #232a28;
    --text: #e7ebe9;
    --muted: #97a29e;
    --line: #2c3532;
    --accent: #5cc3a3;
    --accent-ink: #0d1a16;
    --accent-soft: #1d3a32;
    --done: #63c492;
    --warn: #f0936a;
    --warn-soft: #3b2219;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: inherit; }
img { max-width: 100%; display: block; }
code { font-size: .88em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; word-break: break-all; }
h1 { font-size: 1.7rem; line-height: 1.2; margin: 0 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.i { width: 1.1em; height: 1.1em; flex: none; vertical-align: -.18em; }

/* topo */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .65rem clamp(16px, 4vw, 40px); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.top nav { display: flex; align-items: center; gap: 1.1rem; font-size: .93rem; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a[aria-current] , .top nav a:hover { color: var(--text); }
.who { color: var(--muted); max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top form { margin: 0; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 1.6rem clamp(16px, 4vw, 40px) 4rem; }
.section { margin-bottom: 2.4rem; }
.sechead { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.eyebrow { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .8rem; }
.empty { padding: 3rem 1rem; text-align: center; }

/* botões */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: .4rem .7rem; font-size: .85rem; }
.btn.is-done { border-color: var(--done); color: var(--done); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.top .linkbtn { color: var(--muted); text-decoration: none; }
.linkbtn.danger { color: var(--warn); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* barras de progresso */
.bar { display: block; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar.big { height: 8px; margin: .8rem 0 .3rem; max-width: 420px; }
.fill { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

/* continuar */
.continue { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.cont { display: flex; gap: .8rem; padding: .85rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; box-shadow: var(--shadow); }
.cont:hover { border-color: var(--accent); }
.cont-play { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); flex: none; }
.cont-body { display: grid; gap: .2rem; min-width: 0; flex: 1; }
.cont-course { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cont-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cont-time { font-size: .78rem; color: var(--muted); }

/* grade de cursos */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.1rem; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; text-decoration: none; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.cover { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; color: #fff; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-title { padding: 1rem; font-weight: 700; font-size: 1.15rem; line-height: 1.25; text-align: center; text-shadow: 0 1px 8px rgb(0 0 0 / .25);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-body { display: grid; gap: .45rem; padding: .9rem 1rem 1rem; }
.card-title { font-weight: 650; line-height: 1.3; }
.meta { display: flex; flex-wrap: wrap; gap: .3rem .8rem; color: var(--muted); font-size: .82rem; }
.meta span { display: inline-flex; align-items: center; gap: .3rem; }
.tag { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .72rem; font-weight: 600; background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.cover .tag { position: absolute; top: .6rem; right: .6rem; }
.tag.private { background: var(--warn-soft); color: var(--warn); }
.tag.shared { background: var(--accent-soft); color: var(--accent); }

.hue0 { background: linear-gradient(135deg, #1f6f5c, #3f9b7f); } .hue1 { background: linear-gradient(135deg, #2b4c7e, #5578b0); }
.hue2 { background: linear-gradient(135deg, #7a3e62, #b06690); } .hue3 { background: linear-gradient(135deg, #8a5a17, #c58a3a); }
.hue4 { background: linear-gradient(135deg, #3d5a2a, #6c8f4d); } .hue5 { background: linear-gradient(135deg, #5b3b8c, #8b68c2); }
.hue6 { background: linear-gradient(135deg, #1d6b80, #3d9ab3); } .hue7 { background: linear-gradient(135deg, #9a3b2e, #cf6a52); }
.hue8 { background: linear-gradient(135deg, #2f4f4f, #5a7d7c); } .hue9 { background: linear-gradient(135deg, #6b5d1e, #a59145); }
.hue10 { background: linear-gradient(135deg, #3a3f8f, #6a70c9); } .hue11 { background: linear-gradient(135deg, #7d2f45, #b65c76); }

/* página do curso */
.back, .crumbs a { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); text-decoration: none; font-size: .9rem; }
.back:hover, .crumbs a:hover { color: var(--text); }
.hero { display: grid; grid-template-columns: minmax(0, 340px) 1fr; gap: 1.8rem; align-items: center; margin: 1rem 0 2rem; }
.hero-cover { border-radius: var(--radius); box-shadow: var(--shadow); }
.hero .btn { margin-top: .6rem; max-width: 100%; }
.hero .btn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-flex; }
@media (max-width: 700px) { .hero { grid-template-columns: 1fr; gap: 1rem; } }

.modules { display: grid; gap: .8rem; }
.module { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.module summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1.1rem; cursor: pointer; font-weight: 650; list-style: none; }
.module summary::-webkit-details-marker { display: none; }
.module summary::before { content: ""; width: .5rem; height: .5rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; flex: none; }
.module[open] summary::before { transform: rotate(45deg); }
.mod-title { flex: 1; }
.lessons { list-style: none; margin: 0; padding: 0 .5rem .5rem; }
.lesson { display: flex; align-items: center; gap: .75rem; padding: .55rem .6rem; border-radius: 8px; text-decoration: none; }
.lesson:hover { background: var(--surface-2); }
.state { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--muted); flex: none; }
.state .i { width: 14px; height: 14px; }
.done .state { background: var(--done); color: #fff; }
.ltitle { flex: 1; min-width: 0; }
.lkind { font-size: .78rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 560px) { .lkind { display: none; } }

/* página da aula */
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: calc(100vh - 56px); }
.viewer { padding: 1rem clamp(16px, 3vw, 32px) 3rem; min-width: 0; }
.crumbs { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: .8rem; font-size: .9rem; }
.stage { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; }
.stage video { display: block; width: 100%; max-height: calc(100vh - 200px); aspect-ratio: 16 / 9; background: #000; }
.stage-pdf, .stage-audio, .stage-epub, .stage-file { background: var(--surface); border: 1px solid var(--line); }
.pdf { display: block; width: 100%; height: calc(100vh - 190px); min-height: 480px; border: 0; }
.audio-card, .filecard { display: grid; justify-items: center; gap: .6rem; padding: 3rem 1.5rem; text-align: center; }
.audio-card > .i, .filecard > .i { width: 48px; height: 48px; color: var(--accent); }
.audio-card audio { width: min(560px, 100%); }
.filecard p { margin: 0; }
.overlay { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: .2rem; padding: 1rem;
  background: rgb(0 0 0 / .78); color: #fff; }
.overlay[hidden] { display: none; }
.overlay .muted { color: #c9d1ce; margin: 0; }
.next-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 1rem; }
.overlay .btn:not(.primary) { background: transparent; color: #fff; border-color: rgb(255 255 255 / .4); }

.speed { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.chip { padding: .25rem .6rem; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: .85rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.kbd-hint { margin-left: auto; }
@media (max-width: 700px), (pointer: coarse) { .kbd-hint { display: none; } }

.lesson-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin: 1.2rem 0 1rem; }
.lesson-head h1 { font-size: 1.4rem; flex: 1 1 320px; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.prevnext .btn { justify-content: flex-start; font-weight: 500; min-width: 0; }
.prevnext .btn span { display: grid; min-width: 0; text-align: left; }
.prevnext .btn span, .prevnext .btn small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prevnext small { color: var(--muted); font-size: .75rem; }
.prevnext .right { justify-content: flex-end; }
.prevnext .right span { text-align: right; }

.outline { border-left: 1px solid var(--line); background: var(--surface); }
.outline-toggle { position: sticky; top: 56px; max-height: calc(100vh - 56px); overflow: auto; }
.outline-toggle > summary { display: flex; align-items: center; gap: .5rem; padding: 1rem 1.1rem .6rem; font-weight: 700; list-style: none; cursor: default; pointer-events: none; }
.outline-toggle > summary::-webkit-details-marker { display: none; }
.omod { padding: 0 .5rem .6rem; }
.omod h3 { margin: .6rem .6rem .3rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.omod ol { list-style: none; margin: 0; padding: 0; }
.oitem { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border-radius: 8px; text-decoration: none; font-size: .9rem; line-height: 1.3; }
.oitem:hover { background: var(--surface-2); }
.oitem[aria-current] { background: var(--accent-soft); font-weight: 600; }
.oitem .state { width: 24px; height: 24px; }

@media (max-width: 960px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .outline { border-left: 0; border-top: 1px solid var(--line); }
  .outline-toggle { position: static; max-height: none; }
  .outline-toggle > summary { pointer-events: auto; cursor: pointer; }
  .stage video { max-height: none; }
  .pdf { height: 75vh; }
}

/* login / convite */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.authbox { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 2rem; box-shadow: var(--shadow); }
.authbrand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.3rem; margin-bottom: 1.4rem; }
.stack { display: grid; gap: .9rem; margin-top: 1rem; }
label { display: grid; gap: .3rem; font-size: .9rem; font-weight: 600; }
label small { font-weight: 400; color: var(--muted); }
input:not([type=checkbox]) { width: 100%; padding: .65rem .75rem; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.alert { background: var(--warn-soft); color: var(--warn); padding: .6rem .8rem; border-radius: 9px; font-size: .9rem; }

/* admin */
.admin h1 { margin-bottom: 1.4rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1.4rem; overflow-x: auto; }
.inline { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.inline form { margin: 0; }
.inline input[name=nota] { width: auto; flex: 1 1 220px; }
label.check { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; }
table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; }
td form { margin: 0; }
tr.gone { opacity: .55; }
.newinvite { background: var(--accent-soft); border-radius: 10px; padding: .9rem 1rem; margin-bottom: 1rem; }
.newinvite p { margin: 0 0 .5rem; }
.copyrow { display: flex; gap: .5rem; }
.copyrow input { font-family: ui-monospace, monospace; font-size: .85rem; }

/* larguras das barras (CSP não permite style inline) */
.w0{width:0%}.w1{width:1%}.w2{width:2%}.w3{width:3%}.w4{width:4%}.w5{width:5%}.w6{width:6%}.w7{width:7%}.w8{width:8%}.w9{width:9%}
.w10{width:10%}.w11{width:11%}.w12{width:12%}.w13{width:13%}.w14{width:14%}.w15{width:15%}.w16{width:16%}.w17{width:17%}.w18{width:18%}.w19{width:19%}
.w20{width:20%}.w21{width:21%}.w22{width:22%}.w23{width:23%}.w24{width:24%}.w25{width:25%}.w26{width:26%}.w27{width:27%}.w28{width:28%}.w29{width:29%}
.w30{width:30%}.w31{width:31%}.w32{width:32%}.w33{width:33%}.w34{width:34%}.w35{width:35%}.w36{width:36%}.w37{width:37%}.w38{width:38%}.w39{width:39%}
.w40{width:40%}.w41{width:41%}.w42{width:42%}.w43{width:43%}.w44{width:44%}.w45{width:45%}.w46{width:46%}.w47{width:47%}.w48{width:48%}.w49{width:49%}
.w50{width:50%}.w51{width:51%}.w52{width:52%}.w53{width:53%}.w54{width:54%}.w55{width:55%}.w56{width:56%}.w57{width:57%}.w58{width:58%}.w59{width:59%}
.w60{width:60%}.w61{width:61%}.w62{width:62%}.w63{width:63%}.w64{width:64%}.w65{width:65%}.w66{width:66%}.w67{width:67%}.w68{width:68%}.w69{width:69%}
.w70{width:70%}.w71{width:71%}.w72{width:72%}.w73{width:73%}.w74{width:74%}.w75{width:75%}.w76{width:76%}.w77{width:77%}.w78{width:78%}.w79{width:79%}
.w80{width:80%}.w81{width:81%}.w82{width:82%}.w83{width:83%}.w84{width:84%}.w85{width:85%}.w86{width:86%}.w87{width:87%}.w88{width:88%}.w89{width:89%}
.w90{width:90%}.w91{width:91%}.w92{width:92%}.w93{width:93%}.w94{width:94%}.w95{width:95%}.w96{width:96%}.w97{width:97%}.w98{width:98%}.w99{width:99%}
.w100{width:100%}
