.ai-composer {
  --font: "Inter", ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #ffffff;
  --fg: #09090b;
  --muted: #f4f4f5;
  --muted-fg: #71717a;
  --accent: #f4f4f5;
  --border: #e4e4e7;
  --primary: #2347ff;
  --primary-hi: #1937e6;
  --primary-fg: #ffffff;
  --ring: rgb(35 71 255 / .35);
  --r: 10px;
  --r-sm: 7px;

  --maxw: 700px;

  font: 14px/1.45 var(--font);
  color: var(--fg);
  letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased;

  &, & *, & *::before, & *::after { box-sizing: border-box; }

  button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
  button { cursor: pointer; background: none; border: 0; padding: 0; }
  :focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

  .wrap { max-width: var(--maxw, 1100px); margin: 0 auto; }

  .shell { position: relative; border-radius: 17px; padding: 2px; isolation: isolate; }
  .beam, .glow {
    position: absolute; border-radius: inherit; pointer-events: none;
    overflow: hidden; isolation: isolate; transition: opacity .5s ease;
  }
  .beam { inset: 0; opacity: 1; }
  .glow { inset: -8px; z-index: -1; filter: blur(16px); border-radius: 25px; opacity: 0; }

  .beam::before, .beam::after,
  .glow::before, .glow::after {
    content: ''; position: absolute; left: 50%; top: 50%;
    width: 210%; aspect-ratio: 1; translate: -50% -50%;
    animation: ll-orbit 7s linear infinite;
  }
  .beam::before, .glow::before {
    background: conic-gradient(from 0deg,
      #22d3ee, #38bdf8 14%, #3b82f6 28%, #8b5cf6 44%, #d946ef 58%,
      #8b5cf6 72%, #3b82f6 86%, #22d3ee);
  }
  .beam::after, .glow::after {
    background: conic-gradient(from 90deg,
      transparent 0 6%, rgba(255,255,255,.85) 14%, transparent 25%,
      transparent 41%, rgba(224,242,254,.7) 50%, transparent 61%,
      transparent 75%, rgba(255,255,255,.6) 83%, transparent 93%);
    mix-blend-mode: screen;
    animation-duration: 3.4s;
    animation-direction: reverse;
  }

  .shell.working .glow { opacity: 1; }
  .shell.working .icon-btn,
  .shell.working .stack, .shell.working .type-btn {
    background: rgb(255 255 255 / .5); backdrop-filter: blur(6px);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / .7), 0 1px 2px rgb(35 71 255 / .12);
  }

  .composer {
    position: relative; z-index: 0;
    background: var(--bg);
    border: 0;
    border-radius: 15px;
    box-shadow: 0 1px 2px rgb(0 0 0 / .05);
    transition: box-shadow .15s;
  }
  .composer:focus-within { box-shadow: 0 0 0 3px var(--ring); }

  .field { position: relative; padding: 15px 16px 2px; }
  .ghost {
    position: absolute; inset: 15px 16px auto; text-align: left; padding: 0;
    font-size: 16.5px; line-height: 1.4; color: var(--muted-fg); font-weight: 400;
    cursor: text; white-space: pre-wrap;
  }
  .ghost b { font-weight: 500; color: #52525b; border-bottom: 1px dotted #a1a1aa; padding-bottom: 2px; }
  .caret {
    display: inline-block; width: 1.5px; height: 1em; margin-left: 1px;
    background: var(--primary); vertical-align: -2px; animation: ll-blink 1.05s step-end infinite;
  }
  #prompt {
    position: relative; width: 100%; min-height: 74px; border: 0; resize: none;
    background: transparent; font-size: 16.5px; line-height: 1.4; outline: 0; display: block;
  }

  .chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 16px 2px; margin: 0; list-style: none; }
  .chip {
    display: flex; align-items: center; gap: 5px; font-size: 12px; color: #3f3f46;
    background: var(--muted); border-radius: var(--r-sm); padding: 3px 3px 3px 7px;
  }
  .chip span { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chip button { color: var(--muted-fg); line-height: 0; padding: 2px; border-radius: 4px; }
  .chip button:hover { background: #fff; color: var(--fg); }
  .chip > svg { flex: none; }
  .chip--skill { color: var(--primary); background: rgb(35 71 255 / .07); }
  .chip--img { padding-left: 3px; }
  .chip--img img { width: 20px; height: 20px; border-radius: 4px; object-fit: cover; flex: none; }

  .bar { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 5px 8px 8px 11px; flex-wrap: wrap; }
  .tools { display: flex; align-items: center; gap: 3px; }

  .icon-btn { width: 31px; height: 31px; display: grid; place-items: center; border-radius: var(--r-sm); color: var(--muted-fg); transition: background .12s, color .12s; }
  .icon-btn:hover { background: var(--accent); color: var(--fg); }

  /* the +: images and skills, as the app's prompt box has them. Skills
     opens beside the menu on hover or a click, in place on phones; the
     ::before bridges the gap so the pointer can cross it */
  .add-wrap { position: relative; }
  .add-btn { box-shadow: inset 0 0 0 1px var(--border); }
  .add-btn[aria-expanded="true"] { background: var(--accent); color: var(--fg); }
  .add-menu, .add-sub {
    position: absolute; z-index: 6;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--r);
    box-shadow: 0 10px 24px -8px rgb(0 0 0 / .18), 0 2px 6px -2px rgb(0 0 0 / .1);
    padding: 4px; animation: ll-pop .12s ease-out;
  }
  .add-menu { left: 0; width: 256px; }
  .add-menu.up { bottom: calc(100% + 6px); top: auto; }
  .add-menu.down { top: calc(100% + 6px); bottom: auto; }
  .add-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; text-align: left; padding: 6px 8px; border-radius: var(--r-sm); }
  .add-item:hover, .add-item:focus-visible, .add-skills.open > .add-item { background: var(--accent); outline: 0; }
  .add-item .ico { flex: none; display: flex; color: var(--muted-fg); }
  .add-item:hover .ico, .add-item:focus-visible .ico { color: var(--fg); }
  .add-item .txt { display: flex; flex-direction: column; flex: 1; min-width: 0; }
  .add-item .t { font-size: 13px; font-weight: 500; line-height: 1.25; }
  .add-item .d { font-size: 11.5px; line-height: 1.3; color: var(--muted-fg); margin-top: 1px; }
  .add-item .n {
    display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
    font-size: 11px; font-weight: 600; color: var(--primary); background: rgb(35 71 255 / .08);
  }
  .add-item .chev { display: flex; color: #a1a1aa; }
  .add-item .tick { flex: none; display: flex; width: 15px; color: var(--primary); }
  .add-skills { position: relative; }
  .add-sub { display: none; left: calc(100% + 9px); top: -5px; width: 336px; }
  .add-sub::before { content: ''; position: absolute; right: 100%; top: 0; bottom: 0; width: 12px; }
  .add-menu.up .add-sub { top: auto; bottom: -5px; }
  .add-skills.open > .add-sub { display: block; }
  @media (hover: hover) and (min-width: 561px) {
    .add-skills:hover > .add-sub { display: block; }
    .add-skills:hover > .add-item { background: var(--accent); }
  }
  .add-sep { height: 1px; margin: 4px 6px; background: var(--border); }
  .add-item[href] { color: inherit; text-decoration: none; }

  .stack { display: flex; align-items: center; height: 35px; padding: 0 4px; border-radius: var(--r-sm); transition: background .12s; }
  .stack:hover { background: var(--accent); }
  .stack .logo + .logo, .stack .more { margin-left: -7px; }
  .stack .logo, .stack .more { box-shadow: 0 0 0 2px var(--bg); }
  .stack .empty { display: flex; align-items: center; gap: 6px; color: var(--muted-fg); padding: 0 5px; font-size: 13.5px; font-weight: 500; }
  .more { width: 27px; height: 27px; border-radius: var(--r-sm); background: var(--muted); display: grid; place-items: center; font-size: 10px; font-weight: 600; color: #52525b; }

  .build { display: flex; margin-left: 5px; border-radius: var(--r-sm); overflow: hidden; box-shadow: 0 1px 2px rgb(35 71 255 / .28); }
  .build > button { background: var(--primary); color: var(--primary-fg); height: 35px; font-weight: 500; font-size: 13.5px; transition: background .12s; }
  .build > button:hover { background: var(--primary-hi); }
  .build > button:active { transform: translateY(.5px); }
  .build .go { padding: 0 15px; }
  .build .caret-btn { width: 29px; display: grid; place-items: center; box-shadow: inset 1px 0 0 rgb(255 255 255 / .22); }

  .menu-wrap { position: relative; }
  .menu {
    position: absolute; right: 0; width: 216px; z-index: 5;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--r);
    box-shadow: 0 10px 24px -8px rgb(0 0 0 / .18), 0 2px 6px -2px rgb(0 0 0 / .1);
    padding: 4px; animation: ll-pop .12s ease-out;
  }
  .working .build { pointer-events: none; }
  .working .build > button { background: #4f6bff; }
  .spinner {
    width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; display: inline-block;
    border: 1.6px solid rgb(255 255 255 / .35); border-top-color: #fff;
    animation: ll-orbit .7s linear infinite; vertical-align: -1px;
  }
  .menu a { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 7px 8px; border-radius: var(--r-sm); font-size: 13.5px; color: inherit; text-decoration: none; }
  .menu a:hover, .menu a:focus-visible { background: var(--accent); }
  .menu svg { color: var(--muted-fg); flex: none; }

  .logo {
    position: relative; flex: none; display: grid; place-items: center;
    width: 27px; height: 27px; border-radius: 8px;
    font-size: 10px; font-weight: 600; letter-spacing: .02em;
    background: var(--tint); color: var(--ink); box-shadow: inset 0 0 0 1px var(--edge);
  }
  .logo.lg { width: 34px; height: 34px; border-radius: 8px; font-size: 11px; }
  .logo img { position: absolute; inset: 0; margin: auto; width: 62%; height: 62%; object-fit: contain; }
  .logo.has-img { background: #fff; color: transparent; box-shadow: inset 0 0 0 1px var(--border); }

  .type-wrap { position: relative; }
  .type-btn {
    display: flex; align-items: center; gap: 6px; height: 31px; padding: 0 8px;
    border-radius: var(--r-sm); font-size: 13px; font-weight: 500; color: var(--muted-fg);
    transition: background .12s, color .12s;
  }
  .type-btn:hover { background: var(--accent); color: var(--fg); }
  .type-btn.set { background: var(--muted); color: var(--fg); }
  .type-btn .chev { color: #a1a1aa; margin-left: -1px; }
  .type-menu {
    position: absolute; right: 0; width: 292px; z-index: 6;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--r);
    box-shadow: 0 10px 24px -8px rgb(0 0 0 / .18), 0 2px 6px -2px rgb(0 0 0 / .1);
    padding: 4px; animation: ll-pop .12s ease-out;
  }
  .type-menu.up, .menu.up { bottom: calc(100% + 6px); top: auto; }
  .type-menu.down, .menu.down { top: calc(100% + 6px); bottom: auto; }
  .type-menu .lbl { font-size: 11.5px; font-weight: 500; color: var(--muted-fg); padding: 5px 8px 5px; }
  .type-item { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 5px 7px; border-radius: var(--r-sm); }
  .type-item:hover, .type-item.cursor { background: var(--accent); }
  .type-item .ico {
    width: 26px; height: 26px; border-radius: var(--r-sm); flex: none; display: grid; place-items: center;
    background: var(--tint); color: var(--ink); box-shadow: inset 0 0 0 1px var(--edge);
  }
  .type-item .txt { display: flex; flex-direction: column; min-width: 0; }
  .type-item .t { display: block; font-size: 13px; font-weight: 500; line-height: 1.25; }
  .type-item .d { display: block; font-size: 11.5px; color: var(--muted-fg); line-height: 1.3; margin-top: 1px; }
  .type-item .tick { margin-left: auto; flex: none; color: var(--primary); }

  .effort { border-top: 1px solid var(--border); margin: 6px 2px 0; padding: 10px; }
  .ehead { display: flex; align-items: baseline; gap: 5px; line-height: 1.2; font-size: 12px; font-weight: 500; color: var(--muted-fg); }
  .ehead b { font-size: 13px; line-height: 1.2; font-weight: 600; color: var(--fg); }
  .eends { display: flex; justify-content: space-between; line-height: 1.2; font-size: 11px; color: #a1a1aa; margin: 7px 0 6px; }

  .effort.is-max .ehead b { color: var(--primary); }

  /* --e is the thumb's place, 0 to 1; --h is 1 at Max, where the track goes
     night blue and the thumb, its mark dark as the logo is, sends out little
     blue LanderLab marks: composer.js
     draws the floor and the marks on .efx, the glow round the thumb on
     .eglow, which runs past the track's edges */
  .erail { --thumb: calc(13px + var(--e) * (100% - 26px)); position: relative; height: 30px; }
  .etrack {
    position: absolute; inset: 0; border-radius: 9px; overflow: hidden;
    background: #f4f4f5; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .04);
  }
  .etrack > * { position: absolute; pointer-events: none; }

  .ecool {
    top: 0; bottom: 0; left: 0; width: calc(var(--thumb) + 11px); border-radius: 9px;
    background: #e2e2e5; opacity: calc(1 - var(--h));
    transition: width .22s cubic-bezier(.2, .85, .3, 1), opacity .18s;
  }
  .emax { inset: 0; background: linear-gradient(180deg, #161c3a, #0b0f24); opacity: var(--h); transition: opacity .18s; }
  .efx { inset: 0; width: 100%; height: 100%; opacity: var(--h); transition: opacity .2s; }

  .eticks { inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; transition: opacity .3s .1s; }
  .eticks i { width: 2px; height: 12px; border-radius: 2px; background: #d4d4d8; }
  .eticks i.on { background: #a1a1aa; }
  .effort.is-max .eticks { opacity: 0; transition: none; }

  .eglow {
    position: absolute; z-index: 1; left: -48px; top: -48px; width: calc(100% + 96px); height: calc(100% + 96px);
    pointer-events: none; opacity: var(--h); transition: opacity .25s;
  }

  .erail input {
    position: absolute; z-index: 3; inset: 0; width: 100%; height: 100%; margin: 0;
    -webkit-appearance: none; appearance: none; background: transparent; cursor: grab;
  }
  .erail input:active { cursor: grabbing; }
  .erail input::-webkit-slider-thumb {
    -webkit-appearance: none; width: 24px; height: 26px; background: transparent; border: 0;
  }
  .erail input::-moz-range-thumb {
    width: 24px; height: 26px; background: transparent; border: 0;
  }
  .ethumb {
    position: absolute; z-index: 2; pointer-events: none;
    top: 50%; left: var(--thumb); width: 22px; height: 26px; margin: -13px 0 0 -11px;
    display: grid; place-items: center;
    border-radius: 7px; background: #fff; border: 1px solid rgb(0 0 0 / .1);
    box-shadow: 0 1px 2px rgb(0 0 0 / .12);
    transition: left .22s cubic-bezier(.2, .85, .3, 1), box-shadow .3s;
  }
  .ethumb svg {
    display: block; width: 7.25px; height: 12px; fill: var(--fg); overflow: visible; transform-origin: 50% 100%;
    opacity: 0; scale: .4; transition: opacity .2s, scale .3s cubic-bezier(.2, .9, .3, 1.3);
  }
  .effort.is-max .ethumb { border-color: rgb(35 71 255 / .35); box-shadow: 0 0 0 3px rgb(35 71 255 / .12), 0 1px 2px rgb(0 0 0 / .12); }
  .effort.is-max .ethumb svg { opacity: 1; scale: 1; }
  /* the mark marks time, its two pieces lifting in turn */
  .effort.is-max .ethumb path { animation: ll-step .34s linear infinite; }
  .effort.is-max .ethumb path + path { animation-delay: -.17s; }
  .ethumb.pop { animation: ll-thumb-pop .55s cubic-bezier(.2, .9, .3, 1.25); }
  .ethumb.kick svg { animation: ll-thumb-kick .26s ease-out; }
  .erail input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 10px; }

  .scrim {
    position: fixed; inset: 0; background: rgb(9 9 11 / .55); backdrop-filter: blur(2px);
    display: grid; place-items: center; padding: 16px; z-index: 40; animation: ll-fade .14s ease-out;
  }
  .scrim[hidden] { display: none; }
  .dialog {
    width: min(600px, 100%); max-height: min(700px, 90vh); display: flex; flex-direction: column;
    background: var(--bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
    box-shadow: 0 24px 48px -12px rgb(0 0 0 / .32);
    animation: ll-zoom .16s cubic-bezier(.2,.8,.3,1);
  }
  .dialog header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
  .dialog h2 { margin: 0; font-size: 16.5px; font-weight: 600; letter-spacing: -.015em; }
  .filters { display: flex; gap: 6px; padding: 0 16px 12px; border-bottom: 1px solid var(--border); }
  .search { position: relative; flex: 1; }
  .search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted-fg); }
  .search input, select {
    height: 36px; width: 100%; border: 1px solid var(--border); border-radius: var(--r-sm);
    background: var(--bg); font-size: 13.5px; box-shadow: 0 1px 2px rgb(0 0 0 / .04);
  }
  .search input { padding: 0 10px 0 29px; }
  .search input::placeholder { color: var(--muted-fg); }
  .search input:focus, select:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
  select { width: auto; max-width: 172px; padding: 0 8px; }

  .list { overflow: auto; padding: 12px 16px 16px; scrollbar-width: thin; }
  .sec + .sec { margin-top: 16px; }
  .sec h3 { margin: 0 0 7px; font-size: 12px; font-weight: 500; color: var(--muted-fg); }
  .grid { display: grid; gap: 6px; grid-template-columns: repeat(2, 1fr); }
  .tile {
    display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 10px; min-width: 0; text-align: left;
    border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg);
    box-shadow: 0 1px 2px rgb(0 0 0 / .04); transition: background .12s, border-color .12s;
  }
  .tile:hover { background: var(--accent); border-color: #d4d4d8; }
  .tile .name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tile .dot { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: #22c55e; flex: none; }

  .row { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 8px 0 6px; border-radius: var(--r-sm); transition: background .12s; }
  .row:hover { background: var(--accent); }
  .row + .row { margin-top: 1px; }
  .row .txt { min-width: 0; flex: 1; }
  .row .name { font-size: 14px; font-weight: 500; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .row .desc { font-size: 12.5px; line-height: 1.3; color: var(--muted-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .app-connect {
    flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    width: 96px; height: 30px; border: 1px solid var(--border); border-radius: var(--r-sm);
    font-size: 12.5px; font-weight: 500; color: var(--fg); text-decoration: none;
    background: var(--bg); box-shadow: 0 1px 2px rgb(0 0 0 / .04);
    transition: background .12s, border-color .12s;
  }
  .app-connect:hover { background: var(--muted); border-color: #d4d4d8; }
  .app-connect.on { background: var(--muted); border-color: transparent; color: #3f3f46; box-shadow: none; }
  .app-connect.on svg { color: #16a34a; }

  .empty-state { text-align: center; padding: 40px 0; }
  .empty-state p { margin: 0; font-size: 13.5px; font-weight: 500; }
  .empty-state .sub { margin-top: 4px; color: var(--muted-fg); font-weight: 400; font-size: 12.5px; }

  @media (max-width: 760px) {
    .type-btn .lab { display: none; }
    .type-btn { padding: 0 7px; }
    .ghost, #prompt { font-size: 15.5px; }
    .type-menu { width: 264px; }
  }
  @media (max-width: 560px) {
    .field { padding: 13px 13px 2px; }
    .bar { padding: 4px 7px 7px 9px; }
    #prompt { min-height: 62px; }
    .build .caret-btn { display: none; }
    .add-menu { width: min(300px, calc(100vw - 40px)); }
    .add-sub { position: static; width: auto; border: 0; box-shadow: none; padding: 2px 0 2px 10px; animation: none; }
    .add-sub::before { content: none; }
    .add-sub .d { display: none; }
    .build { border-radius: var(--r-sm); }
    select { max-width: 132px; }
  }
  @media (max-width: 420px) {
    .stack { display: none; }
    .filters { flex-wrap: wrap; }
    select { max-width: none; flex: 1; }
    .dialog header { padding: 12px 14px; }
    .list { padding: 10px 14px 14px; }
  }
}

.tip {
  position: fixed; z-index: 60; pointer-events: none; left: 0; top: 0;
  background: #18181b; color: #fafafa;
  font: 500 12px/1.35 "Inter", ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 5px 9px; border-radius: 7px; max-width: 250px;
  box-shadow: 0 8px 20px -8px rgb(0 0 0 / .45);
  opacity: 0; transform: translateY(3px); transition: opacity .12s ease, transform .12s ease;
}
.tip.on { opacity: 1; transform: none; }

@keyframes ll-orbit  { to { rotate: 360deg; } }
@keyframes ll-blink  { 0%, 100% { opacity: 1 } 50% { opacity: 0 } }
@keyframes ll-pop    { from { opacity: 0; transform: translateY(4px) scale(.97) } }
@keyframes ll-fade   { from { opacity: 0 } }
@keyframes ll-zoom   { from { opacity: 0; transform: scale(.97) translateY(6px) } }
@keyframes ll-step   { 0%, 50% { translate: 0 0 } 50.01%, 100% { translate: 0 -7px } }
@keyframes ll-thumb-pop  { 30% { scale: 1.28; filter: brightness(1.15) drop-shadow(0 0 6px rgb(35 71 255 / .6)) } }
@keyframes ll-thumb-kick { 35% { scale: 1.14 .84 } }

@media (prefers-reduced-motion: reduce) {
  .ai-composer, .ai-composer *, .ai-composer *::before, .ai-composer *::after, .tip {
    animation: none !important; transition: none !important;
  }
}
