/* Open Ground Lab player: styles.
   All colours are tokens on :root, so a client re-skin or a dark mode only changes this block. */

:root {
  --bg: #FAF8F4;
  --surface: #FFFFFF;
  --line: #E7E2D9;
  --sand: #D8CDB8;
  --ink: #2E2E2C;
  --muted: #5E6670;
  --sage: #6F8261;
  --sage-l: #E6EBDF;
  --link: #4F6244;
  --ph: #EDE9E2;
  --on-sage: #FFFFFF;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1E1F1D; --surface: #262725; --line: #3A3B38; --sand: #4A4840; --ink: #EDEAE4;
    --muted: #A9AEB4; --sage: #93A684; --sage-l: #2F3A2A; --link: #B2C4A1; --ph: #31322F;
    --on-sage: #1E1F1D; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1E1F1D; --surface: #262725; --line: #3A3B38; --sand: #4A4840; --ink: #EDEAE4;
  --muted: #A9AEB4; --sage: #93A684; --sage-l: #2F3A2A; --link: #B2C4A1; --ph: #31322F;
  --on-sage: #1E1F1D; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: Inter, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column; overflow: hidden;
}
:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
svg { display: block; }

/* ---------- Top bar ---------- */
.topbar {
  height: 60px; flex-shrink: 0; display: flex; align-items: center; gap: 20px;
  padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; background: none; border: 0; color: var(--ink); width: 44px; height: 44px; align-items: center; justify-content: center; cursor: pointer; }
.menu-btn svg { width: 24px; height: 24px; }
.logo { font-weight: 700; letter-spacing: .08em; font-size: 13px; color: var(--sage); white-space: nowrap; }
.course-title { font-weight: 600; font-size: 16px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.bar { width: 180px; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--sage); transition: width .4s; }

/* ---------- Layout ---------- */
.layout { flex: 1; display: flex; min-height: 0; position: relative; }
.shade { display: none; }

/* ---------- Menu ---------- */
.nav { width: 320px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: 12px 0; }
.sec { border-bottom: 1px solid var(--line); }
.sec-h {
  width: 100%; background: none; border: 0; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 20px; font-weight: 600; font-size: 14px;
}
.sec-h > span:last-child { flex-shrink: 0; white-space: nowrap; }
.sec-h small { font-weight: 400; color: var(--muted); font-size: 12px; white-space: nowrap; }
.chev { display: inline-block; margin-left: 8px; color: var(--muted); transition: transform .2s; }
.sec.open .chev { transform: rotate(90deg); }
.steps { display: none; padding-bottom: 8px; }
.sec.open .steps { display: block; }
.step {
  width: 100%; background: none; border: 0; border-left: 3px solid transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  display: flex; gap: 12px; align-items: center; padding: 9px 16px 9px 28px;
}
.step:hover { background: var(--bg); }
.step.cur { background: var(--sage-l); border-left-color: var(--sage); }
.step-text { flex: 1; font-size: 13.5px; line-height: 1.3; }
.step-text small { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.tick { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.step.done .tick { background: var(--sage); color: var(--on-sage); }
.tick svg { width: 12px; height: 12px; }
.phase { margin-top: 12px; padding: 18px 20px 8px; border-top: 2px solid var(--sage); font-size: 12.5px; font-weight: 600; color: var(--link); }
.phase small { display: block; margin-top: 2px; font-weight: 400; color: var(--muted); }

.ic { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--line); color: var(--muted); }
.ic svg { width: 15px; height: 15px; }

/* ---------- Activity panel ---------- */
.panel { flex: 1; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; }
.panel-head, .page, .pager { width: 100%; max-width: 860px; }
.panel-head { padding: 28px 48px 8px; }
.meta { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.meta .ic { width: 24px; height: 24px; }
.panel-head h1 { margin-top: 8px; font-size: 28px; font-weight: 600; line-height: 1.25; }

.page { flex: 1; padding: 16px 48px 8px; }
.page > * + * { margin-top: 20px; }
.page h2 { margin-top: 32px; font-size: 20px; font-weight: 600; line-height: 1.3; }
.page p, .page li { font-size: 16px; line-height: 1.65; }
.page ul, .page ol { padding-left: 24px; }
.page li + li { margin-top: 6px; }
.page a { color: var(--link); text-underline-offset: 3px; }
.page img { display: block; max-width: 100%; height: auto; border-radius: 10px; }
.muted { color: var(--muted); }
figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }

.placeholder {
  aspect-ratio: 16 / 9; width: 100%; padding: 16px; border: 1px dashed var(--sand); border-radius: 10px; background: var(--ph);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; font-size: 13px; color: var(--muted);
}
.placeholder svg { width: 28px; height: 28px; }
.notice { padding: 18px 22px; border: 1px dashed var(--sand); border-radius: 10px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.callout { padding: 18px 22px; border-radius: 10px; background: var(--sage-l); font-size: 16px; line-height: 1.6; }
.callout strong:first-child { display: block; margin-bottom: 4px; }

.video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #2E2E2C; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
video.video { display: block; }
.video.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #D8CDB8; font-size: 13px; }
.video.empty svg { width: 28px; height: 28px; }

.launch { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.launch .placeholder, .launch img { height: 100%; min-height: 220px; aspect-ratio: auto; border: 0; border-radius: 0; object-fit: cover; }
.launch-body { padding: 24px; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.launch-body h2 { margin: 0; font-size: 19px; }
.launch-body p { font-size: 15px; line-height: 1.55; color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); }

.btn-primary {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 12px 18px;
  border: 0; border-radius: 8px; background: var(--ink); color: var(--surface); font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-primary svg { width: 16px; height: 16px; }
.btn-primary:disabled, .btn-primary[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-dev { align-self: flex-start; min-height: 36px; padding: 7px 12px; border: 1px dashed var(--sage); border-radius: 6px; background: none; color: var(--link); font: inherit; font-size: 13px; cursor: pointer; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.card:hover { border-color: var(--sage); }
.card.phase-card { border-color: var(--sage); background: var(--sage-l); }
.card .num { font-size: 12.5px; color: var(--muted); }
.card h3 { font-size: 16px; font-weight: 600; line-height: 1.3; }
.card .desc { font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.card .go { margin-top: auto; padding-top: 4px; font-size: 13px; color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.tbar { height: 4px; border-radius: 2px; overflow: hidden; background: var(--line); }
.tbar i { display: block; height: 100%; background: var(--sage); }
.badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; background: var(--sage-l); color: var(--link); font-size: 12.5px; }
.card.phase-card .badge { background: var(--surface); }
.badge svg { width: 14px; height: 14px; }

.endmark { display: flex; align-items: center; gap: 8px; padding: 24px 0 8px; font-size: 13px; color: var(--muted); }
.endmark svg, .okmsg svg { width: 16px; height: 16px; }
.okmsg { display: flex; align-items: center; gap: 8px; color: var(--link); font-weight: 600; }

.pager { display: flex; justify-content: space-between; gap: 12px; padding: 18px 48px 32px; }
.pager-btn {
  max-width: 45%; min-height: 44px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  color: var(--ink); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.pager-btn small { display: block; font-size: 11px; color: var(--muted); }
.pager-btn.next { margin-left: auto; background: var(--ink); border-color: var(--ink); color: var(--surface); text-align: right; }
.pager-btn.next small { color: var(--sand); }
.pager-btn[hidden] { display: none; }

/* ---------- Course assistant (placeholder) ---------- */
.bubble {
  position: fixed; right: 24px; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  width: 52px; height: 52px; border: 0; border-radius: 50%; background: var(--sage); color: var(--on-sage);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); cursor: pointer;
}
.bubble svg { width: 24px; height: 24px; }
.bubble-pop {
  position: fixed; right: 24px; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); z-index: 30; max-width: 280px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
  font-size: 14px; line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  .bar i, .chev, .nav { transition: none; }
}

/* ---------- Narrow screens ---------- */
@media (max-width: 820px) {
  .topbar { gap: 10px; padding: 0 10px; }
  .menu-btn { display: flex; }
  .logo { display: none; }
  .course-title { font-size: 15px; }
  .bar { width: 64px; }
  .nav {
    position: absolute; top: 0; bottom: 0; left: 0; z-index: 20; width: 85%; max-width: 340px;
    transform: translateX(-100%); transition: transform .25s;
  }
  body.nav-open .nav { transform: none; box-shadow: 4px 0 16px rgba(0, 0, 0, .15); }
  body.nav-open .shade { display: block; position: absolute; inset: 0; z-index: 10; background: rgba(0, 0, 0, .3); }
  .panel-head { padding: 20px 18px 6px; }
  .panel-head h1 { font-size: 22px; }
  .page { padding: 12px 18px 8px; }
  .launch { grid-template-columns: 1fr; }
  .launch .placeholder, .launch img { aspect-ratio: 16 / 9; min-height: 0; }
  .pager { padding: 14px 18px 90px; }
  .pager-btn { max-width: 48%; padding: 9px 12px; }
  .bubble { right: 16px; width: 48px; height: 48px; }
  .bubble-pop { right: 16px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
