/* Scoped classroom styles. Keep in priority to respect the existing important-layer order. */
@layer priority {
  body:has(#classroomView:not(.hidden)) { --classroom-green:#123f32; --classroom-muted:#64736b; }
  body:has(#classroomView:not(.hidden)) .topbar { display:none !important; }
  body:has(#classroomView:not(.hidden)) .main { padding:24px 28px 40px !important; min-width:0; }
  #classroomView [hidden] { display:none !important; }
  #classroomView .classroom-page-actions { display:flex !important; justify-content:space-between; gap:12px; margin:0 0 18px !important; }
  #classroomView .classroom-sidebar-toggle { display:inline-flex !important; }
  #classroomView .classroom { display:grid !important; grid-template-columns:minmax(0,1fr) 300px !important; grid-template-areas:'head lessons' 'player lessons' 'nav lessons' 'info lessons'; gap:16px 22px !important; align-items:start; }
  #classroomView .video-area { display:contents !important; }
  #classroomView .watching-panel { grid-area:head; padding:0 !important; background:transparent !important; border:0 !important; box-shadow:none !important; }
  #classroomView .watching-panel .eyebrow { font-size:10px !important; letter-spacing:.13em; color:var(--classroom-muted) !important; margin:0 0 5px; }
  #classroomView .watching-panel h2 { color:var(--classroom-green) !important; font-size:clamp(21px,2vw,29px) !important; margin:0 !important; line-height:1.25; }
  #classroomView .classroom-progress { display:flex; align-items:center; gap:14px; margin-top:12px !important; }
  #classroomView .classroom-progress span { font-size:12px !important; color:var(--classroom-muted) !important; }
  #classroomView .classroom-progress .progress-track { width:100px; height:5px !important; background:#dfE7df !important; }
  #classroomView .classroom-progress .progress-bar { background:#b49a5d !important; }
  #classroomView .classroom-player-block { grid-area:player; min-width:0; scroll-margin-top:16px; }
  #classroomView .video-frame { width:100% !important; aspect-ratio:16/9 !important; max-height:none !important; background:#0c2b22 !important; border:0 !important; border-radius:16px !important; box-shadow:0 12px 32px #123f3218 !important; }
  #classroomView .video-frame iframe { position:absolute !important; inset:0; width:100% !important; height:100% !important; }
  #classroomView .video-cover { background-color:#0c2b22 !important; background-image:var(--classroom-cover, radial-gradient(ellipse at 70% 20%,#29654e,transparent 65%),linear-gradient(135deg,#0b2b22,#163e31)) !important; background-size:cover; background-position:center; gap:12px !important; }
  #classroomView .video-play-icon { width:66px; height:66px; color:#173f31 !important; background:#f8f4e8; box-shadow:0 0 0 12px #ffffff0a; }
  #classroomView .video-cover strong { color:#fff; font-size:17px; line-height:1.4; margin:0 !important; position:static !important; }
  #classroomView .video-cover small { color:#dfE9df; font-size:12px; line-height:1.4; margin:0 !important; position:static !important; }
  #classroomView .video-empty-label { display:none; }
  #classroomView .video-frame.video-unavailable { display:grid; place-items:center; aspect-ratio:auto !important; min-height:100px; }
  #classroomView .video-unavailable iframe { display:none; }
  #classroomView .video-unavailable .video-empty-label { display:block; padding:24px; color:#eee9da; text-align:center; }
  #classroomView .video-feedback { display:flex; align-items:center; gap:12px; padding:9px 2px 0; }
  #classroomView .video-feedback p { margin:0; color:var(--classroom-muted); font-size:12px; line-height:1.5; flex:1; }
  #classroomView .video-feedback button { flex-shrink:0; font-size:12px; }
  #classroomView .lesson-nav-actions { grid-area:nav; display:grid !important; grid-template-columns:1fr auto 1fr !important; align-items:center; gap:10px; margin:0 !important; padding:0; }
  #classroomView .lesson-nav-actions span { font-size:12px; text-align:center; color:var(--classroom-muted); }
  #classroomView .lesson-nav-actions button:last-child { justify-self:end !important; }
  #classroomView .lesson-list { grid-area:lessons; padding:16px !important; border:1px solid #dedfd2 !important; border-radius:16px !important; background:#fffef9 !important; box-shadow:none !important; position:sticky !important; top:18px !important; max-height:calc(100dvh - 40px) !important; overflow-y:auto !important; min-width:0; width:100% !important; }
  #classroomView .lesson-list summary { cursor:pointer; color:var(--classroom-green); font-weight:700; font-size:15px; min-height:44px; line-height:1.5; padding:9px 0; }
  #classroomView .lesson-list summary span { display:block; font-size:11px; font-weight:500; color:var(--classroom-muted); }
  #classroomView .module-toggle { color:var(--classroom-green) !important; font-size:13px !important; min-height:44px !important; }
  #classroomView .module-toggle::after { color:var(--classroom-green) !important; background:#eef2e9 !important; border-color:#d9e2d6 !important; }
  #classroomView .module-toggle small { color:var(--classroom-muted) !important; font-size:11px !important; }
  #classroomView .lesson-button { width:100%; min-height:54px !important; font-size:13px !important; color:#354c40 !important; border:1px solid transparent !important; background:transparent !important; padding:12px !important; line-height:1.5; text-align:left; overflow-wrap:anywhere; }
  #classroomView .lesson-button.active { background:#eaf1e5 !important; border-color:#a9bda1 !important; color:#123f32 !important; outline:0 !important; box-shadow:inset 3px 0 #123f32; }
  #classroomView .lesson-button.done:not(.active) { color:#596a60 !important; background:#f5f6f0 !important; }
  #classroomView .lesson-button span { font-size:11px !important; color:#64736b !important; }
  #classroomView button:disabled { opacity:.5; cursor:not-allowed; }
  #classroomView .lesson-info { grid-area:info; min-width:0; margin:0 !important; padding:22px !important; border:1px solid #e1e2d7 !important; border-radius:16px !important; background:#fffef9 !important; box-shadow:none !important; }
  #classroomView .lesson-info .eyebrow { color:#71806a !important; font-size:11px !important; margin:0 0 5px; }
  #classroomView .lesson-info h2 { color:var(--classroom-green) !important; margin:0 0 18px !important; font-size:23px !important; line-height:1.35; }
  #classroomView .classroom-tabs { display:flex; gap:6px; border-bottom:1px solid #e1e2d7; }
  #classroomView .classroom-tabs button { flex:1; border:0; border-bottom:3px solid transparent; border-radius:7px 7px 0 0; background:transparent; color:#64736b; font:inherit; font-size:13px; font-weight:600; padding:12px 8px; min-height:46px; cursor:pointer; }
  #classroomView .classroom-tabs [aria-selected=true] { color:var(--classroom-green); border-bottom-color:var(--classroom-green); background:#eff3e9; }
  #classroomView .classroom-tab-panel { padding:18px 0; min-height:110px; }
  #classroomView #lessonText { margin:0 !important; font-size:14px; line-height:1.75 !important; color:#4e6055 !important; white-space:pre-line; }
  #classroomView .lesson-notes { margin:0 !important; padding:0 !important; border:0 !important; background:transparent !important; display:grid; gap:10px; }
  #classroomView .lesson-notes label { color:var(--classroom-green) !important; font-size:13px; }
  #classroomView .lesson-notes textarea { width:100%; resize:vertical; min-height:120px; font-size:16px; color:#243e30 !important; border:1px solid #cbd8c8 !important; background:white !important; }
  #classroomView .lesson-notes small { color:var(--classroom-muted); font-size:12px; }
  #classroomView .classroom-lesson-actions { display:flex; flex-wrap:wrap; gap:10px; border-top:1px solid #e5e7dc; padding-top:16px; }
  #classroomView :is(.ghost-button,.secondary-button,.primary-button) { min-height:44px !important; padding:10px 14px !important; font-size:13px !important; border-radius:9px !important; width:auto !important; }
  #classroomView :is(.ghost-button,.secondary-button) { background:#fffef9 !important; color:#123f32 !important; border:1px solid #d6dece !important; }
  #classroomView .primary-button { color:white !important; background:#123f32 !important; border:1px solid #123f32 !important; }
  #classroomView :is(button,a,summary,textarea,[tabindex]):focus-visible { outline:3px solid #9a792e !important; outline-offset:3px; }
  #classroomView .material-inline { display:grid; gap:10px; }
  #classroomView .material-card { min-height:56px; }
  #classroomView .classroom-empty { color:var(--classroom-muted); font-size:14px; margin:0; }
  body:has(#classroomView:not(.hidden)) .app-shell.classroom-sidebar-collapsed #classroomView .classroom { grid-template-columns:minmax(0,1000px) !important; grid-template-areas:'head' 'player' 'nav' 'info'; justify-content:center; }
  .app-shell.classroom-sidebar-collapsed #classroomView #classroomLessons { display:none !important; }
  @media (max-width:1100px), (max-height:600px) {
    body:has(#classroomView:not(.hidden)) .app-shell { display:grid !important; grid-template-columns:200px minmax(0,1fr) !important; }
    body:has(#classroomView:not(.hidden)) #platformSidebar { width:100% !important; }
    #classroomView .classroom { grid-template-columns:minmax(0,1fr) !important; grid-template-areas:'head' 'player' 'nav' 'lessons' 'info' !important; gap:14px !important; }
    #classroomView .lesson-list { position:static !important; max-height:none !important; overflow:visible !important; padding:10px 16px !important; }
    #classroomView .lesson-list summary span { display:inline; margin-left:10px; }
    body:has(#classroomView:not(.hidden)) .app-shell.classroom-sidebar-collapsed { grid-template-columns:minmax(0,1fr) !important; }
  }
  @media (min-width:761px) and (max-height:500px) and (max-width:1000px) {
    body:has(#classroomView:not(.hidden)) #platformSidebar { display:none !important; }
    body.mobile-sidebar-open:has(#classroomView:not(.hidden)) #platformSidebar { display:flex !important; position:fixed !important; inset:0 auto 0 0 !important; width:min(85vw,300px) !important; height:100dvh !important; overflow-y:auto !important; z-index:1000 !important; transform:none !important; visibility:visible !important; }
    body.mobile-sidebar-open:has(#classroomView:not(.hidden)) #sidebarClose { display:block !important; }
    body:has(#classroomView:not(.hidden)) #mobileSidebarOpen { display:block !important; }
  }
  @media (max-width:760px), (max-height:500px) and (max-width:1000px) {
    body:has(#classroomView:not(.hidden)) .app-shell { display:block !important; }
    body:has(#classroomView:not(.hidden)) #platformSidebar { width:min(88vw,300px) !important; }
    body:has(#classroomView:not(.hidden)) .main { padding:64px 12px 28px !important; }
    #classroomView .classroom-page-actions { gap:8px; margin-bottom:15px !important; }
    #classroomView .classroom-page-actions button { font-size:11px !important; padding:8px 10px !important; }
    #classroomView .watching-panel h2 { font-size:22px !important; }
    #classroomView .watching-panel .eyebrow { font-size:9px !important; }
    #classroomView .classroom-progress { margin-top:8px !important; }
    #classroomView .video-frame { border-radius:12px !important; }
    #classroomView .lesson-nav-actions { gap:6px; }
    #classroomView .lesson-nav-actions button { font-size:11px !important; padding:9px 10px !important; }
    #classroomView .lesson-nav-actions span { font-size:10px; }
    #classroomView .lesson-info { padding:16px !important; }
    #classroomView .lesson-info h2 { font-size:21px !important; }
    #classroomView .video-feedback { flex-wrap:wrap; }
    #classroomView .video-feedback p { flex-basis:100%; font-size:11px; }
    #classroomView .classroom-lesson-actions .primary-button { width:100% !important; }
    #classroomView .classroom-tab-panel { padding:15px 0; }
  }
  @media (prefers-reduced-motion:reduce) { #classroomView *, #classroomView *::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; } }
  @media (min-width:761px) and (max-width:1000px) and (max-height:500px) {
    body:has(#classroomView:not(.hidden)) .main { padding:12px !important; }
    body:has(#classroomView:not(.hidden)) #mobileSidebarOpen { position:fixed !important; top:12px !important; left:12px !important; width:44px !important; height:44px !important; border:0 !important; border-radius:9px; background:#123f32; color:white; z-index:900; }
    #classroomView .classroom-page-actions { margin-left:54px !important; margin-bottom:8px !important; }
    #classroomView .watching-panel .eyebrow, #classroomView .classroom-progress { display:none !important; }
    #classroomView .watching-panel h2 { font-size:16px !important; }
    #classroomView .classroom { gap:8px !important; }
    #classroomView .classroom-player-block { width:min(100%,calc((100svh - 170px) * 16 / 9)); justify-self:center; }
    #classroomView .video-cover { gap:6px !important; }
    #classroomView .video-play-icon { height:44px; width:44px; }
    #classroomView .video-cover strong { font-size:14px; }
  }
}
