:root {
  --bg: #070a13;
  --bg-soft: #0b0f1d;
  --panel: rgba(14, 18, 33, .88);
  --panel-2: rgba(18, 23, 42, .88);
  --panel-3: rgba(9, 13, 24, .96);
  --line: rgba(255,255,255,.08);
  --line-strong: rgba(255,255,255,.13);
  --text: #eef2ff;
  --muted: #98a4c1;
  --muted-2: #74809d;
  --purple: #7a5cff;
  --purple-2: #aa64ff;
  --pink: #ff4f8b;
  --cyan: #4bdcff;
  --green: #48e89f;
  --yellow: #ffc95b;
  --red: #ff667d;
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --shadow: 0 24px 80px rgba(0,0,0,.34);
  --ease: cubic-bezier(.2,.8,.2,1);
  --editor-font: 15px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(122,92,255,.16), transparent 28%),
    radial-gradient(circle at 88% 14%, rgba(255,79,139,.11), transparent 30%),
    linear-gradient(180deg, #050711, #090d18 52%, #0b1020);
  overflow: hidden;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }

.ambient-grid,
.ambient-noise,
.ambient-glow { position: fixed; inset: 0; pointer-events: none; }
.ambient-grid {
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at center, #000 30%, transparent 92%);
}
.ambient-noise {
  background-image: radial-gradient(rgba(255,255,255,.055) .55px, transparent .6px);
  background-size: 9px 9px;
  opacity: .045;
}
.ambient-glow { filter: blur(80px); opacity: .42; }
.glow-one { width: 340px; height: 340px; background: rgba(122,92,255,.19); top: 12%; left: 8%; border-radius: 50%; }
.glow-two { width: 300px; height: 300px; background: rgba(255,79,139,.13); top: 18%; right: 6%; border-radius: 50%; }

.app {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: grid;
  grid-template-rows: 68px 46px minmax(0, 1fr);
  padding: 12px;
  gap: 10px;
}
.topbar,
.workspace-toolbar,
.panel {
  background: linear-gradient(180deg, rgba(17,22,40,.92), rgba(10,14,26,.94));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035), var(--shadow);
  backdrop-filter: blur(18px);
}
.topbar {
  border-radius: 20px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(240px, .8fr) auto;
  gap: 18px;
  align-items: center;
  padding: 10px 14px;
}
.brand-cluster { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(122,92,255,.3), rgba(255,79,139,.26));
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(122,92,255,.16);
}
.brand-title { font-size: .9rem; letter-spacing: .12em; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-title span { color: var(--cyan); }
.brand-subtitle { color: var(--muted); font-size: .75rem; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-title-wrap {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 13px;
  padding: 8px 10px;
}
.project-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(72,232,159,.6); }
.project-title-wrap input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--text); background: transparent; font-weight: 700; }
.save-state { font-size: .74rem; color: var(--muted); white-space: nowrap; }
.top-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.workspace-toolbar {
  border-radius: 16px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.toolbar-group { display: flex; align-items: center; gap: 5px; }
.toolbar-divider { width: 1px; align-self: stretch; background: var(--line); }
.toolbar-spacer { flex: 1; }
.tool-btn,
.round-btn,
.status-chip,
.mini-action,
.icon-btn,
.dock-tab,
.dock-collapse {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: transparent;
}
.tool-btn {
  padding: 8px 11px;
  border-radius: 10px;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 700;
  transition: .2s ease;
}
.tool-btn:hover,
.tool-btn.active { color: var(--text); background: rgba(255,255,255,.055); }
.editor-size-controls { color: var(--muted); font-size: .78rem; }
.round-btn {
  width: 28px; height: 28px; border-radius: 9px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(560px, 1fr) 300px;
  gap: 10px;
  transition: grid-template-columns .35s var(--ease);
}
.workspace.left-hidden { grid-template-columns: 0 minmax(560px, 1fr) 300px; }
.workspace.right-hidden { grid-template-columns: 320px minmax(560px, 1fr) 0; }
.workspace.left-hidden.right-hidden { grid-template-columns: 0 minmax(560px, 1fr) 0; }
.sidebar { min-width: 0; overflow: hidden; transition: opacity .2s ease, transform .35s var(--ease); }
.workspace.left-hidden .builder-sidebar { opacity: 0; transform: translateX(-20px); pointer-events: none; }
.workspace.right-hidden .inspector-sidebar { opacity: 0; transform: translateX(20px); pointer-events: none; }
.sidebar-scroll { height: 100%; overflow: auto; display: grid; gap: 10px; align-content: start; padding-right: 2px; }
.sidebar-scroll::-webkit-scrollbar { width: 8px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 999px; }
.panel { border-radius: var(--radius-lg); }
.coach-panel,
.quick-start-panel,
.blocks-panel,
.project-panel,
.outline-panel,
.button-map-panel,
.export-panel { padding: 16px; }
.panel-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.compact-row { align-items: center; }
.panel h2 { margin: 4px 0 0; font-size: 1rem; }
.eyebrow { color: var(--cyan); font-size: .67rem; font-weight: 800; letter-spacing: .16em; }
.coach-level {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px;
  background: linear-gradient(135deg, rgba(122,92,255,.28), rgba(255,79,139,.25));
  font-weight: 900;
}
.coach-progress { height: 7px; margin: 16px 0; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; }
.coach-progress span { display: block; width: 16%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--purple), var(--pink)); transition: width .4s var(--ease); }
.coach-message { color: var(--muted); line-height: 1.55; font-size: .88rem; margin-bottom: 14px; }

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 750;
  transition: transform .18s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.99); }
.btn.subtle { background: rgba(255,255,255,.045); border-color: rgba(255,255,255,.075); color: #dce4f9; }
.btn.subtle:hover { background: rgba(255,255,255,.075); }
.btn.accent { background: linear-gradient(90deg, var(--purple), var(--pink)); box-shadow: 0 14px 32px rgba(122,92,255,.2); }
.btn.compact { padding: 9px 11px; font-size: .78rem; }
.btn.full { width: 100%; }

.recipe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 14px; }
.recipe-card,
.block-card,
.welcome-option,
.guided-choice {
  appearance: none;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.075);
  background: rgba(255,255,255,.035);
  transition: transform .18s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.recipe-card {
  min-width: 0;
  padding: 12px;
  border-radius: 14px;
  display: grid;
  gap: 6px;
}
.recipe-card:hover,
.block-card:hover,
.guided-choice:hover,
.welcome-option:hover { transform: translateY(-1px); background: rgba(255,255,255,.065); border-color: rgba(122,92,255,.34); }
.recipe-card.featured,
.block-card.featured,
.welcome-option.featured { background: linear-gradient(135deg, rgba(122,92,255,.17), rgba(255,79,139,.11)); border-color: rgba(122,92,255,.26); }
.recipe-icon { color: var(--cyan); font-weight: 900; }
.recipe-card strong { font-size: .83rem; }
.recipe-card small { color: var(--muted); font-size: .73rem; line-height: 1.35; }

.search-field-wrap {
  margin: 14px 0 10px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  padding: 9px 11px;
  color: var(--muted);
}
.search-field-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: .83rem; }
.block-categories { display: grid; gap: 8px; }
.block-categories details { border: 1px solid rgba(255,255,255,.06); border-radius: 14px; overflow: hidden; background: rgba(255,255,255,.018); }
.block-categories summary { cursor: pointer; list-style: none; padding: 11px 12px; display: flex; align-items: center; justify-content: space-between; font-size: .8rem; font-weight: 800; }
.block-categories summary::-webkit-details-marker { display: none; }
.block-categories summary span { color: var(--muted-2); }
.block-list { padding: 0 8px 8px; display: grid; gap: 7px; }
.block-card { width: 100%; border-radius: 12px; padding: 10px; display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: center; }
.block-card > span { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(122,92,255,.11); color: var(--cyan); font-size: .72rem; font-weight: 900; }
.block-card div { display: grid; gap: 2px; min-width: 0; }
.block-card strong { font-size: .8rem; }
.block-card small { color: var(--muted); font-size: .71rem; line-height: 1.3; }
.block-card[hidden] { display: none; }

.editor-area { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) 220px; gap: 10px; transition: grid-template-rows .35s var(--ease); }
.editor-area.dock-collapsed { grid-template-rows: minmax(0, 1fr) 44px; }
.editor-panel { min-width: 0; min-height: 0; overflow: hidden; display: grid; grid-template-rows: 46px auto minmax(0,1fr) 30px; }
.editor-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.file-tabs { display: flex; min-width: 0; }
.file-tab { appearance: none; border: 1px solid rgba(255,255,255,.07); background: rgba(255,255,255,.045); color: var(--text); border-radius: 10px; padding: 8px 11px; display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; max-width: 250px; }
.file-tab span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--purple); box-shadow: 0 0 10px rgba(122,92,255,.5); }
.editor-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.mini-action { color: var(--muted); padding: 7px 9px; border-radius: 9px; font-size: .76rem; }
.mini-action:hover { color: var(--text); background: rgba(255,255,255,.06); }
.accent-outline { color: #e8dcff; border: 1px solid rgba(122,92,255,.26); background: rgba(122,92,255,.08); }
.find-bar { padding: 7px 10px; display: flex; align-items: center; gap: 7px; border-bottom: 1px solid var(--line); background: rgba(5,8,15,.72); }
.find-bar[hidden] { display: none; }
.find-bar input { flex: 1; min-width: 0; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 9px; padding: 8px 10px; color: var(--text); outline: 0; }
.find-bar span { color: var(--muted); font-size: .75rem; min-width: 70px; text-align: center; }
.editor-shell { min-height: 0; position: relative; display: grid; grid-template-columns: 54px minmax(0,1fr); overflow: hidden; background: #080b14; }
.line-numbers {
  margin: 0;
  padding: 18px 12px;
  text-align: right;
  overflow: hidden;
  color: #59637c;
  background: #070a12;
  border-right: 1px solid rgba(255,255,255,.055);
  font: 500 var(--editor-font)/1.65 'JetBrains Mono', monospace;
  user-select: none;
}
#codeEditor {
  resize: none;
  border: 0;
  outline: 0;
  width: 100%; height: 100%; min-height: 0;
  padding: 18px 20px 80px;
  color: #dbe4ff;
  background:
    radial-gradient(circle at 80% 10%, rgba(122,92,255,.05), transparent 22%),
    #080b14;
  caret-color: var(--cyan);
  font: 500 var(--editor-font)/1.65 'JetBrains Mono', monospace;
  tab-size: 4;
  white-space: pre;
  overflow: auto;
}
#codeEditor::selection { background: rgba(122,92,255,.35); }
.editor-statusbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 0 10px; color: var(--muted-2); font-size: .7rem; overflow: hidden; }
.status-left,
.status-right { display: flex; align-items: center; gap: 12px; min-width: 0; white-space: nowrap; }
.status-chip { color: var(--cyan); background: rgba(75,220,255,.07); border-radius: 8px; padding: 4px 7px; font-size: .68rem; }

.bottom-dock { min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: linear-gradient(180deg, rgba(16,20,37,.94), rgba(10,13,24,.96)); display: grid; grid-template-columns: auto auto auto 1fr auto; grid-template-rows: 43px minmax(0,1fr); box-shadow: var(--shadow); }
.dock-tab { color: var(--muted); padding: 0 15px; border-right: 1px solid rgba(255,255,255,.045); font-size: .78rem; font-weight: 750; }
.dock-tab.active { color: var(--text); background: rgba(255,255,255,.04); box-shadow: inset 0 -2px 0 var(--purple); }
.dock-tab span { margin-left: 5px; color: var(--muted-2); }
.dock-collapse { grid-column: 5; color: var(--muted); font-size: 1rem; padding: 0 16px; }
.dock-content { grid-column: 1 / -1; min-height: 0; border-top: 1px solid var(--line); overflow: hidden; }
.editor-area.dock-collapsed .dock-content { display: none; }
.editor-area.dock-collapsed .dock-collapse { transform: rotate(180deg); }
.dock-pane { height: 100%; overflow: auto; padding: 14px; display: none; }
.dock-pane.active { display: block; animation: fadeUp .25s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.validation-overview { display: grid; grid-template-columns: 62px 1fr; gap: 14px; align-items: center; margin-bottom: 12px; }
.health-ring { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(rgba(255,255,255,.09) 100%, rgba(255,255,255,.06) 0); position: relative; transition: background .7s cubic-bezier(.4,.9,.3,1); }
.health-ring::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: #101525; }
.health-ring span { position: relative; font-weight: 900; font-size: .84rem; }
.validation-overview strong { font-size: .92rem; }
.validation-overview p { margin: 4px 0 0; color: var(--muted); font-size: .8rem; }
.problem-list { display: grid; gap: 7px; }
.problem-item { display: grid; grid-template-columns: 24px 1fr auto; gap: 9px; align-items: start; border: 1px solid rgba(255,255,255,.06); background: rgba(255,255,255,.025); border-radius: 11px; padding: 9px 10px; }
.problem-item.error { border-color: rgba(255,102,125,.22); }
.problem-item.warning { border-color: rgba(255,201,91,.2); }
.problem-item.success { border-color: rgba(72,232,159,.18); }
.problem-icon { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: .7rem; }
.error .problem-icon { color: var(--red); background: rgba(255,102,125,.1); }
.warning .problem-icon { color: var(--yellow); background: rgba(255,201,91,.1); }
.success .problem-icon { color: var(--green); background: rgba(72,232,159,.1); }
.problem-item strong { font-size: .78rem; }
.problem-item p { margin: 3px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.35; }
.problem-item button { appearance: none; border: 0; background: transparent; color: var(--cyan); cursor: pointer; font-size: .7rem; }
.explain-card { max-width: 850px; }
.explain-card h3 { margin: 7px 0 8px; font-size: 1rem; }
.explain-card p { margin: 0; color: var(--muted); line-height: 1.6; font-size: .84rem; }
.explain-code { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #080b14; border: 1px solid var(--line); font: 500 .76rem/1.5 'JetBrains Mono', monospace; color: #cfe1ff; }
.snapshot-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.snapshot-toolbar p { margin: 0; color: var(--muted); font-size: .8rem; }
.snapshot-list { display: grid; gap: 8px; }
.snapshot-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px; border-radius: 11px; background: rgba(255,255,255,.03); border: 1px solid var(--line); }
.snapshot-item strong { display: block; font-size: .78rem; }
.snapshot-item small { color: var(--muted); }
.snapshot-actions { display: flex; gap: 6px; }
.snapshot-actions button { appearance: none; border: 0; background: rgba(255,255,255,.05); color: var(--text); border-radius: 8px; padding: 6px 8px; cursor: pointer; font-size: .7rem; }

.field-label { display: grid; gap: 7px; color: #dfe6fb; font-size: .78rem; margin-top: 12px; }
.field {
  width: 100%;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  color: var(--text);
  border-radius: 11px;
  padding: 10px 11px;
  outline: 0;
}
.field:focus { border-color: rgba(122,92,255,.45); box-shadow: 0 0 0 3px rgba(122,92,255,.11); }
select.field option { background: #111626; }
.icon-btn { width: 32px; height: 32px; border-radius: 10px; color: var(--muted); }
.icon-btn:hover { background: rgba(255,255,255,.06); color: var(--text); }
.outline-list { display: grid; gap: 6px; margin-top: 12px; }
.outline-item { width: 100%; appearance: none; border: 1px solid transparent; background: transparent; color: var(--text); border-radius: 10px; padding: 8px 9px; display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; text-align: left; cursor: pointer; }
.outline-item:hover { background: rgba(255,255,255,.045); border-color: var(--line); }
.outline-item span:first-child { color: var(--cyan); font-size: .7rem; }
.outline-item strong { font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outline-item small { color: var(--muted-2); font-size: .66rem; }
.empty-state { color: var(--muted); font-size: .78rem; line-height: 1.5; padding: 10px 0; }
.button-map { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px; }
.button-map div { border-radius: 10px; background: rgba(255,255,255,.032); border: 1px solid rgba(255,255,255,.06); padding: 8px; min-width: 0; }
.button-map strong { display: block; font-size: .72rem; }
.button-map span { color: var(--muted); font: 500 .66rem 'JetBrains Mono', monospace; overflow-wrap: anywhere; }
.export-panel { text-align: center; }
.export-badge { width: 54px; height: 54px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(135deg, rgba(122,92,255,.25), rgba(255,79,139,.22)); font-weight: 900; color: var(--cyan); }
.export-panel h2 { margin: 0; }
.export-panel p { color: var(--muted); line-height: 1.5; font-size: .8rem; }
.export-panel .btn + .btn { margin-top: 8px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(2,4,9,.76); backdrop-filter: blur(14px); animation: modalFade .22s ease; }
.modal-backdrop[hidden] { display: none; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-card,
.command-palette {
  width: min(980px, 96vw);
  max-height: min(88vh, 900px);
  overflow: hidden;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(18,23,42,.98), rgba(9,13,24,.99));
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 40px 120px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.045);
  animation: modalPop .3s var(--ease);
}
@keyframes modalPop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header,
.modal-footer { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-header { border-bottom: 1px solid var(--line); }
.modal-footer { border-top: 1px solid var(--line); justify-content: flex-end; }
.modal-header h2 { margin: 5px 0 0; font-size: 1.15rem; }
.welcome-card { display: grid; grid-template-columns: 40% 60%; min-height: 520px; }
.welcome-visual { position: relative; overflow: hidden; background: radial-gradient(circle at center, rgba(122,92,255,.24), transparent 45%), linear-gradient(160deg, #0b0f20, #080b15); display: grid; place-items: center; }
.visual-ring { position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); }
.ring-a { width: 290px; height: 290px; animation: spin 18s linear infinite; box-shadow: 0 0 50px rgba(122,92,255,.13); }
.ring-b { width: 190px; height: 190px; border-style: dashed; animation: spinReverse 11s linear infinite; }
.visual-core { position: relative; width: 100px; height: 100px; display: grid; place-items: center; border-radius: 28px; background: linear-gradient(135deg, rgba(122,92,255,.5), rgba(255,79,139,.4)); font-size: 2.8rem; font-weight: 900; box-shadow: 0 0 50px rgba(122,92,255,.3); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spinReverse { to { transform: rotate(-360deg); } }
.welcome-content { padding: 34px; display: flex; flex-direction: column; justify-content: center; }
.welcome-content h1 { margin: 10px 0 12px; font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.08; }
.welcome-content > p { color: var(--muted); line-height: 1.65; margin: 0 0 22px; }
.welcome-options { display: grid; gap: 10px; }
.welcome-option { padding: 14px; border-radius: 15px; display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 12px; }
.welcome-option > span { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(122,92,255,.12); color: var(--cyan); font-weight: 900; }
.welcome-option div { display: grid; gap: 4px; }
.welcome-option small { color: var(--muted); }
.guided-card { width: min(900px, 96vw); }
.guided-progress { height: 6px; background: rgba(255,255,255,.055); }
.guided-progress span { display: block; width: 25%; height: 100%; background: linear-gradient(90deg, var(--purple), var(--pink)); transition: width .35s var(--ease); }
.guided-body { padding: 24px; min-height: 390px; overflow: auto; }
.guided-step { display: none; }
.guided-step.active { display: block; animation: fadeUp .28s var(--ease); }
.step-badge { color: var(--cyan); font-size: .7rem; letter-spacing: .14em; font-weight: 800; }
.guided-step h3 { font-size: 1.55rem; margin: 10px 0 8px; }
.guided-step > p { color: var(--muted); line-height: 1.55; }
.guided-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.guided-choice-grid.two { grid-template-columns: 1fr 1fr; }
.guided-choice { padding: 15px; border-radius: 14px; display: grid; gap: 5px; }
.guided-choice span { color: var(--muted); font-size: .8rem; }
.guided-choice.active { border-color: rgba(122,92,255,.46); background: linear-gradient(135deg, rgba(122,92,255,.18), rgba(255,79,139,.09)); box-shadow: 0 12px 28px rgba(122,92,255,.11); }
.form-grid { display: grid; gap: 12px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.guided-preview,
#blockPreview,
#comboPreview { margin: 0; padding: 14px; border-radius: 14px; background: #070a12; border: 1px solid var(--line); color: #cfe0ff; font: 500 .78rem/1.55 'JetBrains Mono', monospace; white-space: pre-wrap; overflow: auto; }
.block-modal-card { width: min(980px, 96vw); }
.block-modal-grid { display: grid; grid-template-columns: 1fr 1fr; min-height: 370px; max-height: 62vh; }
.modal-form { padding: 18px; overflow: auto; }
.block-preview-panel { padding: 18px; background: rgba(5,8,15,.48); border-left: 1px solid var(--line); overflow: auto; }
.block-preview-panel h3 { margin: 7px 0 12px; }
.insert-location { margin-top: 10px; padding: 10px; border-radius: 11px; background: rgba(75,220,255,.06); color: #bcefff; font-size: .76rem; line-height: 1.4; }
.combo-modal-card { width: min(1180px, 97vw); }
.combo-layout { display: grid; grid-template-columns: 56% 44%; min-height: 480px; max-height: 66vh; }
.combo-builder-side,
.combo-preview-side { padding: 18px; overflow: auto; }
.combo-preview-side { border-left: 1px solid var(--line); background: rgba(5,8,15,.45); }
.combo-tip { margin: 14px 0; padding: 11px; border-radius: 12px; color: #c7d4f0; background: rgba(75,220,255,.055); border: 1px solid rgba(75,220,255,.1); font-size: .8rem; line-height: 1.5; }
.combo-steps { display: grid; gap: 9px; }
.combo-step { display: grid; grid-template-columns: 38px minmax(130px,1fr) 100px 86px 78px; gap: 8px; align-items: end; padding: 10px; border-radius: 13px; border: 1px solid var(--line); background: rgba(255,255,255,.025); }
.step-number { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: rgba(122,92,255,.12); color: var(--cyan); font-weight: 900; align-self: center; }
.step-controls { display: flex; gap: 5px; align-self: center; }
.step-controls button { appearance: none; border: 0; width: 24px; height: 24px; border-radius: 7px; color: var(--muted); background: rgba(255,255,255,.05); cursor: pointer; }
.step-controls button:hover { color: var(--text); }
.combo-actions-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.preview-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.preview-header h3 { margin: 6px 0 12px; }
.duration-badge { padding: 7px 9px; border-radius: 10px; background: rgba(122,92,255,.1); color: #d8cfff; font-size: .75rem; }
.timeline { display: flex; gap: 4px; align-items: stretch; margin-top: 14px; min-height: 60px; overflow-x: auto; padding-bottom: 4px; }
.timeline-step { min-width: 46px; border-radius: 10px; display: grid; place-items: center; padding: 7px; background: linear-gradient(180deg, rgba(122,92,255,.18), rgba(255,79,139,.09)); border: 1px solid rgba(122,92,255,.18); text-align: center; }
.timeline-step strong { font-size: .66rem; }
.timeline-step span { color: var(--muted); font-size: .62rem; margin-top: 3px; }
.command-palette { width: min(700px, 94vw); align-self: start; margin-top: 10vh; }
.command-search-wrap { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.command-search-wrap input { border: 0; outline: 0; background: transparent; color: var(--text); font-size: 1rem; }
kbd { font: 600 .68rem Inter, sans-serif; color: var(--muted); border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; background: rgba(255,255,255,.04); }
.command-results { max-height: 430px; overflow: auto; padding: 8px; }
.command-item { width: 100%; appearance: none; border: 0; background: transparent; color: var(--text); cursor: pointer; border-radius: 11px; padding: 10px 11px; display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: center; text-align: left; }
.command-item:hover,
.command-item.active { background: rgba(255,255,255,.055); }
.command-item > span:first-child { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(122,92,255,.1); color: var(--cyan); font-weight: 900; }
.command-item strong { display: block; font-size: .8rem; }
.command-item small { color: var(--muted); }
.command-item > span:last-child { color: var(--muted-2); font-size: .68rem; }
.toast { position: fixed; z-index: 100; right: 22px; bottom: 22px; padding: 12px 15px; border-radius: 13px; background: rgba(17,22,40,.96); border: 1px solid var(--line-strong); box-shadow: var(--shadow); transform: translateY(20px); opacity: 0; pointer-events: none; transition: .25s var(--ease); }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-color: rgba(255,102,125,.35); }
.toast.success { border-color: rgba(72,232,159,.28); }

body.focus-mode .topbar,
body.focus-mode .workspace-toolbar,
body.focus-mode .builder-sidebar,
body.focus-mode .inspector-sidebar,
body.focus-mode .bottom-dock { display: none; }
body.focus-mode .app { grid-template-rows: minmax(0,1fr); padding: 0; gap: 0; }
body.focus-mode .workspace { display: block; }
body.focus-mode .editor-area { height: 100vh; display: block; }
body.focus-mode .editor-panel { height: 100vh; border-radius: 0; border: 0; }
body.focus-mode .editor-topbar { padding-left: 16px; padding-right: 16px; }
body.focus-mode .editor-shell { min-height: calc(100vh - 76px); }

body.view-learn .builder-sidebar .quick-start-panel,
body.view-learn .builder-sidebar .blocks-panel { opacity: .42; }
body.view-learn .bottom-dock .dock-tab[data-dock="explain"] { color: var(--text); }
body.view-check .builder-sidebar { opacity: .55; }

@media (max-width: 1320px) {
  .workspace { grid-template-columns: 285px minmax(520px, 1fr) 270px; }
  .workspace.left-hidden { grid-template-columns: 0 minmax(520px,1fr) 270px; }
  .workspace.right-hidden { grid-template-columns: 285px minmax(520px,1fr) 0; }
  .topbar { grid-template-columns: minmax(250px,1fr) minmax(200px,.7fr) auto; }
  .top-actions .btn:nth-child(1),
  .top-actions .btn:nth-child(3) { display: none; }
}
@media (max-width: 1080px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; grid-template-rows: auto auto auto; }
  .topbar { grid-template-columns: 1fr auto; }
  .project-title-wrap { grid-column: 1 / -1; order: 3; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { overflow: visible; }
  .sidebar-scroll { overflow: visible; }
  .builder-sidebar { order: 2; }
  .editor-area { order: 1; min-height: 820px; }
  .inspector-sidebar { order: 3; }
  .workspace.left-hidden,
  .workspace.right-hidden,
  .workspace.left-hidden.right-hidden { grid-template-columns: 1fr; }
  .workspace.left-hidden .builder-sidebar,
  .workspace.right-hidden .inspector-sidebar { display: none; }
  .sidebar-scroll { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .blocks-panel,
  .outline-panel { grid-row: span 2; }
  .scene-shell { min-height: 700px; }
}
@media (max-width: 760px) {
  .app { padding: 8px; }
  .topbar { grid-template-columns: 1fr; }
  .top-actions { justify-content: stretch; }
  .top-actions .btn { flex: 1; }
  .workspace-toolbar { overflow-x: auto; }
  .editor-size-controls { display: none; }
  .sidebar-scroll { grid-template-columns: 1fr; }
  .recipe-grid,
  .guided-choice-grid,
  .guided-choice-grid.two,
  .form-grid.two { grid-template-columns: 1fr; }
  .editor-area { min-height: 760px; grid-template-rows: minmax(0,1fr) 250px; }
  .editor-topbar { align-items: flex-start; }
  .editor-actions { max-width: 55%; }
  .mini-action:nth-child(1), .mini-action:nth-child(2) { display: none; }
  .editor-statusbar { font-size: .62rem; }
  .status-left span:nth-child(2), .status-left span:nth-child(3), .status-right span:nth-child(2), .status-right span:nth-child(3) { display: none; }
  .welcome-card { grid-template-columns: 1fr; }
  .welcome-visual { min-height: 220px; }
  .welcome-content { padding: 24px; }
  .block-modal-grid,
  .combo-layout { grid-template-columns: 1fr; max-height: 72vh; overflow: auto; }
  .block-preview-panel,
  .combo-preview-side { border-left: 0; border-top: 1px solid var(--line); }
  .combo-step { grid-template-columns: 34px 1fr 90px; }
  .combo-step .step-value { grid-column: 2; }
  .step-controls { grid-column: 3; grid-row: 1 / span 2; }
  .feature-bar { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* OLED Studio */
body.oled-open .app {
  padding-right: clamp(420px, 46vw, 760px);
  transition: padding-right .38s cubic-bezier(.2,.82,.22,1);
}
body:not(.oled-open) .app {
  transition: padding-right .38s cubic-bezier(.2,.82,.22,1);
}
.oled-edge-toggle {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 80;
  border: 1px solid rgba(255,255,255,.12);
  border-right: 0;
  border-radius: 16px 0 0 16px;
  background: linear-gradient(180deg, rgba(22,28,50,.96), rgba(14,18,34,.96));
  color: #eef2ff;
  padding: 16px 12px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: .12em;
  font-size: .74rem;
  font-weight: 800;
  box-shadow: 0 16px 32px rgba(0,0,0,.32);
}
.oled-studio-drawer {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: clamp(420px, 46vw, 760px);
  z-index: 90;
  transform: translateX(calc(100% + 20px));
  transition: transform .38s cubic-bezier(.2,.82,.22,1), opacity .25s ease;
  opacity: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(10,14,25,.97), rgba(8,11,20,.97));
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 24px 80px rgba(0,0,0,.48), inset 0 1px 0 rgba(255,255,255,.05);
  overflow-x: hidden;
  overflow-y: auto;
}
body.oled-open .oled-studio-drawer {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
body.oled-open .oled-edge-toggle {
  right: clamp(420px, 46vw, 760px);
}
.oled-studio-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.oled-studio-header h2 {
  margin: 4px 0 8px;
  font-size: 1.5rem;
}
.oled-studio-header p {
  margin: 0;
  color: var(--muted, #9ba6c4);
  line-height: 1.5;
  max-width: 58ch;
}
.oled-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.oled-studio-layout {
  flex: none;
  min-height: 420px;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 280px;
  gap: 14px;
}
.oled-screen-browser,
.oled-canvas-stage,
.oled-controls-panel,
.oled-control-section {
  min-height: 0;
}
.oled-screen-browser,
.oled-canvas-stage,
.oled-control-section {
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(20,26,46,.78), rgba(12,16,28,.86));
  border: 1px solid rgba(255,255,255,.07);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.oled-screen-browser,
.oled-canvas-stage {
  padding: 14px;
}
.oled-controls-panel {
  overflow: auto;
  display: grid;
  gap: 12px;
  padding-right: 2px;
}
.oled-control-section {
  padding: 14px;
}
.oled-section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.oled-section-title-row.small h3 { font-size: 1rem; }
.oled-section-title-row h3 {
  margin: 3px 0 0;
  font-size: 1.15rem;
}
.oled-screen-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 290px);
  overflow: auto;
  padding-right: 2px;
}
.oled-screen-card {
  display: grid;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  color: #eef2ff;
}
.oled-screen-card.active {
  background: linear-gradient(180deg, rgba(123,87,255,.18), rgba(255,79,134,.12));
  border-color: rgba(153,119,255,.45);
  box-shadow: 0 10px 28px rgba(123,87,255,.18);
}
.oled-screen-card strong { font-size: .95rem; }
.oled-screen-card span { color: #9aa7c9; font-size: .8rem; }
.oled-screen-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}
.oled-canvas-stage {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
}
.oled-canvas-stage-header,
.oled-stage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.oled-stage-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.oled-meta-pill {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  font-size: .78rem;
  color: #d5def4;
}
.oled-canvas-wrap {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  border-radius: 22px;
  background: radial-gradient(circle at 50% 0%, rgba(123,87,255,.14), transparent 35%), rgba(5,8,15,.82);
  border: 1px solid rgba(255,255,255,.06);
  padding: 18px;
}
#oledCanvas {
  width: min(100%, 680px);
  aspect-ratio: 2 / 1;
  height: auto;
  image-rendering: pixelated;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.1);
  background: #030405;
  box-shadow: 0 22px 60px rgba(0,0,0,.42), inset 0 0 0 1px rgba(255,255,255,.03);
  touch-action: none;
}
.oled-stage-footer {
  color: #aab6d4;
  font-size: .85rem;
}
.oled-stage-tips {
  text-align: right;
  max-width: 34ch;
}
.oled-tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.oled-tool-btn {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: #eef2ff;
  font-weight: 700;
}
.oled-tool-btn.active {
  background: linear-gradient(90deg, rgba(123,87,255,.9), rgba(255,79,134,.9));
  border-color: transparent;
  box-shadow: 0 12px 28px rgba(123,87,255,.22);
}
.oled-field-grid {
  display: grid;
  gap: 10px;
}
.oled-field-grid.two {
  grid-template-columns: 1fr 1fr;
}
.oled-menu-actions,
.oled-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.oled-menu-actions .btn.full { flex: 1 1 100%; }

@media (max-width: 1400px) {
  .oled-studio-layout {
    grid-template-columns: 160px minmax(0, 1fr);
  }
  .oled-controls-panel {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  body.oled-open .app { padding-right: 0; }
  .oled-edge-toggle {
    writing-mode: horizontal-tb;
    top: auto;
    bottom: 12px;
    right: 12px;
    transform: none;
    border-radius: 16px;
    border-right: 1px solid rgba(255,255,255,.12);
    padding: 12px 16px;
  }
  body.oled-open .oled-edge-toggle { right: 12px; }
  .oled-studio-drawer {
    inset: auto 12px 12px 12px;
    width: auto;
    max-height: 82vh;
  }
  .oled-studio-layout {
    grid-template-columns: 1fr;
  }
  .oled-controls-panel {
    grid-template-columns: 1fr;
  }
  .oled-screen-list {
    max-height: 180px;
  }
}

@media (max-width: 780px) {
  .oled-studio-drawer {
    inset: 0;
    border-radius: 0;
    max-height: none;
  }
  .oled-studio-header,
  .oled-canvas-stage-header,
  .oled-stage-footer {
    flex-direction: column;
    align-items: flex-start;
  }
  .oled-header-actions,
  .oled-menu-actions {
    width: 100%;
  }
  .oled-header-actions .btn,
  .oled-menu-actions .btn {
    flex: 1 1 calc(50% - 8px);
  }
  .oled-field-grid.two,
  .oled-tool-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* OLED Studio Ultimate additions */
.oled-image-drop {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 140px;
  padding: 12px;
  border-radius: 18px;
  border: 1px dashed rgba(255,255,255,.16);
  background: rgba(255,255,255,.025);
  color: #dbe3f8;
  text-align: center;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.oled-image-drop.dragover {
  border-color: rgba(163,127,255,.85);
  background: rgba(123,87,255,.12);
  transform: translateY(-1px);
}
.oled-image-drop span { color: #91a0c2; font-size: .8rem; }
#oledImagePreview {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 2 / 1;
  image-rendering: pixelated;
  border-radius: 12px;
  background: #020304;
  border: 1px solid rgba(255,255,255,.08);
  margin-top: 8px;
}
.oled-object-list {
  display: grid;
  gap: 8px;
  max-height: 200px;
  overflow: auto;
  margin-bottom: 10px;
}
.oled-object-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 11px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.025);
  color: #edf2ff;
  text-align: left;
}
.oled-object-item.active {
  border-color: rgba(153,119,255,.52);
  background: linear-gradient(90deg, rgba(123,87,255,.16), rgba(255,79,134,.1));
}
.oled-object-item strong { font-size: .85rem; }
.oled-object-item span { color: #8f9cbc; font-size: .75rem; }
.oled-object-actions { margin-bottom: 10px; }
.oled-wide-panel {
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.07);
  background: linear-gradient(180deg, rgba(17,22,40,.78), rgba(10,14,25,.9));
  overflow: hidden;
  flex: 0 0 auto;
}
.oled-wide-panel summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid transparent;
}
.oled-wide-panel[open] summary { border-bottom-color: rgba(255,255,255,.07); }
.oled-wide-panel summary::-webkit-details-marker { display: none; }
.oled-wide-panel summary strong { display: block; margin-top: 3px; }
.oled-wide-panel summary > span { color: #8d99b8; font-size: .8rem; }
.oled-flow-content,
.oled-gpc-content { padding: 14px; }
.oled-flow-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}
.oled-flow-map {
  min-height: 170px;
  position: relative;
  overflow: auto;
  display: flex;
  align-items: center;
  gap: 56px;
  padding: 24px;
  border-radius: 18px;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    rgba(3,6,13,.62);
  background-size: 24px 24px;
  border: 1px solid rgba(255,255,255,.06);
}
.oled-flow-node {
  position: relative;
  z-index: 2;
  min-width: 145px;
  padding: 13px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.1);
  background: linear-gradient(180deg, rgba(29,36,62,.96), rgba(15,20,37,.96));
  box-shadow: 0 14px 28px rgba(0,0,0,.28);
}
.oled-flow-node.active { border-color: rgba(157,121,255,.65); }
.oled-flow-node strong { display: block; font-size: .9rem; }
.oled-flow-node span { display: block; margin-top: 5px; color: #91a0c2; font-size: .75rem; }
.oled-flow-arrow {
  position: relative;
  min-width: 70px;
  height: 2px;
  background: linear-gradient(90deg, #805eff, #ff4f86);
  flex: 0 0 70px;
}
.oled-flow-arrow::after {
  content: '';
  position: absolute;
  right: -1px;
  top: -4px;
  border-left: 8px solid #ff4f86;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}
.oled-flow-arrow span {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  white-space: nowrap;
  color: #aab5d0;
  font-size: .7rem;
}
.oled-transition-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.oled-transition-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.06);
}
.oled-transition-row span { color: #b9c3dc; font-size: .84rem; }
.oled-transition-row button {
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255,79,134,.12);
  color: #ffb4cb;
}
.oled-gpc-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}
.oled-gpc-preview {
  min-height: 280px;
  max-height: 430px;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border-radius: 18px;
  background: #05070d;
  border: 1px solid rgba(255,255,255,.07);
  color: #dbe4ff;
  font: 12px/1.55 'JetBrains Mono', monospace;
  white-space: pre;
}
.oled-gpc-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 12px;
}
#oledCanvas.select-mode { cursor: grab; }
#oledCanvas.select-mode.dragging { cursor: grabbing; }
#oledCanvas.draw-mode { cursor: crosshair; }

@media (max-width: 1400px) {
  .oled-flow-form,
  .oled-gpc-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .oled-flow-form .btn,
  .oled-gpc-toolbar .btn { grid-column: 1 / -1; }
}
@media (max-width: 780px) {
  .oled-flow-form,
  .oled-gpc-toolbar { grid-template-columns: 1fr; }
  .oled-flow-map { flex-direction: column; align-items: stretch; gap: 24px; }
  .oled-flow-arrow { width: 2px; height: 44px; min-width: 2px; align-self: center; flex-basis: 44px; background: linear-gradient(180deg, #805eff, #ff4f86); }
  .oled-flow-arrow::after { right: auto; left: -4px; top: auto; bottom: -1px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 8px solid #ff4f86; border-bottom: 0; }
  .oled-flow-arrow span { left: 12px; bottom: 50%; transform: translateY(50%); }
  .oled-gpc-actions .btn { flex: 1 1 100%; }
}

/* Corpus Intelligence / Deep Analyzer */
body.analysis-open .app {
  padding-right: clamp(460px, 48vw, 820px);
  transition: padding-right .38s cubic-bezier(.2,.82,.22,1);
}
.analysis-edge-toggle {
  position: fixed;
  top: calc(50% - 90px);
  right: 0;
  z-index: 79;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: 15px 11px;
  border-radius: 16px 0 0 16px;
  border: 1px solid rgba(255,255,255,.12);
  border-right: 0;
  background: linear-gradient(180deg, rgba(28,34,58,.97), rgba(15,19,35,.97));
  color: #eef2ff;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  box-shadow: 0 18px 40px rgba(0,0,0,.34);
  cursor: pointer;
  transition: right .38s cubic-bezier(.2,.82,.22,1), transform .2s ease;
}
.analysis-edge-toggle:hover { transform: translateY(-2px); }
body.analysis-open .analysis-edge-toggle { right: clamp(460px, 48vw, 820px); }
.analysis-drawer {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: clamp(460px, 48vw, 820px);
  z-index: 88;
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(10,14,25,.98), rgba(7,10,18,.98));
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 28px 90px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.05);
  overflow: hidden;
  transition: transform .38s cubic-bezier(.2,.82,.22,1), opacity .25s ease;
}
body.analysis-open .analysis-drawer {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
body.analysis-open.oled-open .analysis-drawer {
  z-index: 96;
}
.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.analysis-header h2 { margin: 4px 0 8px; font-size: 1.55rem; }
.analysis-header p { margin: 0; max-width: 62ch; color: var(--muted, #9ca8c7); line-height: 1.55; }
.analysis-header-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.analysis-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.015);
}
.analysis-tab {
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: #dbe3f8;
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.analysis-tab.active {
  background: linear-gradient(90deg, rgba(123,87,255,.86), rgba(255,79,134,.8));
  border-color: transparent;
  color: white;
  box-shadow: 0 12px 28px rgba(123,87,255,.2);
}
.analysis-content {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 18px;
}
.analysis-pane { display: none; }
.analysis-pane.active { display: block; animation: analysisFade .24s ease; }
@keyframes analysisFade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.analysis-score-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.analysis-score-card,
.analysis-card {
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(20,26,46,.78), rgba(12,16,28,.88));
  border: 1px solid rgba(255,255,255,.07);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.analysis-score-card { padding: 16px; display: grid; gap: 7px; }
.analysis-score-card span { color: #9faac8; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.analysis-score-card strong { font-size: 1.75rem; line-height: 1; }
.analysis-score-card small { color: #7885a5; line-height: 1.35; }
.analysis-grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.analysis-card { padding: 16px; margin-bottom: 14px; }
.analysis-card-title { margin-bottom: 12px; }
.analysis-card-title h3 { margin: 4px 0 0; font-size: 1.08rem; }
.architecture-map {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.architecture-node {
  padding: 11px 12px;
  border-radius: 15px;
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.03);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.architecture-node strong { font-size: .9rem; }
.architecture-node span { color: #9faccc; font-size: .78rem; }
.architecture-node.present {
  border-color: rgba(123,87,255,.35);
  background: linear-gradient(90deg, rgba(123,87,255,.12), rgba(255,79,134,.07));
}
.feature-chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.feature-chip {
  padding: 9px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.035);
  color: #dbe3f7;
  font-size: .82rem;
}
.feature-chip.active {
  border-color: rgba(80,220,255,.25);
  background: rgba(80,220,255,.08);
}
.analysis-summary {
  color: #cbd4ee;
  line-height: 1.7;
  white-space: pre-wrap;
}
.analysis-toolbar-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.analysis-toolbar-row h3 { margin: 4px 0 0; }
.analysis-search { width: min(280px, 46%); }
.compact-label { min-width: 170px; }
.analysis-list { display: grid; gap: 10px; }
.analysis-issue,
.analysis-note,
.symbol-item,
.api-reference-item {
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.025);
  border-radius: 17px;
  padding: 13px 14px;
}
.analysis-issue {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}
.issue-severity {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  margin-top: 5px;
  box-shadow: 0 0 14px currentColor;
}
.analysis-issue.error .issue-severity { color: #ff5577; background: currentColor; }
.analysis-issue.warning .issue-severity { color: #ffb84d; background: currentColor; }
.analysis-issue.info .issue-severity { color: #50dcff; background: currentColor; }
.analysis-issue strong { display: block; margin-bottom: 5px; }
.analysis-issue p { margin: 0; color: #9da9c9; line-height: 1.5; }
.analysis-jump-btn {
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  color: #dfe6fa;
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
}
.symbol-groups { display: grid; gap: 14px; }
.symbol-group {
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.02);
  overflow: hidden;
}
.symbol-group-head {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255,255,255,.025);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.symbol-group-list { display: grid; gap: 8px; padding: 10px; }
.symbol-item {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}
.symbol-item strong { font-family: 'JetBrains Mono', monospace; font-size: .85rem; overflow-wrap: anywhere; }
.symbol-item span { color: #91a0c0; font-size: .78rem; }
.analysis-api-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.api-stat-pill {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(123,87,255,.09);
  border: 1px solid rgba(123,87,255,.22);
  color: #d9d2ff;
  font-size: .8rem;
}
.api-reference-list { display: grid; gap: 10px; }
.api-reference-item {
  display: grid;
  grid-template-columns: minmax(150px, .7fr) minmax(0, 1.6fr) auto;
  gap: 14px;
  align-items: center;
}
.api-reference-item code { color: #aee8ff; font-size: .87rem; overflow-wrap: anywhere; }
.api-reference-item p { margin: 0; color: #a0acc9; line-height: 1.45; }
.api-reference-item .api-meta { text-align: right; color: #7f8cab; font-size: .75rem; }
.autocomplete-popover {
  position: fixed;
  z-index: 120;
  width: min(430px, calc(100vw - 24px));
  max-height: 390px;
  overflow: hidden;
  border-radius: 20px;
  background: rgba(9,13,24,.98);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 22px 70px rgba(0,0,0,.55);
}
.autocomplete-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.autocomplete-head span { color: #8090b0; font-size: .78rem; }
.autocomplete-list { max-height: 330px; overflow: auto; padding: 8px; }
.autocomplete-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 10px;
  text-align: left;
  color: #e9edff;
  border: 0;
  background: transparent;
  padding: 10px 11px;
  border-radius: 13px;
  cursor: pointer;
}
.autocomplete-item:hover,
.autocomplete-item.active { background: rgba(123,87,255,.16); }
.autocomplete-item strong { display: block; font-family: 'JetBrains Mono', monospace; font-size: .86rem; }
.autocomplete-item small { color: #8e9bb9; line-height: 1.35; }
.autocomplete-item span { color: #72809f; font-size: .72rem; }

@media (max-width: 1280px) {
  body.analysis-open .app { padding-right: 0; }
  .analysis-drawer {
    inset: 10px;
    width: auto;
  }
  .analysis-edge-toggle {
    top: auto;
    bottom: 64px;
    right: 12px;
    writing-mode: horizontal-tb;
    border-radius: 16px;
    border-right: 1px solid rgba(255,255,255,.12);
  }
  body.analysis-open .analysis-edge-toggle { right: 12px; }
}
@media (max-width: 760px) {
  .analysis-drawer { inset: 0; border-radius: 0; }
  .analysis-header { flex-direction: column; }
  .analysis-header-actions { width: 100%; }
  .analysis-header-actions .btn { flex: 1 1 30%; }
  .analysis-score-row,
  .analysis-grid-two { grid-template-columns: 1fr 1fr; }
  .analysis-toolbar-row { align-items: stretch; flex-direction: column; }
  .analysis-search { width: 100%; }
  .api-reference-item { grid-template-columns: 1fr; }
  .api-reference-item .api-meta { text-align: left; }
}
@media (max-width: 520px) {
  .analysis-score-row,
  .analysis-grid-two,
  .architecture-map { grid-template-columns: 1fr; }
}

/* ================================================================
   ZenLoader Script Lab - alive animations (appended, additive only)
   ================================================================ */
@keyframes slFadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes slPop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
@keyframes slGlow { 0%,100% { opacity: .8; } 50% { opacity: 1; filter: drop-shadow(0 0 10px rgba(124,92,255,.55)); } }
@keyframes slSheen { from { background-position: -140px 0; } to { background-position: 240px 0; } }
@keyframes slRingPulse { 0% { box-shadow: 0 0 0 0 rgba(124,92,255,.35); } 100% { box-shadow: 0 0 0 12px rgba(124,92,255,0); } }

/* staggered entrance for the main panels/cards */
.panel, .analysis-card, .analysis-score-card { animation: slFadeUp .5s cubic-bezier(.2,.7,.2,1) both; }
.panel:nth-child(2) { animation-delay: .05s; } .panel:nth-child(3) { animation-delay: .1s; }
.analysis-score-card:nth-child(2){animation-delay:.05s;} .analysis-score-card:nth-child(3){animation-delay:.1s;} .analysis-score-card:nth-child(4){animation-delay:.15s;}
.recipe-card, .welcome-option { animation: slFadeUp .5s cubic-bezier(.2,.7,.2,1) both; }
.recipe-card:nth-child(2){animation-delay:.06s;} .recipe-card:nth-child(3){animation-delay:.12s;} .recipe-card:nth-child(4){animation-delay:.18s;}

/* hover life on interactive cards */
.recipe-card, .block-card, .analysis-card, .welcome-option {
  transition: transform .16s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.recipe-card:hover, .block-card:hover, .welcome-option:hover {
  transform: translateY(-2px);
  border-color: rgba(124,92,255,.5);
  box-shadow: 0 10px 26px rgba(0,0,0,.35), 0 0 18px rgba(124,92,255,.14);
}
.analysis-card:hover { transform: translateY(-1px); border-color: rgba(124,92,255,.4); }

/* problems animate in as they render */
.problem-item { animation: slFadeUp .32s ease both; }
.problem-item:nth-child(2){animation-delay:.03s;}.problem-item:nth-child(3){animation-delay:.06s;}
.problem-item:nth-child(4){animation-delay:.09s;}.problem-item:nth-child(n+5){animation-delay:.12s;}

/* the health ring number pops + ring haloes when a real score lands */
.health-ring span { transition: color .3s ease; }
.health-ring.bumped { animation: slRingPulse .7s ease-out 1; }
.health-ring.bumped span { animation: slPop .45s cubic-bezier(.2,.8,.2,1.2) 1; }

/* smooth progress bars */
#coachProgress, #guidedProgress { transition: width .6s cubic-bezier(.4,.9,.3,1); }

/* brand mark breathes; accent buttons get a light sweep */
.brand-mark { animation: slGlow 4.5s ease-in-out infinite; }
.btn.accent, .btn.primary {
  position: relative; overflow: hidden;
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}
.btn.accent:hover, .btn.primary:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn.accent::after, .btn.primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.28), transparent);
  background-size: 140px 100%; background-repeat: no-repeat;
  animation: slSheen 3.6s ease-in-out infinite;
}

/* generic buttons/tabs get a subtle press/hover feel */
.btn, .workspace-tab, [role="tab"] { transition: transform .14s ease, background .18s ease, color .18s ease; }
.btn:active { transform: translateY(1px) scale(.99); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
