@media screen {
  #cm-studio {
    --cm-studio-ink: #214747;
    --cm-studio-muted: #526865;
    --cm-studio-petrol: #245b59;
    --cm-studio-petrol-deep: #194442;
    --cm-studio-plum: #70465f;
    --cm-studio-sage: #526b57;
    --cm-studio-sage-soft: #edf2e9;
    --cm-studio-apricot: #b9633d;
    --cm-studio-cream: #fff9ef;
    --cm-studio-card: #fffdfa;
    --cm-studio-line: #e5d9c9;
    --cm-studio-focus: #8a3e63;
    display: grid;
    align-items: start;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 1.15rem;
    max-width: 1560px;
    margin: 0 auto;
    padding: clamp(1rem, 2.5vw, 2rem) clamp(0.75rem, 2vw, 1.5rem) 3rem;
    color: var(--cm-studio-ink);
  }

  #cm-studio :where(.cm-hero, .cm-settings, .cm-empty-preview, .cm-route, .cm-discovery) { overflow-wrap: anywhere; }
  #cm-studio :where(.cm-hero-actions a, .cm-btn, .cm-field select, .cm-opt input, .cm-blank-chip input, #cm-settings-h, #cm-route):focus-visible {
    outline: 3px solid var(--cm-studio-focus);
    outline-offset: 3px;
  }
  #cm-studio [hidden] { display: none !important; }
  #cm-studio :where(#cm-settings-h, #cm-route, #cm-result) { scroll-margin-top: 150px; }

  #cm-studio .cm-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(1rem, 3vw, 2.5rem);
    grid-row: 1;
    grid-column: 1 / -1;
    min-height: 245px;
    padding: clamp(1.25rem, 3.4vw, 2.75rem);
    overflow: hidden;
    border: 1px solid #e7d7c5;
    border-radius: 26px;
    background: linear-gradient(118deg, #fff4e7 0%, var(--cm-studio-cream) 58%, #e9eee3 100%);
    box-shadow: 0 16px 38px rgb(33 71 71 / 8%);
  }
  #cm-studio .cm-hero-copy { position: relative; z-index: 1; min-width: 0; max-width: 900px; }
  #cm-studio .cm-eyebrow {
    margin: 0 0 0.5rem;
    color: var(--cm-studio-sage);
    font-size: 0.73rem;
    font-weight: 850;
    letter-spacing: 0.14em;
    line-height: 1.4;
    text-transform: uppercase;
  }
  #cm-studio .cm-hero h1 {
    max-width: 800px;
    margin: 0 0 0.75rem;
    color: var(--cm-studio-petrol-deep);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(2rem, 4.2vw, 3.65rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.06;
  }
  #cm-studio .cm-hero-copy > p:not(.cm-eyebrow) {
    max-width: 760px;
    margin: 0;
    color: #405b58;
    font-size: clamp(0.98rem, 1.35vw, 1.08rem);
    line-height: 1.65;
  }
  #cm-studio .cm-hero-meta { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.95rem; }
  #cm-studio .cm-hero-meta > span {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border: 1px solid #d7ded0;
    border-radius: 999px;
    background: rgb(255 255 255 / 82%);
    color: var(--cm-studio-petrol-deep);
    font-size: 0.8rem;
    font-weight: 750;
    line-height: 1.25;
  }
  #cm-studio .cm-hero-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.1rem; }
  #cm-studio .cm-hero-actions a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--cm-studio-petrol-deep);
    border-radius: 11px;
    background: var(--cm-studio-petrol-deep);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    transition: background-color 160ms ease, transform 160ms ease;
  }
  #cm-studio .cm-hero-actions a:nth-child(2) {
    border-color: #8a6b7d;
    background: #fffdfa;
    color: #573a4d;
  }
  #cm-studio .cm-hero-actions a:hover { background: #2b6865; transform: translateY(-1px); }
  #cm-studio .cm-hero-actions a:nth-child(2):hover { background: #f3eae9; }
  #cm-studio .cm-hero-art { position: relative; z-index: 0; display: block; width: clamp(110px, 16vw, 190px); height: auto; }

  #cm-studio .cm-block {
    min-width: 0;
    padding: clamp(1rem, 2vw, 1.4rem);
    border: 1px solid var(--cm-studio-line);
    border-radius: 20px;
    background: var(--cm-studio-card);
    box-shadow: 0 8px 24px rgb(33 71 71 / 5%);
  }
  #cm-studio .cm-settings { grid-row: 2; grid-column: 1; align-self: start; }
  #cm-studio .cm-settings > h2,
  #cm-studio #cm-result > h2 {
    margin: 0 0 0.85rem;
    color: var(--cm-studio-petrol-deep);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(1.35rem, 2vw, 1.8rem);
    line-height: 1.2;
  }
  #cm-studio .cm-settings > .cm-eyebrow,
  #cm-studio #cm-result > .cm-eyebrow { margin-bottom: 0.25rem; }
  #cm-studio .cm-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
  #cm-studio .cm-field { display: flex; min-width: 0; flex-direction: column; gap: 0.35rem; }
  #cm-studio .cm-field label { color: var(--cm-studio-ink); font-size: 0.84rem; font-weight: 800; line-height: 1.35; }
  #cm-studio .cm-field select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0.55rem 0.7rem;
    border: 1px solid #bfcfc6;
    border-radius: 10px;
    background: #fffefa;
    color: #214747;
    font-size: 0.92rem;
    line-height: 1.35;
  }
  #cm-studio .cm-field select:disabled { background: #f1f0eb; color: #5d6a66; opacity: 1; }
  #cm-studio .cm-guidance { margin: 0.85rem 0 0; border-left-color: #809481; border-radius: 0 10px 10px 0; background: #f3f5ee; color: var(--cm-studio-muted); font-size: 0.86rem; line-height: 1.55; }
  #cm-studio .cm-guidance a { color: #514052; font-weight: 750; text-underline-offset: 3px; }
  #cm-studio .cm-guidance a:hover { color: var(--cm-studio-petrol-deep); }
  #cm-studio .cm-opts {
    padding: 0.75rem;
    margin-top: 1rem;
    border: 1px solid #d5dfd0;
    border-radius: 13px;
    background: var(--cm-studio-sage-soft);
  }
  #cm-studio .cm-opt { display: flex; min-height: 44px; align-items: center; gap: 0.65rem; color: #334f3b; font-size: 0.88rem; font-weight: 750; line-height: 1.45; }
  #cm-studio .cm-opt input { width: 22px; height: 22px; flex: 0 0 auto; margin: 0.05rem 0 0; accent-color: var(--cm-studio-petrol); }
  #cm-studio .cm-blanks { padding: 0.75rem; margin-top: 0.7rem; border: 1px solid #e4d7c8; border-radius: 13px; background: #fff8ee; }
  #cm-studio .cm-blanks-title { margin-bottom: 0.55rem; color: #4d4740; font-size: 0.83rem; font-weight: 800; }
  #cm-studio .cm-blanks-list { display: flex; flex-wrap: wrap; gap: 0.45rem; }
  #cm-studio .cm-blank-chip { display: inline-flex; min-height: 44px; align-items: center; padding: 0.35rem 0.65rem; border: 1px solid #dfcbb9; border-radius: 999px; background: #fffdfa; color: #51433b; font-size: 0.82rem; font-weight: 700; }
  #cm-studio .cm-blank-chip input { width: 18px; height: 18px; margin: 0 0.4rem 0 0; accent-color: var(--cm-studio-petrol); }
  #cm-studio .cm-btn {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0.62rem 0.9rem;
    border: 1px solid var(--cm-studio-petrol-deep);
    border-radius: 10px;
    background: var(--cm-studio-petrol-deep) !important;
    color: #fff !important;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.3;
    text-align: center;
    transition: background-color 160ms ease, transform 160ms ease;
  }
  #cm-studio .cm-btn:hover:not(:disabled) { background: #2b6865 !important; transform: translateY(-1px); }
  #cm-studio .cm-btn.ghost { border-color: #987d90; background: #fffdfa !important; color: #573a4d !important; }
  #cm-studio .cm-btn.ghost:hover:not(:disabled) { background: #f3eae9 !important; }
  #cm-studio .cm-btn:disabled { cursor: not-allowed; opacity: 0.58; }
  #cm-studio #cm-generate { width: 100%; }
  #cm-studio .cm-msg { min-height: 1.35em; margin-top: 0.5rem; color: var(--cm-studio-muted); font-size: 0.86rem; line-height: 1.45; }

  #cm-studio .cm-empty-preview {
    display: grid;
    min-width: 0;
    min-height: 360px;
    grid-row: 2;
    grid-column: 2;
    align-content: center;
    justify-items: center;
    gap: 0.8rem;
    padding: clamp(1.5rem, 4vw, 3rem);
    border: 1px solid #d8e0d4;
    border-radius: 22px;
    background: linear-gradient(145deg, #f8f8ef, #edf2e9 58%, #fbefe3);
    color: var(--cm-studio-muted);
    text-align: center;
  }
  #cm-studio .cm-empty-preview h2 { margin: 0; color: var(--cm-studio-petrol-deep); font-family: Georgia, 'Times New Roman', serif; font-size: clamp(1.5rem, 2.6vw, 2.1rem); line-height: 1.2; }
  #cm-studio .cm-empty-preview > p { max-width: 34rem; margin: 0; font-size: 0.98rem; line-height: 1.65; }
  #cm-studio .cm-empty-preview > .cm-eyebrow { font-size: 0.73rem; }
  #cm-studio .cm-empty-symbol { display: flex; min-height: 116px; align-items: center; gap: clamp(0.65rem, 2vw, 1.5rem); color: var(--cm-studio-petrol); }
  #cm-studio .cm-empty-symbol span { display: block; width: clamp(25px, 4vw, 42px); aspect-ratio: 1; border: 2px solid currentColor; border-radius: 50%; background: rgb(255 253 250 / 78%); box-shadow: 0 7px 18px rgb(33 71 71 / 10%); }
  #cm-studio .cm-empty-symbol span:nth-child(2) { width: clamp(40px, 7vw, 72px); border-color: var(--cm-studio-apricot); background: #fff8ef; }
  #cm-studio .cm-empty-symbol span:nth-child(3) { border-color: var(--cm-studio-plum); }
  #cm-studio #cm-result { grid-row: 2; grid-column: 2; min-width: 0; }
  #cm-studio #cm-result:not([hidden]) + .cm-empty-preview { display: none; }
  #cm-studio .cm-preview-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; margin: 0 0 0.85rem; }
  #cm-studio .cm-discovery { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.85rem; }
  #cm-studio .cm-discovery > p { flex: 1 1 100%; margin: 0.15rem 0 0; color: var(--cm-studio-muted); font-size: 0.85rem; line-height: 1.5; }
  #cm-studio .cm-route {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.7rem;
    grid-row: 3;
    grid-column: 1 / -1;
    padding: 0.85rem;
    border: 1px solid #dce3d8;
    border-radius: 16px;
    background: #f4f5ed;
  }
  #cm-studio .cm-route > p { min-width: 0; margin: 0; color: #4d615b; font-size: 0.84rem; line-height: 1.5; }
  #cm-studio .cm-route strong { display: block; margin-bottom: 0.2rem; color: var(--cm-studio-petrol-deep); font-size: 0.9rem; }

  html[data-theme='dark'] #cm-studio {
    --cm-studio-ink: #e7eeea;
    --cm-studio-muted: #c2cfca;
    --cm-studio-petrol: #a7d1c7;
    --cm-studio-petrol-deep: #d0e5dd;
    --cm-studio-sage: #b9d3b7;
    --cm-studio-sage-soft: #263a34;
    --cm-studio-focus: #f0b9d1;
    --cm-studio-card: #202d2b;
    --cm-studio-line: #465450;
  }
  html[data-theme='dark'] #cm-studio .cm-hero { border-color: #5c4d47; background: linear-gradient(118deg, #382e2b, #293331 65%, #263831); }
  html[data-theme='dark'] #cm-studio .cm-hero-copy > p:not(.cm-eyebrow),
  html[data-theme='dark'] #cm-studio .cm-route > p { color: #d1ddd8; }
  html[data-theme='dark'] #cm-studio .cm-hero-meta > span { border-color: #53635d; background: #293633; color: #e2eee8; }
  html[data-theme='dark'] #cm-studio .cm-hero-actions a,
  html[data-theme='dark'] #cm-studio .cm-btn { border-color: #80a99c; background: #245b59 !important; color: #fff !important; }
  html[data-theme='dark'] #cm-studio .cm-hero-actions a:nth-child(2),
  html[data-theme='dark'] #cm-studio .cm-btn.ghost { border-color: #b597a8; background: #342f35 !important; color: #f1ddeb !important; }
  html[data-theme='dark'] #cm-studio .cm-hero-actions a:nth-child(2):hover,
  html[data-theme='dark'] #cm-studio .cm-btn.ghost:hover:not(:disabled) { background: #473a47 !important; }
  html[data-theme='dark'] #cm-studio .cm-settings > h2,
  html[data-theme='dark'] #cm-studio #cm-result > h2,
  html[data-theme='dark'] #cm-studio .cm-empty-preview h2 { color: #d0e5dd; }
  html[data-theme='dark'] #cm-studio .cm-field label,
  html[data-theme='dark'] #cm-studio .cm-opt { color: #e0e9e4; }
  html[data-theme='dark'] #cm-studio .cm-field select { border-color: #667b72; background: #172321; color: #eef5f0; }
  html[data-theme='dark'] #cm-studio .cm-field select:disabled { background: #303b38; color: #c5d0cb; }
  html[data-theme='dark'] #cm-studio .cm-guidance a { color: #f0d6e6; }
  html[data-theme='dark'] #cm-studio .cm-guidance { background: #293832; }
  html[data-theme='dark'] #cm-studio .cm-guidance a:hover { color: #c5e9dd; }
  html[data-theme='dark'] #cm-studio .cm-opts { border-color: #536759; }
  html[data-theme='dark'] #cm-studio .cm-blanks { border-color: #695b4a; background: #342f28; }
  html[data-theme='dark'] #cm-studio .cm-blanks-title { color: #f0e6d8; }
  html[data-theme='dark'] #cm-studio .cm-blank-chip { border-color: #756858; background: #282a27; color: #f0e6d8; }
  html[data-theme='dark'] #cm-studio .cm-empty-preview { border-color: #4e6259; background: linear-gradient(145deg, #263331, #263b34 58%, #3a302c); }
  html[data-theme='dark'] #cm-studio .cm-empty-symbol span { background: #202d2b; }
  html[data-theme='dark'] #cm-studio .cm-route { border-color: #46564e; background: #27332f; }

  @media (max-width: 1100px) {
    #cm-studio { grid-template-columns: minmax(0, 1fr); }
    #cm-studio .cm-settings { grid-row: 2; grid-column: 1; }
    #cm-studio #cm-result, #cm-studio .cm-empty-preview { grid-row: 3; grid-column: 1; }
    #cm-studio .cm-route { grid-row: 4; }
    #cm-studio .cm-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  @media (max-width: 680px) {
    #cm-studio { gap: 0.8rem; padding-inline: 0.65rem; }
    #cm-studio .cm-hero { grid-template-columns: minmax(0, 1fr); min-height: 0; padding: 1.15rem; }
    #cm-studio .cm-hero-art { position: absolute; right: -1.1rem; bottom: -1rem; width: 108px; opacity: 0.18; }
    #cm-studio .cm-hero-copy { max-width: none; }
    #cm-studio .cm-hero h1 { max-width: 100%; font-size: clamp(1.85rem, 8vw, 2.6rem); }
    #cm-studio .cm-hero-copy > p:not(.cm-eyebrow) { max-width: 100%; }
    #cm-studio .cm-hero-actions a { flex: 1 1 145px; }
    #cm-studio .cm-route { grid-template-columns: minmax(0, 1fr); }
    #cm-studio .cm-fields { grid-template-columns: minmax(0, 1fr); }
    #cm-studio .cm-empty-preview { min-height: 280px; }
  }
  @media (max-width: 360px) {
    #cm-studio .cm-hero-art { width: 78px; right: -1.5rem; bottom: -1rem; opacity: 0.12; }
    #cm-studio .cm-hero-actions a { flex-basis: 100%; }
  }
  @media (prefers-reduced-motion: reduce) {
    #cm-studio *, #cm-studio *::before, #cm-studio *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  }
}
