:root {
  color-scheme: dark;
  --ink: #06141f;
  --ink-2: #0b2230;
  --panel: #0d2735;
  --line: rgba(205, 230, 237, 0.13);
  --muted: #9db3bb;
  --cream: #fff5d6;
  --gold: #ffc83d;
  --teal: #28c6b9;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--ink); }
body { color: #fff; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button { font: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(circle at 78% 18%, rgba(40, 198, 185, 0.08), transparent 28%), linear-gradient(145deg, #071824, #0a1b25 58%, #07131b);
}

.library {
  position: relative;
  z-index: 20;
  display: flex;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(4, 15, 23, 0.96);
  box-shadow: 16px 0 40px rgba(0, 0, 0, 0.2);
}

.brand-block { display: flex; align-items: center; gap: 13px; min-height: 90px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.brand-mark { display: grid; width: 45px; height: 45px; place-items: center; border: 2px solid var(--gold); border-radius: 14px 5px 14px 5px; color: var(--gold); font-weight: 1000; letter-spacing: -0.08em; transform: rotate(-2deg); }
.brand-block h1, .presentation-header h2, .planned-panel h2, .planned-panel h3, .notes-panel h3 { margin: 0; }
.brand-block h1 { font-size: 17px; letter-spacing: -0.02em; }
.eyebrow { margin: 0 0 4px; color: var(--teal); font-size: 11px; font-weight: 900; letter-spacing: 0.13em; }

.library-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 14px; }
.library-help { margin: 0; color: var(--muted); font-size: 13px; }
.ready-pill, .lesson-ready, .lesson-planned { border-radius: 999px; font-size: 9px; font-weight: 900; letter-spacing: 0.08em; }
.ready-pill { padding: 5px 8px; color: #05231f; background: var(--teal); white-space: nowrap; }

.unit-list { min-height: 0; padding: 0 12px 16px; overflow-y: auto; scrollbar-color: rgba(255,255,255,.2) transparent; }
.unit { margin-bottom: 6px; }
.unit-button, .lesson-button { width: 100%; border: 0; color: #fff; text-align: left; cursor: pointer; }
.unit-button { display: grid; grid-template-columns: 5px minmax(0, 1fr) 24px; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 12px; background: transparent; }
.unit-button:hover, .unit--open > .unit-button { background: rgba(255, 255, 255, 0.055); }
.unit-swatch { width: 5px; height: 34px; border-radius: 999px; }
.unit-name { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.unit-name strong { font-size: 14px; line-height: 1.15; }
.unit-name small { color: var(--muted); font-size: 11px; }
.chevron { color: var(--muted); font-size: 22px; text-align: center; transition: transform .18s ease; }
.unit--open .chevron { transform: rotate(180deg); }

.lesson-list { display: flex; flex-direction: column; gap: 4px; margin: 2px 0 10px 18px; padding-left: 14px; border-left: 1px solid var(--line); }
.lesson-button { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px 10px 12px; border-radius: 9px; background: transparent; }
.lesson-button:hover { background: rgba(255,255,255,.045); }
.lesson-button--active { background: rgba(40, 198, 185, 0.12); box-shadow: inset 2px 0 var(--teal); }
.lesson-button > span { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.lesson-button strong { font-size: 12px; }
.lesson-button small { color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson-ready { padding: 4px 6px; color: #05231f; background: var(--teal); }
.lesson-planned { color: #6f858d; }

.library-footer { display: flex; align-items: center; gap: 6px; margin-top: auto; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.keyboard-key { display: grid; min-width: 22px; height: 22px; place-items: center; border: 1px solid var(--line); border-radius: 5px; color: var(--cream); background: rgba(255,255,255,.05); }
.keyboard-key:nth-of-type(3) { margin-left: 7px; }

.presentation-pane { display: flex; min-width: 0; min-height: 0; flex-direction: column; background: #071824; }
.presentation-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 90px; padding: 16px 28px; border-bottom: 1px solid var(--line); background: rgba(6, 20, 31, 0.92); }
.presentation-title-group, .header-actions, .notes-heading { display: flex; align-items: center; }
.presentation-title-group { gap: 13px; }
.header-actions { gap: 10px; }
.header-swatch { width: 6px; height: 44px; border-radius: 999px; }
.presentation-header h2 { color: var(--cream); font-size: 24px; letter-spacing: -0.03em; }

.secondary-button, .present-button, .presentation-controls button, .icon-button { border: 0; color: #fff; cursor: pointer; }
.secondary-button, .present-button { min-height: 44px; padding: 0 17px; border-radius: 12px; font-weight: 850; }
.secondary-button { border: 1px solid var(--line); color: var(--cream); background: rgba(255,255,255,.045); }
.secondary-button:hover, .secondary-button.is-active { border-color: rgba(40,198,185,.6); background: rgba(40,198,185,.1); }
.present-button { display: flex; align-items: center; gap: 9px; color: #071824; background: var(--gold); box-shadow: 0 8px 24px rgba(255,200,61,.16); }
.present-button:hover { filter: brightness(1.07); }
.icon-button { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 10px; background: rgba(255,255,255,.06); font-size: 22px; }
.library-toggle, .mobile-close { display: none; }

.viewer-grid { display: flex; min-width: 0; min-height: 0; flex: 1; }
.viewer-main { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; align-items: center; padding: 24px 28px 16px; overflow: hidden; }
.stage-card { position: relative; display: flex; width: min(100%, calc((100vh - 248px) * 16 / 9)); aspect-ratio: 16 / 9; align-items: center; justify-content: center; overflow: hidden; border: 1px solid rgba(255,255,255,.13); border-radius: 15px; background: #000; box-shadow: 0 26px 72px rgba(0,0,0,.38); }
.stage-card img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; }
.fullscreen-hint { position: absolute; top: 16px; right: 16px; padding: 7px 10px; border-radius: 999px; color: #d9e4e8; background: rgba(4,12,18,.72); font-size: 11px; opacity: .75; }
.presentation-pane:not(:fullscreen) .fullscreen-hint { display: none; }

.presentation-controls { display: flex; align-items: center; gap: 14px; margin-top: 13px; }
.presentation-controls button { display: grid; width: 45px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.055); font-size: 22px; }
.presentation-controls button:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.presentation-controls button:disabled { cursor: default; opacity: .3; }
.slide-status { display: flex; min-width: 72px; justify-content: center; gap: 7px; color: var(--muted); font-size: 14px; }
.slide-status strong { color: var(--cream); }

.thumbnail-strip { display: flex; width: 100%; max-width: 1120px; gap: 9px; margin-top: 12px; padding: 5px 3px 8px; overflow-x: auto; }
.thumbnail { position: relative; flex: 0 0 105px; aspect-ratio: 16 / 9; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 8px; background: #000; cursor: pointer; opacity: .55; }
.thumbnail:hover { opacity: .82; }
.thumbnail--active { border-color: var(--gold); opacity: 1; box-shadow: 0 0 0 3px rgba(255,200,61,.12); }
.thumbnail img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumbnail span { position: absolute; right: 4px; bottom: 3px; display: grid; width: 18px; height: 18px; place-items: center; border-radius: 50%; color: #071824; background: var(--gold); font-size: 9px; font-weight: 900; }

.notes-panel { width: 300px; padding: 24px; border-left: 1px solid var(--line); background: rgba(4, 15, 23, .96); }
.notes-heading { justify-content: space-between; gap: 15px; }
.notes-panel h3 { color: var(--cream); font-size: 22px; }
.notes-panel > p { margin: 28px 0; color: #d8e4e8; font-size: 17px; font-weight: 650; line-height: 1.6; }
.notes-tip { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid rgba(40,198,185,.3); border-radius: 14px; color: var(--muted); background: rgba(40,198,185,.07); font-size: 12px; line-height: 1.5; }
.notes-tip strong { color: var(--teal); }

.planned-panel { position: relative; display: flex; max-width: 680px; min-height: 0; flex: 1; flex-direction: column; justify-content: center; align-self: center; padding: 60px; }
.planned-orb { position: absolute; top: 20%; right: 0; width: 220px; height: 220px; border-radius: 50%; opacity: .11; filter: blur(8px); }
.planned-panel h2 { color: var(--cream); font-size: clamp(38px, 5vw, 68px); line-height: .98; letter-spacing: -0.05em; }
.planned-panel h3 { margin-top: 18px; color: var(--gold); font-size: 28px; }
.planned-panel > p { max-width: 600px; color: #c8d7dc; font-size: 19px; line-height: 1.6; }
.planned-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.04); }
.planned-card span { color: var(--muted); font-size: 13px; }

.presentation-pane:fullscreen { width: 100vw; height: 100vh; background: #000; }
.presentation-pane:fullscreen .presentation-header, .presentation-pane:fullscreen .thumbnail-strip, .presentation-pane:fullscreen .notes-panel { display: none; }
.presentation-pane:fullscreen .viewer-main { padding: 0; background: #000; }
.presentation-pane:fullscreen .stage-card { width: 100%; max-width: none; height: calc(100vh - 58px); flex: 1; border: 0; border-radius: 0; box-shadow: none; }
.presentation-pane:fullscreen .presentation-controls { width: 100%; min-height: 58px; margin: 0; justify-content: center; background: #041019; }

.mobile-backdrop { display: none; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .library { position: fixed; inset: 0 auto 0 0; width: min(360px, 88vw); transform: translateX(-103%); transition: transform .2s ease; }
  .library--open { transform: translateX(0); }
  .library-toggle, .mobile-close { display: grid; }
  .mobile-close { margin-left: auto; }
  .mobile-backdrop { position: fixed; inset: 0; z-index: 15; display: block; border: 0; background: rgba(0,0,0,.55); }
  .mobile-backdrop:not(.mobile-backdrop--open) { display: none; }
  .presentation-header { padding: 14px 18px; }
  .secondary-button { display: none; }
  .viewer-main { padding: 18px 14px 12px; }
  .stage-card { width: 100%; }
}

@media (max-width: 620px) {
  .presentation-header h2 { font-size: 19px; }
  .presentation-header .eyebrow { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .present-button { padding: 0 12px; }
  .present-button span { display: none; }
  .thumbnail { flex-basis: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
