:root {
  --studio-header: 68px;
  --studio-sidebar: 208px;
  --studio-ink: #101b18;
  --studio-lime: #d7f992;
  --studio-forest: #153b30;
  --studio-hero-text: #f5faef;
  --studio-hero-muted: #c4d2c8;
}

body:not(.light) {
  --bg: #f5f7f2;
  --panel: #ffffff;
  --line: #dce5da;
  --muted: #51605a;
  --text: #18251f;
  --accent: #245846;
  --input: #f3f6ef;
  --soft: #e9efe5;
  --studio-surface: #fff;
  --studio-float: rgb(250 252 248 / 95%);
  --studio-shadow: 0 16px 46px rgb(29 47 34 / 5%);
  --studio-blue: #245747;
  --studio-on-blue: #fff;
  --studio-blue-tint: #e7f0e4;
  --studio-blue-line: #cadcc6;
  --fw-glass: #fff;
  --fw-glass-border: #dce5da;
}

body.light {
  --bg: #111917;
  --panel: #17231e;
  --line: #34443b;
  --muted: #b6c7bd;
  --text: #eff7eb;
  --accent: #ccefa6;
  --input: #14201b;
  --soft: #25362e;
  --studio-surface: #17231e;
  --studio-float: rgb(21 33 27 / 94%);
  --studio-shadow: 0 14px 42px rgb(0 0 0 / 20%);
  --studio-blue: #caeeac;
  --studio-on-blue: #152719;
  --studio-blue-tint: #253b29;
  --studio-blue-line: #46614a;
  --fw-glass: #17231e;
  --fw-glass-border: #34443b;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Avenir Next", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body > header {
  position: sticky;
  inset: 0 0 auto;
  z-index: 16;
  min-height: var(--studio-header);
  margin: 0;
  padding: 8px clamp(16px, 2.7vw, 42px);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

body > header .brand strong { font-size: 19px; font-weight: 760; }
body > header .brand .logo { width: 36px; height: 36px; }
body > header .brand .fw-mark { filter: hue-rotate(311deg) saturate(.7); }
body > header :is(#today, #menu, #backup, #restore, #fwSecure) { display: none; }
.header-actions { flex-wrap: nowrap; gap: 8px; }
.header-actions #theme { font-size: .78rem; }
.header-actions .studio-search-open {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-color: var(--line);
  background: var(--input);
  padding-inline: 12px;
  border-radius: 12px;
}
.studio-search-open kbd {
  padding-inline: 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: .7rem;
}
.studio-magnifier {
  display: inline-block;
  position: relative;
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border: 1.6px solid currentColor;
  border-radius: 50%;
}
.studio-magnifier::after {
  position: absolute;
  content: "";
  width: 6px;
  height: 1.6px;
  background: currentColor;
  top: 9px;
  left: 8px;
  transform: rotate(47deg);
  transform-origin: left;
}

.shell, .fw-roadmap-closed .shell, .focus-mode .shell {
  display: block;
  width: min(100%, 1560px);
  margin-inline: auto;
  padding: clamp(18px, 2.7vw, 40px) clamp(18px, 3.6vw, 54px) 38px;
  padding-inline-start: calc(var(--studio-sidebar) + clamp(18px, 3.6vw, 54px));
}
.shell main { width: 100%; max-width: 1160px; margin-inline: auto; }
.focus-mode .shell main { max-width: 830px; }
body.fw-compact { --studio-sidebar: 69px; }

.fw-rail {
  top: var(--studio-header);
  left: 0;
  bottom: 0;
  width: var(--studio-sidebar);
  align-items: stretch;
  padding: 16px 12px;
  gap: 4px;
  border: 0;
  border-inline-end: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}
body.fw-compact .fw-rail { border-radius: 0; padding-inline: 8px; }
body .fw-rail button,
body.fw-compact .fw-rail button {
  flex-direction: row;
  justify-content: flex-start;
  gap: 11px;
  width: 100%;
  padding: 7px 13px;
  border-radius: 11px;
  min-height: 43px;
  font-size: .85rem;
  letter-spacing: -.006em;
}
.fw-rail button svg { width: 19px; height: 19px; }
.fw-rail #fwFold { order: 99; margin-top: auto; }
.fw-rail #fwFold span { font-size: .8rem; }
.fw-rail #fwRoadmap { order: -1; border: 1px solid var(--line); margin-bottom: 7px; }
.fw-rail .fw-rail-sep { width: 100%; margin: 3px 0; }
body.fw-compact .fw-rail button { justify-content: center; padding-inline: 4px; }

aside#fwCurriculum,
.fw-roadmap-closed aside#fwCurriculum {
  display: block;
  position: fixed;
  z-index: 22;
  inset: var(--studio-header) auto 0 var(--studio-sidebar);
  width: min(355px, calc(100vw - var(--studio-sidebar)));
  height: auto;
  padding: 18px;
  border: 0;
  border-radius: 0 21px 21px 0;
  background: var(--studio-surface);
  box-shadow: 13px 0 46px rgb(11 28 21 / 14%);
  visibility: visible;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  overscroll-behavior: contain;
}
.fw-roadmap-closed aside#fwCurriculum {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-12px);
}
body:not(.fw-roadmap-closed) .sidebar-overlay {
  display: block;
  position: fixed;
  inset: var(--studio-header) 0 0 var(--studio-sidebar);
  z-index: 18;
  background: rgb(13 31 23 / 24%);
}
.side-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-title .eyebrow { color: var(--text); font-size: 1.08rem; letter-spacing: -.02em; }
.side-title .mobile-close { display: inline-grid; min-width: 44px; min-height: 44px; place-items: center; }
aside#fwCurriculum .atlas-account { padding: 11px; margin-block: 13px; border-radius: 12px; }
aside#fwCurriculum .fieldwork-quick { display: none; }
aside#fwCurriculum #search { min-height: 46px; border-radius: 12px; font-size: 1rem; }
aside#fwCurriculum #nav button { min-height: 43px; border-radius: 10px; }

body[data-studio-view]:not([data-studio-view="lesson"]) #overview { display: none; }
.studio-hero { margin: 0; }
.studio-hero-stage {
  position: relative;
  display: grid;
  isolation: isolate;
  grid-template-columns: minmax(0, 1.05fr) minmax(180px, .95fr);
  align-items: center;
  min-height: 310px;
  overflow: hidden;
  border-radius: 25px;
  border: 1px solid #32493e;
  background: radial-gradient(ellipse at 79% 44%, #304d47 0, #192e28 32%, #12211c 71%, #101c18 100%);
  box-shadow: 0 24px 52px rgb(15 39 27 / 12%);
  color: var(--studio-hero-text);
}
.studio-hero-copy {
  position: relative;
  z-index: 2;
  padding: clamp(24px, 4vw, 51px);
  padding-right: 0;
}
.studio-hero-copy .eyebrow {
  color: var(--studio-lime);
  font-weight: 690;
  font-size: .7rem;
  letter-spacing: .14em;
}
.studio-hero-copy h2 {
  max-width: 15ch;
  margin: 10px 0;
  color: var(--studio-hero-text);
  font-size: clamp(2rem, 4.65vw, 4.7rem);
  font-weight: 720;
  letter-spacing: -.065em;
  line-height: .99;
  text-wrap: balance;
}
.studio-hero-copy p { margin: 14px 0; color: var(--studio-hero-muted); font-size: .9rem; }
.studio-hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 19px; }
body .studio-hero-actions button.primary {
  color: #152510;
  background: var(--studio-lime);
  border-color: var(--studio-lime);
  box-shadow: 0 4px 20px rgb(198 245 134 / 16%);
}
body .studio-hero-actions button:not(.primary),
body.light .studio-hero-actions button:not(.primary) {
  color: var(--studio-hero-text);
  border-color: #64736a;
  background: rgb(228 249 226 / 7%);
}
.studio-hero-actions button { min-height: 46px; font-size: .86rem; }
.studio-hero-visual {
  position: relative;
  aspect-ratio: 1.25;
  align-self: stretch;
  width: 100%;
  min-width: 0;
}
.studio-orb {
  position: absolute;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
}
.studio-orb::before {
  position: absolute;
  inset: 7% 5%;
  z-index: 0;
  content: "";
  border: 1px solid rgb(221 248 231 / 13%);
  border-radius: 50%;
  transform: rotate(-26deg);
  box-shadow: 0 0 0 21px rgb(221 248 231 / 5%), 0 0 0 43px rgb(221 248 231 / 3%);
}
.studio-orb::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  background: radial-gradient(ellipse, rgb(175 231 185 / 22%), transparent 61%);
}
.studio-orb-fallback {
  position: absolute;
  z-index: 1;
  inset: 22% 23%;
  border: clamp(10px, 2vw, 22px) solid #a1cdb7;
  border-color: #d2f9a4 #4e8072 #686e9a #a3c3dc;
  border-radius: 47%;
  transform: rotate(-37deg) skew(10deg);
  box-shadow: inset 0 0 38px #3a98745b, 0 12px 40px #020b07b0;
}
.studio-orb:has(canvas[data-rendered]) .studio-orb-fallback { display: none; }
.studio-orb canvas { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; }
.studio-dots {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgb(205 240 218 / 23%) 1px, transparent 1px);
  background-size: 20px 20px;
  mask-image: radial-gradient(ellipse at 75% 45%, #000, transparent 75%);
}

.studio-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 10px 0 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--studio-surface);
}
.studio-metrics > div { min-width: 0; padding: 9px clamp(7px, 2.2vw, 25px); }
.studio-metrics > div + div { border-inline-start: 1px solid var(--line); }
.studio-metrics dt { color: var(--muted); font-size: .76rem; font-weight: 650; line-height: 1.2; }
.studio-metrics dd {
  margin: 2px 0 0;
  color: var(--text);
  font-size: clamp(1.28rem, 3vw, 2.03rem);
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.06em;
  line-height: 1.25;
}
.studio-metrics dd span { font-size: .68em; color: var(--muted); letter-spacing: -.02em; }
.studio-progress-track {
  border: 0;
  display: block;
  width: 100%;
  height: 5px;
  margin-top: 9px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--soft);
  color: var(--studio-blue);
  accent-color: var(--studio-blue);
}
.studio-progress-track::-webkit-progress-bar { background: var(--soft); }
.studio-progress-track::-webkit-progress-value { background: var(--studio-blue); border-radius: 5px; }
.studio-progress-track::-moz-progress-bar { background: var(--studio-blue); border-radius: 5px; }
.panel { border-radius: 21px; }
.utility { border-radius: 13px; }
.fw-study .fw-study-head h1 { font-weight: 740; }
.fw-lesson-tabs, .studio-step-list { box-shadow: inset 0 1px 3px rgb(12 32 22 / 4%); }

.studio-locked { overflow: hidden; }
.studio-locked > :is(header, .shell, .fw-rail) { visibility: hidden; }
.studio-boot {
  display: none;
  position: fixed;
  inset: 0;
  place-items: center;
  color: #eef8ed;
  background: #15251e;
}
.studio-locked:has(#atlasModal[hidden]) .studio-boot { display: grid; }
.studio-loader {
  width: 44px;
  height: 44px;
  display: inline-block;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-block-end-color: transparent;
  border-radius: 50%;
  animation: studio-spin .9s linear infinite;
}
@keyframes studio-spin { to { transform: rotate(360deg); } }
.studio-boot .studio-loader { margin-bottom: 12px; color: var(--studio-lime); }
.studio-boot > div { display: grid; justify-items: center; gap: 4px; text-align: center; }
.studio-boot p { margin: 0; color: #cdd9cf; }

.atlas-modal { background: rgb(15 28 22 / 61%); }
.atlas-modal .studio-auth-layout { width: min(565px, 100%); }
.atlas-modal .studio-auth-art { display: none; }
.atlas-modal .studio-auth-panel {
  width: 100%;
  padding: clamp(23px, 3.8vw, 46px);
  border-radius: 24px;
}
.studio-locked .atlas-modal {
  background: radial-gradient(ellipse at 22% 12%, #30483e, #172820 48%, #102019 100%);
  backdrop-filter: none;
}
.studio-locked .atlas-modal .studio-auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .92fr);
  width: min(1050px, 100%);
  min-height: 560px;
  max-height: calc(100dvh - 32px);
  border-radius: 26px;
  overflow: auto;
  background: var(--studio-surface);
  box-shadow: 0 28px 100px #0718107c;
}
.studio-locked .atlas-modal .studio-auth-art {
  display: block;
  min-width: 0;
  min-height: 100%;
  position: relative;
  padding: 25px;
  overflow: hidden;
  color: var(--studio-hero-text);
  background: radial-gradient(ellipse at 53% 56%, #3a5c50, #243e33 39%, #1c3028 69%, #1a2e24 100%);
}
.studio-auth-art .studio-orb { inset: 10% 2% 5%; }
.studio-auth-wordmark {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  z-index: 3;
  color: #fff;
  font-size: 1.1rem;
  letter-spacing: -.032em;
  font-weight: 730;
}
.studio-brand-glyph {
  display: inline-grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 10px;
  color: #152d1c;
  background: var(--studio-lime);
  font-size: .82rem;
  font-weight: 840;
}
.studio-locked .atlas-modal .studio-auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-self: stretch;
  border: 0;
  border-radius: 0;
  max-height: unset;
  box-shadow: none;
  background: var(--studio-surface);
}
.atlas-modal h2#atlasModalTitle { margin: 0 0 9px; font-size: clamp(1.8rem, 4vw, 2.7rem); letter-spacing: -.055em; }
.atlas-modal .studio-auth-lead { color: var(--muted); max-width: 40ch; margin: 0 0 23px; font-size: .9rem; }
.atlas-modal #atlasLogin label { font-size: .84rem; font-weight: 670; margin: 0 0 15px; }
.atlas-modal #atlasLogin input { margin-top: 6px; font-size: 1rem; }
.atlas-modal #atlasLogin button { position: relative; min-height: 49px; border-radius: 12px; }
.atlas-modal #atlasLogin button[disabled]::after {
  display: inline-block;
  content: "";
  width: 14px;
  height: 14px;
  margin-left: 9px;
  vertical-align: -.18em;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-radius: 50%;
  animation: studio-spin .75s linear infinite;
}
.studio-login-loading { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.studio-login-loading .studio-loader { width: 27px; height: 27px; color: var(--studio-blue); flex: 0 0 27px; }
#atlasMessage:not(:empty) { margin-bottom: 0; }

.studio-command {
  width: min(570px, calc(100vw - 28px));
  max-height: min(620px, calc(100dvh - 35px));
  margin: min(13vh, 112px) auto auto;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 19px;
  color: var(--text);
  background: var(--studio-surface);
  box-shadow: 0 25px 80px rgb(8 31 19 / 25%);
}
.studio-command::backdrop { background: rgb(10 29 20 / 43%); backdrop-filter: blur(4px); }
.studio-command-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.studio-command-top h2 { margin: 0; font-size: 1.06rem; }
.studio-command input { width: 100%; min-height: 46px; font-size: 1rem; border-radius: 11px; }
.studio-command-list { display: grid; gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; }
.studio-command-list button {
  display: flex;
  width: 100%;
  min-height: 45px;
  align-items: center;
  justify-content: space-between;
  text-align: start;
  gap: 12px;
  border-radius: 10px;
  color: var(--text);
  background: var(--input);
  font-size: .87rem;
}
.studio-command-list button small { color: var(--muted); text-align: end; }
.studio-command-list p { padding-inline: 7px; color: var(--muted); }

@media (max-width: 700px) {
  :root { --studio-header: 62px; --studio-sidebar: 0px; }
  body > header { padding-inline: 11px; border-radius: 0; }
  body > header .brand strong { font-size: 16px; }
  body > header .brand .logo { width: 30px; height: 30px; }
  .header-actions { gap: 3px; }
  .header-actions :is(#theme, .studio-search-open) { min-width: 42px; min-height: 42px; justify-content: center; }
  .header-actions #theme { font-size: 0; }
  .studio-search-open :is(.studio-search-name, kbd) { display: none; }
  .shell, .fw-roadmap-closed .shell, .focus-mode .shell {
    padding: 13px 11px calc(92px + env(safe-area-inset-bottom));
  }
  .fw-rail, body.fw-compact .fw-rail {
    inset: auto 8px max(9px, env(safe-area-inset-bottom));
    width: auto;
    border: 1px solid var(--line);
    border-radius: 17px;
    padding: 4px;
    box-shadow: 0 8px 28px rgb(15 44 28 / 12%);
  }
  body .fw-rail button, body.fw-compact .fw-rail button {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
  }
  .fw-rail #fwRoadmap { margin: 0; border: 0; }
  aside#fwCurriculum, .fw-roadmap-closed aside#fwCurriculum {
    inset: 0 auto 0 0;
    width: min(88vw, 355px);
    padding-top: max(16px, env(safe-area-inset-top));
  }
  body:not(.sidebar-open) aside#fwCurriculum {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-18px);
  }
  body.sidebar-open aside#fwCurriculum { visibility: visible; opacity: 1; transform: none; pointer-events: auto; }
  body:not(.sidebar-open) .sidebar-overlay { display: none; }
  body.sidebar-open .sidebar-overlay { display: block; inset: 0; z-index: 18; }
  .studio-hero-stage {
    grid-template-columns: 1fr;
    min-height: 325px;
    align-items: end;
    border-radius: 18px;
  }
  .studio-hero-copy { padding: 126px 17px 20px; z-index: 3; }
  .studio-hero-copy h2 { max-width: 14ch; font-size: clamp(1.95rem, 8.2vw, 3rem); }
  .studio-hero-copy p { margin-block: 8px; }
  .studio-hero-visual { position: absolute; inset: -16px -8px auto auto; width: min(73%, 300px); aspect-ratio: 1.43; }
  .studio-hero-stage::after {
    position: absolute;
    z-index: 2;
    inset: 27% 0 0;
    background: linear-gradient(transparent, #12211cf0 36%, #12211c);
    content: "";
    pointer-events: none;
  }
  .studio-hero-actions { margin-top: 13px; gap: 6px; }
  .studio-hero-actions button { padding-inline: 11px; }
  .studio-metrics { padding-inline: 3px; }
  .studio-metrics dt { font-size: .67rem; }
  .studio-locked .atlas-modal { padding: 11px; }
  .studio-locked .atlas-modal .studio-auth-layout {
    grid-template-columns: 1fr;
    min-height: 0;
    max-height: calc(100dvh - 22px);
    border-radius: 18px;
  }
  .studio-locked .atlas-modal .studio-auth-art { min-height: clamp(102px, 21dvh, 163px); padding: 14px; }
  .studio-auth-art .studio-orb { inset: -27% 0 -20% 24%; }
  .studio-locked .atlas-modal .studio-auth-panel { padding: 20px 17px; }
  .atlas-modal #atlasLogin label { margin-bottom: 11px; }
  .atlas-modal .studio-auth-lead { margin-bottom: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .studio-loader, .atlas-modal #atlasLogin button[disabled]::after { animation: none; }
}

@media print {
  body > header, #fwRail, #fwCurriculum, .studio-hero, .studio-command, .studio-boot { display: none !important; }
  .shell, .fw-roadmap-closed .shell { width: 100%; padding: 0; }
}
