/* Premium Academy: visual layer only. Official progress and access remain server owned. */
:root {
  --academy-bg: #080e1c;
  --academy-panel: #10192c;
  --academy-raised: #151f35;
  --academy-border: #2b3858;
  --academy-ink: #f5f7ff;
  --academy-muted: #aebbd5;
  --academy-violet: #8d62ff;
  --academy-blue: #4775ff;
  --academy-focus: #9eaffe;
  --academy-radius: 18px;
}
.shell:has(.v3-dashboard), .shell.v2-course-focus { background: var(--academy-bg); color: var(--academy-ink); }
.shell:has(.v3-dashboard) .main, .shell.v2-course-focus .main { background: var(--academy-bg); }
.shell:has(.v3-dashboard) .sidebar, .shell.v2-course-focus > .sidebar {
  background: #0b1426; border-right: 1px solid #202d49;
}
.shell:has(.v3-dashboard) .topbar, .shell.v2-course-focus .course-topbar {
  background: var(--academy-bg); border-bottom-color: #1c2943;
}
.shell:has(.v3-dashboard) .content { width: 100%; max-width: 1680px; padding: clamp(20px, 2.4vw, 40px); }
.shell:has(.v3-dashboard) .sidebar button:focus-visible,
.shell.v2-course-focus .sidebar button:focus-visible,
.v3-dashboard :focus-visible, .v3-course-frame :focus-visible {
  outline: 3px solid var(--academy-focus); outline-offset: 3px;
}
.v3-dashboard, .v3-course-frame { color: var(--academy-ink); }
.v3-dashboard button, .v3-course-frame button { font: inherit; cursor: pointer; }
.v3-dashboard button:disabled, .v3-course-frame button:disabled { cursor: default; }

/* V3.1 navigation and dashboard. Real data and access remain server owned. */
.shell:has(.academy-v2-navigation) { grid-template-columns: 238px minmax(0, 1fr); }
.sidebar:has(.academy-v2-navigation) {
  padding: 26px 16px 18px; background: #0b1425; border-right: 1px solid #202b43;
}
.sidebar:has(.academy-v2-navigation) .logo {
  display: flex; align-items: center; gap: 12px; padding: 0 4px 52px;
  color: #fff; font-size: 1.36rem; font-weight: 760; letter-spacing: -.035em;
}
.sidebar:has(.academy-v2-navigation) .logo img { width: 42px; height: 42px; flex: none; border-radius: 11px; }
.sidebar:has(.academy-v2-navigation) .logo small {
  display: block; margin-top: 3px; color: #aebad4; font-size: .62rem;
  font-weight: 700; letter-spacing: .22em; text-transform: uppercase;
}
.academy-v2-navigation { gap: 30px; }
.academy-v2-navigation .nav { gap: 6px; }
.academy-v2-navigation .nav button {
  display: flex; align-items: center; gap: 14px; min-height: 44px;
  padding: 10px 13px; border-radius: 10px; color: #b5c2db;
  font-size: .87rem; font-weight: 570; transition: color .16s ease, background .16s ease;
}
.academy-v2-navigation .nav button .nav-icon { flex: none; width: 20px; height: 20px; stroke-width: 1.8; }
.academy-v2-navigation .nav button.active {
  background: #1a2453; color: #fff; box-shadow: inset 3px 0 #8663f9;
}
.academy-v2-navigation .nav button.active::before { display: none; }
.academy-v2-navigation .nav button:hover:not(:disabled) { background: #1b2944; color: #fff; }
.academy-v2-navigation .v2-nav-secondary { padding-top: 22px; border-top: 1px solid #243049; }
.academy-v2-navigation .v2-nav-group-label { padding-left: 13px; color: #8898b7; }
.sidebar:has(.academy-v2-navigation) .sidebar-foot { margin-top: auto; }
.sidebar:has(.academy-v2-navigation) .student {
  display: flex; align-items: center; gap: 10px; padding: 10px 4px;
  border-top: 1px solid #263149; border-radius: 0; font-size: .78rem;
}
.sidebar:has(.academy-v2-navigation) .student small { color: #97a6c3; }
.sidebar:has(.academy-v2-navigation) .avatar {
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 50%; color: #dbe6ff; background: #1c3055;
}
.shell:has(.academy-v2-navigation) .topbar {
  height: 54px; padding-inline: clamp(18px, 2.2vw, 34px);
  background: #080f1e; border-color: #1d2940;
}
.shell:has(.academy-v2-navigation) .crumb { color: #8495b4; font-size: .78rem; }
.shell:has(.academy-v2-navigation) .crumb b { color: #e7edfb; }
.shell:has(.academy-v2-navigation) .status-pill { color: #9babc8; font-size: .76rem; }

/* Dashboard: illustrated resume, compact verified progress, real course cards. */
.academy-v2-dashboard.v3-dashboard {
  --v2-ink: var(--academy-bg); --v2-surface: var(--academy-panel);
  --v2-line: var(--academy-border); --v2-text: var(--academy-ink);
  --v2-muted: var(--academy-muted); --v2-accent: #a782ff;
  max-width: 1530px; margin-inline: auto;
}
.v3-dashboard .v3-welcome { padding: 8px 0 18px; }
.v3-dashboard .v3-welcome h1 {
  max-width: none; margin: 0 0 6px; font-size: clamp(1.8rem, 2.35vw, 2.45rem);
  line-height: 1.13; letter-spacing: -.04em;
}
.v3-dashboard .v3-welcome h1 span { color: #a076ff; }
.v3-dashboard .v3-welcome > p:last-child { margin: 0; color: #acbad3; font-size: .96rem; }
.v3-dashboard-grid {
  display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(265px, .9fr);
  gap: 18px; align-items: start;
}
.v3-dashboard .v3-hero {
  position: relative; isolation: isolate; overflow: hidden; min-height: 365px;
  padding: 29px clamp(24px, 2.6vw, 38px); border: 1px solid #5558b3;
  border-radius: 17px; background: #101830;
  box-shadow: 0 16px 38px rgba(0,0,0,.21);
}
.v3-dashboard .v3-hero::after { display: none; }
.v3-hero-visual {
  position: absolute; inset: 0 0 0 auto; z-index: -1; width: 60%;
  overflow: hidden; background: #101830;
}
.v3-hero-visual::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, #101830 0%, rgba(16,24,48,.72) 17%, transparent 47%);
}
.v3-hero-visual img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 58% center; }
.v3-hero-copy { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; width: min(58%, 500px); min-height: 305px; }
.v3-dashboard .v3-hero .v2-section-index { color: #c7a5ff; font-size: .73rem; font-weight: 750; letter-spacing: .06em; }
.v3-dashboard .v3-hero .v2-chapter-label { margin-top: 8px; color: #b0bde0; font-size: .77rem; }
.v3-dashboard .v3-hero .v2-work-content { display: block; margin: auto 0 12px; padding: 0; }
.v3-dashboard .v3-hero .v2-kicker { margin: 0 0 9px; color: #c5b2f8; font-size: .78rem; }
.v3-dashboard .v3-hero h2 { max-width: 19ch; margin: 0 0 11px; font-size: clamp(1.65rem, 2.3vw, 2.35rem); line-height: 1.12; letter-spacing: -.04em; }
.v3-dashboard .v3-hero .v2-work-objective { max-width: 47ch; margin: 0; color: #c5cee5; font-size: .87rem; line-height: 1.47; }
.v3-dashboard .v3-hero .v2-work-action { margin: 0 0 19px; }
.v3-dashboard .v3-hero .v2-primary-action, .v3-course-frame .v2-course-forward, .v3-tutor-toggle {
  min-height: 43px; padding: 9px 18px; border: 1px solid #8774f3; border-radius: 10px;
  background: #5448e6; color: #fff; font-size: .87rem; font-weight: 700;
  box-shadow: 0 7px 18px rgba(54,46,188,.23);
  transition: background .16s ease, transform .16s ease;
}
.v3-dashboard .v3-hero .v2-primary-action { display: inline-flex; align-items: center; gap: 25px; }
.v3-dashboard .v3-hero .v2-primary-action:hover, .v3-course-frame .v2-course-forward:hover:not(:disabled), .v3-tutor-toggle:hover { background: #6854f1; transform: translateY(-1px); }
.v3-dashboard .v3-hero .v2-work-progress { display: grid; grid-template-columns: 1fr auto; width: 100%; max-width: 370px; margin: 0; padding: 0; font-size: .74rem; }
.v3-dashboard .v3-hero .v2-work-progress label { color: #b6c3df; }
.v3-dashboard .v3-hero .v2-work-progress span { color: #dfe6f9; font-variant-numeric: tabular-nums; }
.v3-dashboard .v3-hero progress { grid-column: 1 / -1; width: 100%; height: 6px; margin-top: 6px; accent-color: #9772fb; }
.v3-dashboard .v2-lower {
  align-self: start; display: block; min-width: 0; margin: 0; padding: 20px;
  border: 1px solid #2a3652; border-radius: 17px; background: #0e1729;
}
.v3-dashboard .v2-lower .v2-note { display: none; }
.v3-dashboard .v2-progress { padding: 0; border: 0; background: none; box-shadow: none; }
.v3-dashboard .v2-progress h2 { margin: 0 0 15px; font-size: 1.13rem; }
.v3-progress-main { padding: 14px; border: 1px solid #27334c; border-radius: 12px; background: #141f33; }
.v3-dashboard .v3-progress-value { display: block; margin: 0 0 9px; font-size: 2rem; letter-spacing: -.045em; }
.v3-dashboard .v2-global-progress { margin: 0; }
.v3-dashboard .v2-global-progress > div { display: flex; justify-content: space-between; gap: 8px; font-size: .76rem; }
.v3-dashboard .v2-global-progress label { color: #aebbd5; }
.v3-dashboard .v2-global-progress strong { flex: none; font-variant-numeric: tabular-nums; }
.v3-dashboard progress { accent-color: #8c6af3; }
.v3-dashboard .v2-global-progress progress { width: 100%; height: 6px; margin-top: 7px; }
.v3-progress-metric { display: flex; justify-content: space-between; gap: 8px; padding: 15px 3px; border-bottom: 1px solid #293550; color: #adbcd7; font-size: .79rem; }
.v3-progress-metric strong { flex: none; color: #e3eafd; font-variant-numeric: tabular-nums; }
.v3-dashboard .v3-progress-details { margin: 0; padding: 12px 2px; color: #a8b6d2; font-size: .75rem; }
.v3-dashboard .v3-progress-details summary { cursor: pointer; color: #c6b5ff; }
.v3-dashboard .v3-progress-details dl { margin: 12px 0; }
.v3-dashboard .v3-progress-details dl > div { display: flex; justify-content: space-between; gap: 10px; margin: 7px 0; }
.v3-dashboard .v3-progress-details p { font-size: .73rem; line-height: 1.45; }
.v3-dashboard .v2-text-action { padding: 3px 2px; color: #b39aff; font-size: .8rem; }
.v3-courses { margin-top: 27px; }
.v3-courses-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.v3-courses-heading h2 { margin: 0; font-size: 1.3rem; }
.v3-courses-heading button { border: 0; background: none; color: #b79aff; font-size: .83rem; font-weight: 650; }
.v3-course-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.v3-course-card {
  overflow: hidden; min-width: 0; border: 1px solid #2a3652; border-radius: 14px;
  background: #0e1729; transition: border-color .18s ease, transform .18s ease;
}
.v3-course-card:hover { border-color: #6d65a8; transform: translateY(-2px); }
.v3-course-art { position: relative; display: block; height: auto; aspect-ratio: 2.05; overflow: hidden; background: #142243; }
.v3-course-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.v3-course-art::after { content: ''; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent,rgba(8,14,27,.45)); pointer-events: none; }
.v3-course-status { position: absolute; top: 12px; left: 12px; z-index: 1; padding: 5px 9px; border: 1px solid rgba(185,171,255,.33); border-radius: 99px; background: rgba(58,43,157,.83); color: #fff; font-size: .68rem; font-weight: 750; backdrop-filter: blur(5px); }
.v3-course-copy { padding: 16px 17px 17px; }
.v3-course-chapter { color: #9eabca; font-size: .7rem; }
.v3-course-copy h3 { min-height: 2.5em; margin: 7px 0 13px; font-size: 1rem; line-height: 1.25; }
.v3-course-progress { display: flex; align-items: center; gap: 10px; color: #b8c4de; font-size: .75rem; font-variant-numeric: tabular-nums; }
.v3-course-progress progress { flex: 1; width: auto; min-width: 0; height: 6px; }
.v3-course-progress span { flex: none; white-space: nowrap; }
.v3-course-copy button { margin-top: 13px; padding: 0; border: 0; background: none; color: #c1adff; font-size: .78rem; font-weight: 650; }

/* Course reader: compact outline, calm reading column, optional Tutor. */
.shell.course-focus.v2-course-focus { display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.shell.course-focus.v2-course-focus > .sidebar { display: flex; min-height: 0; }
.shell.v2-course-focus .content { max-width: none; padding: 18px clamp(18px, 2.1vw, 34px) 12px; }
.shell.v2-course-focus .v3-course-frame { max-width: 1640px; margin-inline: auto; }
.v3-course-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 2px 0 17px; }
.v3-course-heading span { color: #b898ff; font-size: .72rem; font-weight: 750; letter-spacing: .095em; }
.v3-course-heading h1 { margin: 6px 0 0; font-size: clamp(1.65rem, 2.25vw, 2.15rem); line-height: 1.15; letter-spacing: -.035em; }
.v3-course-subtitle { max-width: 68ch; margin: 9px 0 0; color: #aebbd4; font-size: .88rem; line-height: 1.5; }
.v3-tutor-toggle { flex: none; min-height: 38px; padding: 8px 14px; font-size: .83rem; }
.shell.v2-course-focus .course-progress-head { width: 100%; max-width: none; margin: 0 0 14px; }
.v3-course-progress-meta { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 7px; color: #b5c4e0; font-size: .78rem; }
.v3-course-progress-meta strong { color: #e8edfc; font-variant-numeric: tabular-nums; white-space: nowrap; }
.shell.v2-course-focus .course-progress-head .slim-progress { height: 6px; background: #202b43; }
.shell.v2-course-focus .course-progress-head .slim-progress i { background: #8262f3; }
.v3-course-layout { display: grid; flex: 1; grid-template-columns: minmax(0, 1fr) minmax(210px, 260px); grid-template-areas: "reading outline"; gap: clamp(14px, 1.4vw, 24px); min-height: 0; }
.v3-course-frame.tutor-open .v3-course-layout { grid-template-columns: minmax(0, 1fr) minmax(215px, 255px) minmax(310px, 350px); grid-template-areas: "reading outline tutor"; }
.v3-course-layout .v3-outline { grid-area: outline; }
.v3-course-layout .v3-reading { grid-area: reading; }
.v3-course-layout .v3-tutor-panel { grid-area: tutor; }
.v3-outline { align-self: start; max-height: 100%; overflow: auto; padding: 17px 15px; border: 1px solid #27334e; border-radius: 14px; background: #0c1528; scrollbar-width: thin; }
.v3-outline summary { display: flex; justify-content: space-between; gap: 8px; cursor: pointer; font-weight: 700; font-size: .92rem; }
.v3-outline summary span { color: var(--academy-muted); font-variant-numeric: tabular-nums; font-size: .8rem; }
.v3-outline ol { margin: 17px 0 0 9px; padding: 0 0 0 12px; border-left: 1px solid #3b4a6a; list-style: none; }
.v3-outline li { position: relative; }
.v3-outline li::before { content: ''; position: absolute; left: -18px; top: 13px; width: 9px; height: 9px; border: 1px solid #687896; border-radius: 50%; background: #0c1528; }
.v3-outline li.current::before { border-color: #ac8cff; background: #8c64f6; box-shadow: 0 0 0 4px rgba(141,98,255,.15); }
.v3-outline li.visited::before { border-color: #63a9ef; background: #367dc5; }
.v3-outline li + li { margin-top: 4px; }
.v3-outline li > button, .v3-outline li > span { display: flex; align-items: start; width: 100%; gap: 8px; padding: 9px 7px; border: 0; border-radius: 8px; background: transparent; color: #a9b7d3; text-align: left; font-size: .8rem; line-height: 1.35; }
.v3-outline li > button:hover { background: #1b2949; color: white; }
.v3-outline li.current > button { background: #27205d; color: #fff; box-shadow: inset 3px 0 #a777ff; }
.v3-outline li.visited > button { color: #d5dcf3; }
.v3-outline li.upcoming > span { opacity: .57; }
.v3-outline li > :first-child > span:first-child { flex: none; min-width: 1.8rem; font-variant-numeric: tabular-nums; }
.v3-reading { min-width: 0; min-height: 0; }
.shell.v2-course-focus .v3-reading .course-immersive { width: 100%; max-width: none; height: 100%; }
.shell.v2-course-focus .v3-reading .lesson.v2-course-scroll { padding: 0 4px 24px 0; }
.shell.v2-course-focus .v3-reading .course-section { padding: clamp(22px, 2.1vw, 34px); border: 1px solid #2a3753; border-radius: 15px; background: #10192d; }
.v3-section-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 15px; }
.v3-section-header > div { min-width: 0; }
.v3-section-header .section-kicker { color: #a787fc; font-size: .73rem; letter-spacing: .08em; text-transform: uppercase; }
.v3-section-header .v3-concept-art { flex: none; width: min(30%, 210px); height: 112px; object-fit: cover; object-position: center; border: 1px solid #344165; border-radius: 11px; opacity: .88; }
.shell.v2-course-focus .v3-reading .course-section h2 { margin-top: 5px; font-size: clamp(1.45rem, 2.2vw, 2.1rem); }
.shell.v2-course-focus .v3-reading .course-section p, .shell.v2-course-focus .v3-reading .course-intro p { max-width: 72ch; color: #d5def0; line-height: 1.7; }
.shell.v2-course-focus .v3-reading .callout { border-radius: 12px; background: #131f3a; border-color: #384875; }
.shell.v2-course-focus .v3-reading .ask-tutor { margin-top: 8px; }
.shell.v2-course-focus .v2-course-dock { width: 100%; max-width: none; border-color: var(--academy-border); background: var(--academy-bg); }
.shell.v2-course-focus .v2-course-dock .v2-course-forward { background: #5149e9; color: #fff; }
.shell.v2-course-focus .v2-course-dock .v2-course-forward:hover:not(:disabled) { background: #6a55f1; }

/* Reuse the existing Tutor thread and composer inside the course. */
.v3-tutor-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid #465082; border-radius: 15px; background: #0b1327; box-shadow: 0 14px 30px rgba(0,0,0,.16); }
.v3-tutor-panel > header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 15px; border-bottom: 1px solid var(--academy-border); background: #121c36; }
.v3-tutor-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.v3-tutor-identity img { width: 32px; height: 32px; flex: none; }
.v3-tutor-panel > header span { color: #ad9aff; font-size: .68rem; letter-spacing: .07em; font-weight: 750; }
.v3-tutor-panel > header h2 { margin: 3px 0 0; font-size: .96rem; }
.v3-tutor-panel > header button { flex: none; padding: 7px 8px; border: 1px solid var(--academy-border); border-radius: 8px; background: #17223a; color: var(--academy-ink); font-size: .72rem; }
.v3-tutor-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; overscroll-behavior: contain; scrollbar-width: thin; }
.v3-tutor-intro { margin: 0 0 14px; color: var(--academy-muted); font-size: .82rem; line-height: 1.5; }
.v3-tutor-panel .tutor-chat-history { display: flex; flex-direction: column; gap: 12px; }
.v3-tutor-panel .chat-message { width: 100%; max-width: 100%; grid-template-columns:25px minmax(0, 1fr); gap: 8px; margin: 0 0 12px; }
.v3-tutor-panel .chat-avatar { width: 25px; height: 25px; font-size: .78rem; }
.v3-tutor-panel .chat-message.user { display: block; padding-left: 20px; }
.v3-tutor-panel .chat-copy { font-size: .84rem; line-height: 1.55; overflow-wrap: anywhere; }
.v3-tutor-panel .chat-copy label { margin-bottom: 3px; font-size: .62rem; }
.v3-tutor-panel .chat-message.user .chat-copy { max-width: 100%; background: #19377d; }
.v3-tutor-panel .chat-copy p:last-child { margin-bottom: 0; }
.v3-tutor-bottom { padding: 12px; border-top: 1px solid var(--academy-border); background: #0d172b; }
.v3-tutor-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.v3-tutor-quick button { min-height: 34px; padding: 6px 9px; border: 1px solid var(--academy-border); border-radius: 8px; background: #18243c; color: #e4e8ff; font-size: .74rem; }
.v3-tutor-quick button:hover:not(:disabled) { border-color: #8c78e9; background: #26305a; }
.v3-tutor-panel .tutor-compose { margin: 0; }
.v3-tutor-panel .tutor-compose textarea { width: 100%; min-height: 70px; max-height: 160px; resize: vertical; border-color: #394669; border-radius: 10px; background: #111d32; color: white; }
.v3-tutor-panel .tutor-compose footer { gap: 6px; }
.v3-tutor-panel .tutor-compose footer small { color: var(--academy-muted); font-size: .67rem; }

/* The existing parcours, verified progress and practice keep their content and state. */
.academy-v2-journey, .academy-v2-profile, .academy-v2-chapter {
  --v2-ink: var(--academy-bg); --v2-surface: var(--academy-panel);
  --v2-line: var(--academy-border); --v2-text: var(--academy-ink);
  --v2-muted: var(--academy-muted); --v2-accent: #aa8dff;
  color: var(--academy-ink);
}
.shell:has(.academy-v2-journey, .academy-v2-profile, .academy-v2-chapter, .exercise-intro) {
  background: var(--academy-bg); color: var(--academy-ink);
}
.shell:has(.academy-v2-journey, .academy-v2-profile, .academy-v2-chapter, .exercise-intro) .main {
  background: var(--academy-bg);
}
.academy-v2-journey .v2-journey-head h1, .academy-v2-profile .v2-profile-head h1,
.academy-v2-chapter .v2-journey-head h1 { font-size: clamp(2rem, 3.4vw, 3rem); }
.academy-v2-journey .v2-journey-list, .academy-v2-chapter .v2-journey-list {
  overflow: hidden; border: 1px solid var(--academy-border); border-radius: var(--academy-radius);
  background: #0e1729;
}
.academy-v2-journey .v2-journey-list li:last-child,
.academy-v2-chapter .v2-journey-list li:last-child { border-bottom: 0; }
.academy-v2-journey .v2-journey-row, .academy-v2-chapter .v2-journey-row,
.academy-v2-journey .v2-journey-locked, .academy-v2-chapter .v2-journey-locked { padding-inline: clamp(14px, 2vw, 22px); }
.academy-v2-journey .v2-journey-row:hover, .academy-v2-journey .v2-journey-row.is-current,
.academy-v2-chapter .v2-journey-row:hover, .academy-v2-chapter .v2-journey-row.is-current { background: #1b2850; }
.academy-v2-profile .v2-profile-totals { gap: 12px; border: 0; background: transparent; }
.academy-v2-profile .v2-profile-totals > div { border: 1px solid var(--academy-border); border-radius: 13px; background: var(--academy-panel); }
.academy-v2-profile .v2-profile-grid { gap: clamp(20px, 3vw, 36px); }
.academy-v2-profile .v2-profile-chapters li, .academy-v2-profile .v2-profile-review li { border-color: var(--academy-border); }
.academy-v2-chapter .v2-chapter-evaluation { border-color: var(--academy-border); }

.shell:has(.exercise-intro) .content { max-width: 1180px; }
.exercise-intro { max-width: 900px; padding-top: 24px; }
.exercise-intro h1 { font-size: clamp(2rem, 3.5vw, 3.1rem); letter-spacing: -.03em; }
.exercise-kicker, .scenario-label, .exercise-start > span, .exercise-step > span { color: #aa8dff; }
.exercise-lead { color: var(--academy-muted); font-size: 1rem; line-height: 1.65; }
.exercise-explainer > div, .exercise-sheet .exercise-step, .attempt-history,
.attempt-review, .exercise-feedback, .exercise-official-steps li, .hint-box {
  border-color: var(--academy-border); border-radius: 13px; background: var(--academy-panel);
}
.scenario-card {
  padding: clamp(24px, 3vw, 38px); border-color: #4c4b8d; border-radius: var(--academy-radius);
  background: radial-gradient(circle at 100% 0, rgba(105,83,230,.1), transparent 36%), #111a31;
  box-shadow: 0 12px 36px rgba(0,0,0,.15);
}
.scenario-card > p { max-width: 72ch; font-size: clamp(1.1rem, 1.6vw, 1.32rem); line-height: 1.6; }
.scenario-objective { border-color: var(--academy-border); }
.exercise-sheet, .exercise-feedback { max-width: 100%; }
.exercise-sheet .exercise-step { padding: clamp(17px, 2vw, 25px); }
.exercise-sheet input, .exercise-sheet textarea, .exercise-sheet select {
  max-width: 100%; border-color: #3a496b; border-radius: 9px; background: #0d1729; color: var(--academy-ink);
}
.exercise-sheet input:focus-visible, .exercise-sheet textarea:focus-visible,
.exercise-sheet select:focus-visible, .exercise-toolbar button:focus-visible,
.academy-v2-journey button:focus-visible, .academy-v2-profile button:focus-visible {
  outline: 3px solid var(--academy-focus); outline-offset: 3px;
}
.exercise-feedback { background: #111b30; }
.feedback-grid article { border: 1px solid var(--academy-border); background: #17233a; }
.attempt-history > summary, .attempt-review > summary { color: #d2d8f1; }
.feedback-status.correct { color: #76d6ae; }
.feedback-status.partial { color: #ffd18a; }
.feedback-status.review { color: #ffabb1; }
.shell:has(.exercise-intro) button:disabled, .exercise-sheet :disabled { opacity: .55; cursor: not-allowed; }
.shell:has(.exercise-intro) [aria-busy="true"], .v3-dashboard [aria-busy="true"] { cursor: progress; }

@media (max-width: 1550px) and (min-width: 901px) {
  .v3-course-frame.tutor-open .v3-course-layout {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "outline tutor" "reading tutor";
  }
  .v3-course-frame.tutor-open .v3-outline { max-height: 43px; padding: 10px 14px; }
  .v3-course-frame.tutor-open .v3-outline[open] { max-height: min(35dvh, 280px); }
  .v3-course-frame.tutor-open .v3-outline ol { margin-top: 12px; }
  .v3-course-frame.tutor-open .v3-tutor-panel { height: 100%; }
}
@media (max-width: 1024px) {
  .v3-dashboard-grid { grid-template-columns: 1fr; }
  .v3-dashboard .v2-lower { padding: 16px 20px; }
  .v3-dashboard .v2-progress { display: grid; grid-template-columns: auto minmax(180px,1fr) auto; align-items: center; gap: 14px; }
  .v3-dashboard .v2-progress h2 { margin: 0; }
  .v3-dashboard .v3-progress-main { padding: 8px 12px; }
  .v3-dashboard .v3-progress-value { display: inline; margin: 0 10px 0 0; font-size: 1.25rem; }
  .v3-dashboard .v3-progress-main .v2-global-progress { display: inline-block; vertical-align: middle; min-width: 140px; }
  .v3-dashboard .v3-progress-metric, .v3-dashboard .v3-progress-details { display: none; }
  .v3-course-grid { gap: 12px; }
}
@media (max-width: 900px) {
  .shell:has(.academy-v2-navigation) { grid-template-columns: minmax(0,1fr); }
  .shell.course-focus.v2-course-focus { grid-template-columns: minmax(0, 1fr); }
  .shell.course-focus.v2-course-focus > .sidebar { display: none; }
  .shell.course-focus.v2-course-focus > .sidebar.open { display: flex; }
  .v3-dashboard-grid { grid-template-columns: 1fr; }
  .v3-dashboard .v3-hero { min-height: 340px; }
  .v3-course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .v3-course-frame.tutor-open .v3-course-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "tutor"; }
  .v3-course-frame.tutor-open .v3-course-heading,
  .v3-course-frame.tutor-open .course-progress-head,
  .v3-course-frame.tutor-open .course-replay-banner { display: none; }
  .v3-course-frame.tutor-open .v3-reading, .v3-course-frame.tutor-open .v3-outline { display: none; }
  .v3-course-frame.tutor-open .v3-tutor-panel { width: 100%; }
}
@media (max-width: 700px) {
  .shell:has(.v3-dashboard) .content { padding: 18px 14px 30px; }
  .v3-dashboard .v3-welcome h1 { font-size: clamp(1.65rem, 6vw, 2.05rem); }
  .v3-dashboard .v3-hero { display: flex; flex-direction: column; min-height: 0; padding: 0 20px 22px; }
  .v3-hero-visual { position: relative; z-index: 0; width: calc(100% + 40px); height: 172px; margin: 0 -20px 14px; }
  .v3-hero-visual::after { background: linear-gradient(0deg,#101830,transparent 48%); }
  .v3-hero-copy { width: 100%; min-height: 0; }
  .v3-dashboard .v3-hero h2 { font-size: clamp(1.6rem, 7vw, 2.15rem); }
  .v3-dashboard .v3-hero .v2-work-content { margin: 17px 0; }
  .v3-dashboard .v3-hero .v2-primary-action { width: auto; justify-content: center; }
  .v3-dashboard .v2-progress { display: block; }
  .v3-dashboard .v2-progress h2 { margin-bottom: 12px; }
  .v3-dashboard .v3-progress-main .v2-global-progress { width: calc(100% - 65px); }
  .v3-dashboard .v3-progress-metric { display: flex; padding-bottom: 6px; }
  .v3-dashboard .v3-progress-details { display: block; }
  .v3-course-grid { grid-template-columns: 1fr; }
  .v3-course-art { height: auto; }
  .v3-course-copy h3 { min-height: 0; }
  .shell.v2-course-focus .content { padding: 8px 10px max(8px, env(safe-area-inset-bottom)); }
  .v3-course-heading { align-items: center; padding-bottom: 8px; }
  .v3-course-heading h1 { font-size: 1.15rem; }
  .v3-course-heading span { font-size: .64rem; }
  .v3-course-subtitle { display: none; }
  .v3-course-progress-meta { font-size: .7rem; }
  .v3-course-progress-meta span { max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .v3-tutor-toggle { min-height: 40px; padding: 7px 9px; font-size: .73rem; }
  .v3-course-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "outline" "reading"; gap: 7px; }
  .v3-course-frame:not(.tutor-open) .v3-course-layout { grid-template-rows: auto minmax(0, 1fr); }
  .v3-course-frame.tutor-open .v3-course-layout { grid-template-rows: minmax(0, 1fr); }
  .v3-outline { max-height: 42px; min-height: 42px; padding: 9px 12px; overflow: auto; }
  .v3-outline[open] { max-height: min(34dvh, 240px); }
  .shell.v2-course-focus .v3-reading .course-section { padding: 18px 15px; }
  .v3-section-header .v3-concept-art { width: 30%; height: 74px; }
  .v3-tutor-panel { border-radius: 12px; }
  .v3-tutor-scroll { padding: 12px; }
  .v3-tutor-bottom { padding: 10px; }
  .v3-tutor-quick button { flex: 1; min-width: 0; padding-inline: 4px; }
  .v3-tutor-panel .tutor-compose footer small { display: none; }
  .v3-tutor-panel .tutor-compose footer { justify-content: flex-end; }
  .shell.v2-course-focus .v2-course-dock .v2-course-tutor { display: none; }
  .shell.v2-course-focus .v2-course-dock { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .exercise-intro { padding-top: 18px; }
  .exercise-intro h1 { font-size: clamp(1.8rem, 8vw, 2.3rem); }
  .scenario-card { padding: 22px 17px; }
  .exercise-explainer { grid-template-columns: 1fr; }
  .feedback-grid { grid-template-columns: 1fr; }
  .retry-row { flex-wrap: wrap; }
}
@media (max-width: 390px) {
  .v3-courses-heading { align-items: flex-start; }
  .v3-courses-heading button { max-width: 40%; font-size: .78rem; text-align: right; }
  .v3-course-heading h1 { font-size: 1.02rem; }
  .v3-tutor-toggle { max-width: 110px; white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .v3-dashboard *, .v3-course-frame * { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* V7: native, accessible formative reveal inside existing protected lessons. */
.shell.v2-course-focus .v3-reading .callout.practice {
  border: 1px solid #53638a;
  border-left: 3px solid #a4b8ff;
  background: #111c35;
  padding: 17px 20px;
}
.shell.v2-course-focus .v3-reading .callout.practice > strong { color: #eff3ff; }
.shell.v2-course-focus .v3-reading .callout.practice > p { margin: 12px 0 16px; }
.shell.v2-course-focus .v3-reading .callout.practice summary {
  cursor: pointer;
  font-weight: 700;
  color: #eff3ff;
  padding: 12px 0;
  line-height: 1.4;
}
.shell.v2-course-focus .v3-reading .callout.practice summary:focus-visible {
  outline: 2px solid #c4d1ff;
  outline-offset: -3px;
  border-radius: 10px;
}
.shell.v2-course-focus .v3-reading .callout.practice .practice-solution {
  margin: 0;
  max-width: none;
  border-top: 1px solid #384767;
}
.shell.v2-course-focus .v3-reading .callout.practice .practice-solution p { color: #b4e7cb; margin: 0 0 3px; }
.shell.v2-course-focus .v3-reading .v7-lesson-frame {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}
.shell.v2-course-focus .v3-reading .v7-lesson-frame > div,
.shell.v2-course-focus .v3-reading .v7-reference {
  border: 1px solid #364666;
  border-radius: 12px;
  background: #111b30;
  padding: 17px 20px;
}
.shell.v2-course-focus .v3-reading .v7-lesson-frame strong { color: #d3e0ff; }
.shell.v2-course-focus .v3-reading .v7-lesson-frame p { margin-bottom: 0; }
.shell.v2-course-focus .v3-reading .v7-lesson-frame li,
.shell.v2-course-focus .v3-reading .v7-reference li { margin: 7px 0; color: #d5def0; }
.shell.v2-course-focus .v3-reading .v7-reference { margin: 20px 0 32px; }
.shell.v2-course-focus .v3-reading .v7-reference summary { cursor: pointer; font-weight: 700; color: #eff3ff; }
.shell.v2-course-focus .v3-reading .v7-reference summary:focus-visible { outline: 2px solid #c4d1ff; outline-offset: 4px; }
.shell.v2-course-focus .v3-reading .v7-reference-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.shell.v2-course-focus .v3-reading .v7-reference dt { font-weight: 700; color: #d3e0ff; margin-top: 12px; }
.shell.v2-course-focus .v3-reading .v7-reference dd { margin: 4px 0 0; color: #d5def0; }
@media (max-width: 700px) {
  .shell.v2-course-focus .v3-reading .v7-lesson-frame,
  .shell.v2-course-focus .v3-reading .v7-reference-grid { grid-template-columns: 1fr; }
}
