:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --bg-soft: #0f1218;
  --panel: #12161e;
  --panel-raised: #171c25;
  --panel-hover: #1c2230;
  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.13);
  --text: #f5f6f8;
  --text-soft: #c1c7d0;
  --muted: #7f8896;
  --accent: #c8b6ff;
  --accent-strong: #a991f5;
  --accent-soft: rgba(200,182,255,.11);
  --green: #8ed6ac;
  --danger: #ff8f9c;
  --shadow: 0 24px 70px rgba(0,0,0,.38);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --topbar: 72px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; }
svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }

::selection { background: rgba(200,182,255,.28); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2b313d; border: 3px solid transparent; background-clip: padding-box; border-radius: 99px; }

.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}
.boot-mark, .brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(200,182,255,.32);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(200,182,255,.15), rgba(200,182,255,.04));
  color: #e8e0ff;
  font-weight: 800;
  letter-spacing: -.04em;
  box-shadow: inset 0 1px rgba(255,255,255,.08);
}
.boot-mark { width: 48px; height: 48px; border-radius: 15px; }
.brand-mark.large { width: 46px; height: 46px; border-radius: 14px; }

/* Login */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px 72px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -20%, rgba(200,182,255,.10), transparent 38%),
    linear-gradient(180deg, #0d1016 0%, #090b0f 100%);
}
.login-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .18;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, black, transparent 76%);
}
.login-orb { position: absolute; border-radius: 999px; filter: blur(1px); pointer-events: none; }
.orb-one { width: 420px; height: 420px; background: rgba(130,107,210,.09); left: -210px; top: 12%; }
.orb-two { width: 360px; height: 360px; background: rgba(108,151,191,.07); right: -180px; bottom: 6%; }
.login-card {
  width: min(560px, 100%);
  position: relative;
  z-index: 1;
  padding: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 28px;
  background: rgba(18,22,30,.82);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.04);
}
.login-brand-row { display: flex; gap: 14px; align-items: center; }
.eyebrow { display: block; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .16em; }
.login-brand-name { margin-top: 4px; font-size: 14px; font-weight: 650; }
.login-copy { padding: 54px 0 42px; }
.login-copy h1 { margin: 0; font-size: clamp(38px, 7vw, 58px); line-height: .98; letter-spacing: -.055em; font-weight: 720; }
.login-copy h1 span { color: var(--accent); }
.login-copy p { max-width: 440px; margin: 20px 0 0; color: var(--muted); line-height: 1.7; font-size: 14px; }
.login-form { display: grid; gap: 9px; }
.login-form > label { font-size: 11px; font-weight: 700; color: var(--text-soft); }
.password-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.login-button { display: inline-flex; align-items: center; gap: 8px; }
.login-footer { position: absolute; bottom: 24px; z-index: 1; color: #505865; font-size: 11px; }

input, textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: rgba(7,9,13,.68);
  color: var(--text);
  padding: 12px 13px;
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input::placeholder, textarea::placeholder { color: #5d6571; }
input:focus, textarea:focus { border-color: rgba(200,182,255,.48); box-shadow: 0 0 0 3px rgba(200,182,255,.08); background: #0b0e13; }
textarea { resize: vertical; min-height: 96px; line-height: 1.55; }

.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--panel-raised);
  color: var(--text-soft);
  border-radius: 11px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: background .15s, border-color .15s, color .15s, transform .12s;
}
.btn:hover { background: var(--panel-hover); border-color: rgba(255,255,255,.18); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: #eeeaff; color: #17131f; border-color: #eeeaff; }
.btn.primary:hover { background: white; border-color: white; color: #100d17; }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 10px; font-size: 11px; }

.status { min-height: 18px; font-size: 11px; color: var(--muted); line-height: 1.5; }
.status.ok { color: var(--green); }
.status.err { color: var(--danger); }

/* App shell */
.app-shell { min-height: 100vh; }
.topbar {
  height: var(--topbar);
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  background: rgba(11,13,18,.86);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}
.brand-group { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-copy { min-width: 0; display: grid; gap: 2px; }
.brand-copy strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-copy span { color: var(--muted); font-size: 10px; }
.tabs { display: flex; gap: 3px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.025); }
.tab-btn { border: 0; background: transparent; color: var(--muted); padding: 7px 13px; border-radius: 8px; cursor: pointer; font-size: 11px; font-weight: 700; }
.tab-btn.active { background: var(--panel-raised); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.22); }
.top-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.role-pill { padding: 6px 9px; border: 1px solid var(--border); border-radius: 99px; color: var(--muted); font-size: 10px; }
.icon-action, .mini-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-action { width: 34px; height: 34px; border-radius: 10px; }
.icon-action:hover, .mini-btn:hover:not(:disabled) { background: var(--panel-raised); border-color: var(--border-strong); color: var(--text); }
.mobile-only { display: none; }

/* Course */
.course-layout { min-height: calc(100vh - var(--topbar)); display: grid; grid-template-columns: minmax(0, 1fr) 410px; }
.stage { min-width: 0; max-width: 1380px; width: 100%; margin: 0 auto; padding: 28px clamp(18px, 3vw, 46px) 52px; }
.lesson-context { height: 28px; display: flex; align-items: start; }
.breadcrumb { display: flex; align-items: center; min-width: 0; gap: 8px; font-size: 10px; color: var(--muted); }
.breadcrumb i { font-style: normal; color: #3f4651; }
.breadcrumb strong { color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-card { border-radius: var(--radius-xl); padding: 8px; background: linear-gradient(145deg, rgba(255,255,255,.09), rgba(255,255,255,.025)); box-shadow: var(--shadow); }
.player-frame { width: 100%; aspect-ratio: 16/9; overflow: hidden; border-radius: 18px; background: #050608; display: grid; place-items: center; }
.player-frame iframe, .player-frame video { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.empty-player { display: grid; place-items: center; text-align: center; gap: 8px; color: var(--muted); }
.empty-player strong { margin-top: 5px; color: var(--text-soft); font-size: 14px; }
.empty-player span { font-size: 11px; }
.empty-player-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(200,182,255,.16); }
.empty-player-icon svg { width: 20px; height: 20px; }

.lesson-panel { padding-top: 28px; }
.lesson-heading { display: flex; gap: 28px; justify-content: space-between; align-items: flex-start; }
.lesson-heading h1 { margin: 8px 0 8px; font-size: clamp(25px, 3vw, 38px); line-height: 1.1; letter-spacing: -.035em; }
.lesson-heading p { margin: 0; max-width: 750px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.complete-btn { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); background: transparent; color: var(--text-soft); border-radius: 12px; padding: 9px 12px; cursor: pointer; font-size: 11px; font-weight: 700; }
.complete-btn span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; background: rgba(255,255,255,.05); }
.complete-btn.completed { color: var(--green); border-color: rgba(142,214,172,.22); background: rgba(142,214,172,.055); }
.lesson-navigation { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nav-lesson { min-width: 0; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.018); padding: 11px; color: var(--text-soft); cursor: pointer; text-align: left; }
.nav-lesson.next { justify-content: flex-end; text-align: right; }
.nav-lesson:hover:not(:disabled) { background: var(--panel); border-color: var(--border-strong); }
.nav-lesson:disabled { opacity: .35; cursor: default; }
.nav-lesson > span:not(.nav-icon) { min-width: 0; display: grid; gap: 3px; }
.nav-lesson small { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .1em; }
.nav-lesson strong { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.nav-icon { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: rgba(255,255,255,.04); }

.curriculum { position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); border-left: 1px solid var(--border); background: #0e1117; overflow: hidden; }
.curriculum-head { padding: 25px 21px 18px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, rgba(255,255,255,.02), transparent); }
.curriculum-title-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.curriculum-head h2 { margin: 5px 0 0; font-size: 17px; letter-spacing: -.02em; }
.progress-block { margin-top: 19px; }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; }
.progress-meta strong { color: var(--text-soft); }
.progress-track { height: 4px; margin-top: 8px; background: rgba(255,255,255,.055); border-radius: 99px; overflow: hidden; }
.progress-track span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-strong), var(--accent)); border-radius: inherit; transition: width .25s ease; }
.search-box { margin-top: 18px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--border); border-radius: 11px; background: rgba(0,0,0,.16); color: #697280; }
.search-box:focus-within { border-color: rgba(200,182,255,.32); color: var(--accent); }
.search-box svg { flex: 0 0 auto; width: 15px; height: 15px; }
.search-box input { padding: 10px 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: 11px; }
.curriculum-scroll { height: calc(100% - 188px); overflow-y: auto; padding: 8px 0 18px; }
.topic { border-bottom: 1px solid rgba(255,255,255,.045); }
.topic-toggle { width: 100%; display: grid; grid-template-columns: 32px 1fr 20px; align-items: center; gap: 10px; padding: 15px 17px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.topic-toggle:hover { background: rgba(255,255,255,.018); }
.topic-index { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--border); color: var(--muted); font-size: 9px; font-weight: 800; }
.topic-copy { min-width: 0; display: grid; gap: 3px; }
.topic-copy strong { font-size: 12px; line-height: 1.35; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topic-copy small { color: #626b77; font-size: 9px; }
.topic-chevron { display: grid; place-items: center; color: #5f6874; transition: transform .18s ease; }
.topic.open .topic-chevron { transform: rotate(90deg); }
.subtopic-list { display: none; padding: 0 9px 10px; }
.topic.open .subtopic-list { display: grid; gap: 3px; }
.subtopic-item { width: 100%; display: grid; grid-template-columns: 28px minmax(0,1fr); align-items: center; gap: 9px; border: 1px solid transparent; background: transparent; border-radius: 11px; padding: 8px 9px; cursor: pointer; text-align: left; }
.subtopic-item:hover { background: rgba(255,255,255,.025); }
.subtopic-item.active { background: var(--accent-soft); border-color: rgba(200,182,255,.12); }
.subtopic-state { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 9px; color: #68717d; background: rgba(255,255,255,.035); }
.subtopic-state svg { width: 12px; height: 12px; }
.subtopic-state.done { color: var(--green); background: rgba(142,214,172,.07); }
.subtopic-item.active .subtopic-state { color: var(--accent); background: rgba(200,182,255,.11); }
.subtopic-copy { min-width: 0; display: grid; gap: 2px; }
.subtopic-copy small { color: #626b77; font-size: 8px; font-weight: 700; letter-spacing: .06em; }
.subtopic-copy strong { color: #aab1bc; font-size: 11px; font-weight: 600; line-height: 1.35; }
.subtopic-item.active .subtopic-copy strong { color: #ede9ff; }
.empty-list, .search-empty { color: var(--muted); font-size: 10px; text-align: center; padding: 18px; }
.curriculum-scrim { display: none; }

/* Editor */
.editor { width: min(1500px, 100%); margin: 0 auto; padding: 34px clamp(16px, 3vw, 42px) 60px; }
.editor-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 30px; }
.editor-head h1 { margin: 7px 0 6px; font-size: 30px; letter-spacing: -.04em; }
.editor-head p { margin: 0; color: var(--muted); font-size: 12px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.editor-layout { display: grid; grid-template-columns: 330px minmax(0,1fr); gap: 18px; align-items: start; }
.editor-sidebar { position: sticky; top: calc(var(--topbar) + 18px); }
.stack { display: grid; gap: 12px; }
.card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--panel); padding: 17px; }
.card h2 { margin: 0; font-size: 13px; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.card-title-row svg { width: 17px; height: 17px; }
.field { display: grid; gap: 6px; }
.field label, .file-row > label { color: var(--text-soft); font-size: 10px; font-weight: 700; }
.field.compact { gap: 5px; }
.field.compact input { padding: 9px 10px; font-size: 11px; }
.hint { color: var(--muted); font-size: 10px; line-height: 1.55; }
.hint code { color: #bbb0dc; }
.file-row { display: grid; gap: 6px; }
.file-row label { display: flex; justify-content: space-between; gap: 10px; }
.file-row label span { color: #626b77; font-size: 9px; font-weight: 500; }
.file-input { padding: 9px; border-style: dashed; color: var(--muted); font-size: 10px; }
.file-input::file-selector-button { border: 0; border-radius: 8px; margin-right: 8px; padding: 6px 8px; background: var(--panel-hover); color: var(--text-soft); font: inherit; cursor: pointer; }
.import-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.storage-card { display: grid; gap: 10px; }
.storage-line { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.storage-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(142,214,172,.07); }
.content-toolbar { min-height: 58px; display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 12px; padding: 0 3px; }
.content-toolbar > div { display: flex; align-items: baseline; gap: 10px; }
.content-toolbar strong { font-size: 13px; }
.content-toolbar span { color: var(--muted); font-size: 10px; }
.topic-editor { margin-bottom: 12px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--panel); }
.topic-editor-head { display: grid; grid-template-columns: 42px minmax(160px,1fr) auto; align-items: end; gap: 11px; padding: 13px; background: rgba(255,255,255,.02); }
.editor-number { width: 38px; height: 38px; display: grid; place-items: center; align-self: end; border: 1px solid var(--border); border-radius: 11px; color: var(--accent); background: var(--accent-soft); font-size: 10px; font-weight: 800; }
.topic-editor-actions, .row-actions { display: flex; gap: 5px; align-items: center; }
.mini-btn { width: 29px; height: 29px; border-radius: 8px; font-size: 12px; }
.mini-btn:disabled { opacity: .28; cursor: default; }
.mini-btn.danger:hover { color: var(--danger); border-color: rgba(255,143,156,.25); background: rgba(255,143,156,.05); }
.subtopics-editor { border-top: 1px solid var(--border); }
.subtopic-editor { display: grid; grid-template-columns: 55px minmax(150px,.8fr) minmax(240px,1.25fr) auto; align-items: end; gap: 9px; padding: 11px 13px; border-bottom: 1px solid rgba(255,255,255,.045); }
.subtopic-editor:last-child { border-bottom: 0; }
.subtopic-order { align-self: center; color: var(--muted); font-size: 10px; text-align: center; }
.row-actions { align-self: end; height: 35px; }
.editor-empty { padding: 25px; color: var(--muted); text-align: center; font-size: 10px; }
.big-empty { min-height: 310px; display: grid; place-content: center; justify-items: center; gap: 8px; border: 1px dashed var(--border-strong); border-radius: var(--radius-xl); background: rgba(255,255,255,.012); }
.big-empty strong { margin-top: 6px; color: var(--text-soft); font-size: 14px; }
.big-empty span { font-size: 10px; }

@media (max-width: 1120px) {
  .course-layout { grid-template-columns: minmax(0,1fr) 350px; }
  .editor-layout { grid-template-columns: 290px minmax(0,1fr); }
  .subtopic-editor { grid-template-columns: 50px 1fr auto; }
  .subtopic-editor .link-field { grid-column: 2 / -1; }
  .subtopic-editor .row-actions { grid-column: 3; grid-row: 1; }
}

@media (max-width: 860px) {
  :root { --topbar: 64px; }
  .topbar { grid-template-columns: 1fr auto; padding: 0 14px; }
  .topbar .tabs { display: none; }
  .role-pill { display: none; }
  .brand-copy span { display: none; }
  .mobile-only { display: inline-grid; }
  .course-layout { display: block; }
  .stage { padding: 18px 14px 44px; }
  .curriculum { position: fixed; top: 0; right: 0; z-index: 100; width: min(390px, 92vw); height: 100vh; transform: translateX(102%); transition: transform .22s ease; border-left: 1px solid var(--border-strong); box-shadow: -25px 0 70px rgba(0,0,0,.42); }
  .curriculum.mobile-open { transform: translateX(0); }
  .curriculum-head { padding-top: 20px; }
  .curriculum-scroll { height: calc(100% - 188px); }
  .curriculum-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.56); backdrop-filter: blur(4px); }
  .curriculum-scrim.show { display: block; }
  .editor { padding-top: 24px; }
  .editor-head { align-items: flex-start; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-sidebar { position: static; }
}

@media (max-width: 620px) {
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 11px; }
  .brand-copy strong { max-width: 180px; }
  .login-card { padding: 26px 22px; border-radius: 22px; }
  .login-copy { padding: 44px 0 34px; }
  .login-copy h1 { font-size: 42px; }
  .password-row { grid-template-columns: 1fr; }
  .login-button { justify-content: center; }
  .player-card { padding: 5px; border-radius: 18px; }
  .player-frame { border-radius: 14px; }
  .lesson-heading { display: grid; }
  .complete-btn { justify-self: start; }
  .lesson-navigation { grid-template-columns: 1fr; }
  .nav-lesson.next { text-align: left; justify-content: flex-start; }
  .nav-lesson.next > span:first-child { order: 2; }
  .nav-lesson.next .nav-icon { order: 1; transform: rotate(180deg); }
  .editor-head { display: grid; }
  .editor-main-actions { width: 100%; }
  .editor-main-actions .btn { flex: 1; }
  .topic-editor-head { grid-template-columns: 38px 1fr; }
  .topic-editor-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .subtopic-editor { grid-template-columns: 42px 1fr; }
  .subtopic-editor .link-field { grid-column: 2; }
  .subtopic-editor .row-actions { grid-column: 1 / -1; grid-row: auto; justify-content: flex-end; }
  .content-toolbar { align-items: flex-start; }
  .content-toolbar > div { display: grid; gap: 3px; }
}

/* v2 — disciplinas > tópicos > aulas */
.brand-button { appearance: none; border: 0; background: transparent; color: inherit; padding: 0; cursor: pointer; text-align: left; }

.discipline-home {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(42px, 7vw, 86px) clamp(18px, 4vw, 54px) 72px;
}
.discipline-hero { max-width: 760px; margin-bottom: 38px; }
.discipline-hero h1 { margin: 10px 0 12px; font-size: clamp(36px, 6vw, 64px); line-height: .98; letter-spacing: -.055em; }
.discipline-hero p { margin: 0; max-width: 650px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.overall-progress { margin-top: 22px; display: inline-flex; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 11px; background: rgba(255,255,255,.02); }
.overall-progress strong { color: var(--accent); }
.discipline-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.discipline-card {
  appearance: none;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 22px;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(200,182,255,.075), rgba(255,255,255,.018) 48%, rgba(255,255,255,.01));
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 18px 45px rgba(0,0,0,.20), inset 0 1px rgba(255,255,255,.035);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.discipline-card:hover { transform: translateY(-3px); border-color: rgba(200,182,255,.34); background: linear-gradient(145deg, rgba(200,182,255,.12), rgba(255,255,255,.026) 52%, rgba(255,255,255,.012)); }
.discipline-card-top { display: flex; justify-content: space-between; align-items: center; }
.discipline-badge { min-width: 44px; height: 34px; display: inline-grid; place-items: center; padding: 0 10px; border: 1px solid rgba(200,182,255,.24); border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 850; letter-spacing: .08em; }
.discipline-arrow { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); }
.discipline-card-copy { margin: auto 0 24px; display: grid; gap: 7px; }
.discipline-card-copy strong { font-size: clamp(22px, 2.4vw, 31px); letter-spacing: -.035em; }
.discipline-card-copy small { color: var(--muted); font-size: 11px; }
.discipline-progress { height: 4px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.055); }
.discipline-progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-strong), var(--accent)); }
.discipline-card-foot { margin-top: 9px; color: #697280; font-size: 9px; }

.lesson-context { height: auto; min-height: 42px; display: flex; align-items: center; gap: 13px; margin-bottom: 5px; }
.back-link { appearance: none; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 9px; background: rgba(255,255,255,.018); color: var(--text-soft); cursor: pointer; font-size: 10px; font-weight: 700; }
.back-link:hover { border-color: rgba(200,182,255,.28); background: var(--accent-soft); color: var(--accent); }
.back-link svg { width: 13px; height: 13px; }
.breadcrumb { flex-wrap: wrap; }

.curriculum { display: flex; flex-direction: column; }
.curriculum-head { flex: 0 0 auto; padding: 18px 18px 16px; }
.curriculum-scroll { flex: 1 1 auto; height: auto; min-height: 0; overflow-y: auto; padding: 10px 10px 20px; }
.curriculum-actions-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }

/* Cada tópico agora é um bloco visual próprio. */
.topic { margin: 0 0 9px; overflow: hidden; border: 1px solid var(--border); border-radius: 15px; background: rgba(255,255,255,.018); box-shadow: inset 3px 0 0 rgba(200,182,255,.10); }
.topic:hover { border-color: rgba(255,255,255,.12); }
.topic.open { border-color: rgba(200,182,255,.22); background: rgba(200,182,255,.035); box-shadow: inset 3px 0 0 rgba(200,182,255,.50); }
.topic-toggle { grid-template-columns: 36px minmax(0,1fr) 22px; gap: 11px; padding: 14px 13px; }
.topic-toggle:hover { background: rgba(255,255,255,.025); }
.topic-index { width: 34px; height: 34px; border-radius: 10px; border-color: rgba(200,182,255,.14); background: rgba(200,182,255,.035); color: #a99bcf; }
.topic.open .topic-index { color: var(--accent); border-color: rgba(200,182,255,.30); background: rgba(200,182,255,.09); }
.topic-copy strong { white-space: normal; overflow: visible; text-overflow: clip; color: #d4d8df; font-size: 11.5px; line-height: 1.4; }
.topic.open .topic-copy strong { color: #f0ecff; }
.subtopic-list { padding: 3px 8px 9px; border-top: 1px solid rgba(255,255,255,.045); }
.topic.open .subtopic-list { gap: 5px; }
.subtopic-item { padding: 9px 9px; border-radius: 10px; }
.subtopic-item.active { background: rgba(200,182,255,.12); border-color: rgba(200,182,255,.20); }
.subtopic-copy strong { font-size: 10.5px; color: #b8bec8; }

/* Editor por disciplina */
.section-editor-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; padding: 5px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.018); }
.section-editor-tab { appearance: none; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); padding: 8px 11px; cursor: pointer; font-size: 11px; font-weight: 750; }
.section-editor-tab:hover { color: var(--text); background: rgba(255,255,255,.035); }
.section-editor-tab.active { color: #ece7ff; border-color: rgba(200,182,255,.18); background: var(--accent-soft); }
.section-editor-tab.add { margin-left: auto; border-color: var(--border); }
.section-editor-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; margin-bottom: 12px; }
.danger-text { color: var(--danger); }
.storage-dot.bad { background: var(--danger); box-shadow: 0 0 0 4px rgba(255,143,156,.07); }

@media (max-width: 900px) {
  .discipline-grid { grid-template-columns: 1fr; }
  .discipline-card { min-height: 160px; }
  .discipline-card-copy { margin: 28px 0 20px; }
}

@media (max-width: 860px) {
  .curriculum-head { padding-top: 16px; }
  .curriculum-scroll { height: auto; }
  .lesson-context { align-items: flex-start; flex-direction: column; gap: 8px; margin-bottom: 10px; }
  .breadcrumb { line-height: 1.5; }
  .discipline-home { padding-top: 42px; }
}

@media (max-width: 620px) {
  .discipline-home { padding: 34px 14px 48px; }
  .discipline-hero { margin-bottom: 24px; }
  .discipline-hero h1 { font-size: 38px; }
  .discipline-hero p { font-size: 12px; }
  .discipline-card { min-height: 145px; padding: 17px; border-radius: 18px; }
  .discipline-card-copy { margin: 22px 0 17px; }
  .discipline-card-copy strong { font-size: 24px; }
  .stage { padding-left: 12px; padding-right: 12px; }
  .player-card { padding: 4px; }
  .lesson-panel { padding-top: 20px; }
  .lesson-heading h1 { font-size: 27px; }
  .curriculum { width: min(420px, 94vw); }
  .topic-toggle { padding: 13px 11px; }
  .subtopic-item { padding: 10px 8px; }
  .section-editor-head { grid-template-columns: 1fr; }
  .section-editor-tab.add { margin-left: 0; }
}

/* v3 — experiência mobile de estudo */
.mobile-study-nav { display: none; }

@media (max-width: 860px) {
  .topbar {
    min-height: var(--topbar);
    height: var(--topbar);
    padding-left: 16px;
    padding-right: 14px;
  }
  .brand-group { gap: 10px; }
  .brand-copy strong { font-size: 15px; letter-spacing: -.02em; }
  .top-actions { gap: 7px; }
  .top-actions .icon-action { width: 40px; height: 40px; border-radius: 12px; }

  .stage { padding-top: 14px; }
  .lesson-context { margin-bottom: 8px; }
  .player-card { box-shadow: 0 18px 48px rgba(0,0,0,.34); }
  .player-frame { background: #000; }
  .player-frame iframe { background: #000; touch-action: manipulation; }
}

@media (max-width: 620px) {
  :root { --topbar: 60px; }

  body.mobile-menu-open { overflow: hidden; }

  .topbar {
    min-height: calc(var(--topbar) + env(safe-area-inset-top));
    height: calc(var(--topbar) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
    gap: 8px;
    background: rgba(11,13,18,.94);
    backdrop-filter: blur(20px);
  }
  .brand-mark { width: 38px; height: 38px; border-radius: 11px; font-size: 12px; }
  .brand-copy strong { max-width: min(52vw, 230px); font-size: 16px; line-height: 1; }
  .top-actions .icon-action { width: 42px; height: 42px; border-radius: 13px; }
  .top-actions svg { width: 19px; height: 19px; }

  .stage {
    padding: 10px 12px calc(96px + env(safe-area-inset-bottom));
    overflow: hidden;
  }
  .lesson-context {
    min-height: 0;
    margin-bottom: 9px;
    gap: 7px;
  }
  .back-link { padding: 7px 9px; border-radius: 10px; font-size: 10px; }
  .breadcrumb {
    width: 100%;
    max-width: 100%;
    flex-wrap: nowrap;
    gap: 7px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding-bottom: 2px;
    line-height: 1.25;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .breadcrumb::-webkit-scrollbar { display: none; }
  .breadcrumb strong,
  .breadcrumb span { flex: 0 0 auto; }

  /* Quase edge-to-edge sem perder o acabamento arredondado. */
  .player-card {
    width: calc(100% + 16px);
    margin-left: -8px;
    padding: 3px;
    border-radius: 17px;
    background: linear-gradient(145deg, rgba(255,255,255,.085), rgba(255,255,255,.018));
  }
  .player-frame { border-radius: 14px; }
  .player-frame iframe,
  .player-frame video { width: 100%; height: 100%; }

  .lesson-panel { padding-top: 18px; }
  .lesson-heading { gap: 16px; }
  .lesson-heading h1 { margin-top: 7px; margin-bottom: 7px; font-size: clamp(24px, 7.5vw, 30px); line-height: 1.05; }
  .lesson-heading p { font-size: 11.5px; line-height: 1.55; }
  .complete-btn { width: 100%; justify-content: center; min-height: 44px; margin-top: 3px; }

  /* No celular, anterior/próxima ficam na barra fixa inferior. */
  .lesson-navigation { display: none; }

  .mobile-study-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 70;
    display: grid;
    grid-template-columns: 1fr minmax(104px, 1.15fr) 1fr;
    align-items: stretch;
    gap: 6px;
    padding: 6px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 18px;
    background: rgba(15,18,24,.94);
    backdrop-filter: blur(22px);
    box-shadow: 0 14px 42px rgba(0,0,0,.5), inset 0 1px rgba(255,255,255,.035);
    transition: transform .2s ease, opacity .2s ease;
  }
  .mobile-study-nav.drawer-open { opacity: 0; transform: translateY(120%); pointer-events: none; }
  .mobile-study-nav button {
    appearance: none;
    min-width: 0;
    min-height: 46px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 8px;
    font-size: 10px;
    font-weight: 750;
    cursor: pointer;
    touch-action: manipulation;
  }
  .mobile-study-nav button:active:not(:disabled) { background: rgba(255,255,255,.06); }
  .mobile-study-nav button:disabled { opacity: .28; }
  .mobile-study-nav svg { width: 17px; height: 17px; }
  .mobile-study-lessons {
    background: rgba(200,182,255,.12) !important;
    color: #eee9ff !important;
    border: 1px solid rgba(200,182,255,.17) !important;
  }

  /* A lista vira bottom sheet no celular em vez de ocupar a tela pela lateral. */
  .curriculum {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: none;
    height: min(82dvh, 760px);
    padding-bottom: env(safe-area-inset-bottom);
    border-left: 0;
    border-top: 1px solid var(--border-strong);
    border-radius: 22px 22px 0 0;
    transform: translateY(103%);
    transition: transform .24s cubic-bezier(.22,.8,.2,1);
    box-shadow: 0 -24px 70px rgba(0,0,0,.52);
  }
  .curriculum::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    width: 38px;
    height: 4px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(255,255,255,.16);
  }
  .curriculum.mobile-open { transform: translateY(0); }
  .curriculum-head { padding: 23px 14px 13px; }
  .curriculum-actions-row { margin-bottom: 11px; }
  .curriculum-title-row h2 { font-size: 16px; }
  .progress-block { margin-top: 13px; }
  .search-box { margin-top: 13px; min-height: 42px; }
  .curriculum-scroll { padding: 8px 8px calc(14px + env(safe-area-inset-bottom)); }
  .topic { margin-bottom: 7px; border-radius: 14px; }
  .topic-toggle { min-height: 58px; padding: 11px 10px; }
  .topic-index { width: 35px; height: 35px; }
  .topic-copy strong { font-size: 11px; line-height: 1.35; }
  .subtopic-item { min-height: 48px; padding: 9px 8px; }
  .subtopic-copy strong { font-size: 10.5px; line-height: 1.4; }
  #close-curriculum { width: 40px; height: 40px; }

  .curriculum-scrim {
    background: rgba(0,0,0,.62);
    backdrop-filter: blur(5px);
  }
}

@media (max-width: 380px) {
  .brand-copy strong { max-width: 43vw; font-size: 15px; }
  .top-actions .icon-action { width: 40px; height: 40px; }
  .mobile-study-nav { left: 7px; right: 7px; bottom: calc(7px + env(safe-area-inset-bottom)); }
  .mobile-study-nav button { padding-inline: 5px; }
}


/* v4 — correção do recorte do Google Drive no mobile
   O /preview reserva uma faixa interna para o chrome do próprio Drive.
   Em 16:9 puro, essa faixa rouba altura do vídeo. No mobile, damos ao
   iframe a altura de um vídeo 16:9 + espaço para o chrome do Drive. */
@media (max-width: 860px) {
  .player-frame.drive-preview {
    aspect-ratio: auto;
    height: calc((100vw - 20px) * 0.5625 + 72px);
    min-height: 250px;
    max-height: 72vh;
    overflow: hidden;
    background: #000;
  }
}

@media (max-width: 620px) {
  .player-frame.drive-preview {
    height: calc((100vw - 8px) * 0.5625 + 70px);
    min-height: 248px;
    max-height: 68vh;
  }
}
