/* Studio: an app shell, not a page. Top bar, chat column, and the build filling everything else.
   Start mode is a single prompt over a slowly turning build. Tokens come from app.css.
   The 3D window is a night garden: sky fading to a lantern glow at the horizon, quiet glass
   controls along the bottom, nothing on top of the build unless it is working. */

html, body.studio-body { height: 100%; }
body.studio-body { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; overflow: hidden; background: var(--bg); background-image: none; }

body.studio-body > main { display: grid; min-height: 0; }
.shell {
  --chat-w: clamp(340px, 30vw, 430px);
  display: grid; min-height: 0; height: 100%;
  grid-template-columns: var(--chat-w) minmax(0, 1fr);
  grid-template-rows: 52px minmax(0, 1fr);
  grid-template-areas: "top top" "chat stage";
}
.shell[data-mode="start"] { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "start"; }

/* ---- top bar ---- */
.topbar {
  grid-area: top; display: flex; align-items: center; gap: 12px; min-width: 0;
  padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 92%, #000);
}
.topbar .logo { font-size: 1.1rem; gap: 10px; flex: none; }
.logo-cube { width: 18px; height: 18px; border-radius: 4px; flex: none;
  background: linear-gradient(135deg, #ffd27a 0 34%, var(--accent) 34% 67%, #b97817 67%); box-shadow: 0 0 18px rgba(243, 178, 60, .35); }
.topbar-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 380px; }
.topbar-title .sep { color: var(--edge); }
.title-input { min-width: 0; overflow: hidden; white-space: nowrap; min-height: 34px !important; padding: 4px 8px !important; border: 1px solid transparent !important; background: transparent !important; border-radius: 8px !important;
  font: 500 .96rem var(--font) !important; color: var(--ink) !important; text-overflow: ellipsis; }
.title-input:hover { border-color: var(--line) !important; }
.title-input:focus { border-color: var(--edge) !important; background: var(--panel) !important; outline: none; }
.title-input:focus-visible { outline: 2px solid var(--focus) !important; outline-offset: 1px; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.credits { min-width: 64px; justify-content: center; transition: opacity .18s ease, border-color .15s; }
.credits.is-pending { opacity: 0; }
.credits { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font: 500 .9rem var(--font); padding: 0 11px; height: 34px; border-radius: 10px; border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.credits:hover { color: var(--ink); border-color: var(--edge); background: var(--panel); }
.credits.is-low { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.gem { width: 10px; height: 10px; transform: rotate(45deg); background: var(--accent); border-radius: 2px; box-shadow: 0 0 8px rgba(243, 178, 60, .5); }
.icon-link { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); }
.icon-link:hover { border-color: var(--edge); background: var(--panel); }
.grid-ico { width: 14px; height: 14px; background:
  linear-gradient(var(--ink-2) 0 0) 0 0 / 6px 6px no-repeat, linear-gradient(var(--ink-2) 0 0) 8px 0 / 6px 6px no-repeat,
  linear-gradient(var(--ink-2) 0 0) 0 8px / 6px 6px no-repeat, linear-gradient(var(--ink-2) 0 0) 8px 8px / 6px 6px no-repeat; }
.get-btn { min-height: 34px; padding: 6px 14px; border: 0; border-radius: 10px; position: relative; }
.get-btn[aria-expanded="true"] { background: color-mix(in srgb, var(--accent) 80%, #fff); }
.get-short { display: none; }
#open-get.needs-check::after { content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--azalea); box-shadow: 0 0 0 2px var(--bg); }

/* ---- start screen ---- */
.start { grid-area: start; position: relative; display: grid; place-items: center; overflow: hidden; min-height: 0;
  padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.start-bg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .7; --live-opacity: .7; }
.start::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 55% at 50% 52%, color-mix(in srgb, var(--bg) 84%, transparent) 0%, color-mix(in srgb, var(--bg) 40%, transparent) 70%, transparent 100%); }
.start-card { position: relative; z-index: 1; width: min(720px, 100%); display: grid; gap: 14px; text-align: left; }
.start-card h1 { font-size: clamp(2.1rem, 6vw, 3.6rem); margin: 0; text-shadow: 0 2px 24px rgba(0, 0, 0, .5); }
.start-sub { color: var(--ink-2); margin: 0 0 6px; font-size: 1.05rem; }
.ideas { display: flex; flex-wrap: wrap; gap: 8px; }
.idea { font: 400 .88rem var(--font); color: var(--ink-2); background: color-mix(in srgb, var(--panel) 80%, transparent); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; text-align: left; }
.idea:hover { color: var(--ink); border-color: var(--edge); background: var(--panel); }
.idea-small { font-size: .84rem; padding: 5px 11px; }

/* ---- prompt box (start + composer) ---- */
.prompt-box { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 12px 10px 10px 14px; display: grid; gap: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35); transition: border-color .15s, box-shadow .15s; }
.prompt-box:focus-within { border-color: color-mix(in srgb, var(--accent) 65%, var(--line)); box-shadow: 0 12px 40px rgba(0, 0, 0, .35), 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); }
.prompt-box textarea { border: 0 !important; background: transparent !important; padding: 2px 0 !important; min-height: 0 !important; resize: none;
  font: 400 1rem/1.5 var(--font); color: var(--ink); outline: none; max-height: 220px; overflow-y: auto; }
.prompt-box textarea:focus-visible { outline: none; }
.start .prompt-box textarea { font-size: 1.1rem; min-height: 84px !important; }
.prompt-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; min-width: 0; }
.prompt-row .send { margin-left: auto; min-height: 40px; padding: 7px 8px 7px 16px; border-radius: 12px; border: 0; gap: 8px; flex: none; }
.send-price { font: 500 .78rem/1 var(--font); padding: 5px 8px; border-radius: 8px; background: rgba(31, 21, 3, .14); white-space: nowrap; }
.send-price:empty { display: none; }
.send:has(.send-price:empty) { padding-right: 16px; }
.send.is-pending { padding-right: 8px; }
.send.is-pending .send-price:empty { display: inline-block; visibility: hidden; min-width: 3.6em; }
.send.is-short { background: var(--panel-2); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warn) 50%, var(--line)); }
.send.is-short .send-price { background: var(--warn-soft); color: var(--warn); }
.row-hint { font-size: .8rem; color: var(--ink-2); opacity: .8; }
.attach-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 10px; border-radius: 10px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-2) 55%, transparent); color: var(--ink); font: 500 .86rem var(--font); cursor: pointer; flex: none; white-space: nowrap; }
.attach-btn .ico { color: var(--accent); flex: none; }
.attach-btn:hover { background: var(--panel-2); border-color: var(--edge); }
.attach-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.attach-btn.is-full { color: var(--ink-2); }
.attach-btn.is-full .ico { color: var(--ink-2); }
.row-end { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.row-end .send { margin-left: 0; }
.att-hint { margin: 0; padding: 0 6px; font-size: .84rem; line-height: 1.45; color: var(--ink-2); }
.att-hint.is-error { color: var(--warn); }
.start-card .att-hint { margin-top: -6px; }
.composer .att-hint { font-size: .8rem; margin-top: -2px; }
.prompt-box:has(.att-list:not(:empty)) ~ .att-hint:not(.is-error) { color: var(--teal); }
.att-list { display: flex; gap: 8px; min-width: 0; overflow-x: auto; }
.att-list:empty { display: none; }
.att { position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); flex: none; background: var(--panel-2); }
.att img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .78); color: #fff; cursor: pointer; padding: 0; }
.att button::before { content: ""; position: absolute; inset: -6px; }           /* a bigger target than the little disc */
.att button:hover { background: #000; }
.att button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.drop-veil { display: none; }
.prompt-box.is-dropping { border-color: var(--azalea); border-style: dashed; }
.prompt-box.is-dropping .drop-veil { display: grid; place-items: center; position: absolute; inset: 0; border-radius: inherit; z-index: 3;
  background: color-mix(in srgb, var(--azalea-soft) 92%, transparent); color: var(--ink); font-weight: 500; pointer-events: none; }
.pin-note { margin: 0; display: inline-flex; gap: 6px; align-items: center; font-size: .82rem; color: var(--teal); }
.pin-note[hidden] { display: none; }

/* build type: the same pill as "Style: Any", a menu with the price and what each one is for */
.chev { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.kind-pick { position: relative; flex: none; transition: opacity .2s; }
.kind-pick.is-pending { opacity: 0; min-width: 118px; height: 30px; }
.kind-pick[hidden] { display: none; }
.kind-menu { position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 25; width: min(310px, calc(100vw - 24px)); padding: 6px; display: grid; gap: 2px;
  background: var(--panel); border: 1px solid var(--edge); border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .5); }
.kind-menu[hidden] { display: none; }
.kind-pick[data-dir="down"] .kind-menu { bottom: auto; top: calc(100% + 8px); }
.kind-opt { display: grid; gap: 2px; text-align: left; padding: 9px 10px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink); cursor: pointer; font: inherit; }
.kind-opt:hover { background: var(--panel-2); }
.kind-opt[aria-checked="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.kind-opt:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.ko-top { display: flex; align-items: center; gap: 8px; }
.ko-top strong { font-weight: 600; font-size: .92rem; margin-right: auto; }
.ko-price { font-size: .8rem; color: var(--accent); white-space: nowrap; }
.kind-opt.is-free .ko-price { font-weight: 600; }
.ko-blurb { font-size: .8rem; color: var(--ink-2); line-height: 1.4; padding-left: 21px; }
.ko-note { margin: 4px 6px 2px; font-size: .78rem; color: var(--ink-2); line-height: 1.4; }
/* ascending bars: where this kind sits on the ladder (Lite < Design < Premium; Quick < Smart) */
.tier { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; flex: none; }
.tier i { width: 4px; border-radius: 1px; background: currentColor; opacity: .28; }
.tier i:nth-child(1) { height: 5px; } .tier i:nth-child(2) { height: 8px; } .tier i:nth-child(3) { height: 12px; }
.tier i.on { opacity: 1; color: var(--accent); }

.start-fit { justify-self: start; display: inline-flex; flex-wrap: wrap; gap: 0 6px; padding: 4px 2px; border: 0; background: none; cursor: pointer;
  font: 400 .88rem var(--font); color: var(--ink-2); text-align: left; text-shadow: 0 1px 10px rgba(0, 0, 0, .6); }
.start-fit span { color: var(--teal); text-decoration: underline; text-underline-offset: 3px; }
.start-fit:hover span { color: var(--ink); }
.start-fit:disabled { opacity: .6; cursor: progress; }

/* ---- chat ---- */
.chat { grid-area: chat; display: grid; grid-template-rows: minmax(0, auto) minmax(120px, 1fr) auto; min-height: 0; border-right: 1px solid var(--line); background: var(--bg); }

/* "Fit to my world": optional and collapsed, a slim row above the conversation */
.fit { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 55%, var(--bg)); min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.fit-sum { position: sticky; top: 0; z-index: 1; background: color-mix(in srgb, var(--panel) 55%, var(--bg)); display: flex; align-items: center; gap: 10px; padding: 9px 18px; cursor: pointer; list-style: none; font: 500 .88rem var(--font); color: var(--ink-2); min-height: 40px; }
.fit-sum::-webkit-details-marker { display: none; }
.fit-sum:hover { color: var(--ink); }
.fit-sum::before { content: ""; width: 14px; height: 9px; flex: none; border-radius: 2px; background: linear-gradient(var(--ground) 0 55%, #6b4a2b 55%); box-shadow: 0 -3px 0 -1px #6fae4a; }
.fit-title { flex: 1; min-width: 0; }
.fit-state { font-size: .74rem; font-weight: 500; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
.fit-state.is-set { color: var(--teal); border-color: color-mix(in srgb, var(--teal) 40%, transparent); background: var(--teal-soft); }
.fit-sum .chev { transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.fit[open] .fit-sum .chev { transform: translateY(1px) rotate(-135deg); }
.fit[open] .fit-sum { color: var(--ink); }
.fit-body { display: grid; gap: 14px; padding: 2px 18px 16px; font-size: .88rem; }
.fit-intro, .fit-foot { margin: 0; color: var(--ink-2); }
.fit-foot { font-size: .8rem; }
.fit-step { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.fit-step h3 { margin: 0; display: flex; align-items: center; gap: 8px; font: 600 .92rem var(--font); }
.fit-n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font-size: .74rem; background: var(--panel-2); color: var(--accent); flex: none; }
.fit-step .hint { font-size: .84rem; }
.fit-step kbd { font-size: .76rem; }
.fit-row { display: flex; gap: 8px; min-width: 0; }
.fit-row input { flex: 1; min-width: 0; min-height: 38px; padding: 6px 10px; font: 400 .84rem var(--mono); }
.fit-row .btn { flex: none; }
.fit-live { margin: 0; min-height: 1.2em; font-size: .8rem; color: var(--teal); }
.fit-live:empty { display: none; }
.fit-done { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 8px 8px 10px; border-radius: 10px;
  background: var(--teal-soft); border: 1px solid color-mix(in srgb, var(--teal) 30%, transparent); }
.fit-done > .ico { color: var(--teal); }
.fit-done-text { display: grid; min-width: 0; }
.fit-done-text strong { font-weight: 500; overflow-wrap: anywhere; }
.fit-done-text span { font-size: .8rem; color: var(--ink-2); }
.fit-done .btn { min-height: 32px; padding: 4px 10px; }
.fit-how { margin: 0; padding-left: 20px; display: grid; gap: 4px; color: var(--ink); }
.fit-how li::marker { color: var(--accent); font-weight: 600; }
.fit-upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.fit-pick { gap: 6px; cursor: pointer; }
.fit-file-name { font-size: .8rem; color: var(--ink-2); overflow-wrap: anywhere; min-width: 0; }
.fit-label { font-weight: 500; font-size: .84rem; }
.fit-facts { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; }
.fit-facts dt { color: var(--ink-2); }
.fit-facts dd { margin: 0; }
.fit-warn, .fit-warnings { margin: 0; color: var(--warn); font-size: .84rem; }
.fit-warnings { padding-left: 18px; display: grid; gap: 4px; }
.fit-error { margin: 0; font-size: .86rem; }
.log { overflow-y: auto; padding: 20px 18px 12px; display: flex; flex-direction: column; gap: 16px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--edge) transparent; }
.msg { max-width: 92%; overflow-wrap: anywhere; line-height: 1.5; font-size: .95rem; }
.msg-text { white-space: pre-wrap; }
.msg-you { align-self: flex-end; background: var(--azalea-soft); color: var(--ink); padding: 9px 13px; border-radius: 16px 16px 4px 16px; display: grid; gap: 8px; }
.msg-builder { align-self: flex-start; color: var(--ink); padding-left: 28px; position: relative; }
.msg-builder::before { content: ""; position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 4px;
  background: linear-gradient(135deg, #ffd27a 0 34%, var(--accent) 34% 67%, #b97817 67%); box-shadow: 0 0 12px rgba(243, 178, 60, .3); }
.msg-failed::before { background: var(--bad-soft); box-shadow: inset 0 0 0 2px var(--bad); }
.msg-shots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.msg-shots img, .shot-missing { width: 84px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--azalea) 30%, transparent); display: block; }
.shot-missing { display: grid; place-items: center; color: var(--ink-2); background: color-mix(in srgb, var(--bg) 40%, transparent); }
.ver-chip { margin-top: 8px; display: inline-flex; gap: 8px; align-items: center; font: 400 .86rem var(--font); color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; cursor: pointer; max-width: 100%; text-align: left; }
.ver-chip b { font-weight: 600; color: var(--accent); flex: none; }
.ver-chip span { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ver-chip em { font-style: normal; font-size: .72rem; color: var(--teal); border: 1px solid color-mix(in srgb, var(--teal) 40%, transparent); padding: 1px 6px; border-radius: 6px; flex: none; }
.ver-chip em.from { color: var(--ink-2); border-color: var(--line); }
.ver-chip:hover { border-color: var(--edge); }
.ver-chip.is-on { border-color: color-mix(in srgb, var(--accent) 70%, transparent); background: var(--accent-soft); }
.ver-chip.is-on span { color: var(--ink); }
.retry { margin-top: 8px; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--edge); background: var(--panel); color: var(--ink); font: 500 .88rem var(--font); }
.retry:hover { border-color: var(--accent); }
.is-working { width: 100%; max-width: 100%; display: grid; gap: 10px; color: var(--ink-2); }
.work-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.work-text { color: var(--ink); flex: 1; min-width: 0; }
.work-time { font-size: .78rem; font-variant-numeric: tabular-nums; }
.work-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.work-steps li { font-size: .72rem; color: var(--ink-2); padding-top: 7px; position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.work-steps li::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: 2px; background: var(--line); }
.work-steps li.is-done::before { background: color-mix(in srgb, var(--accent) 70%, var(--line)); }
.work-steps li.is-current { color: var(--ink); }
.work-steps li.is-current::before { background: linear-gradient(90deg, var(--accent) 0 40%, var(--line) 40%); background-size: 250% 100%; animation: sweep 1.4s linear infinite; }
.work-steps li.is-failed::before { background: var(--bad); }
@keyframes sweep { from { background-position: 100% 0; } to { background-position: -150% 0; } }
/* live build: the request's items (ticked only when the checks found them) and the builder's steps */
.work-tasks { display: grid; gap: 6px; }
.wt-head { margin: 0; display: flex; justify-content: space-between; gap: 10px; font-size: .78rem; color: var(--ink-2); }
.wt-head > span:first-child { color: var(--ink); font-weight: 500; }
.wt-sum { font-variant-numeric: tabular-nums; }
.wt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.wt-list li { display: flex; align-items: center; gap: 8px; font-size: .84rem; min-width: 0; }
.wt-box { width: 16px; height: 16px; flex: none; display: grid; place-items: center; border-radius: 5px; border: 1.5px solid var(--edge); color: var(--accent-ink); transition: background .3s, border-color .3s; }
.wt-list li.is-done { color: var(--ink); }
.wt-list li.is-done .wt-box { background: var(--accent); border-color: var(--accent); }
.ver-actions a.rate-btn { text-decoration: none; }
.wt-list li.is-builder { color: var(--ink-2); }
.wt-head.wt-sub { margin-top: 8px; font-size: .78rem; color: var(--ink-2); }
.wt-list li.is-builder .wt-box { border-style: dashed; border-radius: 50%; }
.wt-by { display: block; font-size: .74rem; color: var(--ink-3, var(--ink-2)); opacity: .8; }
.work-log { font-size: .8rem; border-top: 1px solid var(--line); padding-top: 6px; }
.work-log summary { cursor: pointer; color: var(--ink-2); min-height: 28px; display: flex; align-items: center; }
.work-log summary:hover { color: var(--ink); }
.work-log ol { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.work-log li { position: relative; padding-left: 16px; display: grid; gap: 6px; color: var(--ink-2); }
.work-log li::before { content: ""; position: absolute; left: 3px; top: .5em; width: 6px; height: 6px; border-radius: 50%; background: var(--edge); }
.work-log li.is-current { color: var(--ink); }
.work-log li.is-current::before { background: var(--accent); animation: glow .8s ease-in-out infinite alternate; }
.work-log li.k-check::before { border-radius: 1px; }
.wl-pics { display: flex; gap: 6px; flex-wrap: wrap; }
.wl-pics img { width: 72px; height: 72px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); }
.work-note { margin: 0; font-size: .74rem; color: var(--ink-2); }
.dots { display: inline-flex; gap: 4px; flex: none; }
.dots i { width: 6px; height: 6px; background: var(--accent); border-radius: 1px; animation: hop 1.1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.tip-card { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 34px 10px 12px;
  border: 1px dashed var(--edge); border-radius: 12px; color: var(--ink-2); font-size: .84rem; }
.tip-card p { margin: 0; }
.tip-card > .ico { color: var(--teal); margin-top: 2px; }
.tip-card kbd { font-size: .78rem; }
.tip-close { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); cursor: pointer; }
.tip-close:hover { background: var(--panel-2); color: var(--ink); }
.skeleton { display: grid; gap: 12px; }
.skeleton i { display: block; height: 38px; border-radius: 14px; background: linear-gradient(90deg, var(--panel) 0 40%, var(--panel-2) 50%, var(--panel) 60%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton i:nth-child(1) { width: 62%; justify-self: end; } .skeleton i:nth-child(2) { width: 80%; height: 70px; } .skeleton i:nth-child(3) { width: 48%; justify-self: end; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.composer { padding: 8px 14px 12px; display: grid; gap: 8px; background: var(--bg); }
.composer .notice { margin: 0; font-size: .9rem; }
.composer .prompt-box { box-shadow: none; }
.composer textarea { min-height: 26px !important; }
.composer .prompt-box:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent); }
.composer-note { margin: 0; font-size: .76rem; color: var(--ink-2); padding: 0 4px; min-height: 1.2em; }
.composer-note kbd { font-size: .72rem; padding: 0 .35em; }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; }
.free-note { margin: 0 0 6px; font-size: .86rem; color: var(--ink-2); }
/* changing an older version: says so right where the next message is typed */
.base-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 7px 10px; border-radius: 12px; font-size: .84rem;
  background: var(--teal-soft); border: 1px solid color-mix(in srgb, var(--teal) 35%, transparent); color: var(--ink); }
.base-note[hidden] { display: none; }
.base-note > .ico { color: var(--teal); flex: none; transform: scaleX(-1); }
.bn-text { flex: 1 1 180px; min-width: 0; }
.bn-back { border: 0; background: none; padding: 2px 4px; cursor: pointer; font: 500 .82rem var(--font); color: var(--teal); text-decoration: underline; text-underline-offset: 3px; }
.bn-back:hover { color: var(--ink); }
.short-card { display: grid; gap: 8px; }
.short-card p { margin: 0; }
.short-card .btn-row { gap: 8px; }
.auto-card { scroll-margin: 16px; }

/* ---- stage (the build) ---- */
.stage { grid-area: stage; position: relative; min-height: 0; min-width: 0; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(ellipse 70% 38% at 50% 100%, rgba(243, 178, 60, .13), transparent 70%),
    linear-gradient(180deg, #121c22 0%, var(--sky) 55%, #22312f 100%); }
.canvas-host { position: absolute; inset: 0; }
.stage.is-building .canvas-host { filter: saturate(.75) brightness(.86); transition: filter .4s; }
.stage.is-live .canvas-host { filter: none; }        /* the live build is the thing to look at: not dimmed */
.stage:fullscreen { width: 100vw; height: 100vh; }
.stage-top { position: absolute; left: 12px; top: 12px; right: 70px; z-index: 4; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; pointer-events: none; }
.stage-top > * { pointer-events: auto; }
.versions { display: flex; gap: 2px; padding: 3px; border-radius: 12px; overflow-x: auto; max-width: 100%; scrollbar-width: none;
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(8px); border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); }
.versions:empty { display: none; }
.ver { font: 500 .82rem var(--font); color: var(--ink-2); background: transparent; border: 0; border-radius: 9px; padding: 5px 10px; cursor: pointer; flex: none; min-height: 30px; font-variant-numeric: tabular-nums; }
.ver:hover { color: var(--ink); background: var(--panel-2); }
.ver[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); }
.ver-info { margin: 0; display: flex; gap: 4px 10px; align-items: baseline; flex-wrap: wrap; font-size: .84rem; text-shadow: 0 1px 8px rgba(0, 0, 0, .7); min-width: 0; }
.ver-info strong { font-weight: 500; }
.ver-info .muted { font-size: .8rem; }
.mats-link { font: inherit; font-size: .8rem; color: var(--ink); background: color-mix(in srgb, var(--panel) 82%, transparent); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; cursor: pointer; text-shadow: none; }
.mats-link:hover { border-color: var(--accent); }
.mats-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mats-more { color: var(--accent); }
.diff-note { color: var(--accent); font-size: .8rem; }
.from-note { color: var(--teal); font-size: .8rem; }
/* "Good build" / "Not quite" on the version on screen */
.rate { display: flex; gap: 2px; padding: 3px; border-radius: 12px; flex: none;
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(8px); border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); }
.rate[hidden] { display: none; }
.rate-btn { display: inline-flex; align-items: center; gap: 6px; font: 500 .8rem var(--font); color: var(--ink-2); background: transparent; border: 1px solid transparent;
  border-radius: 9px; padding: 4px 10px; min-height: 30px; cursor: pointer; }
.rate-btn:hover:not(:disabled) { color: var(--ink); background: var(--panel-2); }
.rate-btn:disabled { cursor: progress; }
.rate-bad .ico { transform: scaleY(-1); }
.rate-thanks { align-self: center; padding: 0 10px 0 6px; font: 500 .8rem var(--font); color: var(--good); animation: pw-fade .2s ease-out; }
.rate-good[aria-pressed="true"] { color: var(--good); background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.rate-bad[aria-pressed="true"] { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.ver-banner { flex: 0 1 100%; max-width: min(520px, 100%); display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap;
  padding: 8px 8px 8px 14px; border-radius: 12px; font-size: .86rem; background: color-mix(in srgb, var(--teal-soft) 90%, transparent); border: 1px solid color-mix(in srgb, var(--teal) 35%, transparent); backdrop-filter: blur(8px); }
.ver-banner .btn { min-height: 32px; padding: 4px 12px; }
.vb-short { display: none; }
.stage.is-building .ver-banner { display: none; } /* the progress pill says "Building v4 from v2" instead */
/* above the viewer's toolbar (up to three rows when the stage is narrow), so a toast never covers Edit or the view buttons */
.studio-body .toasts { bottom: 150px; right: 16px; }
.stage-progress { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 5; display: grid; gap: 6px; justify-items: center; pointer-events: none; }
.has-versions .stage-progress { top: 58px; }
.sp-pill { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px; font-size: .88rem; white-space: nowrap;
  background: color-mix(in srgb, var(--bg) 82%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); backdrop-filter: blur(8px); box-shadow: 0 8px 30px rgba(0, 0, 0, .4); }
.sp-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: glow 1.2s ease-in-out infinite alternate; }
@keyframes glow { from { opacity: .45; } to { opacity: 1; } }
.sp-live { font: 600 .7rem var(--font); letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; background: var(--bad); color: #fff; }
.sp-live[hidden] { display: none; }
.stage.is-live .sp-dot { display: none; }
.stage.is-live .ver-info, .stage.is-live .rate { display: none; }   /* the window shows the build in progress, not that version */
@media (max-width: 480px) { .sp-pill { white-space: normal; max-width: calc(100vw - 32px); } }
.sp-bar { width: 180px; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--line) 80%, transparent); overflow: hidden; }
.sp-bar i { --f: .1; display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(var(--f)); transition: transform .8s ease; }
/* "Your build is ready" (once per new design): over the build, under the version row, above the viewer's toolbar */
.ready-card { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); z-index: 6; width: min(420px, calc(100% - 24px)); display: grid; gap: 10px;
  padding: 16px 18px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line)); background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(10px); box-shadow: 0 18px 50px rgba(0, 0, 0, .45); animation: ready-in .35s ease-out; }
.ready-card[hidden] { display: none; }
.ready-card h2 { margin: 0; font-size: 1.15rem; padding-right: 28px; }
.ready-card p { margin: 0; color: var(--ink-2); font-size: .9rem; }
.ready-card .btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ready-card .tip-close { position: absolute; top: 10px; right: 10px; }
@keyframes ready-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .ready-card { animation: none; } }
/* phones: the status strip over the 3D window while a build runs (studio.js renderStageProgress); hidden on wide screens */
.phone-strip { display: none; }
.stage-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; color: var(--ink-2); text-align: center; padding: 20px; z-index: 1; }
.stage-status { margin: 0; max-width: 36ch; }
.stage-empty.is-working .stage-status { color: var(--ink); font-size: 1.05rem; }
/* six blocks stacking up, like a build going up course by course */
.stack { display: grid; grid-template-columns: repeat(3, 22px); grid-auto-rows: 22px; gap: 3px; transform: rotateX(0); }
.stack i { border-radius: 3px; background: color-mix(in srgb, var(--accent) 80%, var(--bg)); opacity: .25; animation: place 2.4s infinite ease-out; }
.stack i:nth-child(1) { grid-row: 2; animation-delay: 0s; }
.stack i:nth-child(2) { grid-row: 2; animation-delay: .2s; background: color-mix(in srgb, var(--teal) 70%, var(--bg)); }
.stack i:nth-child(3) { grid-row: 2; animation-delay: .4s; }
.stack i:nth-child(4) { grid-row: 1; animation-delay: .7s; background: color-mix(in srgb, var(--azalea) 70%, var(--bg)); }
.stack i:nth-child(5) { grid-row: 1; animation-delay: .9s; }
.stack i:nth-child(6) { grid-row: 1; animation-delay: 1.1s; background: color-mix(in srgb, var(--teal) 70%, var(--bg)); }
.stage-empty:not(.is-working) .stack i { animation: none; opacity: .35; }
@keyframes place { 0% { opacity: .15; transform: translateY(-8px); } 18%, 80% { opacity: 1; transform: none; } 100% { opacity: .15; } }
.steps-row { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.steps-row li { font-size: .8rem; padding: 4px 10px 4px 22px; border-radius: 999px; border: 1px solid var(--line); position: relative; color: var(--ink-2); }
.steps-row li::before { content: ""; position: absolute; left: 9px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--edge); }
.steps-row li.is-done { color: var(--ink); } .steps-row li.is-done::before { background: var(--accent); }
.steps-row li.is-current { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.steps-row li.is-current::before { background: var(--accent); animation: glow .8s ease-in-out infinite alternate; }

/* ---- the 3D viewer inside the stage ---- */
.pw-viewer { position: absolute; inset: 0; transition: opacity .2s ease; }
.js .pw-viewer.pw-fade:not(.is-ready) { opacity: 0; }   /* fades in over the old view (or the placeholder) once drawn */
.pw-stage { position: absolute; inset: 0; }
.pw-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.pw-canvas:active { cursor: grabbing; }
.pw-canvas:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; border-radius: 0; }
.pw-loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; }
.pw-viewer-fallback { padding: 64px 20px 20px; overflow: auto; display: grid; gap: 12px; align-content: start; }
.pw-fallback-canvas { width: 100%; max-height: 440px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 12px; background: #6a9a3c; object-fit: contain; }
.pw-compass { position: absolute; right: 14px; top: 12px; width: 42px; height: 42px; border-radius: 50%; z-index: 3; pointer-events: none;
  background: color-mix(in srgb, var(--bg) 70%, transparent); border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); backdrop-filter: blur(6px); }
.pw-compass-dial { --az: 0rad; position: absolute; inset: 0; transform: rotate(var(--az)); }
.pw-compass-dial span { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; font: 600 .62rem/14px var(--font); text-align: center; color: var(--ink-2); }
.pw-compass-dial .pw-c-n { transform: translateY(-13px) rotate(calc(var(--az) * -1)); color: #ff8a7a; font-size: .7rem; }
.pw-compass-dial .pw-c-s { transform: translateY(13px) rotate(calc(var(--az) * -1)); }
.pw-compass-dial .pw-c-e { transform: translateX(13px) rotate(calc(var(--az) * -1)); }
.pw-compass-dial .pw-c-w { transform: translateX(-13px) rotate(calc(var(--az) * -1)); }
.pw-toolbar { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 3; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; pointer-events: none; flex-wrap: wrap; }
.pw-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; pointer-events: auto; }
.pw-group-right { margin-left: auto; }
.pw-tool, .pw-layer, .pw-seg { height: 36px; display: inline-flex; align-items: center; gap: 7px; border-radius: 11px; color: var(--ink);
  background: color-mix(in srgb, var(--bg) 76%, transparent); border: 1px solid color-mix(in srgb, var(--line) 85%, transparent); backdrop-filter: blur(8px); font: 500 .84rem var(--font); }
.pw-tool { padding: 0 10px; cursor: pointer; min-width: 36px; justify-content: center; }
.pw-tool:hover { border-color: var(--edge); background: color-mix(in srgb, var(--panel-2) 90%, transparent); }
.pw-tool[aria-pressed="true"], .pw-tool[aria-expanded="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pw-seg { padding: 2px; gap: 2px; }
.pw-seg .pw-tool { height: 30px; border: 0; background: transparent; border-radius: 9px; min-width: 32px; padding: 0 7px; backdrop-filter: none; }
.pw-seg .pw-tool:hover { background: var(--panel-2); }
.pw-seg .pw-tool[aria-pressed="true"] { background: var(--panel-2); color: var(--accent); }
.pw-diff-btn[aria-pressed="false"] .ico { color: var(--accent); }
.pw-layer { padding: 0 10px; cursor: default; color: var(--ink-2); }
.pw-layer input { width: clamp(80px, 12vw, 160px); margin: 0; }
.pw-layer-out { font: 500 .78rem var(--font); color: var(--ink); min-width: 4ch; font-variant-numeric: tabular-nums; }
.pw-key { position: absolute; right: 12px; bottom: 56px; z-index: 6; }
.pw-legend { list-style: none; margin: 0; padding: 10px 12px; display: grid; gap: 7px; width: min(320px, calc(100vw - 48px)); font-size: .82rem; color: var(--ink-2);
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--edge); border-radius: 12px; box-shadow: 0 14px 40px rgba(0, 0, 0, .45); }
.pw-legend li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: center; }
.pw-legend i { display: block; justify-self: center; }
.lg-you { width: 9px; height: 18px; background: #fff; border-radius: 2px; }
.lg-conflict { width: 16px; height: 16px; border: 2px solid #ff1f1f; border-radius: 2px; }
.lg-plot { width: 18px; height: 0; border-top: 3px solid #ffb000; }
.lg-target { width: 5px; height: 18px; background: #ff3df0; border-radius: 3px; }
.lg-ghost { width: 16px; height: 16px; background: color-mix(in srgb, #8fae6f 45%, #9aa3a8); opacity: .6; border-radius: 3px; }
.lg-new { width: 16px; height: 16px; background: var(--accent); border-radius: 3px; box-shadow: 0 0 8px var(--accent); }
.lg-gone { width: 16px; height: 16px; background: var(--azalea); opacity: .55; border-radius: 3px; }
.lg-drag { width: 14px; height: 14px; border: 2px solid var(--ink-2); border-radius: 50%; }
.pw-hint { position: absolute; left: 50%; bottom: 62px; transform: translateX(-50%); z-index: 3; margin: 0; padding: 7px 14px; border-radius: 999px; pointer-events: none;
  font-size: .84rem; color: var(--ink); white-space: nowrap; background: color-mix(in srgb, var(--bg) 80%, transparent); border: 1px solid var(--line); backdrop-filter: blur(6px);
  transition: opacity .35s, transform .35s; }
.pw-hint.is-gone { opacity: 0; transform: translate(-50%, 6px); }

/* ---- drawer ---- */
/* a child of the shell: it sits over the build's cell on a desktop and over whichever pane is showing on a phone */
.drawer { grid-area: stage; justify-self: end; width: min(460px, 100%); min-height: 0; background: var(--panel); border-left: 1px solid var(--line);
  display: grid; grid-template-rows: auto auto minmax(0, 1fr); z-index: 8; box-shadow: -20px 0 50px rgba(0, 0, 0, .35); animation: slide-in .22s ease-out; }
.drawer .skeleton { padding: 4px 0; }
.drawer .skeleton i { height: 54px; width: 100% !important; justify-self: stretch !important; }
.drawer .skeleton i:nth-child(2) { height: 96px; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.stage.has-drawer .pw-compass { display: none; }
/* the drawer covers the right of the stage: the viewer's toolbar and the version line stay to its left (phones: the
   drawer takes the whole screen instead) */
@media (min-width: 861px) {
  .stage.has-drawer .pw-toolbar, .stage.has-drawer .stage-top { right: calc(min(460px, 100%) + 12px); }
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.drawer-head h2 { font-size: 1.05rem; margin: 0; }
.drawer .icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 20px; cursor: pointer; }
.drawer .icon-btn:hover { background: var(--panel-2); }
.drawer-tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.drawer-tabs .tab { font: 500 .88rem var(--font); background: none; border: 0; border-radius: 0; min-height: 40px; color: var(--ink-2); padding: 10px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.drawer-tabs .tab:hover { color: var(--ink); }
.drawer-tabs .tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); background: none; }
.drawer-body { overflow-y: auto; padding: 16px; overscroll-behavior: contain; }
.drawer-body .tip { font-size: .88rem; color: var(--ink-2); background: var(--panel-2); border-radius: 10px; padding: 10px 12px; }
.drawer-body .reminder { border-width: 1px; }
.drawer-body .file-row { border-top: 1px solid var(--line); }
.drawer-body .issue { border-top: 1px solid var(--line); }
/* "Get it": the "Where do you play?" picker, then one download, its steps and its safety checks (studio-getit.js) */
.gi-pick h3 { margin: 0 0 4px; font-size: 1.05rem; }
.gi-pick > .btn-ghost { margin-top: 10px; }
.gi-options { display: grid; gap: 8px; margin-top: 12px; }
.gi-opt { display: grid; gap: 2px; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--ink); font: inherit; cursor: pointer; }
.gi-opt:hover, .gi-opt:focus-visible { border-color: color-mix(in srgb, var(--accent) 65%, var(--line)); }
.gi-opt strong { display: flex; align-items: center; gap: 8px; }
.gi-opt span { color: var(--ink-2); font-size: .86rem; }
.gi-opt strong .badge { font-size: .7rem; }
.gi-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 4px 8px 12px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 12px; font-size: .92rem; }
.gi-primary { display: grid; gap: 6px; margin-bottom: 10px; }
.gi-primary p { margin: 0; }
.gi-download { justify-self: start; }
.gi-checked { margin: 0 0 14px; font-size: .88rem; color: var(--good); }
.gi-checked.is-warn { color: var(--warn); }
.gi-warnings { margin-bottom: 14px; }
.gi-warnings ul { margin: 4px 0 0; padding-left: 20px; }
.gi-steps { margin: 0 0 16px; padding-left: 22px; display: grid; gap: 8px; }
.drawer-body h3 { font-size: 1rem; margin: 18px 0 8px; }
.gi-where { margin: 6px 0 14px; }
.gi-where p { margin: 6px 0; }
.gi-others { margin: 14px 0; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; }
.gi-others > summary { padding: 10px 2px; cursor: pointer; font-weight: 600; }
.gi-others .gi-bundle { margin: 4px 0 12px; }

.studio-footer { margin: 0; padding: 0; border-top: 1px solid var(--line); background: var(--bg); }
.studio-footer .footer-inner { display: block; max-width: none; padding: 0; }
.studio-footer .footer-links, .studio-footer .footer-small { display: none; }
.studio-footer .disclaimer { margin: 0; border: 0; border-radius: 0; text-align: center; font: 400 .62rem/1.6 var(--mono); color: var(--ink-2); opacity: .7;
  padding: 2px max(16px, env(safe-area-inset-right, 0px)) calc(2px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }

/* ---- style (optional): one small pill under the prompt box, a popover of style chips ---- */
.composer-foot { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; min-width: 0; }
.composer-foot .composer-note { flex: 1 1 150px; }
.style-pick { position: relative; flex: none; justify-self: start; }
.style-pill, .kind-btn { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px 0 9px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--ink-2); font: 400 .8rem var(--font); cursor: pointer; white-space: nowrap; }
.style-pill b, .kind-btn b { font-weight: 500; color: var(--ink); }
.style-pill .chev, .kind-btn .chev { width: 6px; height: 6px; margin-left: 1px; transform: translateY(-2px) rotate(45deg); }
.style-pill:hover, .style-pill[aria-expanded="true"], .kind-btn:hover, .kind-btn[aria-expanded="true"] { color: var(--ink); border-color: var(--edge); background: var(--panel); }
.style-pill:focus-visible, .kind-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.start-card .style-pill, .start-card .kind-btn { background: color-mix(in srgb, var(--panel) 80%, transparent); }
.kind-btn .tier { color: var(--ink-2); }
.style-menu { position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 25; width: min(400px, calc(100vw - 24px)); padding: 10px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px;
  background: var(--panel); border: 1px solid var(--edge); border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .5); }
.start-card .style-menu { bottom: auto; top: calc(100% + 8px); }
.style-head { grid-column: 1 / -1; margin: 0 4px 5px; font-size: .8rem; color: var(--ink-2); }
.style-opt { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 36px; padding: 6px 8px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--ink); font: 400 .84rem var(--font); text-align: left; cursor: pointer; }
.style-opt > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.style-opt.is-any { grid-column: 1 / -1; }
.style-opt:hover { background: var(--panel-2); }
.style-opt[aria-checked="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.style-opt:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.style-note { margin: -2px 0 0; display: flex; gap: 8px; align-items: flex-start; padding: 0 4px; font-size: .8rem; line-height: 1.4; color: var(--teal); }
.style-note .sw { margin-top: 1px; }
/* the swatch: a tiny house in the style's colours (roof, walls, a door) */
.sw { --w: #c9c3b4; --r: #6d7a71; --a: var(--accent); position: relative; display: inline-block; width: 16px; height: 16px; flex: none; }
.sw::before { content: ""; position: absolute; inset: 0 0 50% 0; background: var(--r); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.sw::after { content: ""; position: absolute; inset: 50% 13% 0 13%; border-radius: 0 0 2px 2px;
  background: linear-gradient(var(--a) 0 0) 50% 100% / 32% 62% no-repeat, var(--w); }
.sw.is-any::before { background: conic-gradient(from 210deg at 50% 100%, #d98aa6, #6b3f91, #2f8b85, #5f7d3a, #c49a5c, #d98aa6); }
.style-tag { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; color: var(--ink-2); white-space: nowrap; }
.style-tag .sw { width: 13px; height: 13px; }
.ver-chip .style-tag { flex: none; }

/* ---- tablets: narrower chat ---- */
@media (max-width: 1100px) {
  .shell { --chat-w: 330px; }
  .pw-tool .pw-tool-text { font-size: .8rem; }
}

/* ---- phones: one pane at a time, tabs at the bottom ---- */
.mobile-tabs { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: 52px minmax(0, 1fr) auto; grid-template-areas: "top" "main" "tabs"; }
  .shell[data-mode="start"] { grid-template-rows: 52px minmax(0, 1fr); grid-template-areas: "top" "start"; }
  .chat, .stage { grid-area: main; border-right: 0; }
  .shell[data-pane="stage"] .chat, .shell[data-pane="chat"] .stage { display: none; }
  .mobile-tabs:not([hidden]) { grid-area: tabs; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); background: var(--bg); }
  .mobile-tabs button { font: 500 .95rem var(--font); background: var(--bg); color: var(--ink-2); border: 0; padding: 12px; min-height: 48px; cursor: pointer; }
  .mobile-tabs button[aria-pressed="true"] { color: var(--ink); box-shadow: inset 0 2px 0 var(--accent); }
  .topbar { gap: 8px; }
  .topbar-title { flex: 1 1 auto; }
  .topbar-title .sep, .logo-word { display: none; }
  .shell[data-mode="start"] .logo-word { display: inline; }
  .get-long { display: none; }
  .get-short { display: inline; }
  .credits { padding: 0 9px; }
  .stage-top { right: 64px; }
  .ver-info .muted { display: none; }
  .rate-label { display: none; }
  .rate-btn { padding: 4px 9px; }
  .ver-banner { padding: 4px 4px 4px 12px; font-size: .82rem; flex-wrap: nowrap; }
  .vb-long { display: none; }
  .vb-short { display: inline; }
  .studio-body .toasts { bottom: 170px; left: 12px; right: 12px; max-width: none; }
  .pw-toolbar { left: 8px; right: 8px; bottom: 8px; }
  .pw-group-left .pw-tool-text { font-size: .78rem; }
  .pw-key { bottom: 100px; right: 8px; }
  .pw-hint { bottom: 104px; }
  .drawer { grid-area: main; width: 100%; border-left: 0; }
  .row-hint { display: none; }
  .phone-strip:not([hidden]) { position: absolute; top: 8px; left: 8px; right: 8px; z-index: 6; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 10px;
    padding: 10px 14px 12px; border-radius: 12px; border: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(8px);
    color: var(--ink); font: 500 .9rem var(--font); text-align: left; cursor: pointer; }
  .ps-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ps-count { color: var(--ink-2); font-size: .82rem; white-space: nowrap; }
  .ps-bar { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--line) 80%, transparent); overflow: hidden; }
  .ps-bar i { --f: .1; display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(var(--f)); transition: transform .8s ease; }
  .stage.has-strip .stage-progress { display: none; }
  .stage.has-strip .stage-top { top: 70px; }
}
@media (max-width: 480px) {
  /* fingers: every icon button is at least 44 x 44 (rating, guide, share, versions, the viewer's buttons) */
  .rate-btn, .ver, .icon-link { min-width: 44px; min-height: 44px; justify-content: center; }
  .pw-tool, .pw-layer { height: 44px; }
  .pw-tool { min-width: 44px; }
  .pw-seg { height: auto; padding: 0; }
  .pw-seg .pw-tool { height: 44px; min-width: 44px; }
  .pw-group-left { width: 100%; }
  .pw-group-right { margin-left: 0; }
  .pw-layer { flex: 1; }
  .pw-layer input { width: 100%; flex: 1; }
  .pw-walk-btn .pw-tool-text { display: none; }   /* the icon (and its label) says it on a phone */
  .composer { padding: 8px 10px 10px; }
  .style-menu { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .style-opt { min-height: 40px; }
  .log { padding: 16px 12px 10px; }
  .fit-sum { padding: 9px 12px; }
  .fit-body { padding: 2px 12px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .dots i, .stack i, .sp-dot, .steps-row li.is-current::before, .work-steps li.is-current::before, .work-log li.is-current::before, .skeleton i { animation: none !important; }
  .stack i { opacity: .8; }
  .drawer { animation: none; }
}

/* ---- read-only example: studio.html?demo=<id> (no composer, a "Make one like this" button instead) ---- */
.chat.is-demo { grid-template-rows: minmax(0, 1fr) auto; }
.demo-banner { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; font-size: .84rem; color: var(--ink-2); line-height: 1.45; }
.demo-badge { font: 600 .72rem var(--font); color: var(--accent-ink); background: var(--accent); border-radius: 6px; padding: 1px 7px; }
.demo-note { align-self: flex-start; max-width: 96%; display: grid; gap: 6px; padding: 10px 13px 12px; border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; background: var(--panel); font-size: .92rem; line-height: 1.5; overflow-wrap: anywhere; }
.demo-note p { margin: 0; }
.demo-note-label { font: 600 .8rem var(--font); color: var(--teal); }
.demo-note-text { color: var(--ink); }
.demo-note-change { color: var(--ink-2); font-size: .86rem; }
.demo-note .ver-chip { margin-top: 4px; justify-self: start; max-width: 100%; }
.demo-cta { display: grid; gap: 10px; padding: 12px 14px 14px; border-top: 1px solid var(--line); background: var(--bg); }
.demo-cta-text { margin: 0; font-size: .86rem; color: var(--ink-2); line-height: 1.45; }
.demo-cta .btn { width: 100%; justify-content: center; min-height: 44px; }
.demo-make { white-space: nowrap; }
@media (max-width: 860px) {
  .demo-make { padding: 6px 10px; font-size: .82rem; min-height: 34px; }
  .shell.is-demo .topbar-title { flex: 1 1 0; min-width: 0; }
}

/* ---- studio.html?demo=<id>: the start page never shows while the example opens ---- */
.example-wait { display: none; grid-area: start; align-content: center; justify-items: center; gap: 14px; padding: 24px; color: var(--ink-2); }
.example-wait .skeleton { width: min(420px, 90%); }
.example-wait p { margin: 0; }
.demo-pending .shell[data-mode="start"] .start { display: none; }
.demo-pending .shell[data-mode="start"] .example-wait { display: grid; }
