:root {
  --bg: #16181d; --panel: #1f2229; --panel2: #262a33; --line: #343945; --text: #d9dde6; --muted: #8a92a3;
  --accent: #4ab3ff; --accent2: #2b7fc4; --danger: #ff6b6b; --sel: #24425f; --insel: #1f3042;
  font: 13px/1.35 "Segoe UI", system-ui, sans-serif; color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
button, input, select { font: inherit; color: var(--text); }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 3px 9px; cursor: pointer; }
button:hover { border-color: #4a5160; background: #2d323c; }
button.on, button.primary { background: var(--accent2); border-color: var(--accent); color: #fff; }
button:disabled { opacity: .5; cursor: default; }
input { background: #14161b; border: 1px solid var(--line); border-radius: 3px; padding: 2px 5px; min-width: 0; }
input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
input[type=checkbox] { vertical-align: -2px; }
input[type=color] { padding: 0; width: 30px; height: 22px; border: none; background: none; }
code { background: #12141a; padding: 0 4px; border-radius: 3px; }
.muted { color: var(--muted); } .small { font-size: 11.5px; }
body { display: grid; grid-template-rows: auto 1fr auto; }

#toolbar { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 6px 8px; background: var(--panel); border-bottom: 1px solid var(--line); align-items: center; }
#toolbar .grp { display: flex; gap: 4px; align-items: center; }
#toolbar .grp.right { margin-left: auto; }
#toolbar .snap input[type=number] { width: 56px; }
#toolbar label { display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.chip { font-size: 11.5px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; cursor: help; }
.chip:empty { display: none; }
.chip.ok { border-color: #2f7a4f; color: #8fe0ad; }
.chip.warn { border-color: #6b5326; color: #f0c27a; }

main { display: grid; grid-template-columns: 270px 1fr 320px; min-height: 0; }
aside { background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
#left { border-right: 1px solid var(--line); }
#right { border-left: 1px solid var(--line); }
.panel-head { padding: 6px 8px; font-weight: 600; background: var(--panel2); border-bottom: 1px solid var(--line); }
.panel-head.tabs { display: flex; gap: 4px; padding: 4px 6px; border-top: 1px solid var(--line); }
.search-row { display: flex; gap: 4px; padding: 5px 6px; }
.search-row input { flex: 1; }

#outliner-list { flex: 1; overflow-y: auto; position: relative; }
.ol-spacer { width: 1px; }
.ol-layer { position: absolute; top: 0; left: 0; right: 0; }
.ol-row { height: 26px; display: flex; align-items: center; gap: 5px; padding-right: 6px; cursor: default; white-space: nowrap; }
.ol-row:hover { background: #2a2f39; }
.ol-row.sel { background: var(--sel); } .ol-row.insel { background: var(--insel); }
.ol-row.hidden { opacity: .45; }
.ol-row .tw { width: 12px; color: var(--muted); cursor: pointer; text-align: center; }
.ol-row .cs { width: 10px; height: 10px; border-radius: 2px; flex: none; border: 1px solid #0006; }
.ol-row .nm { overflow: hidden; text-overflow: ellipsis; }
.ol-row .nm.grp { color: #b9c7ff; }
.ol-row .nm.proxy { font-style: italic; color: #e8b77a; }
.ol-row .sub { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.ol-row .eye { color: var(--muted); cursor: pointer; font-size: 10px; }
.ol-pic { position: relative; width: 22px; height: 22px; flex: none; border-radius: 4px; overflow: hidden; background: var(--ph, #2a2f39); box-shadow: inset 0 0 0 1px #0006; }
.ol-pic.ready { background: radial-gradient(circle at 50% 35%, #353b48, #1a1d23); }
.ol-pic.grp { background: none; box-shadow: none; }
.ol-pic.grp::before, .ol-pic.grp::after { content: ''; position: absolute; width: 10px; height: 10px; border: 1.5px solid #b9c7ff; border-radius: 2px; }
.ol-pic.grp::before { left: 3px; top: 3px; opacity: .55; }
.ol-pic.grp::after { left: 8px; top: 8px; background: var(--panel); }
.ol-row:hover .ol-pic.grp::after { background: #2a2f39; }
.ol-row.sel .ol-pic.grp::after { background: var(--sel); } .ol-row.insel .ol-pic.grp::after { background: var(--insel); }

/* 3D previews (thumbs.js): fade in when first drawn, instantly when cached */
.thumb { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: transform .25s ease-out; pointer-events: none; }
.thumb.ready { opacity: 1; }
.thumb.fresh { animation: thumb-in .35s ease-out; }
@keyframes thumb-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }

#viewport { position: relative; min-width: 0; min-height: 0; }
#viewport canvas { display: block; width: 100%; height: 100%; }
#nav-hint { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); background: #0d0f13d9; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px 4px 10px; font-size: 12px; color: var(--muted); white-space: nowrap; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; }
#nav-hint b { color: var(--text); font-weight: 600; }
#nav-hint button { padding: 0 5px; margin-left: 6px; font-size: 11px; }
#nav-hint.hidden { display: none; }
#select-rect { position: absolute; display: none; border: 1px solid var(--accent); background: #4ab3ff22; pointer-events: none; }
#toasts { position: absolute; left: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; max-width: 70%; }
.toast { background: #0d0f13e6; border: 1px solid var(--line); border-radius: 5px; padding: 6px 10px; }
.toast.error { border-color: var(--danger); color: #ffd0d0; }

#inspector-body { padding: 8px; overflow-y: auto; max-height: 52%; border-bottom: 1px solid var(--line); }
#inspector-body p { margin: 4px 0 8px; }
.row { display: flex; gap: 5px; align-items: center; margin-bottom: 6px; }
.row > label { width: 64px; flex: none; color: var(--muted); }
.row > input:not([type=color]) { flex: 1; }
.row.vec input[type=number] { width: 0; flex: 1; }
.ax { font-size: 10px; font-weight: 700; width: 9px; }
.axX { color: #ff6b6b; } .axY { color: #6bdc6b; } .axZ { color: #5ab0ff; }
.ax.axR { color: #ff6b6b; }
.note { background: #3a2f1c; border: 1px solid #6b5326; border-radius: 4px; padding: 5px 7px; font-size: 12px; }
.btns { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 4px; }

#library-list { flex: 1; overflow-y: auto; padding: 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; align-content: start; }
#library-list > p { grid-column: 1 / -1; margin: 6px 2px; }
/* no content-visibility or animated placeholders here: measured, both made scrolling the library stutter */
.lib-item { display: flex; flex-direction: column; gap: 4px; padding: 4px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; min-width: 0;
  transition: background .15s, border-color .15s; }
.lib-item:hover { background: #2a2f39; border-color: #4ab3ff66; }
.lib-item:hover .thumb.ready { transform: scale(1.08); }
.lib-pic { --pic-bg: radial-gradient(120% 95% at 50% 28%, #3b4352 0%, #23272f 58%, #17191e 100%);
  position: relative; display: block; aspect-ratio: 1; border-radius: 5px; overflow: hidden; background: var(--ph, var(--pic-bg)); box-shadow: inset 0 0 0 1px #0007; }
.lib-pic.ready { background: var(--pic-bg); }
.lib-pic .tag { position: absolute; left: 4px; top: 4px; width: auto; z-index: 1; opacity: .92; }
.lib-name { font-size: 11.5px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: 10px; padding: 0 4px; border-radius: 3px; background: #2f3d52; color: #9fc6ff; width: 38px; text-align: center; flex: none; }
.tag.proxy { background: #4a3a1f; color: #f0c27a; } .tag.light { background: #4a461f; color: #f3e48a; } .tag.effect { background: #4a2a1f; color: #ffab7a; }

#statusbar { display: flex; align-items: center; justify-content: flex-start; gap: 20px; padding: 3px 10px; background: var(--panel); border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; }
#statusbar #status { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.version-badge { flex: none; font-variant-numeric: tabular-nums; letter-spacing: .06em; color: #8a93a8; font-size: 11px; padding-left: 10px; border-left: 1px solid var(--line); }

.modal { position: fixed; inset: 0; background: #000a; display: none; align-items: center; justify-content: center; z-index: 50; }
.modal.open { display: flex; }
.modal .box { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; width: min(440px, 94vw); max-height: 90vh; overflow: auto; }
.modal .box.wide { width: min(720px, 94vw); }
.box-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.box-head h3, .box h2 { margin: 0; }
#file-dir { width: 100%; margin-bottom: 6px; }
#file-list { height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 4px; margin-bottom: 8px; background: #14161b; }
#file-list .f { padding: 4px 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
#file-list .f:hover { background: #2a2f39; }
#file-list .f.dir { color: #b9c7ff; justify-content: flex-start; }
#extract-log, #link-log { background: #0d0f13; border: 1px solid var(--line); border-radius: 4px; height: 160px; overflow: auto; padding: 6px; font-size: 11.5px; white-space: pre-wrap; }
table.keys { border-collapse: collapse; width: 100%; }
table.keys td { padding: 4px 8px; border-bottom: 1px solid var(--line); }
table.keys td:nth-child(odd) { color: var(--accent); white-space: nowrap; }
#viewport canvas:focus { outline: none; }

/* world kit dialogs */
select, textarea { font: inherit; color: var(--text); background: #14161b; border: 1px solid var(--line); border-radius: 3px; padding: 2px 5px; }
textarea { width: 100%; resize: vertical; font-family: Consolas, monospace; font-size: 12px; }
.gen-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.gen-tabs button { border-radius: 999px; padding: 3px 12px; }
.gen-tabs button.on { border-color: var(--accent); background: #1d3147; }
.gen-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-bottom: 10px; max-height: min(52vh, 560px); overflow-y: auto; padding-right: 2px; }
.gen-card { display: flex; flex-direction: column; gap: 4px; padding: 6px 6px 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: var(--panel2); transition: border-color .15s, transform .15s; }
.gen-card[hidden] { display: none; }
.gen-card:hover { transform: translateY(-1px); border-color: #3b5577; }
.gen-card input { display: none; }
.gen-card.on { border-color: var(--accent); background: #1d3147; box-shadow: 0 0 0 1px var(--accent) inset; }
.gen-card b { padding: 0 4px; }
.gen-thumb { position: relative; aspect-ratio: 16 / 10; border-radius: 5px; overflow: hidden; background: radial-gradient(circle at 50% 60%, #241a4a, #07060f); }
.gen-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gen-kind { position: absolute; top: 5px; left: 5px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; background: rgba(10, 8, 24, .78); color: #c4b5fd; }
.gen-kind.asset { color: #7dd3fc; }
.gen-kind.prop { color: #fcd34d; }
.gen-desc { padding: 0 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.kit-status { min-height: 1.2em; }
.fix-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.fix-act { display: flex; gap: 6px; align-items: center; flex: none; }
ul.problems li { color: #ffb4b4; } ul.notes li { color: #f0d49a; }
p.ok { color: #8fe0ad; }
h4 { margin: 14px 0 4px; }

/* AI builder — cinematic neural theme */
button.ai-btn { border-color: #8a5cf6; box-shadow: 0 0 12px #8a5cf640; }
button.ai-btn.on { background: linear-gradient(135deg, #5b3db0, #3d5a9e); border-color: #c4b5fd; box-shadow: 0 0 18px #a78bfa55; }
#ai-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%);
  display: flex; flex-direction: column; z-index: 5; overflow: hidden;
  background: linear-gradient(165deg, #0f1118 0%, #12101a 45%, #0a0c14 100%);
  border-left: 1px solid #8a5cf650;
  box-shadow: -12px 0 40px #00000080, inset 1px 0 0 #c4b5fd18;
}
#ai-panel::before {
  content: ''; pointer-events: none; position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 80% 40% at 100% 0%, rgba(138,92,246,.22), transparent 55%),
    radial-gradient(ellipse 60% 30% at 0% 100%, rgba(74,179,255,.12), transparent 50%);
}
#ai-panel > * { position: relative; z-index: 1; }
#ai-panel[hidden] { display: none; }
#ai-panel.busy { animation: ai-pulse-border 2.2s ease-in-out infinite; }
@keyframes ai-pulse-border {
  0%, 100% { border-left-color: #8a5cf650; box-shadow: -12px 0 40px #00000080; }
  50% { border-left-color: #c4b5fd90; box-shadow: -12px 0 48px #8a5cf640; }
}
.ai-head {
  display: flex; gap: 8px; align-items: center; padding: 8px 10px;
  border-bottom: 1px solid #8a5cf630;
  background: linear-gradient(90deg, #1a1528, #14161f);
}
.ai-head .grow { flex: 1; }
.ai-brand { display: flex; gap: 8px; align-items: center; min-width: 0; }
.ai-mark {
  font-size: 18px; line-height: 1; color: #e9d5ff;
  text-shadow: 0 0 12px #a78bfa, 0 0 24px #8a5cf680;
  animation: ai-mark-pulse 3s ease-in-out infinite;
}
@keyframes ai-mark-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .85; transform: scale(1.06); } }
.ai-brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ai-title {
  font-size: 13px; letter-spacing: .04em; text-transform: uppercase;
  background: linear-gradient(90deg, #e9d5ff, #93c5fd);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ai-tagline { font-size: 10.5px; color: #9ca3af; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-settings { padding: 6px 10px; border-bottom: 1px solid var(--line); background: #0d0f14aa; }
.ai-settings summary { cursor: pointer; color: var(--muted); }
.ai-settings .row > label { width: 54px; }
.ai-settings select { flex: 1; }
.ai-settings a { color: var(--accent); }
#ai-log {
  flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px;
  background: repeating-linear-gradient(0deg, transparent, transparent 23px, #ffffff06 24px);
}
.ai-hello { padding: 10px 12px; border-radius: 10px; border: 1px solid #8a5cf640; background: #1a1528cc; }
.ai-hello-lead { margin: 0 0 8px; font-size: 12px; line-height: 1.45; color: #c4b5fd; }
.ai-hello kbd { font: inherit; font-size: 10px; padding: 1px 5px; border-radius: 3px; background: #0d0f13; border: 1px solid var(--line); color: var(--text); }
.ai-examples { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-examples button {
  font-size: 11px; padding: 4px 8px; border-radius: 999px;
  border: 1px solid #8a5cf655; background: #2a2140; color: #ddd6fe;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.ai-examples button:hover { border-color: #c4b5fd; box-shadow: 0 0 12px #8a5cf640; transform: translateY(-1px); }
.ai-msg { padding: 8px 11px; border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.ai-msg.me {
  align-self: flex-end; max-width: 92%;
  background: linear-gradient(135deg, #1e3a5f, #24425f);
  border: 1px solid #4ab3ff40; box-shadow: 0 4px 16px #00000040;
}
.ai-msg.bot {
  background: linear-gradient(145deg, #1a1d28, #14161f);
  border: 1px solid #ffffff10;
  box-shadow: inset 0 1px 0 #ffffff08;
}
.ai-msg.err { background: #3a1f22; border: 1px solid var(--danger); color: #ffd0d0; }
.ai-text { font-size: 13px; }
.ai-think { margin-top: 6px; border-radius: 6px; border: 1px dashed #8a5cf640; padding: 4px 8px; background: #0d0f13; }
.ai-think summary { color: #a78bfa; cursor: pointer; font-size: 11.5px; letter-spacing: .03em; }
.ai-think div { color: var(--muted); font-size: 11.5px; }
.ai-writing { color: #93c5fd !important; animation: ai-shimmer-text 1.5s ease-in-out infinite; }
@keyframes ai-shimmer-text { 0%, 100% { opacity: .7; } 50% { opacity: 1; } }
.ai-tool { font-size: 12px; font-family: Consolas, monospace; padding: 3px 0 3px 18px; position: relative; white-space: normal; }
.ai-tool::before { content: '◆'; position: absolute; left: 2px; color: #8a5cf6; font-size: 9px; top: 5px; }
.ai-tool.ok::before { content: '✓'; color: #8fe0ad; font-size: 12px; top: 2px; }
.ai-tool.bad::before { content: '✕'; color: var(--danger); font-size: 12px; top: 2px; }
.ai-tool.bad .small { color: #ffb4b4; }
.ai-tool-name { color: #c4b5fd; font-weight: 600; }
.ai-note { color: #f0d49a; font-size: 12px; margin-top: 4px; }
.ai-compose {
  border-top: 1px solid #8a5cf635; padding: 10px;
  background: linear-gradient(180deg, #0d0f14, #12101a);
}
#ai-input {
  border-radius: 8px; padding: 8px 10px; line-height: 1.4;
  border: 1px solid #8a5cf640; background: #0a0c12;
  box-shadow: inset 0 2px 8px #00000060;
  transition: border-color .15s, box-shadow .15s;
}
#ai-input:focus {
  outline: none; border-color: #a78bfa;
  box-shadow: inset 0 2px 8px #00000060, 0 0 0 2px #8a5cf630, 0 0 20px #8a5cf625;
}
.ai-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 8px; }
.ai-actions #ai-usage { flex: 1; font-size: 10.5px; color: var(--muted); }
#ai-send.primary {
  background: linear-gradient(135deg, #7c3aed, #4ab3ff);
  border-color: #c4b5fd; font-weight: 600; letter-spacing: .02em;
  box-shadow: 0 4px 14px #7c3aed50;
}
#ai-send.primary:hover { filter: brightness(1.08); box-shadow: 0 4px 18px #7c3aed70; }
#ai-panel.busy #ai-input { opacity: .85; }

/* update bar and what's new */
#update-bar, #whats-new, #relink-bar { position: fixed; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; gap: 10px; align-items: center; padding: 8px 14px; border-radius: 8px; box-shadow: 0 6px 24px #0008; max-width: calc(100% - 24px); flex-wrap: wrap; }
#update-bar { top: 8px; background: #1d3147; border: 1px solid var(--accent); }
#whats-new { bottom: 34px; background: #2a2140; border: 1px solid #8a5cf6; z-index: 290; pointer-events: auto; }
body.project-gate-open #viewport canvas,
body.project-gate-open #select-rect { pointer-events: none !important; }
body.project-gate-open #toolbar,
body.project-gate-open aside { pointer-events: none; opacity: .72; }
body.project-gate-open #statusbar { opacity: .72; }
.ai-keycard { background: #2a2140; border: 1px solid #8a5cf6; border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.ai-keycard p { margin: 0; color: var(--muted); }
.ai-keycard input { width: 100%; padding: 5px 7px; }
.ai-keymsg { color: #f0d49a; align-self: center; }

/* cinematic boot splash */
html.splash-active, body.splash-active { overflow: hidden; height: 100%; overscroll-behavior: none; }
body.splash-active { position: fixed; inset: 0; width: 100%; }
#app-splash {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; min-height: 100dvh; min-height: -webkit-fill-available;
  background: #06080e; color: #e8ecf4; overflow: hidden; overscroll-behavior: none;
  animation: splash-in 1.1s cubic-bezier(.2,.9,.2,1) both;
}
#app-splash.splash-out { animation: splash-out .9s cubic-bezier(.4,0,.8,1) forwards; pointer-events: none; }
@keyframes splash-in { from { opacity: 0; filter: brightness(2) blur(8px); } to { opacity: 1; filter: none; } }
@keyframes splash-out { to { opacity: 0; filter: brightness(.6) blur(12px); transform: scale(1.03); } }
#splash-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.splash-hero {
  position: absolute; inset: -4%; background:
    linear-gradient(180deg, #06080ecc 0%, #06080e55 38%, #06080ef0 100%),
    url("images/splash-hero.jpg") center/cover no-repeat;
  transform: scale(1.08);
  animation: splash-ken 14s ease-in-out infinite alternate;
}
@keyframes splash-ken { from { transform: scale(1.08) translate3d(0,0,0); } to { transform: scale(1.14) translate3d(-1.2%,-.8%,0); } }
.splash-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 85% 70% at 50% 42%, transparent 0%, #06080e 78%);
}
.splash-grain {
  position: absolute; inset: 0; pointer-events: none; opacity: .35; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  animation: splash-grain .35s steps(2) infinite;
}
@keyframes splash-grain { to { transform: translate3d(-2%,1%,0); } }
.splash-scan {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(74,179,255,.06) 48%, transparent 52%);
  animation: splash-scan 4.5s linear infinite;
}
@keyframes splash-scan { from { transform: translateY(-100%); } to { transform: translateY(100%); } }
.splash-content {
  position: relative; z-index: 2; text-align: center; padding: 16px 20px; max-width: min(720px, 92vw);
  max-height: 100%; overflow: hidden; flex: none;
}
@media (max-height: 640px) {
  .splash-content { padding: 10px 14px; transform: scale(0.9); transform-origin: center center; }
  .splash-mark svg { width: 52px; height: 52px; }
  .splash-title { margin-bottom: 8px; font-size: clamp(1.5rem, 8vw, 2.4rem); }
  .splash-tag { font-size: 0.88rem; margin-bottom: 6px; }
  .splash-credit, .splash-version { margin-bottom: 8px; }
  .splash-progress { margin-bottom: 8px; }
}
@media (max-height: 420px) {
  .splash-content { transform: scale(0.72); }
  .splash-scan { opacity: 0.15; }
  .splash-eyebrow, .splash-tag { display: none; }
}
.splash-mark { color: var(--accent); margin-bottom: 10px; filter: drop-shadow(0 0 18px #4ab3ff88); animation: splash-mark 2.4s ease-in-out infinite; }
@keyframes splash-mark { 50% { transform: scale(1.04); filter: drop-shadow(0 0 28px #a78bfa99); color: #b9c7ff; } }
.splash-eyebrow {
  margin: 0 0 8px; letter-spacing: .28em; text-transform: uppercase; font-size: 11px; color: #8a92a3;
  animation: splash-fade .9s .25s both;
}
.splash-title {
  margin: 0 0 12px; font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 700; letter-spacing: .04em; line-height: 1.05;
  text-shadow: 0 0 40px #4ab3ff44;
}
.splash-title .w { display: inline-block; opacity: 0; transform: translateY(24px) scale(.92);
  animation: splash-word .85s cubic-bezier(.2,.9,.2,1) forwards; }
.splash-title .w:nth-child(1) { animation-delay: .35s; color: #fff; }
.splash-title .w:nth-child(2) { animation-delay: .52s; color: #b9c7ff; margin: 0 .12em; }
.splash-title .w:nth-child(3) { animation-delay: .68s; color: var(--accent); }
@keyframes splash-word { to { opacity: 1; transform: none; } }
@keyframes splash-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.splash-tag {
  margin: 0 0 10px; font-size: clamp(.95rem, 2.2vw, 1.15rem); color: #c5cad6;
  animation: splash-fade .9s .85s both;
}
.splash-credit {
  margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .32em; text-transform: uppercase;
  color: #e8c56a; text-shadow: 0 0 24px #d4a85366, 0 0 48px #4ab3ff22;
  animation: splash-fade .9s 1.05s both;
}
.splash-version {
  margin: 0 0 20px; font-size: 11px; font-weight: 600; letter-spacing: .35em; font-variant-numeric: tabular-nums;
  color: #6a7285; text-shadow: 0 0 20px #4ab3ff33;
  animation: splash-fade .8s 1.18s both;
}
.splash-progress {
  height: 3px; width: min(320px, 70vw); margin: 0 auto 14px; background: #ffffff18; border-radius: 99px; overflow: hidden;
  box-shadow: 0 0 24px #4ab3ff33;
}
#splash-bar {
  height: 100%; width: 0%; border-radius: inherit;
  background: linear-gradient(90deg, #2b7fc4, #4ab3ff 40%, #a78bfa);
  box-shadow: 0 0 16px #4ab3ffaa;
  transition: width .12s linear;
}
.splash-hint { margin: 0; font-size: 11.5px; color: #6a7285; animation: splash-fade .8s 1.4s both; }

/* start screen: live 3D backdrop (gate-scene.js) with the title and three actions over it */
.modal.welcome-gate { z-index: 280; padding: 0; align-items: stretch; justify-content: flex-start; overscroll-behavior: contain;
  background: radial-gradient(ellipse at 68% 42%, #1d1340 0%, #08061a 55%, #030308 100%); }
#gate-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.gate-vignette { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, #030308f0 0%, #030308b0 28%, #03030800 58%), radial-gradient(ellipse at 60% 50%, transparent 55%, #000b 100%); }
.gate-ui { position: relative; z-index: 2; display: flex; flex-direction: column; justify-content: center; gap: clamp(18px, 3.4vh, 34px);
  width: min(620px, 100%); min-height: 100%; padding: 6vh 0 6vh clamp(20px, 6vw, 96px); box-sizing: border-box; }
.gate-eyebrow { margin: 0; font-size: 11px; letter-spacing: .55em; text-transform: uppercase; color: #e8c56a; text-shadow: 0 0 18px #e8c56a66; animation: gate-rise .9s .2s both; }
.gate-title { margin: 12px 0 16px; font-weight: 800; line-height: .92; letter-spacing: -.025em; font-size: clamp(2.8rem, 6.6vw, 6rem);
  background: linear-gradient(100deg, #ffffff 0%, #e4e9ff 30%, #b8a8ff 48%, #6fc3ff 62%, #ffffff 80%); background-size: 240% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 34px #8a5cf666);
  animation: gate-rise 1.1s .35s both, gate-shine 7s 1.6s ease-in-out infinite; }
.gate-title-small { display: block; font-size: .36em; letter-spacing: .62em; margin-bottom: .18em; font-weight: 700; }
.gate-tag { margin: 0; max-width: 30em; font-size: clamp(1rem, 1.35vw, 1.22rem); line-height: 1.5; color: #c9cfe0; animation: gate-rise 1s .6s both; }
.gate-cards { display: grid; gap: 12px; max-width: 470px; }
.gate-card { display: grid; grid-template-columns: 46px 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center; text-align: left;
  padding: 14px 18px; border-radius: 14px; border: 1px solid #ffffff1c; color: var(--text); cursor: pointer;
  background: linear-gradient(135deg, #ffffff12, #ffffff05); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: transform .2s ease, border-color .2s, box-shadow .2s, background .2s; animation: gate-rise .9s both; }
.gate-card:nth-child(1) { animation-delay: .8s; } .gate-card:nth-child(2) { animation-delay: .92s; } .gate-card:nth-child(3) { animation-delay: 1.04s; }
.gate-card .gate-ico { grid-row: span 2; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; font-size: 21px; color: #b9c7ff; background: #ffffff10; }
.gate-card b { font-size: 1.08rem; color: #fff; font-weight: 650; }
.gate-card small { font-size: 12.5px; color: #9aa3b5; }
.gate-card:hover, .gate-card:focus-visible { transform: translateX(6px); border-color: #a78bfaaa; outline: none;
  background: linear-gradient(135deg, #a78bfa26, #4ab3ff12); box-shadow: 0 0 0 1px #a78bfa44, 0 14px 44px #8a5cf640; }
.gate-card-hero { border-color: #b9a6ffaa; background: linear-gradient(135deg, #6a46d6e6, #2b7fc4cc); box-shadow: 0 0 46px #8a5cf666, inset 0 1px 0 #ffffff33; }
.gate-card-hero:hover, .gate-card-hero:focus-visible { background: linear-gradient(135deg, #7a56e6, #3a90d8); box-shadow: 0 0 60px #8a5cf699, inset 0 1px 0 #ffffff44; }
.gate-card-hero .gate-ico { color: #fff; background: #ffffff26; }
.gate-card-hero small { color: #ece6ff; }
.gate-foot { margin: 0; font-size: 12px; color: #7d8598; animation: gate-rise 1s 1.2s both; }
.gate-foot a { color: #9fd0ff; }
.gate-foot code { background: #ffffff10; }
.gate-caption { position: absolute; z-index: 2; right: clamp(16px, 3vw, 40px); bottom: clamp(16px, 4vh, 40px); min-width: 250px; max-width: 340px;
  display: flex; flex-direction: column; gap: 3px; padding: 12px 16px; border-radius: 12px; pointer-events: none;
  background: linear-gradient(135deg, #ffffff10, #ffffff04); border: 1px solid #ffffff1a; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); opacity: 0; }
.gate-caption.in { animation: gate-rise .7s both; }
.gate-cap-kind { font-size: 10px; letter-spacing: .32em; text-transform: uppercase; color: #9fd0ff; }
.gate-cap-title { font-size: 1.05rem; color: #fff; }
.gate-cap-count { font-size: 12px; color: #aab2c5; font-variant-numeric: tabular-nums; }
.gate-cap-bar { height: 3px; border-radius: 2px; background: #ffffff14; overflow: hidden; margin-top: 4px; }
.gate-cap-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #4ab3ff, #a78bfa, #ff4fa3); box-shadow: 0 0 10px #a78bfa; }
@media (max-width: 900px) { .gate-caption { top: 16px; bottom: auto; right: 16px; left: 16px; max-width: none; } }
@keyframes gate-rise { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes gate-shine { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
@media (max-width: 900px) {
  .gate-ui { justify-content: flex-end; width: 100%; padding: 24px 18px 28px; }
  .gate-vignette { background: linear-gradient(0deg, #030308f5 0%, #030308c0 45%, #03030800 78%); }
  .gate-cards { max-width: none; }
}
@media (max-height: 640px) {
  .gate-ui { gap: 12px; padding-top: 16px; padding-bottom: 16px; }
  .gate-tag { display: none; }
  .gate-card { padding: 10px 14px; }
  .gate-card small { display: none; }
}
@media (prefers-reduced-motion: reduce) { .gate-title { animation: none; } }

/* Guided tour (spotlight + JARVIS card) */
#guided-tour { position: fixed; inset: 0; z-index: 200; pointer-events: auto; isolation: isolate; }
#guided-tour[hidden] { display: none !important; pointer-events: none; }
#guided-tour .tour-shade { position: fixed; z-index: 200; background: #04060ecc; pointer-events: auto; transition: .15s ease; }
#guided-tour .tour-hole {
  position: fixed; border-radius: 10px; pointer-events: none; z-index: 201;
  box-shadow: 0 0 0 2px #a78bfa, 0 0 28px #4ab3ff99, 0 0 80px #8a5cf644;
  animation: tour-pulse 1.6s ease-in-out infinite;
}
@keyframes tour-pulse { 50% { box-shadow: 0 0 0 2px #e8c56a, 0 0 36px #a78bfaaa, 0 0 90px #4ab3ff55; } }
/* the spotlight hole is simply not shaded, so the target shows and stays clickable without being lifted; lifting it
   above the tour layer used to cover the tour card and its buttons */
.tour-highlight { }
body:has(#guided-tour:not([hidden])) #whats-new, body:has(#guided-tour:not([hidden])) #update-bar { display: none; }
#guided-tour .tour-card {
  position: fixed; z-index: 210; left: 50%; right: auto; top: auto; bottom: max(12px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); width: min(420px, calc(100vw - 24px)); max-height: min(44vh, 340px);
  overflow-y: auto; pointer-events: auto; touch-action: manipulation;
  padding: 14px 16px 12px; border-radius: 12px;
  background: linear-gradient(155deg, #1a1228f5 0%, #12151ef2 45%, #0d0f13fa 100%);
  border: 1px solid #8a5cf688; box-shadow: 0 0 40px #8a5cf655, 0 20px 60px #000c;
  outline: none;
}
.tour-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 11px; color: #9aa3b5; }
.tour-jarvis-mark { color: #e8c56a; font-size: 14px; text-shadow: 0 0 12px #e8c56a88; }
.tour-voice-label { letter-spacing: .22em; text-transform: uppercase; font-weight: 600; color: #c4b5fd; }
.tour-step-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.tour-mute, .tour-skip { background: transparent; border: 1px solid #ffffff22; padding: 2px 8px; font-size: 11px; cursor: pointer; border-radius: 4px; }
.tour-skip { color: #9aa3b5; }
.tour-title { margin: 0 0 6px; font-size: 1.15rem; color: #fff; }
.tour-body { margin: 0 0 10px; color: #c5cad6; line-height: 1.45; font-size: 13px; }
.tour-wave { display: flex; gap: 3px; height: 14px; align-items: flex-end; margin-bottom: 10px; opacity: .35; }
#guided-tour.speaking .tour-wave { opacity: 1; }
.tour-wave span { width: 3px; background: linear-gradient(#4ab3ff, #a78bfa); border-radius: 2px; animation: tour-wave 0.9s ease-in-out infinite; }
.tour-wave span:nth-child(2) { animation-delay: .12s; }
.tour-wave span:nth-child(3) { animation-delay: .24s; }
.tour-wave span:nth-child(4) { animation-delay: .36s; }
.tour-wave span:nth-child(5) { animation-delay: .48s; }
@keyframes tour-wave { 0%, 100% { height: 4px; } 50% { height: 14px; } }
.tour-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.tour-actions .tour-back { opacity: .85; }
.tour-actions .tour-next { min-width: 88px; }
.tour-kbd-hint { flex: 1; font-size: 10px; color: #6a7285; letter-spacing: .04em; }
.help-tour-row { margin: 0 0 12px; }

#ai-panel.tour-ai-glow { box-shadow: inset 0 0 0 1px #a78bfa88, 0 0 48px #8a5cf666; }

/* unsaved world kept by an earlier session */
#recovery-bar { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 320; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  max-width: calc(100% - 24px); padding: 10px 14px; border-radius: 10px; background: #2a2140f2; border: 1px solid #e8c56a; box-shadow: 0 8px 30px #000a; }
#recovery-bar b { color: #f0d49a; }

/* feedback */
.toast .toast-report { pointer-events: auto; margin-left: 6px; padding: 1px 8px; font-size: 11.5px; }
.feedback-kinds { display: flex; gap: 6px; margin-bottom: 10px; }
#modal-feedback textarea { width: 100%; margin: 4px 0 8px; font-family: inherit; font-size: 13px; }
#modal-feedback .row > input { flex: 1; }
.feedback-check { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.feedback-details { max-height: 120px; overflow: auto; background: #0d0f13; border: 1px solid var(--line); border-radius: 4px; padding: 6px; font-size: 11px; white-space: pre-wrap; color: var(--muted); }
#modal-feedback a { color: var(--accent); }
.feedback-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.feedback-status { min-height: 1.2em; color: #f0d49a; }
.feedback-status a { color: var(--accent); }

/* credits */
.ai-paywall .btns { display: flex; gap: 6px; }
.ai-paywall .btns input { flex: 1; }
.ai-buy-btn { display: inline-block; align-self: flex-start; padding: 6px 14px; border-radius: 6px; background: linear-gradient(135deg, #6a46d6, #2b7fc4); color: #fff !important; text-decoration: none; font-weight: 600; }
#ai-account { color: #c4b5fd; }

/* shared builds: credit on the start screen */
.gate-cap-by { font-size: 12px; color: #f0d49a; }
.gate-cap-by:empty { display: none; }
.gate-cap-by a { color: #f0d49a; pointer-events: auto; }
#modal-share .row > input, #modal-share .row > select { flex: 1; }

/* reviewing shared builds */
#review-bar { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 330; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  width: min(980px, calc(100% - 24px)); padding: 10px 14px; border-radius: 10px; background: #1b2235f5; border: 1px solid #4ab3ff; box-shadow: 0 8px 30px #000a; }
#review-bar .grow { flex: 1; }
#review-bar a { color: #f0d49a; }
#review-bar input { flex: 1; min-width: 180px; }
.review-tag { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: #9fd0ff; }
#review-bar .review-ok { background: #1f7a4a; border-color: #8fe0ad; }
#review-bar .review-no { border-color: var(--danger); color: #ffd0d0; }

/* closed beta */
.beta-badge { display: inline-block; margin-left: 10px; padding: 2px 9px; border-radius: 999px; font-size: 10px; letter-spacing: .18em; vertical-align: 1px;
  color: #1a1030; background: linear-gradient(90deg, #f0d49a, #e8c56a); text-shadow: none; box-shadow: 0 0 14px #e8c56a66; }
.chip.beta-chip { border-color: #e8c56a; color: #f0d49a; cursor: help; }
/* dialogs the start screen can open sit above it */
#modal-feedback, #modal-share { z-index: 300; }

/* Discord sign-in */
.account-btn { display: inline-flex; align-items: center; gap: 6px; border-color: #5865f2; }
.account-btn:not(.signed-in) { background: #5865f2; color: #fff; }
.account-btn img { width: 18px; height: 18px; border-radius: 50%; }
.account-menu { position: fixed; z-index: 400; display: flex; flex-direction: column; gap: 6px; min-width: 200px; padding: 10px 12px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 10px 30px #000a; }
.account-menu[hidden] { display: none; }
.ai-paywall .ai-discord { align-self: flex-start; background: #5865f2; border-color: #5865f2; color: #fff; }

/* King Colossus: the creator's name, with a tilted crown on the K */
.kc-name { position: relative; display: inline-block; font-size: clamp(15px, 1.6vw, 21px); font-weight: 800; letter-spacing: .2em; text-transform: uppercase;
  background: linear-gradient(100deg, #fff6cf 0%, #f3cd6b 30%, #fff3b8 50%, #d79a2b 70%, #fff6cf 100%); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 10px #e8c56a88) drop-shadow(0 0 26px #e8c56a44); animation: kc-shine 5s ease-in-out infinite; }
.kc-k { position: relative; display: inline-block; }
.kc-crown { position: absolute; left: -.3em; top: -.78em; width: 1.15em; height: auto; transform: rotate(-20deg); transform-origin: 70% 100%;
  filter: drop-shadow(0 2px 3px #0008) drop-shadow(0 0 8px #f3cd6b88); animation: kc-crown 3.6s ease-in-out infinite; }
.kc-presents { font-size: 10px; font-weight: 500; letter-spacing: .5em; color: #c9a95a; vertical-align: .35em; text-shadow: none; margin-left: .6em; }
.gate-eyebrow { letter-spacing: normal; padding-top: .7em; }
.splash-credit { letter-spacing: normal; }
.splash-credit .kc-name { font-size: 16px; }
@keyframes kc-shine { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
@keyframes kc-crown { 0%, 100% { transform: rotate(-20deg) translateY(0); } 50% { transform: rotate(-16deg) translateY(-1px); } }
@media (prefers-reduced-motion: reduce) { .kc-name, .kc-crown { animation: none; } }

/* Powered by Vibranium */
.vib-badge { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; padding: 7px 14px 7px 10px; border-radius: 12px; text-decoration: none; cursor: default;
  background: linear-gradient(135deg, #1a0f2ecc, #0b0816cc); border: 1px solid #a855f777; box-shadow: 0 0 22px #7c3aed44, inset 0 1px 0 #ffffff14;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: gate-rise 1s 1.3s both; }
.vib-fist { width: 22px; height: auto; filter: drop-shadow(0 0 6px #a855f7aa); }
.vib-text { display: flex; flex-direction: column; line-height: 1.05; }
.vib-text small { font-size: 9px; letter-spacing: .32em; text-transform: uppercase; color: #b9a6d9; }
.vib-text b { font-size: 15px; letter-spacing: .26em; text-transform: uppercase;
  background: linear-gradient(100deg, #e9d5ff 0%, #a855f7 35%, #f5f3ff 50%, #7c3aed 65%, #e9d5ff 100%); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: kc-shine 4s ease-in-out infinite; }

/* sign-in on the start screen, and the account page */
.discord-mark { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }
.account-btn { gap: 6px; }
.account-btn.signed-in { background: var(--panel2); color: var(--text); }
.gate-account { position: absolute; z-index: 3; top: clamp(14px, 3vh, 28px); right: clamp(14px, 3vw, 36px); display: inline-flex; align-items: center; gap: 9px;
  padding: 9px 16px; border-radius: 999px; border: 1px solid #7983f5; background: #5865f2; color: #fff; font-weight: 600; font-size: 14px; cursor: pointer;
  box-shadow: 0 0 26px #5865f266; animation: gate-rise .9s .5s both; }
.gate-account:hover { filter: brightness(1.08); }
.gate-account.signed-in { background: #ffffff12; border-color: #ffffff2a; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: none; font-weight: 500; }
.gate-account img { width: 26px; height: 26px; border-radius: 50%; }
.gate-account .chip-credits { font-size: 12px; color: #f0d49a; padding-left: 8px; border-left: 1px solid #ffffff2a; }
.gate-account[hidden] { display: none; }
@media (max-width: 900px) { .gate-account { top: auto; bottom: 14px; right: 14px; } }
#modal-account { z-index: 300; }
.acct-who { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.acct-who img, .acct-avatar { width: 52px; height: 52px; border-radius: 50%; }
.acct-avatar { display: grid; place-items: center; background: #5865f2; font-size: 22px; font-weight: 700; }
.acct-who b { font-size: 1.2rem; }
.acct-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0; }
.acct-stats > div { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); }
.acct-big { font-size: 1.6rem; font-weight: 800; color: #f0d49a; }
#modal-account .row > input { flex: 1; }
.acct-build { padding: 5px 0; border-bottom: 1px solid var(--line); color: var(--text); }
.acct-status { display: inline-block; font-size: 10px; padding: 1px 7px; margin-right: 8px; border-radius: 999px; border: 1px solid var(--line); }
.acct-status.approved { color: #8fe0ad; border-color: #2f7a4f; } .acct-status.pending { color: #f0d49a; border-color: #6b5326; } .acct-status.rejected { color: var(--muted); }
.acct-foot { margin-top: 14px; }

/* AI builder asking before something that costs (a picture) */
.ai-msg.ai-confirm { border: 1px solid #8a5cf6; background: #221a36; }
.ai-msg.ai-confirm .row { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
#relink-bar { bottom: 96px; background: #1c2a24; border: 1px solid #36d399; z-index: 280; }
/* AI builder: model, effort and the running cost, always in view */
.ai-quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 10px; border-bottom: 1px solid #2a2f3a; }
.ai-quick select { max-width: 48%; }
.ai-meter { margin-left: auto; font-size: 12px; color: #c4b5fd; white-space: nowrap; }
