/* Dallas3D Studio - the editor's own HUD, on top of css/style.css (the design system)
   and css/site.css (the shared account menu, covers and cards). See DESIGN.md.
   No token is defined or redefined here: every colour is a token, or a color-mix() of tokens.

   THE IDEA HERE
   The studio is the engine's cockpit. A chrome rail runs across the top, two docked panels
   sit either side as machined slabs, and one lit stage burns between them. Section names,
   statuses and readouts speak in the HUD's small-caps voice; only live things glow.

   Dark is the night rig: layered graphite, an ambient blue bloom around the stage, a lit
   hairline on every panel edge. Light is the same cockpit under a studio lamp - the panels
   are pulled towards the cool-silver bench so they read as brushed glass on metal, never as
   a white page, and the depth that dark gets from glow, light gets from a thin directional
   shadow and a higher-contrast technical line. */

/* The two background images in style.css are written relative to that file, which resolves
   wrongly under /@user/slug/edit. Point them at the real place. */
.chat-mark { background-image: url("/assets/logo-64.png"); }
.msg-agent::before { background-image: url("/assets/logo-64.png"); }
/* the agent's replies: bold names, lists, code - rendered from its text */
.msg .rich p { margin: 0 0 8px; }
.msg .rich p:last-child { margin-bottom: 0; }
.msg .rich ul, .msg .rich ol { margin: 0 0 8px; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; }
.msg .rich li::marker { color: var(--accent); }
.msg .rich strong { color: var(--text); font-weight: 700; }
.msg .rich code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; padding: 1px 5px; border-radius: 5px; background: color-mix(in srgb, var(--accent) 12%, var(--bg-2)); }
.msg .rich .rich-heading { font-weight: 700; }
.step.is-wait { color: var(--text-2); }
.step.is-wait .step-icon { color: var(--accent); animation: pulse 1.2s infinite; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- the shell: three machined slabs ----------
   The panels are pulled a little towards the bench colour so the chrome, the panels and the
   rows on them are three distinct tones instead of one. The lit inner edge is what makes a
   panel look milled rather than drawn. */
.chat, .side {
  background: var(--sheen), color-mix(in srgb, var(--surface) 93%, var(--bg) 7%);
}
.chat { box-shadow: inset -1px 0 0 color-mix(in srgb, var(--hud-line) 55%, transparent); }
.side { box-shadow: inset 1px 0 0 color-mix(in srgb, var(--hud-line) 55%, transparent); }

/* ---------- the studio top bar ---------- */
.studio-topbar {
  gap: 12px;
  background: var(--sheen), color-mix(in srgb, var(--surface) 82%, var(--bg) 18%);
}
.studio-brand { flex: none; border-radius: 8px; transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
.studio-brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.studio-brand:hover { opacity: .85; transform: translateY(-1px); }

.studio-id { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
/* the HUD names what it is showing, the way a panel in an engine does */
.studio-id::before {
  content: "Project"; flex: none; padding-right: 11px; border-right: 1px solid var(--border);
  color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}
.game-name {
  max-width: min(34vw, 340px); padding: 4px 9px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--text); cursor: text; text-align: left;
  font: 600 15.5px/1.2 "Space Grotesk", "Inter", sans-serif; letter-spacing: -.015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.game-name:hover { background: var(--raised); border-color: var(--border-strong); }
.game-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* the details dialog: the address is typed after a fixed "/@you/" prefix */
.dialog textarea { width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
                   background: var(--input); color: var(--text); resize: vertical; line-height: 1.45;
                   transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.dialog textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.address-line { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
                background: var(--input); overflow: hidden; }
.address-line:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.address-prefix { padding: 0 2px 0 11px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; white-space: nowrap; }
.address-line input { flex: 1; min-width: 0; height: 36px; padding: 0 10px 0 0; border: 0; background: transparent; color: var(--text);
                      font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.address-line input:focus-visible { outline: none; }
.field-hint { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

/* the save state is telemetry: a lamp and a small-caps reading */
.save-state {
  flex: none; display: inline-flex; align-items: center; gap: 7px; color: var(--muted);
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.save-state::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%; flex: none;
  background: var(--good); box-shadow: 0 0 8px var(--good);
}
.save-state.is-saving { color: var(--text-2); }
.save-state.is-saving::before { background: var(--warn); box-shadow: 0 0 8px var(--warn); animation: pulse 1s infinite; }

/* the honest state badge: a real pill, not the flat top-bar text style */
.studio-topbar #state-badge {
  flex: none; padding: 0 10px; background: var(--raised); color: var(--text-2);
  border: 1px solid var(--border);
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.studio-topbar #state-badge.is-good { background: color-mix(in srgb, var(--good) 14%, transparent); border-color: color-mix(in srgb, var(--good) 40%, transparent); color: var(--good); }
.studio-topbar #state-badge.is-bad { background: color-mix(in srgb, var(--bad) 14%, transparent); border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--bad); }
.studio-topbar #state-badge.is-busy { background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }
.badge.is-accent { background: var(--accent-soft); color: var(--accent); }
.studio-topbar #state-badge.is-accent { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.badge.is-accent::before { background: var(--accent); }

/* the actions: two instruments and one launch button */
.studio-topbar .topbar-actions { gap: 6px; }
.topbar-sep { flex: none; width: 1px; height: 20px; margin: 0 4px; background: var(--border); }
.studio-topbar .topbar-actions #build,
.studio-topbar .topbar-actions #versions {
  height: 30px; color: var(--text-2);
  background: var(--sheen), color-mix(in srgb, var(--raised) 82%, var(--bg) 18%);
  border-color: var(--border-strong);
}
.studio-topbar .topbar-actions #build svg { color: var(--accent-3); transition: transform var(--dur) var(--ease); }
.studio-topbar .topbar-actions #build:hover {
  color: var(--text); border-color: color-mix(in srgb, var(--accent-3) 70%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-3) 26%, transparent),
              0 0 20px -6px var(--accent-3);
}
.studio-topbar .topbar-actions #build:hover svg { transform: rotate(-8deg) scale(1.06); }
/* a saved change is waiting: green, and the cube keeps turning until Build is pressed */
.studio-topbar .topbar-actions #build.is-needed {
  background: color-mix(in srgb, var(--good) 22%, var(--raised)); border-color: var(--good); color: var(--good);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent), 0 0 18px color-mix(in srgb, var(--good) 35%, transparent);
}
.studio-topbar .topbar-actions #build.is-needed svg { color: var(--good); animation: build-turn 1.6s linear infinite; }
.studio-topbar .topbar-actions #build.is-needed:hover svg { animation-duration: 0.8s; }
@keyframes build-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .studio-topbar .topbar-actions #build.is-needed svg { animation: none; } }
.studio-topbar .topbar-actions #versions:hover { color: var(--text); border-color: var(--accent); }
.studio-topbar .topbar-actions #build:disabled,
.studio-topbar .topbar-actions #versions:disabled { box-shadow: none; }

/* Publish is the one action that ships something: it carries a standing glow and answers the
   pointer with a single pass of light across its face. */
.studio-topbar .topbar-actions #publish {
  height: 30px; padding: 0 15px; overflow: hidden; font-weight: 600;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent-ink) 30%, transparent), var(--glow-2);
}
.studio-topbar .topbar-actions #publish::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background: linear-gradient(104deg, transparent 34%, color-mix(in srgb, var(--accent-ink) 34%, transparent) 50%, transparent 66%);
  background-size: 260% 100%; background-position: 190% 0;
  transition: opacity var(--dur) var(--ease);
}
.studio-topbar .topbar-actions #publish:hover::after { opacity: 1; animation: sheen-sweep 820ms var(--ease); }
.studio-topbar .topbar-actions #publish:disabled { box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent-ink) 22%, transparent); }
.studio-topbar .topbar-actions #publish:disabled::after { display: none; }

.studio-topbar .auth-slot { margin-left: 2px; }
.studio-topbar .account-btn { height: 30px; background: color-mix(in srgb, var(--raised) 82%, var(--bg) 18%); }

/* ---------- the toolbar over the stage ---------- */
.toolbar { background: var(--sheen), color-mix(in srgb, var(--surface) 88%, var(--bg) 12%); }
.toolbar .badge { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.toolbar .badge.is-good { box-shadow: 0 0 18px -8px var(--good); }
/* v6: the playable preview while the checks still run (app.js paintPreview) */
.toolbar .badge.is-preview { background: var(--accent-soft); color: var(--accent); text-transform: none; letter-spacing: 0; }
.toolbar .badge.is-preview::before { background: var(--accent); }

/* ---------- the stage: a viewport, framed ---------- */
.stage { box-shadow: var(--shadow), 0 0 70px -26px color-mix(in srgb, var(--accent) 55%, transparent); }
/* corner brackets - the frame of a camera, not the border of a picture */
.stage::before, .graph-view::before {
  content: ""; position: absolute; inset: 12px; z-index: 2; pointer-events: none;
  --bracket: color-mix(in srgb, var(--accent) 34%, transparent);
  background:
    linear-gradient(var(--bracket), var(--bracket)) left top / 16px 1.5px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) left top / 1.5px 16px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) right top / 16px 1.5px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) right top / 1.5px 16px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) left bottom / 16px 1.5px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) left bottom / 1.5px 16px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) right bottom / 16px 1.5px no-repeat,
    linear-gradient(var(--bracket), var(--bracket)) right bottom / 1.5px 16px no-repeat;
}
.graph-view { position: relative; }
.graph-view::before { inset: 8px; z-index: 7; }

.building { gap: 12px; }
.building::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(52% 44% at 50% 48%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 72%);
}
.building > * { position: relative; }
.building strong { letter-spacing: .01em; }

/* ---------- the banner, now retryable ---------- */
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- a chat note that carries an action (a failed build) ---------- */
.msg-note:has(.btn) {
  display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 13px;
  border: 1px solid color-mix(in srgb, var(--warn) 34%, var(--border)); border-radius: var(--radius);
  background: color-mix(in srgb, var(--warn) 7%, var(--raised));
}
.note-reason { display: block; max-width: 46ch; color: var(--text-2); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }

/* ---------- the inspector panel (objects and assets) ---------- */
.side-head { background: var(--sheen), color-mix(in srgb, var(--surface) 84%, var(--bg) 16%); }
/* the lit tick that names a live section */
.side-head::before {
  content: ""; position: absolute; left: 0; top: 13px; bottom: 13px; width: 2px;
  border-radius: 0 2px 2px 0; background: var(--accent); box-shadow: 0 0 9px -1px var(--accent);
}
.side-toggle h2 { color: var(--text-2); transition: color var(--dur) var(--ease); }
.side-toggle:hover h2 { color: var(--text); }
.count { font-variant-numeric: tabular-nums; }

/* object and asset rows: small instrument slabs that lift under the pointer */
.side .card {
  border-radius: var(--radius-sm); background: var(--sheen), var(--raised);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.side .card:hover { transform: translateY(-1px); border-color: var(--border-strong); box-shadow: var(--glow-2); }
.side .card.is-open {
  background: var(--sheen), var(--tint);
  box-shadow: var(--glow-2), inset 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}
.side .card.is-open::before { animation: rail-breathe 2.6s var(--ease) infinite; }
.card-name { letter-spacing: -.005em; }
.card-sub { font-size: 11.5px; letter-spacing: .01em; }

/* a thumbnail is a viewport too: a technical grid behind whatever it holds */
.side .thumb, .dialog-row .thumb {
  border-radius: 9px; border-color: var(--border-strong);
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 9px 9px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 9px 9px,
    var(--input);
  box-shadow: inset 0 0 14px -5px color-mix(in srgb, var(--accent) 60%, transparent);
}
.side button.thumb:hover { border-color: var(--accent); box-shadow: var(--glow-2); transform: translateY(-1px); }
.side button.thumb { transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }

/* folders and drag-and-drop: a drop target is a lit bay, not a dashed box */
.folder-head { border: 1px solid transparent; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.folder-head:hover { background: var(--raised); border-color: var(--border); }
.folder.is-drop, .asset-tree.is-drop {
  outline: 1px dashed var(--accent); outline-offset: -2px; border-radius: var(--radius-sm);
  background:
    repeating-linear-gradient(45deg, var(--accent-soft) 0 7px, transparent 7px 14px),
    var(--tint);
  box-shadow: var(--glow-2);
}
.card.is-dragging { opacity: .45; }
.card[draggable="true"]:active { cursor: grabbing; }

/* ---------- dialogs ---------- */
.dialog h2 + .dialog-text { margin-top: 10px; }
.dialog h2 { font-family: "Space Grotesk", "Inter", sans-serif; letter-spacing: -.015em; }

/* ---------- the publish dialog: a release console ---------- */
#publish-title::before {
  content: "Release"; display: block; margin-bottom: 5px; color: var(--accent);
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}
.publish-points {
  display: flex; flex-direction: column; gap: 9px; margin: 14px 0 0; padding: 14px 15px; list-style: none;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: color-mix(in srgb, var(--raised) 86%, var(--bg) 14%);
}
.publish-points li { position: relative; padding-left: 24px; color: var(--text-2); font-size: 13px; line-height: 1.5; }
/* a checked-off item, not a bullet */
.publish-points li::before {
  content: ""; position: absolute; left: 3px; top: 5px; width: 9px; height: 5px; border-radius: 0;
  background: none; border-left: 1.8px solid var(--accent); border-bottom: 1.8px solid var(--accent);
  transform: rotate(-45deg);
}
.publish-points li:last-child::before { border-color: var(--muted); }
.publish-points b { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.dialog-field .field-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.dialog-field .field-line b { color: var(--text-2); font-size: 13px; font-weight: 600; }
.dialog-field .optional { color: var(--muted); font-weight: 400; }

.publish-progress { margin-top: 18px; }
.progress {
  position: relative; height: 8px; border-radius: 999px; overflow: hidden;
  background: var(--input); border: 1px solid var(--border-strong);
}
.progress i {
  position: relative; display: block; height: 100%; width: 0; border-radius: 999px; overflow: hidden;
  background: linear-gradient(90deg, var(--accent-2), var(--accent) 52%, var(--accent-3));
  box-shadow: 0 0 14px -3px var(--accent);
  transition: width .25s linear;
}
/* the stripes run while the bar fills, so a slow compile still looks like work */
.progress i::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg,
    color-mix(in srgb, var(--accent-ink) 24%, transparent) 0 6px, transparent 6px 14px);
  background-size: 28px 100%;
  animation: hud-stripes 700ms linear infinite;
}
.publish-progress-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; }
#publish-step { color: var(--text-2); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.publish-time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.alert { align-items: flex-start; flex-direction: column; gap: 6px; margin-top: 16px; }
.alert-bad strong { font-size: 13px; }
.alert-bad p { color: inherit; }
.alert-bad p.alert-calm { color: var(--text-2); }

.publish-done { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 8px; }
.publish-tick {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  font-size: 19px; font-weight: 700; color: var(--good);
  background: color-mix(in srgb, var(--good) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--good) 45%, transparent);
  box-shadow: 0 0 26px -6px var(--good);
  animation: pop-in 280ms var(--ease);
}
.publish-done-text h3 { margin: 0 0 4px; font: 600 17px/1.2 "Space Grotesk", "Inter", sans-serif; letter-spacing: -.015em; }
.publish-done-text p { color: var(--text-2); font-size: 13px; line-height: 1.55; }
.publish-done-note { margin-bottom: 6px; color: var(--text); font-style: italic; overflow-wrap: anywhere; }
.publish-done-actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* ---------- the versions drawer: a build history, read as a release console ---------- */
.dialog.drawer {
  width: min(470px, 100vw); max-width: none; height: 100dvh; max-height: 100dvh;
  margin: 0 0 0 auto; padding: 0; border-radius: 0; border-width: 0 0 0 1px;
  border-left-color: var(--border-strong); flex-direction: column;
  background: var(--sheen), color-mix(in srgb, var(--surface) 93%, var(--bg) 7%);
}
/* [open] keeps the browser's own "a closed dialog is hidden" rule winning over display:flex */
.dialog.drawer[open] { display: flex; }
.drawer-head {
  position: relative; flex: none; display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 18px 20px 15px; border-bottom: 1px solid var(--border);
  background: var(--sheen), color-mix(in srgb, var(--surface) 82%, var(--bg) 18%);
}
.drawer-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--hud-line) 14%, var(--hud-line) 86%, transparent);
}
.drawer-head > div::before {
  content: "Release console"; display: block; margin-bottom: 4px; color: var(--accent);
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}
.drawer-head h2 { font: 600 19px/1.2 "Space Grotesk", "Inter", sans-serif; letter-spacing: -.02em; }
.drawer-sub { margin-top: 6px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.drawer-foot {
  flex: none; display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  padding: 14px 20px 18px; border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--raised) 86%, var(--bg) 14%);
}
.drawer-note { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.drawer-body .loading { padding: 40px 0; }
.drawer-body .empty { align-items: flex-start; text-align: left; }

/* every row is a stop on one rail: the newest draft at the top, the live build lit up */
.version {
  position: relative; display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 5px 12px;
  padding: 12px 12px 12px 10px; border: 1px solid transparent; border-radius: var(--radius);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.version::before {                       /* the rail that joins one build to the next */
  content: ""; position: absolute; left: 35px; top: 0; bottom: -2px; width: 1px; background: var(--border);
}
.version:first-child::before { top: 25px; }
.version:last-child::before { bottom: auto; height: 25px; }
.version:only-child::before { display: none; }
.version:hover { background: color-mix(in srgb, var(--raised) 72%, transparent); border-color: var(--border); }
.version + .version { box-shadow: none; }
.version-no {
  position: relative; z-index: 1; display: grid; place-items: center; width: 52px; height: 26px;
  border: 1px solid var(--border); border-radius: 7px;
  background: color-mix(in srgb, var(--raised) 88%, var(--bg) 12%); color: var(--text-2);
  font: 700 12.5px/1 "Space Grotesk", "Inter", sans-serif; letter-spacing: .04em; font-variant-numeric: tabular-nums;
}
.version-text { min-width: 0; }
.version-role { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 22px; }
.version-role strong { font-size: 13.5px; font-weight: 600; }
.version-meta { margin-top: 3px; color: var(--muted); font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
.version-actions { grid-column: 2; display: flex; gap: 6px; margin-top: 2px; }
.version-actions:empty { display: none; }

.version.is-live {
  background: color-mix(in srgb, var(--good) 9%, transparent);
  border-color: color-mix(in srgb, var(--good) 32%, transparent);
}
.version.is-live::after {              /* the lit rail of the build players are on */
  content: ""; position: absolute; left: -1px; top: 11px; bottom: 11px; width: 2px; border-radius: 2px;
  background: var(--good); box-shadow: 0 0 10px var(--good);
}
.version.is-live .version-no {
  color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent);
  background: color-mix(in srgb, var(--good) 15%, var(--surface)); box-shadow: 0 0 16px -5px var(--good);
}
.version.is-draft .version-no { border-style: dashed; border-color: var(--border-strong); color: var(--text-2); }

.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 6px;
  border: 1px solid transparent; background: var(--raised); color: var(--muted);
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.tag.is-good { background: color-mix(in srgb, var(--good) 14%, transparent); border-color: color-mix(in srgb, var(--good) 36%, transparent); color: var(--good); }
.tag.is-bad { background: color-mix(in srgb, var(--bad) 14%, transparent); border-color: color-mix(in srgb, var(--bad) 36%, transparent); color: var(--bad); }
.tag.is-accent { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 34%, transparent); color: var(--accent); }

.btn-make-live { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.btn-make-live:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); box-shadow: var(--glow-2); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: var(--bad); color: var(--bad); }
/* the confirm button of a destructive answer, so it never looks like a friendly primary action */
.btn.is-danger { background: var(--bad); border-color: var(--bad); color: var(--accent-ink); }
.btn.is-danger:hover { background: color-mix(in srgb, var(--bad) 85%, #000); border-color: color-mix(in srgb, var(--bad) 85%, #000); }

/* ---------- the no-access / offline page ---------- */
.gate { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.gate-panel {
  width: min(440px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center; padding: 32px 28px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--sheen), var(--surface); box-shadow: var(--shadow);
}
.gate-panel:focus { outline: none; }
.gate-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.gate-brand span { font: 600 17px/1 "Space Grotesk", "Inter", sans-serif; letter-spacing: -.01em; }
.gate-home { margin-top: 6px; color: var(--muted); font-size: 12.5px; text-decoration: none; }
.gate-home:hover { color: var(--text-2); text-decoration: underline; }
.gate-panel h2 { font: 600 20px/1.25 "Space Grotesk", "Inter", sans-serif; }
.gate-panel p { max-width: 42ch; color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.gate-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }

/* ---------- /studio - the project list ---------- */
.studio-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: clamp(28px, 4vw, 44px) 0 22px; }
.studio-head h2 { font: 600 clamp(24px, 3.4vw, 32px)/1.15 "Space Grotesk", "Inter", sans-serif; letter-spacing: -.02em; }
.studio-head p { margin-top: 8px; color: var(--text-2); font-size: 14px; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 18px; padding-bottom: 56px; }
.project-card {
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--sheen), var(--surface);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.project-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.project-card .cover { border-bottom: 1px solid var(--border); }
.project-card .cover a { position: absolute; inset: 0; }
.project-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 6px; min-width: 0; }
.project-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.project-title-row h3 { min-width: 0; margin: 0; font: 600 15.5px/1.3 "Inter", sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-title-row h3 a { color: inherit; text-decoration: none; }
.project-title-row h3 a:hover { color: var(--accent); }
.kind-tag { flex: none; padding: 1px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.project-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.project-updated { color: var(--muted); font-size: 12.5px; }
.project-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px 14px; margin-top: auto; }
.project-foot .meta { margin-right: auto; gap: 10px; }
.project-foot .btn { flex: none; }

.studio-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px;
  padding: clamp(40px, 8vw, 80px) 24px; border: 1px dashed var(--border-strong); border-radius: 18px;
  background:
    repeating-linear-gradient(45deg, var(--grid) 0 7px, transparent 7px 14px),
    var(--surface);
  margin-bottom: 56px;
}
.studio-empty img { width: 64px; height: 64px; }
.studio-empty h3 { font: 600 20px/1.2 "Space Grotesk", "Inter", sans-serif; }
.studio-empty p { max-width: 46ch; color: var(--text-2); font-size: 14px; line-height: 1.6; }
.studio-empty .steps-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; padding: 0; list-style: none; color: var(--muted); font-size: 13px; text-align: left; }
.studio-empty .steps-list li { display: flex; align-items: center; gap: 8px; }
.studio-empty .steps-list b { display: grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 11px; }
/* ---------- motion of this file ---------- */
@keyframes sheen-sweep { from { background-position: 190% 0; } to { background-position: -70% 0; } }
@keyframes hud-stripes { to { background-position: 28px 0; } }
@keyframes rail-breathe { 50% { opacity: .5; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.72); } }

/* ---------- smaller screens ---------- */
@media (max-width: 1240px) {
  .studio-id::before { display: none; }
}
@media (max-width: 1100px) {
  .studio-id .save-state { display: none; }
}
/* style.css hides every top-bar badge below 960px; the publish state must stay visible. */
@media (max-width: 960px) {
  .studio-topbar #state-badge { display: inline-flex; }
  .chat, .side { box-shadow: none; }
}
@media (max-width: 860px) {
  .studio-topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; row-gap: 8px; }
  .studio-id { order: 3; width: 100%; flex: none; }
  .game-name, .rename-input { max-width: none; width: auto; flex: 1; }
  .studio-topbar .topbar-actions { flex: 1; justify-content: flex-end; }
  .topbar-sep { display: none; }
}
@media (max-width: 560px) {
  .studio-topbar .topbar-actions #build span, .studio-topbar .topbar-actions #versions span { display: none; }
  .dialog.drawer { width: 100vw; border-left: 0; }
  .publish-done { grid-template-columns: minmax(0, 1fr); }
  .publish-done-actions { grid-column: 1; }
  .publish-done .publish-tick { display: none; }
  .project-grid { grid-template-columns: minmax(0, 1fr); }
  .studio-head { padding-top: 24px; }
  .version { grid-template-columns: 46px minmax(0, 1fr); }
  .version::before { left: 32px; }
}


/* a message kept back for lack of credits, waiting to be resent */
.pending {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 13px; border-radius: var(--radius);
  border: 1px dashed color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 7%, var(--raised));
}
.pending-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--warn); }
.pending-text { color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.pending-actions { display: flex; gap: 8px; }

/* "back to before this": lives on the user's own bubble, quiet until hovered */
.msg-user { position: relative; }
.msg-user .undo {
  display: block; margin: 8px 0 -2px; padding: 3px 8px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 6px;
  background: rgba(255, 255, 255, .12); color: var(--accent-ink); font-size: 11px; font-weight: 600; cursor: pointer;
  opacity: .55; transition: opacity var(--dur) var(--ease), background var(--dur) var(--ease);
}
.msg-user:hover .undo, .msg-user .undo:focus-visible { opacity: 1; }
.msg-user .undo:hover { background: rgba(255, 255, 255, .22); }

/* a sound's thumb is its play button */
.thumb-sound { font-size: 14px; color: var(--accent); background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent-2) 14%, transparent)); cursor: pointer; }
.thumb-sound:hover { color: var(--accent-ink); background: var(--accent); }

/* Independent grid lines and cells slowly light up while work is in progress. */
.preview-empty.is-working { background-position: center, center, center, center; }
.preview-empty.is-working > .preview-symbol,
.preview-empty.is-working > .eyebrow,
.preview-empty.is-working > h2,
.preview-empty.is-working > p { display: none; }
.preview-work { position: absolute; inset: 0; pointer-events: none; color: var(--accent); }
.preview-work[hidden] { display: none; }
.preview-work::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 32% 40%, color-mix(in srgb, var(--accent) 5%, transparent), transparent 55%),
    radial-gradient(ellipse at 72% 62%, color-mix(in srgb, var(--accent) 4%, transparent), transparent 50%);
}
.preview-grid-lights { position: absolute; inset: 0; overflow: hidden; }
.grid-stop-accent { stop-color: var(--accent); }
.grid-stop-highlight { stop-color: color-mix(in srgb, var(--accent) 45%, var(--text)); }
.preview-grid-light {
  opacity: 0;
  animation: preview-grid-light var(--light-duration) ease-in-out var(--light-delay) infinite;
}
.preview-lit-cell { fill: url(#preview-cell-light); stroke: var(--accent); stroke-opacity: .16; stroke-width: .75; }
.preview-trace, .preview-trace-glow { stroke: url(#preview-trace); stroke-linecap: round; stroke-linejoin: round; }
.preview-trace { stroke-width: 1; }
.preview-trace-glow { stroke-width: 4; opacity: .2; filter: blur(3px); }
/* A short luminous section follows each path, rising and falling in intensity. */
.preview-line-energy {
  fill: none; stroke: color-mix(in srgb, var(--accent) 40%, var(--text)); stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 14 114; stroke-dashoffset: 18; opacity: 0;
  animation: preview-line-energy var(--light-duration) linear var(--light-delay) infinite;
}
.preview-line-energy-glow { stroke: var(--accent); stroke-width: 5; filter: blur(3px); }
@keyframes preview-line-energy {
  0%, 12% { stroke-dashoffset: 18; opacity: 0; }
  22% { opacity: .25; }
  42% { opacity: 1; }
  62% { opacity: .6; }
  82%, 100% { stroke-dashoffset: -100; opacity: 0; }
}
.preview-cell-corner { stroke: var(--accent); stroke-width: 1; opacity: .65; }
.preview-grid-node { fill: color-mix(in srgb, var(--accent) 50%, var(--text)); }
.preview-grid-spark { fill: var(--accent); opacity: .6; }
@keyframes preview-grid-light {
  0%, 10%, 88%, 100% { opacity: 0; }
  38%, 54% { opacity: .8; }
}
@media (prefers-reduced-motion: reduce) {
  .preview-grid-light { animation: none; opacity: .3; }
  .preview-line-energy { animation: none; opacity: 0; }
}

/* The build companion: movement and poses are confined to the beagle. */
.mascot { position: absolute; left: 0; right: 0; bottom: 30px; height: 88px; pointer-events: none; opacity: 0; transition: opacity .2s var(--ease); }
.preview-empty.is-working .mascot { opacity: 1; }
.mascot-dog { position: absolute; bottom: 0; left: 0; width: 120px; height: 88px; overflow: visible; }
.dog-facing { transform-origin: 60px 44px; }
.mascot-bubble {
  position: absolute; bottom: 96px; max-width: calc(100% - 24px); box-sizing: border-box; padding: 6px 11px; border-radius: 10px 10px 10px 3px;
  background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); color: var(--text);
  font: 700 12.5px "Space Grotesk", "Inter", sans-serif; box-shadow: var(--glow-2);
  opacity: 0; transform: translateY(4px) scale(.97); transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.mascot-bubble.is-shown { opacity: 1; transform: none; }
.dog-leg { transform-box: view-box; transform-origin: 0 0; transition: transform .25s var(--ease); }
.dog-body { transform-origin: 74px 56px; transition: transform .25s var(--ease); }
.dog-head { transform-origin: 77px 43px; transition: transform .25s var(--ease); }
.dog-ear { transform-origin: 78px 25px; }
.dog-tail { transform-origin: 25px 44px; animation: dog-wag 1.1s ease-in-out infinite; }
.dog-tag { transform-origin: 89px 49px; }
/* Plant the paw through the first half of the stride, then flex the joint to clear the floor. */
.dog-shin { transform-box: view-box; transform-origin: 0 0; transition: transform .25s var(--ease); }
.mascot-dog.is-walking .dog-leg { animation: dog-step var(--stride, .8s) linear infinite; }
.mascot-dog.is-walking .dog-shin { animation: dog-knee var(--stride, .8s) linear infinite; }
.mascot-dog.is-walking .dog-hock { animation-name: dog-hock; }
.mascot-dog.is-walking .leg-fr, .mascot-dog.is-walking .leg-bl,
.mascot-dog.is-walking .leg-fr .dog-shin, .mascot-dog.is-walking .leg-bl .dog-shin { animation-delay: calc(var(--stride, .8s) * -.5); }
@keyframes dog-step {
  0%, 100% { transform: translateY(1.2px) rotate(-18deg); }
  25% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(1.2px) rotate(18deg); }
  65% { transform: translateY(-1px) rotate(12deg); }
  80% { transform: translateY(-2px) rotate(-10deg); }
}
@keyframes dog-knee {
  0%, 50%, 100% { transform: rotate(0deg); }
  65% { transform: rotate(-32deg); }
  80% { transform: rotate(-18deg); }
}
@keyframes dog-hock {
  0%, 50%, 100% { transform: rotate(0deg); }
  65% { transform: rotate(30deg); }
  80% { transform: rotate(16deg); }
}
/* A relaxed breath cycle: rest, extend, four soft pants, then tuck back in.
   The mouth clips the retracting tongue so it slides inside instead of shrinking. */
.dog-tongue { transform-origin: 105px 46px; animation: dog-pant 5.6s ease-in-out infinite; }
.dog-mouth { transform-origin: 104px 44px; animation: dog-breathe 5.6s ease-in-out infinite; }
.dog-mouth, .dog-tongue-window { transition: opacity .2s var(--ease); }
@keyframes dog-pant {
  0%, 16%, 82%, 100% { transform: translateY(-10px) rotate(0deg); }
  24% { transform: translateY(-1px) rotate(-2deg); }
  29%, 41%, 53%, 65% { transform: translateY(.6px) rotate(2deg); }
  35%, 47%, 59%, 71% { transform: translateY(-1.2px) rotate(-1deg); }
  75% { transform: translateY(-2px) rotate(0deg); }
}
@keyframes dog-breathe {
  0%, 16%, 82%, 100% { transform: scaleY(.15); }
  24% { transform: scaleY(.85); }
  29%, 41%, 53%, 65% { transform: scaleY(1.12); }
  35%, 47%, 59%, 71% { transform: scaleY(.8); }
  75% { transform: scaleY(.7); }
}
.mascot-dog.is-sniffing .dog-tongue-window, .mascot-dog.is-sniffing .dog-mouth { opacity: 0; }
.mascot-dog.is-walking .dog-body { animation: dog-rock var(--stride, .8s) linear infinite; }
@keyframes dog-rock { 0%, 50%, 100% { transform: translateY(0); } 25%, 75% { transform: translateY(-1.2px); } }
.mascot-dog.is-walking .dog-ear { animation: dog-ear var(--stride, .8s) ease-in-out infinite; }
.mascot-dog.is-walking .dog-tag { animation: dog-tag var(--stride, .8s) ease-in-out infinite; }
@keyframes dog-ear { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(7deg); } }
@keyframes dog-tag { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
@keyframes dog-wag { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(12deg); } }
.mascot-dog.is-looking .dog-tail { animation-duration: .6s; }
.mascot-dog.is-looking .dog-head { transform: rotate(-9deg); }
.mascot-dog.is-sniffing .dog-head { transform: translate(0, 6px) rotate(32deg); }
.mascot-dog.is-sniffing .dog-ear { animation: dog-ear 1.1s ease-in-out infinite; }
.mascot-dog.is-sniffing .dog-body { transform: rotate(4deg); }
.mascot-dog.is-sitting .dog-body { transform: translateY(3px) rotate(-12deg); }
.mascot-dog.is-sitting .leg-bl, .mascot-dog.is-sitting .leg-br { transform: translate(6px, 9px) rotate(-65deg) scale(.8); }
.mascot-dog.is-sitting .dog-hock { transform: rotate(70deg); }
.dog-eye { animation: dog-blink 5.2s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes dog-blink { 0%, 43%, 47%, 100% { transform: scaleY(1); } 45% { transform: scaleY(.12); } }
.mascot-dog * { animation-play-state: paused; }
.preview-empty.is-working .mascot-dog * { animation-play-state: running; }
@media (prefers-reduced-motion: reduce) {
  .mascot-dog, .mascot-dog * { animation: none !important; transition: none !important; }
  .mascot-bubble { transform: none; transition: opacity .2s var(--ease); }
}

/* a system error is ours, not theirs: amber and calm, with a small working dot */
.chat-cost { margin: -6px 0 10px; color: var(--text-2); font-size: 12.5px; }
.msg-role { font-size: 12.5px; color: var(--text-2); padding: 4px 10px; margin: 2px 0; border-left: 2px solid var(--border); }
.msg-role-who { font-weight: 600; color: var(--text); }
.msg-role.is-running { border-left-color: var(--accent); }
.msg-role.is-done { border-left-color: var(--ok, #3cb371); }
.msg-role.is-blocked, .msg-role.is-unverified { border-left-color: var(--warn); }
.msg-role.is-skipped { opacity: .7; }
.msg-error.is-system { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); padding-left: 28px; position: relative; }
.msg-error.is-system::before { content: ""; position: absolute; left: 11px; top: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 8px var(--warn); animation: pulse 1.2s infinite; }

/* the demo: a banner on top, and the buttons that would change the game put to sleep */
.demo-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px; background: color-mix(in srgb, var(--accent) 16%, var(--bg)); border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); font-size: 13px; color: var(--text); }
.demo-banner span { flex: 1 1 320px; }
body.is-demo #build, body.is-demo #publish, body.is-demo #versions, body.is-demo #add-assets, body.is-demo #add-folder,
body.is-demo .card-actions .btn-icon:not(.btn-gear), body.is-demo .folder-head .btn { opacity: .45; pointer-events: none; }

/* the composer's tools and the keyword row */
.composer-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 6px 16px 10px; font-size: 12px; color: var(--muted); }
.composer-mode { color: var(--text-2); }
.chat-tabs[hidden] { display: none; }
.chat-tabs-arrows { position: sticky; right: 0; z-index: 2; display: flex; gap: 2px; align-items: center; margin-left: auto; padding: 0 2px 6px 10px; background: linear-gradient(90deg, transparent, var(--bg) 35%); }
.chat-tabs-arrow { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font: inherit; font-size: 15px; line-height: 1; cursor: pointer; }
.chat-tabs-arrow:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.chat-tabs-arrow:disabled { opacity: .35; cursor: default; }
.chat-tabs { scroll-behavior: smooth; }

.chat-tabs { display: flex; gap: 6px; padding: 6px 12px 0; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); }
.chat-tabs::-webkit-scrollbar { display: none; }
.chat-tab { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 5px 10px 7px; border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0;
            background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; margin-bottom: -1px; max-width: 180px; }
.chat-tab:hover { color: var(--text); background: var(--bg-2); }
.chat-tab.is-active { color: var(--text); background: var(--bg-2); border-color: var(--border); font-weight: 600; }
.chat-tab-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-tab.is-working::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: pulse 1.2s infinite; flex: none; }
.chat-tab-close { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: 13px; line-height: 1; color: var(--muted); }
.chat-tab-close:hover { background: var(--border); color: var(--text); }
.chat-head #chat-gear { margin-left: auto; width: 30px; height: 30px; font-size: 16px; color: var(--muted); }
.chat-head #chat-gear:hover { color: var(--text); }
.composer-tools .tool { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.composer-tools select { height: 26px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-2); color: var(--text); font: inherit; font-size: 12px; }
.composer-tools input[type="checkbox"] { margin: 0; accent-color: var(--accent); }
.composer-tools .composer-hint { margin-left: auto; padding: 0; }
.hints { padding: 8px 16px 0; display: flex; flex-direction: column; gap: 6px; }
.hints-label { font-size: 11.5px; color: var(--muted); }
.hints-row { display: flex; gap: 6px; flex-wrap: wrap; }
.hint { height: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text-2); font: inherit; font-size: 12px; cursor: pointer; transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease); }
.hint:hover { border-color: var(--border-strong); color: var(--text); }
.hint.is-on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* the first-time tour: a spotlight around each part, and the dream box floating beside it */
.tour-spot { position: fixed; z-index: 300; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(4, 8, 20, .62), 0 0 0 2px var(--accent), 0 0 24px var(--accent); pointer-events: none; transition: left .45s var(--ease), top .45s var(--ease), width .45s var(--ease), height .45s var(--ease); }
.tour-box { position: fixed; z-index: 301; width: 300px; padding: 14px 16px 12px; border-radius: 16px 16px 16px 4px; border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border)); background: var(--bg-2); color: var(--text); box-shadow: 0 18px 50px rgba(0, 0, 0, .5), var(--glow-2); transition: left .45s var(--ease), top .45s var(--ease); }
.tour-box.is-bob { animation: tour-bob 2.6s ease-in-out infinite; }
@keyframes tour-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
.tour-box-head { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.tour-cloud { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, var(--accent)); color: #fff; font-size: 12px; box-shadow: 0 0 12px var(--accent); animation: pulse 2s infinite; }
.tour-title { margin: 8px 0 4px; font-size: 15px; }
.tour-text { margin: 0 0 12px; font-size: 13px; line-height: 1.45; color: var(--text-2); }
.tour-actions { display: flex; gap: 6px; }
.tour-actions [data-next] { margin-left: auto; }
.tour-offer { width: min(420px, calc(100vw - 32px)); }
.tour-offer-body { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tour-offer .tour-cloud { width: 44px; height: 44px; font-size: 20px; margin-bottom: 6px; }
.tour-offer .dialog-actions { justify-content: center; }
#tour-btn, #report-btn { width: 30px; height: 30px; font-weight: 700; color: var(--muted); }
#report-btn:hover { color: var(--bad); }
#tour-btn:hover { color: var(--text); }
@media (prefers-reduced-motion: reduce) { .tour-box.is-bob { animation: none; } .tour-spot, .tour-box { transition: none; } }

/* Embed: the code, the size, a box in that shape */
.embed-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; margin-top: 12px; }
@media (max-width: 760px) { .embed-grid { grid-template-columns: 1fr; } }
.embed-controls { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.embed-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.embed-presets .chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); font: inherit; font-size: 12.5px; cursor: pointer; }
.embed-presets .chip:hover { color: var(--text); border-color: var(--accent); }
.embed-presets .chip.is-active { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--bg-2)); font-weight: 600; }
.embed-size { display: flex; align-items: end; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.embed-size label { display: flex; flex-direction: column; gap: 4px; }
.embed-size input { width: 110px; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font: inherit; }
.embed-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.embed-check input { margin: 0; accent-color: var(--accent); }
.embed-dialog textarea { width: 100%; box-sizing: border-box; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text);
                         font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; word-break: break-all; }
.embed-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.embed-note { font-size: 12.5px; color: var(--good); }
.embed-more summary { cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.embed-preview-wrap { display: grid; place-items: center; min-height: 200px; padding: 14px; border-radius: 14px; border: 1px dashed var(--border); background: var(--bg-2); }
.embed-preview { width: 100%; max-height: 300px; border-radius: 10px; display: grid; place-items: center; color: var(--text-2); font-size: 12.5px;
                 background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--bg)), var(--bg)); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); }

/* ---------- the Android tab: a virtual phone, and the way to a real one ---------- */
.android-view { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 16px; gap: 10px; }
.android-view[hidden] { display: none; }
.android-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.android-devices { display: flex; gap: 4px; }
.android-devices .chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); font: inherit; font-size: 12.5px; cursor: pointer; }
.android-devices .chip.is-active { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--bg-2)); font-weight: 600; }
.android-spacer { flex: 1; }
#android-build.is-busy span::after { content: ""; display: inline-block; width: 10px; height: 10px; margin-left: 8px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; vertical-align: -1px; }
.phone-room { flex: 1; min-height: 0; position: relative; overflow: hidden; border-radius: 14px; border: 1px solid var(--border);
              background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--accent) 12%, var(--bg-2)), var(--bg)); }
.phone { padding: 12px 34px; border-radius: 38px; background: #0a0c12; border: 2px solid #2a2f3d; box-shadow: 0 30px 80px rgba(0, 0, 0, .55), inset 0 0 0 2px #151926; position: absolute; left: 50%; top: 50%; transform-origin: center; }
.phone.is-portrait { padding: 34px 12px; }
.phone::before { content: ""; position: absolute; left: 14px; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: #1d2333; box-shadow: inset 0 0 0 2px #0e1220; translate: 0 -50%; }
.phone.is-portrait::before { left: 50%; top: 14px; translate: -50% 0; }
.phone-screen { position: relative; border-radius: 18px; overflow: hidden; background: #000; }
.phone-screen iframe { width: 100%; height: 100%; border: 0; display: block; }
.phone-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: #8f9bb0; font-size: 14px; }
.phone-empty[hidden] { display: none; }
.android-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.android-status { flex: 1; min-width: 200px; }
.android-status.is-good { color: var(--good); }
.android-package-line { display: inline-flex; align-items: center; gap: 8px; }
.android-package-line code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); }
.android-caption { margin: 0; font-size: 11.5px; color: var(--muted); }
#add-android { margin-left: 6px; }

/* ---------- install on a phone ---------- */
.install-dialog { width: min(520px, calc(100vw - 32px)); }
.install-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.install-head h2 { margin: 0; }
.install-head .dialog-hint { margin: 2px 0 0; }
.install-head .dialog-hint b { color: var(--accent); font-weight: 600; }
.install-icon { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: var(--accent);
                background: color-mix(in srgb, var(--accent) 16%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.install-checks { list-style: none; margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--border); display: grid; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.install-checks li { padding-left: 20px; position: relative; }
.install-checks li::before { content: ""; position: absolute; left: 2px; top: 5px; width: 9px; height: 5px; border-left: 2px solid var(--good); border-bottom: 2px solid var(--good); transform: rotate(-45deg); }
.install-checks b { color: var(--text); }
.install-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.install-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; opacity: .55; transition: opacity .2s, background .2s; }
.install-steps li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.install-steps b { font-size: 13.5px; }
.install-steps small { color: var(--muted); font-size: 12px; }
.install-dot { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700;
               border: 1.5px solid var(--border-strong); color: var(--text-2); position: relative; }
.install-steps li.is-doing { opacity: 1; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.install-steps li.is-doing .install-dot { border-color: transparent; color: transparent; }
.install-steps li.is-doing .install-dot::after { content: ""; position: absolute; inset: -1.5px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; }
.install-steps li.is-done { opacity: 1; }
.install-steps li.is-done .install-dot { background: var(--good); border-color: var(--good); color: transparent; }
.install-steps li.is-done .install-dot::after { content: ""; position: absolute; left: 8px; top: 8px; width: 9px; height: 5px; border-left: 2px solid #06130c; border-bottom: 2px solid #06130c; transform: rotate(-45deg); }
.install-steps li.is-failed { opacity: 1; }
.install-steps li.is-failed .install-dot { background: var(--bad, #ef5b5b); border-color: var(--bad, #ef5b5b); color: #fff; }
.install-bar { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin-top: 6px; }
.install-bar[hidden] { display: none; }
.install-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .15s linear; }
.install-confirm { display: flex; gap: 14px; align-items: center; margin-top: 14px; padding: 14px; border-radius: 14px;
                   border: 1px solid color-mix(in srgb, var(--warn, #f5b942) 55%, transparent); background: color-mix(in srgb, var(--warn, #f5b942) 12%, transparent); }
.install-confirm[hidden] { display: none; }
.install-confirm b { font-size: 14px; }
.install-confirm p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-2); }
.install-confirm .install-tip { color: var(--muted); font-size: 12px; }
.install-phone { flex: none; width: 34px; height: 58px; border-radius: 8px; border: 2px solid var(--warn, #f5b942); display: grid; place-items: center; animation: phone-nudge 1.2s ease-in-out infinite; }
.install-phone span { width: 16px; height: 9px; border-radius: 3px; background: var(--warn, #f5b942); animation: pulse 1.2s infinite; }
@keyframes phone-nudge { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-7deg); } 40% { transform: rotate(7deg); } 60% { transform: rotate(-4deg); } 80% { transform: rotate(0); } }
.install-result { margin: 14px 0 0; padding: 11px 13px; border-radius: 12px; font-size: 13px; border: 1px solid var(--border); }
.install-result[hidden] { display: none; }
.install-result.is-good { border-color: color-mix(in srgb, var(--good) 50%, transparent); background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--text); }
.install-result.is-bad { border-color: color-mix(in srgb, var(--bad, #ef5b5b) 50%, transparent); background: color-mix(in srgb, var(--bad, #ef5b5b) 12%, transparent); color: var(--text); }
.install-result a { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .install-phone, .install-phone span { animation: none; } }

/* the package: com is fixed, the studio and the game are typed */
.package-parts { display: flex; align-items: flex-end; gap: 6px; margin: 14px 0 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.package-parts i { font-style: normal; color: var(--muted); padding-bottom: 9px; font-weight: 700; }
.package-parts label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.package-parts small { font-family: "Inter", sans-serif; font-size: 11.5px; color: var(--muted); }
.package-parts input { width: 100%; box-sizing: border-box; font-family: inherit; font-size: 13.5px; padding: 8px 11px; color: var(--text); background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.package-parts input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.package-fixed { padding: 8px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-2); color: var(--muted); cursor: not-allowed; user-select: none; }

/* publish: the Android app too */
.publish-apk { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 4px; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--border); cursor: pointer; }
.publish-apk[hidden] { display: none; }
.publish-apk:has(input:checked) { border-color: color-mix(in srgb, var(--good) 55%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); }
.publish-apk.is-off { cursor: not-allowed; opacity: .7; }
.publish-apk input { margin-top: 3px; accent-color: var(--good); width: 16px; height: 16px; flex: none; }
.publish-apk span { display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; }
.publish-apk small { color: var(--muted); font-size: 12px; line-height: 1.45; }

/* publish: public or a private link (v5) */
.publish-mode { border: 0; margin: 12px 0 4px; padding: 0; display: grid; gap: 8px; }
.publish-mode[hidden] { display: none; }
.publish-mode legend { margin-bottom: 6px; font-size: 13.5px; }
.publish-mode .publish-mode-option { margin: 0; }
.publish-mode .publish-mode-option:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); }
.publish-mode .publish-mode-option input { accent-color: var(--accent); }
.publish-link { display: grid; gap: 8px; margin: 10px 0 4px; padding: 12px 13px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.publish-link[hidden] { display: none; }
.publish-link-row { display: flex; gap: 8px; align-items: center; }
.publish-link-row input { flex: 1; min-width: 0; font: 13px/1.4 ui-monospace, monospace; padding: 8px 10px; color: var(--text); background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.publish-link small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.publish-link-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* the phones, listed in the install window itself */
.install-pick { margin-bottom: 12px; }
.install-pick-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.install-devices { display: grid; gap: 8px; }
.install-device { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 13px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
                  border-radius: 12px; border: 1px solid color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 9%, transparent); transition: background .15s, transform .15s; }
.install-device:hover:not(:disabled) { background: color-mix(in srgb, var(--good) 17%, transparent); transform: translateY(-1px); }
.install-device:disabled { opacity: .6; cursor: default; }
.install-device > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.install-device b { font-size: 14px; }
.install-device small { font-size: 12px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.install-device em { font-style: normal; font-size: 12.5px; font-weight: 700; padding: 5px 12px; border-radius: 999px; background: var(--good); color: #06130c; }
.install-device-icon { flex: none; width: 18px; height: 30px; border-radius: 5px; border: 2px solid var(--good); position: relative; }
.install-device-icon::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 6px; height: 2px; border-radius: 2px; background: var(--good); translate: -50% 0; }
.install-none, .install-first { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.install-none[hidden], .install-first[hidden] { display: none; }
.install-first { margin-top: 6px; color: var(--muted); font-size: 12px; }

/* ---------- fonts in the Texts dialog ---------- */
.font-game-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.font-game-row .param-text { flex: 1; }
.font-note { margin: 6px 2px 10px; font-size: 12px; color: var(--muted); }
.font-button { flex: none; max-width: 150px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); font-size: 12.5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-button:hover { border-color: var(--accent); color: var(--text); }
.font-button.is-own { color: var(--text); border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 14%, var(--bg-2)); font-size: 14px; }
.font-button-game { max-width: 260px; display: inline-flex; align-items: center; gap: 10px; padding: 7px 12px; }
.font-button-game b { font-size: 17px; font-weight: 400; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.font-button-game span { font-size: 12px; color: var(--accent); }
.param-row-text:has(.font-button) { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(0, 1.6fr) auto; align-items: center; gap: 10px; }

.font-dialog { width: min(640px, calc(100vw - 32px)); height: min(720px, calc(100vh - 48px)); padding: 0; overflow: hidden; }
.font-dialog[open] { display: flex; flex-direction: column; }
.font-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 10px; }
.font-head h2 { margin: 0; }
.font-head .dialog-hint { margin: 3px 0 0; }
.font-search { margin: 0 20px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font: inherit; font-size: 13.5px; }
.font-search:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.font-cats { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 20px; }
.font-cat { padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text-2); font: inherit; font-size: 12px; cursor: pointer; }
.font-cat.is-active { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); font-weight: 600; }
.font-list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 12px 12px; display: grid; gap: 4px; align-content: start; border-top: 1px solid var(--border); }
.font-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.font-row:hover { background: var(--bg-2); border-color: var(--border); }
.font-row.is-current { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.font-sample { flex: 1; min-width: 0; font-size: 24px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .25; transition: opacity .2s; }
.font-row.is-ready .font-sample { opacity: 1; }
.font-meta { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-family: "Inter", sans-serif; }
.font-meta b { font-size: 12.5px; font-weight: 600; }
.font-meta small { font-size: 11px; color: var(--muted); }
.font-none { padding: 30px; text-align: center; color: var(--muted); font-size: 13px; }
.font-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

/* ---------- artwork: the game's icon and menu background ---------- */
.side-section[hidden] { display: none; }
.artwork-now { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: end; padding: 4px 2px 8px; }
.artwork-now figure { margin: 0; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.artwork-now figcaption { font-size: 11.5px; color: var(--muted); }
.art-thumb { border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-2); display: grid; place-items: center; font-size: 11px; color: var(--muted); text-align: center; }
.art-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-thumb.art-icon { width: 72px; height: 72px; border-radius: 18px; }
.art-thumb.art-background { aspect-ratio: 16 / 9; width: 100%; }
.artwork-line { margin: 0 2px 6px; font-size: 12px; color: var(--text-2); }
.artwork-line[hidden] { display: none; }
.artwork-dialog { width: min(860px, calc(100vw - 32px)); }
.art-row-head { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; }
.art-row-head h3 { margin: 0 auto 0 0; font-size: 14px; }
.art-rule { font-size: 11.5px; color: var(--muted); }
.art-row { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; font-size: 13px; color: var(--muted); }
.art-card { position: relative; flex: none; display: flex; flex-direction: column; gap: 5px; padding: 6px; border-radius: 14px; border: 2px solid transparent; background: var(--bg-2); cursor: pointer; font-size: 11.5px; color: var(--text-2); }
.art-card input { position: absolute; opacity: 0; pointer-events: none; }
.art-card img { display: block; border-radius: 9px; object-fit: cover; background: var(--bg); }
.art-card.art-icon img { width: 116px; height: 116px; border-radius: 24px; }
.art-card.art-background img { width: 232px; height: 130px; }
.art-card:hover { border-color: var(--border-strong); }
.art-card:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg-2)); color: var(--text); }
.art-card:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-soft); }
.art-card.is-current span::after { content: " · in the game"; color: var(--good); }
.art-card.is-waiting { display: grid; place-items: center; cursor: default; border: 2px dashed var(--border); color: var(--muted); animation: pulse 1.4s infinite; }
.art-card.art-icon.is-waiting { width: 132px; height: 148px; }
.art-card.art-background.is-waiting { width: 248px; height: 162px; }
.art-progress { margin-top: 14px; padding: 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.art-progress[hidden], .art-again[hidden] { display: none; }
.art-progress .progress { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.art-progress .progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.art-progress-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; font-size: 12.5px; color: var(--text-2); }
.art-again { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.art-again-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.art-design { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.art-design select { height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font: inherit; font-size: 13px; }
.art-title { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.art-title input { width: 16px; height: 16px; accent-color: var(--brand); }
/* the judge's reading on a card: a score, a Best tag, and a Menu preview for backgrounds */
.art-painter { margin-top: 4px; }
.art-painter[hidden] { display: none; }
.art-low { margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; color: var(--text);
           border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.art-low[hidden] { display: none; }
.art-score { position: absolute; top: 10px; left: 10px; padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1.4;
             background: rgba(10, 13, 18, .78); color: #fff; border: 1px solid rgba(255, 255, 255, .25); cursor: help; }
.art-score.is-low { color: var(--warn); }
.art-best { position: absolute; left: 10px; bottom: 34px; padding: 2px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
            background: var(--good); color: #fff; }
.art-preview { position: absolute; top: 10px; right: 46px; height: 30px; padding: 0 9px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .25);
               background: rgba(10, 13, 18, .72); color: #fff; font: inherit; font-size: 11px; line-height: 1; cursor: pointer; opacity: .85; }
.art-preview:hover, .art-preview:focus-visible { opacity: 1; border-color: var(--accent); background: rgba(10, 13, 18, .9); }
.art-reference { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--text-2); }
.art-reference .dialog-hint { margin: 0; flex: 1 1 100%; }
.art-reference-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); background: var(--bg); }
.art-reference-thumb[hidden] { display: none; }

/* ---------- the Studio on a phone ---------- */
.phone-tabs { display: none; }
@media (max-width: 760px) {
  html, body { height: 100%; overflow: hidden; }
  body { display: flex; flex-direction: column; }

  /* the top bar: the game first, then one row of actions that scrolls sideways */
  .studio-topbar { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "brand id" "actions actions";
                   gap: 6px 10px; height: auto; padding: 8px 12px; flex: none; }
  .studio-topbar .studio-brand { grid-area: brand; }
  .studio-topbar .studio-id { grid-area: id; order: 0; width: auto; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
  .studio-topbar .game-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
  .studio-topbar .credits, .studio-topbar #state-badge { flex: none; }
  .studio-topbar .plan-tag { display: none; }                      /* the plan is on the Coins page; the name needs the room */
  .studio-topbar .game-name { min-width: 72px; }
  /* one row that fits the screen, nothing scrolls or gets cut: square icon buttons, Publish takes
     the room that is left and keeps its word, the account is a compact chip */
  .studio-topbar .topbar-actions { grid-area: actions; display: flex; flex-wrap: nowrap; gap: 6px; justify-content: flex-start; overflow: visible;
                                   min-width: 0; padding: 0; }
  .studio-topbar .topbar-actions > * { flex: none; }
  .studio-topbar .topbar-actions .topbar-sep { display: none; }
  .studio-topbar .topbar-actions .btn { height: 44px; min-height: 44px; border-radius: 12px; }
  .studio-topbar .topbar-actions #build span, .studio-topbar .topbar-actions #versions span, .studio-topbar .topbar-actions #embed span { display: none; }
  .studio-topbar .topbar-actions #build, .studio-topbar .topbar-actions #versions, .studio-topbar .topbar-actions #embed { width: 44px; padding: 0; justify-content: center; }
  .studio-topbar .topbar-actions #build svg, .studio-topbar .topbar-actions #versions svg, .studio-topbar .topbar-actions #embed svg { width: 20px; height: 20px; }
  .studio-topbar .topbar-actions #publish { flex: 1 1 0; min-width: 96px; padding: 0 12px; justify-content: center; white-space: nowrap; font-size: 14.5px; }
  .studio-topbar .auth-slot { margin-left: 0; min-width: 0; }
  .studio-topbar .auth-slot .btn-google { padding: 0 12px; }
  .studio-topbar .auth-slot .btn-google .full { display: none; }
  .studio-topbar .auth-slot .btn-google .short { display: inline; }

  /* one panel at a time */
  .layout, .layout.is-graph { display: block; flex: 1 1 auto; min-height: 0; overflow: hidden; }
  .layout > .chat, .layout > .preview, .layout > .side { display: none; height: 100%; border: 0; }
  body[data-phone="chat"] .layout > .chat { display: flex; }
  body[data-phone="game"] .layout > .preview { display: flex; flex-direction: column; overflow-y: auto; }
  body[data-phone="objects"] .layout > .side, body[data-phone="objects"] .layout.is-graph > .side { display: flex; flex-direction: column; overflow-y: auto; }
  .chat { height: 100%; }
  .stage { aspect-ratio: auto; flex: 1 1 auto; min-height: 46dvh; margin: 10px; }
  .graph-view { height: auto; flex: 1 1 auto; min-height: 60dvh; margin: 10px; }
  /* the game toolbar: the tabs, the running badge, and Restart / Fullscreen as two icon buttons */
  .toolbar { gap: 6px 8px; padding: 8px 10px; flex-wrap: wrap; }
  .toolbar .tabs { flex: 1 1 100%; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .toolbar .tabs .tab { flex: none; min-height: 40px; }
  .toolbar #kind-badge { display: none; }
  .toolbar .toolbar-actions { margin-left: auto; gap: 6px; }
  .toolbar .toolbar-actions .btn { width: 40px; min-height: 40px; padding: 0; justify-content: center; font-size: 0; border-radius: 10px; }
  .toolbar .toolbar-actions .btn svg { width: 18px; height: 18px; margin: 0; }
  .android-view { margin: 10px; }
  .android-bar { gap: 6px; }
  .android-bar .btn, .android-devices .chip { min-height: 40px; }
  .preview-foot { display: none; }

  .phone-tabs { display: grid; grid-template-columns: repeat(3, 1fr); flex: none; border-top: 1px solid var(--border); background: var(--bg-2);
                padding-bottom: env(safe-area-inset-bottom, 0); }
  .phone-tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; border: 0; background: transparent;
                       color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; }
  .phone-tabs svg { width: 22px; height: 22px; }
  .phone-tabs button { position: relative; }
  .phone-tabs button.has-ask::after { content: ""; position: absolute; top: 9px; left: calc(50% + 9px); width: 10px; height: 10px; border-radius: 50%; background: var(--warn, #ffd23f); box-shadow: 0 0 0 2px var(--bg-2); }
  .phone-tabs button.is-active { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }
  body > .phone-tabs { order: 9; }

  /* dialogs use the screen */
  .dialog, .dialog.dialog-wide, .artwork-dialog, .install-dialog, .font-dialog { width: calc(100vw - 24px); max-width: none; max-height: calc(100dvh - 24px); overflow-y: auto; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .btn { flex: 1 1 auto; min-height: 44px; }
  .art-row-head { flex-wrap: wrap; }
  .art-row-head h3 { width: 100%; }
  .param-row, .param-row-text, .param-row-text:has(.font-button) { grid-template-columns: minmax(0, 1fr); }
  .package-parts { flex-wrap: wrap; }
  .help-button, .btn-icon, .chat-head .btn { min-width: 40px; min-height: 40px; }
  .card .btn, .folder-head .btn { min-height: 36px; }
  #send { min-height: 44px; min-width: 64px; }
}

/* the agents are closed for an update; a model that is switched off */
.agents-closed { margin: 0 12px 8px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--warn, #f5b942) 55%, transparent);
  border-radius: 10px; background: color-mix(in srgb, var(--warn, #f5b942) 12%, transparent); font-size: 13px; line-height: 1.4; }
.seg-item.is-off, .seg-item:disabled { opacity: .5; cursor: not-allowed; }

/* the Android tab: Debug or Release */
.android-kind { display: inline-flex; }
.android-kind .seg-item { padding: 4px 10px; font-size: 12px; }

/* the palette on an object: one row per part */
.color-row { align-items: center; }
.color-controls { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.color-box, .param-row input.color-box { flex: none; width: 48px; min-width: 48px; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: transparent; cursor: pointer; }
.color-box:disabled { cursor: not-allowed; opacity: .45; }
.color-hex, .param-row input.color-hex { flex: none; width: 96px; font-family: ui-monospace, monospace; font-size: 13px; text-transform: lowercase; }
.color-row.is-locked .param-text { opacity: .6; }
@media (max-width: 560px) {
  .color-row { flex-direction: column; align-items: stretch; gap: 8px; }
}

/* the object viewer with its details: the object on the left, colours and numbers on the right */
.param-row.color-row { grid-template-columns: minmax(0, 1fr) auto; }
.view-head-actions { display: inline-flex; gap: 8px; align-items: center; }
.view-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.dialog.has-panel { width: min(1120px, calc(100vw - 32px)); }
.dialog.has-panel .view-body { grid-template-columns: minmax(0, 1fr) 340px; }
.view-panel { display: flex; flex-direction: column; gap: 8px; min-width: 0; max-height: min(58vh, 480px); overflow-y: auto; padding-right: 2px; }
.view-panel[hidden] { display: none; }
.view-panel h3 { margin: 4px 0 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.view-rows { max-height: none; overflow: visible; }
.view-status { margin: 2px 0 0; min-height: 18px; font-size: 12.5px; color: var(--muted); }
.view-status.is-good { color: var(--good); }
.view-status.is-bad { color: var(--bad); }
.view-panel.is-working .param-row { opacity: .6; pointer-events: none; }
@media (max-width: 860px) {
  .dialog.has-panel .view-body { grid-template-columns: minmax(0, 1fr); }
  .view-panel { max-height: none; overflow: visible; }
}

/* a section's (?) hint opens over the sections under it: its head is lifted while the hint shows */
.side-head:has(.section-help:hover), .side-head:has(.help-button:focus-visible) { z-index: 40; }
.side .help-tooltip { z-index: 41; }

.side .help-tooltip { z-index: 60; }
/* an object's card in the side panel: its name gets the whole row, its buttons go under it */
.side .card:not(.is-asset) { grid-template-columns: auto minmax(0, 1fr); row-gap: 6px; }
.side .card:not(.is-asset) .card-actions { grid-column: 1 / -1; justify-content: flex-end; flex-wrap: wrap; }

/* the (?) hint: a dark card with a lit edge, a small head, and an arrow that points at the button */
.help-button { border: 1px solid transparent; transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.section-help:hover .help-button, .help-button:focus-visible { background: var(--accent-soft); color: var(--accent-hover); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.side .help-tooltip {
  padding: 12px 14px 13px; border-radius: var(--radius); text-align: left;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--raised)), var(--raised));
  color: var(--text-2); font-size: 12.5px; line-height: 1.55; font-weight: 400; letter-spacing: 0; text-transform: none;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border-strong));
  box-shadow: var(--shadow), 0 0 0 1px rgba(0, 0, 0, .35), 0 0 22px -8px var(--accent);
  transform: translateY(-4px) scale(.98); transform-origin: var(--arrow, 80%) top;
  transition: opacity .14s var(--ease), transform .14s var(--ease), visibility .14s;
}
.side .help-tooltip.is-above { transform: translateY(4px) scale(.98); transform-origin: var(--arrow, 80%) bottom; }
.section-help:hover .help-tooltip, .help-button:focus-visible + .help-tooltip { transform: none; }
.help-title { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; color: var(--text); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.help-title::before { content: "?"; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 800; letter-spacing: 0; }
.help-words { display: block; }
.side .help-tooltip::after {
  content: ""; position: absolute; left: calc(var(--arrow, 80%) - 6px); top: -6px; width: 10px; height: 10px; transform: rotate(45deg);
  background: color-mix(in srgb, var(--accent) 9%, var(--raised));
  border-left: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border-strong));
  border-top: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border-strong));
}
.side .help-tooltip.is-above::after { top: auto; bottom: -6px; transform: rotate(225deg); background: var(--raised); }
@media (prefers-reduced-motion: reduce) { .side .help-tooltip { transition: none; transform: none; } }

/* the viewer's colours: a number and a colour, no names */
.color-number { font: 600 13px/1 ui-monospace, monospace; color: var(--text-2); min-width: 28px; }
.view-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }

/* Artwork: minimize, and one picture in full */
.art-head-actions { display: inline-flex; gap: 8px; align-items: center; }
.art-full { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; padding: 0; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .25);
            background: rgba(10, 13, 18, .72); color: #fff; font-size: 15px; line-height: 1; cursor: zoom-in; opacity: .85; display: grid; place-items: center; }
.art-full:hover, .art-full:focus-visible { opacity: 1; border-color: var(--accent); background: rgba(10, 13, 18, .9); }
.art-view { width: min(1100px, calc(100vw - 32px)); }
.art-view-stage { display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.art-view-stage img { display: block; max-width: 100%; max-height: min(70vh, 720px); object-fit: contain; border-radius: 8px; }
.art-view-stage img.art-view-icon { width: min(512px, 100%); border-radius: 22%; }
.art-mini { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px;
            border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border-strong)); background: var(--raised);
            box-shadow: var(--shadow); font-size: 13px; color: var(--text); }
.art-mini[hidden] { display: none; }
.art-mini-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.art-mini.is-busy .art-mini-dot { background: var(--accent); animation: pulse 1.4s infinite; }
@media (max-width: 720px) { .art-mini { right: 10px; left: 10px; bottom: 70px; justify-content: space-between; } }

.artwork-replaced { margin: 8px 0 0; font-size: 12.5px; color: var(--text-2); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.artwork-replaced[hidden] { display: none; }
.art-words { margin-top: 4px; }

/* ---------- free changes: Tune, Look, History (js/studio-free.js) ---------- */
.free-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.free-tool {
  display: flex; flex-direction: column; gap: 3px; min-width: 0; min-height: 58px; padding: 9px 10px; text-align: left; cursor: pointer;
  border: 1px solid var(--border); border-top: 2px solid color-mix(in srgb, var(--c, var(--accent)) 70%, transparent);
  border-radius: var(--radius-sm); background: var(--raised); transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.free-tool:hover { background: var(--hover); border-color: color-mix(in srgb, var(--c, var(--accent)) 60%, transparent); }
.free-tool b { font-size: 13px; font-weight: 600; color: var(--text); }
.free-tool small { font-size: 11px; line-height: 1.3; color: var(--muted); }
.side-section[data-section="free"] .count { font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; }

.free-rows { gap: 14px; }
.free-group { display: flex; flex-direction: column; gap: 6px; }
.free-group-name { position: sticky; top: 0; z-index: 1; padding: 4px 2px; background: var(--surface); color: var(--c, var(--accent));
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.tune-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 1.1fr) 92px; gap: 12px; align-items: center; padding: 8px 10px;
  border: 1px solid var(--border); border-left: 2px solid transparent; border-radius: var(--radius-sm); background: var(--raised);
}
.tune-row.is-changed { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--raised)); }
.tune-row input[type="range"] { width: 100%; min-width: 0; accent-color: var(--accent); }
.tune-row input[type="number"] { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-2); color: var(--text); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.tune-row input[type="number"]:invalid { border-color: var(--bad); }
.tune-row input[type="checkbox"] { justify-self: end; width: 18px; height: 18px; accent-color: var(--accent); }
.look-row { grid-template-columns: minmax(0, 1fr) minmax(150px, 1.1fr); cursor: pointer; }
.look-row select { width: 100%; height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-2); color: var(--text); font-size: 13px; }
.look-row select:disabled { opacity: .55; cursor: not-allowed; }
.look-row .param-text small { white-space: normal; }
.free-count { margin-right: auto; align-self: center; color: var(--good); font-size: 12.5px; font-weight: 600; }
.free-empty { padding: 18px 4px; white-space: normal; }

.history-drawer .drawer-head > div::before { content: "Free undo"; }
.history-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 8px; border: 1px solid transparent; border-radius: var(--radius-sm); }
.history-row:hover { background: color-mix(in srgb, var(--raised) 72%, transparent); border-color: var(--border); }
.history-row strong { overflow-wrap: anywhere; }

.free-tip { display: flex; align-items: center; gap: 8px; margin: 0 12px 8px; padding: 7px 8px 7px 12px; font-size: 12.5px; color: var(--text-2);
  border: 1px solid color-mix(in srgb, var(--good) 36%, transparent); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--good) 9%, transparent); }
.free-tip[hidden] { display: none; }
.free-tip > span { flex: 1; min-width: 0; }
@media (max-width: 760px) {
  .tune-row { grid-template-columns: minmax(0, 1fr) 92px; }
  .tune-row .param-text { grid-column: 1 / -1; }
  .look-row { grid-template-columns: minmax(0, 1fr); }
  .free-count { flex-basis: 100%; }
}

/* ---------- the layout editor: drag the game's buttons and texts (js/studio-layout.js) ---------- */
.layout-bar { display: flex; flex-direction: column; gap: 6px; margin: 12px 16px -6px; padding: 8px 10px; border: 1px solid var(--border);
  border-top: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); border-radius: var(--radius-sm); background: var(--sheen), var(--surface); }
.layout-bar[hidden], .layout-overlay[hidden] { display: none; }
.layout-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.layout-name { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.layout-screens { gap: 4px; }
.layout-screens .seg-item { height: 29px; padding: 0 11px; font-size: 12.5px; }
.layout-spacer { flex: 1; }
.layout-unsaved { padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.layout-readout { min-width: 0; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.layout-scale { min-width: 40px; text-align: center; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.layout-note { margin: 0; font-size: 12.5px; color: var(--text-2); }
.layout-note.is-bad { color: var(--bad); }
.layout-faults { margin: 0; padding: 0 0 0 18px; max-height: 96px; overflow-y: auto; font-size: 12.5px; color: var(--text-2); }
.layout-bar.is-old .layout-item, .layout-bar.is-old .layout-screens, .layout-bar.is-old .layout-unsaved,
.layout-bar.is-old #layout-check, .layout-bar.is-old #layout-save { display: none; }

.layout-overlay { position: absolute; inset: 0; z-index: 3; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.layout-overlay.is-waiting { pointer-events: none; opacity: .6; }
.layout-box { position: absolute; box-sizing: border-box; cursor: move; touch-action: none; border-radius: 3px;
  outline: 1px dashed color-mix(in srgb, var(--accent) 38%, transparent); outline-offset: 1px; }
.layout-box.is-moved { outline-color: color-mix(in srgb, var(--accent-3) 70%, transparent); }
.layout-box:hover, .layout-box:focus-visible { outline: 1.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.layout-box.is-selected { outline: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: var(--glow-2); }
.layout-handle { position: absolute; right: -8px; bottom: -8px; width: 14px; height: 14px; border-radius: 4px; cursor: nwse-resize; touch-action: none;
  background: var(--accent); border: 2px solid var(--text); }
.layout-handle::after { content: ""; position: absolute; inset: -12px; }      /* a bigger place for a finger */
.layout-guide { position: absolute; z-index: 900; pointer-events: none; background: var(--accent-2); box-shadow: 0 0 6px var(--accent-2); }
.layout-guide.is-x { top: 0; bottom: 0; width: 1px; }
.layout-guide.is-y { left: 0; right: 0; height: 1px; }
.layout-tag { position: absolute; z-index: 901; pointer-events: none; max-width: 100%; padding: 2px 7px; border-radius: 5px; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent-ink); background: var(--accent); }
@media (max-width: 760px) {
  .layout-bar { margin: 8px 10px -2px; }
  .layout-bar .btn, .layout-screens .seg-item { min-height: 36px; }
  .layout-readout { flex-basis: 100%; }
  .layout-item .layout-spacer { display: none; }
}

/* a note on the control that was pressed ("Wait for the agent to finish."): a small bubble, gone by itself */
.tip-bubble { position: fixed; z-index: 90; max-width: min(340px, calc(100vw - 16px)); padding: 8px 12px; border-radius: 10px;
  background: var(--raised); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lift);
  font-size: 13px; line-height: 1.4; opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .15s, transform .15s; }
.tip-bubble.is-shown { opacity: 1; transform: none; pointer-events: auto; }
.tip-bubble::after { content: ""; position: absolute; left: var(--arrow, 50%); bottom: -6px; width: 10px; height: 10px; margin-left: -5px;
  background: var(--raised); border-right: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); transform: rotate(45deg); }
.tip-bubble.is-below::after { bottom: auto; top: -6px; transform: rotate(225deg); }


/* ---- the scene inspector (js/studio-inspector.js) ---- */
.inspector-drawer { position: fixed; inset: 0 0 0 auto; z-index: 80; width: min(520px, 96vw); right: 0; left: auto; margin: 0 0 0 auto; height: 100vh; max-height: 100vh; overflow: auto; }
.inspector-drawer .drawer-head > div::before { content: "Scene editor"; }
.inspector-drawer { overflow-x: hidden; }
.inspector-body, .inspector-block, .inspector-field > * { min-width: 0; }      /* a fieldset is min-content wide by default: it pushed the drawer sideways */
.inspector-slider { min-width: 0; }
.inspector-scene { font-weight: 400; color: var(--muted); margin-left: 6px; }
.inspector-tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.inspector-view { width: 100%; height: 190px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--border); touch-action: none; cursor: crosshair; }
.inspector-split { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 10px; margin-top: 10px; }
.inspector-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow: auto; }
.inspector-row { text-align: left; padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.inspector-row small { display: block; color: var(--muted); font-size: 11px; }
.inspector-row.is-on { border-color: var(--accent); background: var(--accent-soft); }
.inspector-block { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px 10px; margin: 0 0 8px; }
.inspector-block legend { font-weight: 600; padding: 0 4px; }
.inspector-field { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; }
.inspector-field input[type="text"], .inspector-field input[type="number"], .inspector-field select { width: 100%; }
.inspector-field.is-live { color: var(--muted); }
/* the gizmo's modes and views; vectors, sliders, overrides, prefabs (Sprint 3) */
.inspector-gizmo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 6px; }
.inspector-gizmo [aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.inspector-viewpick { margin-left: auto; max-width: 200px; }
.inspector-view:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.inspector-block legend { display: flex; align-items: center; gap: 6px; }
.inspector-drop { padding: 0 6px; line-height: 1.4; color: var(--muted); }
.inspector-vec { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.inspector-vec input { width: 100%; min-width: 0; }
.inspector-tune { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 6px; align-items: center; }
.inspector-slider { width: 100%; accent-color: var(--accent); }
.inspector-field input[type="color"] { width: 56px; height: 26px; padding: 0 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.inspector-field.is-override { grid-template-columns: 110px minmax(0, 1fr) auto; }
.inspector-field.is-override > span { color: var(--accent); font-weight: 600; }
.inspector-own { color: var(--accent); font-weight: 400; }
.inspector-revert { padding: 2px 8px; }
.inspector-texture { width: 100%; }
.inspector-prefab { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin: 8px 0 0; }
.inspector-prefab input { width: 100%; }

/* the account's plan beside the Coins (app.js paintPlan) */
.plan-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font: 700 10.5px/1 "Space Grotesk", sans-serif;
  letter-spacing: .1em; color: var(--text-2); border: 1px solid color-mix(in srgb, currentColor 35%, transparent); }
.plan-tag[data-plan="studio"] { color: var(--accent); }
.plan-tag[data-plan="pro"] { color: var(--warn); }
