/* COLOR / OS modern static studio shell
   Scope contract:
   - static studio only
   - excludes print modes and the isolated React webapp view
   - does not target .frame/.slide/.psheet/#printRoot/.s-app internals
   - palette colors remain supplied by existing runtime inline styles */

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app {
  --modern-shell: var(--studio-bg, #fff);
  --modern-surface: var(--studio-panel, #fff);
  --modern-ink: var(--studio-ink, #17191d);
  --modern-muted: var(--studio-muted, #626874);
  --modern-line: var(--studio-line, #dfe2e7);
  --modern-focus: var(--studio-focus, #2449c6);
  --modern-soft: color-mix(in srgb, var(--modern-surface) 82%, var(--modern-shell));
  --modern-quiet: color-mix(in srgb, var(--modern-ink) 5%, var(--modern-surface));
  --modern-strong-line: color-mix(in srgb, var(--modern-ink) 18%, var(--modern-line));
  --modern-shadow: 0 22px 64px rgba(16, 24, 40, .09);
  --modern-card-shadow: 0 8px 28px rgba(16, 24, 40, .06);
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  overflow-x: clip;
  background: var(--modern-shell);
  color: var(--modern-ink);
  font-size: 15px;
  line-height: 1.65;
}

/* Compact navigation rail */
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .side {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: auto;
  height: 100vh;
  padding: 28px 16px 22px;
  border: 0;
  border-right: 1px solid var(--modern-line);
  background: var(--modern-surface);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .side > .brand {
  color: var(--modern-ink);
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.035em;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .side > .brand em {
  margin: 0 .12em;
  color: var(--modern-focus);
  font-style: normal;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .side > .sub {
  max-width: 138px;
  margin-top: 12px;
  color: var(--modern-muted);
  font-size: 12px;
  line-height: 1.55;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .side > .nav {
  display: grid;
  gap: 4px;
  margin-top: 34px;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .side > .nav > button {
  position: relative;
  min-height: 42px;
  padding: 10px 10px 10px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--modern-muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .side > .nav > button::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 2px;
  border-radius: 2px;
  background: transparent;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .side > .nav > button:is(:hover, .active) {
  background: var(--modern-quiet);
  color: var(--modern-ink);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .side > .nav > button.active::before {
  background: var(--modern-focus);
}

/* Main canvas and compact utility bar */
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main {
  width: 100%;
  max-width: none;
  min-width: 0;
  padding: 22px clamp(24px, 4vw, 64px) 96px;
  overflow-x: clip;
  background: var(--modern-shell);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main > .topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 42px;
  margin: 0 0 clamp(54px, 7vw, 104px);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--modern-line);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main > .topbar > h1 {
  margin: 0;
  color: var(--modern-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .11em;
  text-transform: uppercase;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main > .topbar > .pill {
  max-width: min(48vw, 560px);
  padding: 7px 11px;
  overflow: hidden;
  border: 1px solid var(--modern-line);
  border-radius: 6px;
  background: var(--modern-surface);
  color: var(--modern-muted);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Cinematic introduction, injected before #archive */
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-intro {
  display: grid;
  grid-template-columns: minmax(0, .88fr) minmax(420px, 1.12fr);
  gap: clamp(44px, 7vw, 112px);
  align-items: center;
  min-height: min(680px, calc(100vh - 138px));
  margin: 0 0 clamp(72px, 10vw, 148px);
  padding: 10px 0 clamp(44px, 6vw, 84px);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introCopy {
  position: relative;
  z-index: 2;
  max-width: 660px;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 26px;
  color: var(--modern-muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
  letter-spacing: .16em;
  text-transform: uppercase;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-eyebrow::before {
  content: '';
  width: 24px;
  height: 2px;
  flex: none;
  border-radius: 2px;
  background: var(--modern-focus);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introCopy > h2 {
  max-width: 760px;
  margin: 0;
  color: var(--modern-ink);
  font-family: inherit;
  font-size: clamp(52px, 5vw, 64px);
  font-weight: 780;
  line-height: 1.04;
  letter-spacing: -.055em;
  text-wrap: balance;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introCopy > p {
  max-width: 570px;
  margin: 28px 0 0;
  color: var(--modern-muted);
  font-size: 16px;
  line-height: 1.8;
  text-wrap: pretty;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introActions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introActions :is(a, button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 18px;
  border: 1px solid var(--modern-ink);
  border-radius: 8px;
  background: var(--modern-ink);
  color: var(--modern-surface);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introActions :is(a, button):nth-child(n + 2) {
  border-color: var(--modern-strong-line);
  background: var(--modern-surface);
  color: var(--modern-ink);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introActions :is(a, button):hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(16, 24, 40, .11);
}

/* Original CSS-built palette object. No generated/demo imagery. */
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introArt {
  position: relative;
  min-width: 0;
  min-height: clamp(420px, 44vw, 610px);
  isolation: isolate;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introArt::before {
  content: '';
  position: absolute;
  inset: 8% 0 2%;
  z-index: -2;
  border-radius: 50%;
  background: radial-gradient(circle at 52% 56%, color-mix(in srgb, var(--modern-ink) 12%, transparent), transparent 62%);
  filter: blur(18px);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-paletteObject {
  position: absolute;
  inset: 7% 2% 5% 0;
  transform: rotate(-4deg);
  transform-origin: 50% 70%;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-paletteObject::before,
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-paletteObject::after {
  content: '';
  position: absolute;
  right: 8%;
  bottom: 8%;
  left: 12%;
  height: 19%;
  border: 1px solid color-mix(in srgb, var(--intro-ink, #18202b) 16%, transparent);
  border-radius: 18px;
  background: var(--intro-accent, #e8a28c);
  box-shadow: var(--modern-card-shadow);
  transform: translate(2%, 14%) rotate(2deg);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-paletteObject::after {
  z-index: -1;
  background: var(--intro-brand, #3157b7);
  transform: translate(-4%, -4%) rotate(-2deg);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-paletteObject > :is(.modern-objectBrand, .modern-objectAccent, .modern-objectPaper) {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--intro-ink, #18202b) 17%, transparent);
  border-radius: 20px;
  box-shadow: 0 28px 68px rgba(16, 24, 40, .16);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-objectBrand {
  inset: 3% 5% 25% 18%;
  z-index: 3;
  padding: clamp(24px, 3vw, 42px);
  background: var(--intro-brand, #3157b7);
  color: var(--intro-on-brand, #fff);
  transform: rotate(5deg);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-objectAccent {
  inset: 24% 19% 10% 4%;
  z-index: 2;
  padding: clamp(20px, 2.6vw, 36px);
  background: var(--intro-accent, #e8a28c);
  color: var(--intro-on-accent, #17191d);
  transform: rotate(-6deg);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-objectPaper {
  inset: 14% 1% 2% 32%;
  z-index: 4;
  padding: clamp(22px, 2.8vw, 40px);
  background: var(--modern-surface);
  color: var(--intro-ink, var(--modern-ink));
  transform: rotate(2deg);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-objectLabel {
  position: relative;
  z-index: 2;
  display: block;
  max-width: 15ch;
  color: inherit;
  font-size: clamp(14px, 1.4vw, 20px);
  font-weight: 760;
  line-height: 1.25;
  letter-spacing: -.025em;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-objectLabel + .modern-objectLabel {
  align-self: flex-end;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app :is(.modern-objectStripes, .modern-stripes) {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  width: min(180px, 55%);
  margin-top: auto;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app :is(.modern-objectStripes, .modern-stripes) > i,
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-objectStripe {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app :is(.modern-objectStripes, .modern-stripes) > i:nth-child(2),
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-objectStripe:nth-child(2) {
  background: var(--intro-accent, #e8a28c);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app :is(.modern-objectStripes, .modern-stripes) > i:nth-child(3),
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-objectStripe:nth-child(3) {
  background: var(--intro-brand, #3157b7);
}

/* Three-step wayfinding */
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-stepNav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 clamp(56px, 7vw, 96px);
  border-top: 1px solid var(--modern-line);
  border-bottom: 1px solid var(--modern-line);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-stepNav > a {
  position: relative;
  min-width: 0;
  padding: 22px 22px 22px 48px;
  color: var(--modern-muted);
  font-size: 13px;
  font-weight: 680;
  line-height: 1.45;
  text-decoration: none;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-stepNav > a + a {
  border-left: 1px solid var(--modern-line);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-stepNav > a::before {
  content: counter(modern-step, decimal-leading-zero);
  position: absolute;
  top: 22px;
  left: 16px;
  color: var(--modern-focus);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-stepNav {
  counter-reset: modern-step;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-stepNav > a {
  counter-increment: modern-step;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-stepNav > a:hover {
  background: var(--modern-quiet);
  color: var(--modern-ink);
}

/* Major sections */
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main > .section {
  min-width: 0;
  margin-top: clamp(72px, 9vw, 132px);
  scroll-margin-top: 28px;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main > .modern-intro + #archive,
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main > .modern-stepNav + #archive {
  margin-top: 0;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main > .section > .sechead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px 28px;
  margin: 0 0 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--modern-line);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main > .section > .sechead > h2 {
  margin: 0;
  color: var(--modern-ink);
  font-family: inherit;
  font-size: 22px;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: -.035em;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main > .section > .sechead > small {
  max-width: 760px;
  color: var(--modern-muted);
  font-size: 12px;
  line-height: 1.65;
  text-align: right;
}

/* Archive control bar, supporting either wrapper order */
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-archiveBar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid var(--modern-line);
  border-radius: 12px;
  background: var(--modern-surface);
  box-shadow: 0 1px 0 rgba(16, 24, 40, .02);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-archiveBar > .filters {
  flex: 1 1 auto;
  margin: 0;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-archiveSearch,
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app label[for="modernArchiveSearch"] {
  color: var(--modern-muted);
  font-size: 12px;
  font-weight: 680;
  line-height: 1.4;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-archiveSearch {
  display: grid;
  flex: 0 1 280px;
  gap: 6px;
  min-width: 210px;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #modernArchiveSearch {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--modern-strong-line);
  border-radius: 8px;
  outline: 0;
  background: var(--modern-shell);
  color: var(--modern-ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #modernArchiveSearch::placeholder {
  color: var(--modern-muted);
  opacity: 1;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #modernArchiveSearch:focus-visible {
  outline: 3px solid var(--modern-focus);
  outline-offset: 3px;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .filters > button {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--modern-line);
  border-radius: 7px;
  background: var(--modern-surface);
  color: var(--modern-muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  cursor: pointer;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .filters > button:is(:hover, .active) {
  border-color: var(--modern-ink);
  background: var(--modern-ink);
  color: var(--modern-surface);
}

/* Richer archive cards: swatch remains the immutable original HEX. */
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive > .grid,
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .modern-archiveBar + .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 94px auto;
  gap: 0;
  min-width: 0;
  min-height: 166px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--modern-line);
  border-radius: 12px;
  outline-offset: 0;
  background: var(--modern-surface);
  color: var(--modern-ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(16, 24, 40, .02);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .chip:hover {
  transform: translateY(-3px);
  border-color: var(--modern-strong-line);
  box-shadow: var(--modern-card-shadow);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .chip.sel {
  border-color: var(--modern-ink);
  outline: 2px solid var(--modern-ink);
  box-shadow: var(--modern-card-shadow);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .chip > .sw2 {
  grid-column: 1 / -1;
  grid-row: 1;
  width: 100%;
  height: 94px;
  border: 0;
  border-radius: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .10);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .chip > span:not(.sw2):not(.gb) {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  padding: 14px 6px 15px 15px;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .chip b {
  display: block;
  overflow: hidden;
  color: var(--modern-ink);
  font-size: 14px;
  font-weight: 740;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .chip small {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--modern-muted);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .chip > .gb {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  margin: 14px 13px 0 0;
  padding: 3px 6px;
  border-color: var(--modern-line);
  background: var(--modern-soft);
  color: var(--modern-ink);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
}

/* Existing recipe/detail/export shell surfaces */
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail > .detail {
  grid-template-columns: minmax(270px, 330px) minmax(0, 1fr);
  gap: 20px;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .heroCard {
  top: 20px;
  border-color: var(--modern-line);
  border-radius: 14px;
  background: var(--modern-surface);
  box-shadow: var(--modern-card-shadow);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .heroMeta,
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .heroRel {
  background: var(--modern-surface);
  color: var(--modern-ink);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail :is(.card, .combo, .rolePanel),
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #export > .card {
  border-color: var(--modern-line);
  border-radius: 12px;
  background: var(--modern-surface);
  color: var(--modern-ink);
  box-shadow: 0 1px 0 rgba(16, 24, 40, .02);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail > .cpanel {
  margin-top: 20px;
  padding: clamp(18px, 2vw, 26px);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail > .sechead[style] {
  margin-top: 34px !important;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail > .sechead[style] > h2 {
  color: var(--modern-ink);
  font-size: 18px !important;
  font-weight: 740;
  letter-spacing: -.02em;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .combos {
  gap: 12px;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .combo {
  min-height: 250px;
  padding: 17px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .combo:hover {
  transform: translateY(-2px);
  border-color: var(--modern-strong-line);
  box-shadow: var(--modern-card-shadow);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .combo.active {
  border-color: var(--modern-ink);
  background: var(--modern-surface);
  box-shadow: var(--modern-card-shadow);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .combo .strip {
  height: 32px;
  border: 1px solid var(--modern-line);
  border-radius: 6px;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .rolePanel {
  padding: clamp(18px, 2vw, 26px);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .previewSwitch {
  margin-top: 38px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--modern-line);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .previewSwitch > button,
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .slideTabs > button,
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .grayButton,
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #export .actions > button {
  min-height: 40px;
  border-color: var(--modern-line);
  border-radius: 7px;
  background: var(--modern-surface);
  color: var(--modern-ink);
  font-size: 12px;
  font-weight: 680;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .previewSwitch > button.active,
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .slideTabs > button.active,
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #export .actions > button:not(.ghost) {
  border-color: var(--modern-ink);
  background: var(--modern-ink);
  color: var(--modern-surface);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .stage {
  gap: 18px;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .stage > div:last-child {
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .chartPrev,
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .appCard,
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #export .token {
  border-color: var(--modern-line);
  border-radius: 10px;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #export .tokens {
  gap: 10px;
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #export .token {
  min-height: 96px;
  padding: 11px;
  background: var(--modern-surface);
  color: var(--modern-ink);
}

body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #export .footer {
  border-color: var(--modern-line);
  color: var(--modern-muted);
  font-size: 12px;
}

/* Desktop density */
@media (min-width: 1320px) {
  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main {
    padding-right: clamp(56px, 5vw, 84px);
    padding-left: clamp(56px, 5vw, 84px);
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive > .grid,
  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .modern-archiveBar + .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app {
    grid-template-columns: 156px minmax(0, 1fr);
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-intro {
    grid-template-columns: minmax(0, .9fr) minmax(340px, 1.1fr);
    gap: 34px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail > .detail {
    grid-template-columns: 250px minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app {
    display: block;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .side {
    position: static;
    width: 100%;
    height: auto;
    padding: 16px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--modern-line);
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .side > .sub {
    display: none;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .side > .nav {
    display: flex;
    gap: 4px;
    margin-top: 12px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .side > .nav > button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 8px 10px;
    white-space: nowrap;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .side > .nav > button::before {
    display: none;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main {
    padding: 18px 18px 72px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main > .topbar {
    margin-bottom: 56px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-intro {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introArt {
    min-height: 470px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-archiveBar {
    align-items: stretch;
    flex-direction: column;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-archiveSearch {
    flex-basis: auto;
    min-width: 0;
  }
}

@media (max-width: 560px) {
  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main {
    padding-right: 14px;
    padding-left: 14px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main > .topbar {
    align-items: flex-start;
    margin-bottom: 48px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main > .topbar > .pill {
    max-width: 52vw;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-intro {
    gap: 24px;
    margin-bottom: 72px;
    padding-bottom: 24px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introCopy > h2 {
    font-size: clamp(40px, 13vw, 52px);
    line-height: 1.07;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introCopy > p {
    margin-top: 22px;
    font-size: 15px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introActions {
    display: grid;
    grid-template-columns: 1fr;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introActions :is(a, button) {
    width: 100%;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introArt {
    min-height: 355px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-paletteObject {
    inset: 2% -4% 2% -8%;
    transform: scale(.9) rotate(-4deg);
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-paletteObject > :is(.modern-objectBrand, .modern-objectAccent, .modern-objectPaper) {
    border-radius: 14px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-stepNav {
    grid-template-columns: 1fr;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-stepNav > a {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-stepNav > a + a {
    border-top: 1px solid var(--modern-line);
    border-left: 0;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-stepNav > a::before {
    top: 16px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main > .section {
    margin-top: 80px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main > .section > .sechead {
    display: grid;
    gap: 8px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .main > .section > .sechead > small {
    text-align: left;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-archiveBar {
    padding: 12px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive > .grid,
  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .modern-archiveBar + .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .chip {
    grid-template-rows: 76px auto;
    min-height: 148px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .chip > .sw2 {
    height: 76px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .chip > span:not(.sw2):not(.gb) {
    padding: 12px 5px 13px 11px;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .chip > .gb {
    margin: 12px 9px 0 0;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail > .detail {
    grid-template-columns: 1fr;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .heroCard {
    position: static;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .combos {
    grid-template-columns: 1fr;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .combo {
    min-height: 0;
  }
}

@media (max-width: 390px) {
  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive > .grid,
  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .modern-archiveBar + .grid {
    grid-template-columns: 1fr;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .chip {
    grid-template-rows: 92px auto;
  }

  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .chip > .sw2 {
    height: 92px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app > .side > .nav > button,
  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-introActions :is(a, button),
  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #archive .chip,
  body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .combo {
    transition: none !important;
  }
}

/* Isolated generated sample and token-driven typography refinements. */
body:not(.printmode):not(.webappOnly) > .app .modern-introFacts{display:flex;gap:24px;flex-wrap:wrap;margin-top:32px;color:var(--studio-muted);font-size:12px;}
body:not(.printmode):not(.webappOnly) > .app .modern-introFacts b{display:block;color:var(--studio-ink);font-size:22px;line-height:1.4;}
body:not(.printmode):not(.webappOnly) > .app .modern-introArt.has-generated-art{display:flex;align-items:center;justify-content:center;}
body:not(.printmode):not(.webappOnly) > .app .modern-introArt.has-generated-art::before,body:not(.printmode):not(.webappOnly) > .app .has-generated-art .modern-paletteObject{display:none;}
body:not(.printmode):not(.webappOnly) > .app .modern-generatedArt{display:block;max-width:100%;width:100%;height:auto;border-radius:20px;}
body:not(.printmode):not(.webappOnly) > .app .modern-objectPaper{background:var(--intro-paper,var(--studio-panel));}
body:not(.printmode):not(.webappOnly) > .app .modern-paletteObject :is(span,code){font-size:12px;line-height:1.5;font-weight:650;}
body:not(.printmode):not(.webappOnly) > .app .modern-paletteObject strong{font-size:clamp(24px,2.5vw,36px);line-height:1.2;letter-spacing:-.04em;}
body:not(.printmode):not(.webappOnly) > .app .modern-objectBrand code{font-family:inherit;}
body:not(.printmode):not(.webappOnly) > .app .modern-objectLines{display:grid;gap:10px;}
body:not(.printmode):not(.webappOnly) > .app .modern-objectLines i{display:block;height:6px;background:var(--intro-muted);border-radius:4px;}
body:not(.printmode):not(.webappOnly) > .app .modern-objectLines i:nth-child(2){width:76%;}
body:not(.printmode):not(.webappOnly) > .app .modern-objectLines i:nth-child(3){width:52%;}
body:not(.printmode):not(.webappOnly) > .app .modern-archiveDisclosure{border-top:1px solid var(--studio-line);border-bottom:1px solid var(--studio-line);padding:20px 0;}
body:not(.printmode):not(.webappOnly) > .app .modern-archiveDisclosure summary{display:flex;justify-content:space-between;align-items:center;gap:16px;cursor:pointer;font-size:17px;font-weight:650;list-style:none;}
body:not(.printmode):not(.webappOnly) > .app .modern-archiveDisclosure summary span{font-size:12px;color:var(--studio-muted);}
body:not(.printmode):not(.webappOnly) > .app .modern-archiveDisclosure summary::after{content:'+';font-size:22px;}
body:not(.printmode):not(.webappOnly) > .app .modern-archiveDisclosure[open] summary::after{content:'−';}
body:not(.printmode):not(.webappOnly) > .app .modern-archiveResult{color:var(--studio-muted);font-size:12px;line-height:1.6;}
body:not(.printmode):not(.webappOnly) > .app .modern-archiveBar{margin-top:24px;}
body:not(.printmode):not(.webappOnly) > .app .chip[hidden]{display:none;}
@media(max-width:520px){body:not(.printmode):not(.webappOnly) > .app .modern-introFacts{gap:20px;}body:not(.printmode):not(.webappOnly) > .app .modern-paletteObject strong{font-size:24px;}body:not(.printmode):not(.webappOnly) > .app .modern-archiveDisclosure summary{font-size:15px;}body:not(.printmode):not(.webappOnly) > .app .modern-archiveDisclosure summary span{display:none;}}

/* Preserve explicit type floors and opaque surfaces in the full studio. */
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-objectPaper{background:var(--intro-paper,var(--studio-panel));}
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-stepNav small{display:block;font-size:12px;line-height:1.6;margin-top:7px;}
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-stepNav b{display:block;font-size:16px;color:var(--modern-ink);margin-top:6px;}
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-stepNav span{display:block;font-size:12px;}
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app .modern-stepNav>a::before{font-size:12px;}
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail :is(.heroCat,.heroCopy,.heroMeta span,.heroRel h4){font-size:12px;line-height:1.5;}
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #detail .heroCat{background:var(--studio-panel);color:var(--studio-ink);backdrop-filter:none;}

/* Foreground and raw surface change atomically; never tween a readable pair. */
body:not(.print-mode):not(.printmode):not(.webappOnly) > .app #heroMain{transition:none;}
