/* ============================================================
   aesthetic.red — design system
   The whole product speaks one visual language: the code chunk.
   Pills of real code on a deep plum-navy canvas (CK 2016, fresher).
   ============================================================ */

:root {
  /* canvas + surfaces */
  --bg:      #232033;
  --canvas:  #2E2B41;   /* editor background, straight from the reference */
  --panel:   #292640;
  --raised:  #353152;
  --line:    #3E3A5C;
  --text:    #EDEBF7;
  --muted:   #9B96B8;

  /* chunk type colors — the identity */
  --red:     #FF4A5F;   /* brand (.red) + visibility keywords */
  --salmon:  #E05A64;
  --green:   #A6E05B;   /* method calls, RUN */
  --green-d: #6FA832;
  --blue:    #56A8F5;   /* keywords, links */
  --mblue:   #4A90D9;   /* method signatures */
  --orange:  #F2A254;   /* enums */
  --yellow:  #F5DE5C;   /* strings */
  --purple:  #B47EE8;   /* fields */
  --pink:    #F58C8C;   /* numbers */
  --chip:    #3A3750;   /* dark chips: void, package, imports */

  --font-display: 'Baloo 2', 'Avenir Next', sans-serif;
  --font-body: 'Nunito Sans', 'Helvetica Neue', sans-serif;
  --font-code: 'Inconsolata', 'SF Mono', monospace;

  --r: 10px;            /* app radius */
  --r-chunk: 7px;       /* chunk radius */
  --shadow: 0 8px 24px rgba(12, 10, 24, .45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* beats display:flex on panels */
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}
body.ide { overflow: hidden; height: 100vh; display: flex; flex-direction: column; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; }
code { font-family: var(--font-code); }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
dialog::backdrop { background: rgba(15, 13, 28, .7); }

/* ---------------- Top bar ---------------- */
.TopBar {
  display: flex; align-items: center; gap: 28px;
  padding: 0 20px; height: 56px; flex-shrink: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 20;
}
.Brand { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-display); font-weight: 800; font-size: 17px; }
.Brand:hover { text-decoration: none; filter: brightness(1.1); }
.Brand__chunk { padding: 3px 10px; border-radius: var(--r-chunk); line-height: 1.3; }
.Brand__chunk--green { background: var(--green); color: #1E2A0E; }
.Brand__chunk--red { background: var(--red); color: #fff; }
.Brand__cursor {
  width: 2px; height: 18px; margin-left: 5px; background: var(--green);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.TopNav { display: flex; gap: 4px; }
.TopNav__item {
  color: var(--muted); font-family: var(--font-display); font-weight: 600;
  padding: 6px 14px; border-radius: var(--r-chunk);
}
.TopNav__item:hover { color: var(--text); text-decoration: none; background: var(--raised); }
.TopNav__item.is-active { color: var(--text); background: var(--raised); box-shadow: inset 0 -2px 0 var(--green); }

.TopBar__right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.Xp { display: flex; align-items: center; gap: 7px; font-family: var(--font-display); font-weight: 600; font-size: 13px; }
.Xp__star { color: var(--yellow); }
.Xp__level { color: var(--text); }
.Xp__amount { color: var(--muted); }

.Avatar { display: flex; align-items: center; gap: 8px; }
.Avatar img { border-radius: 6px; image-rendering: pixelated; }
.Avatar__name { font-weight: 700; font-size: 13px; }
.Avatar__out { color: var(--muted); font-size: 14px; padding: 4px; }
.Avatar__out:hover { color: var(--red); text-decoration: none; }

/* ---------------- Buttons: shaped like chunks ---------------- */
.Btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  padding: 8px 16px; border-radius: var(--r-chunk);
  border: none; cursor: pointer; line-height: 1.2;
  transition: transform .08s ease, filter .12s ease;
}
.Btn:active { transform: translateY(1px); }
.Btn--run { background: var(--green); color: #1E2A0E; box-shadow: 0 3px 0 var(--green-d); }
.Btn--run:hover { filter: brightness(1.07); }
.Btn--run:disabled { filter: saturate(.4) brightness(.8); cursor: default; box-shadow: none; }
.Btn--big { font-size: 16px; padding: 10px 26px; letter-spacing: .06em; }
.Btn--outline { background: transparent; color: var(--text); border: 2px solid var(--line); }
.Btn--outline:hover { border-color: var(--blue); color: var(--blue); }
.Btn--ghost { background: transparent; color: var(--muted); }
.Btn--ghost:hover { color: var(--text); background: var(--raised); }
.Btn--download { border-color: var(--green-d); color: var(--green); }
.Btn--download:hover { border-color: var(--green); color: var(--green); text-decoration: none; }

/* ---------------- Landing ---------------- */
.Landing { max-width: 1120px; margin: 0 auto; padding: 24px; }
.Hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; padding: 56px 0 40px; }
.Hero__eyebrow {
  font-family: var(--font-code); font-size: 13px; color: var(--green);
  letter-spacing: .08em; margin: 0 0 10px;
}
.Hero__title { font-size: 56px; line-height: 1.05; font-weight: 800; }
.Hero__title em { font-style: normal; color: var(--green); position: relative; }
.Hero__sub { color: var(--muted); font-size: 17px; max-width: 46ch; }
.Hero__sub strong { color: var(--green); }
.EpicWord { color: var(--purple); font-family: var(--font-display); font-weight: 800; letter-spacing: .04em; }

.LoginCard { margin-top: 26px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; max-width: 460px; }
.LoginCard__label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.LoginCard__row { display: flex; gap: 10px; }
.LoginCard input {
  flex: 1; background: var(--canvas); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-chunk);
  padding: 10px 12px; font-family: var(--font-code); font-size: 15px;
}
.LoginCard input:focus { border-color: var(--green); outline: none; }
.LoginCard__error { color: var(--red); font-size: 13px; margin: 10px 0 0; }

/* hero demo: real chunks assembling */
.Hero__demo { perspective: 900px; }
.DemoCanvas {
  background: var(--canvas); border-radius: 14px; padding: 26px 22px;
  box-shadow: var(--shadow);
  background-image: radial-gradient(circle, #4A4570 1.3px, transparent 1.3px);
  background-size: 26px 26px;
}
.DemoChunk { display: flex; gap: 3px; margin: 7px 0; opacity: 0; transform: translateY(14px); animation: chunkIn .45s cubic-bezier(.2,.9,.3,1.2) forwards; }
.DemoChunk.indent { margin-left: 34px; }
.DemoChunk.d1 { animation-delay: .15s } .DemoChunk.d2 { animation-delay: .45s }
.DemoChunk.d3 { animation-delay: .75s } .DemoChunk.d4 { animation-delay: 1.05s }
.DemoChunk.d5 { animation-delay: 1.35s }
@keyframes chunkIn { to { opacity: 1; transform: none; } }
.ch {
  font-family: var(--font-code); font-weight: 700; font-size: 13.5px;
  padding: 4px 9px; border-radius: var(--r-chunk); white-space: nowrap;
}
.ch--red { background: var(--salmon); color: #fff; }
.ch--dark { background: var(--chip); color: #C9C4E4; }
.ch--blue { background: var(--mblue); color: #fff; }
.ch--green { background: var(--green); color: #1E2A0E; }
.ch--orange { background: var(--orange); color: #3A2508; }

.Landing__strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding: 26px 0 64px; }
.StripCard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.StripCard h3 { font-size: 17px; display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.StripCard__dot { width: 12px; height: 12px; border-radius: 4px; background: var(--dot, var(--green)); display: inline-block; }
.StripCard p { color: var(--muted); margin: 0; font-size: 14px; }
.StripCard code { color: var(--green); font-size: 13px; }

/* ---------------- Dashboard ---------------- */
.Page { max-width: 1120px; margin: 0 auto; padding: 30px 24px 80px; }
.Section { margin-bottom: 44px; }
.Section__head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 16px; }
.Section__head h1 { font-size: 26px; }
.Section__hint { color: var(--muted); font-size: 13.5px; margin: 0; }

.TileGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }

.ProjectTile { position: relative; }
.ProjectTile__box {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden; color: var(--text);
  transition: transform .12s ease, border-color .12s ease;
}
.ProjectTile__box:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--green); }
.ProjectTile__img { aspect-ratio: 16/10; background: var(--canvas); }
.ProjectTile__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ProjectTile h2 { font-size: 15px; padding: 10px 12px 12px; font-weight: 700; }
.ProjectTile__meta { display: flex; align-items: center; gap: 10px; padding: 8px 2px 0; }
.ProjectTile__delete {
  margin-left: auto; background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 12px; padding: 4px 6px; border-radius: 4px; opacity: 0;
}
.ProjectTile:hover .ProjectTile__delete { opacity: 1; }
.ProjectTile__delete:hover { color: #fff; background: var(--red); }

.BrandTag {
  font-family: var(--font-display); font-weight: 600; font-size: 11px;
  padding: 3px 9px; border-radius: 20px; letter-spacing: .03em;
  background: var(--raised); color: var(--muted);
}
.BrandTag--minecraft { color: var(--green); }
.BrandTag--roblox { color: var(--red); }
.BrandTag--standalone { color: var(--blue); }

.ProgressBar { position: relative; flex: 1; max-width: 110px; height: 10px; background: var(--canvas); border-radius: 6px; overflow: hidden; }
.ProgressBar__bar { height: 100%; border-radius: 6px; background: var(--purple); transition: width .3s ease; }
.ProgressBar--green .ProgressBar__bar { background: var(--green); }
.ProgressBar__label {
  position: absolute; right: -34px; top: -3px; font-size: 10px; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
}
.ProgressBar { margin-right: 34px; }

.TextTile {
  display: flex; align-items: center; justify-content: center; text-align: center;
  border-radius: var(--r); border: none; cursor: pointer; min-height: 176px;
  font-family: var(--font-display); font-weight: 700; font-size: 17px; color: #fff;
  transition: transform .12s ease, filter .12s ease;
  background-size: cover;
}
.TextTile:hover { transform: translateY(-3px); filter: brightness(1.08); text-decoration: none; }
.TextTile--blue { background: linear-gradient(140deg, #3D7BE0, #2A55B8); box-shadow: inset 0 0 0 2px rgba(255,255,255,.12); }
.TextTile--purple { background: linear-gradient(140deg, #8B5BD6, #6437B4); box-shadow: inset 0 0 0 2px rgba(255,255,255,.12); }
.TextTile__wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.TextTile__plus {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.18); border: 2px dashed rgba(255,255,255,.55);
  font-size: 24px; line-height: 36px; font-weight: 500;
}

/* ---------------- Courses ---------------- */
.CourseGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.CourseCard {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; display: flex; flex-direction: column;
}
.CourseCard.is-soon { opacity: .68; }
.CourseCard__img { position: relative; aspect-ratio: 16/7; background: var(--canvas); }
.CourseCard__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.CourseCard__img .BrandTag { position: absolute; top: 10px; left: 10px; background: rgba(20,17,35,.85); }
.CourseCard__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.CourseCard__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.CourseCard__top h2 { font-size: 19px; }
.CourseCard__body > p { color: var(--muted); font-size: 14px; margin: 0; }
.CourseCard__skills { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.CourseCard__skills li {
  font-family: var(--font-code); font-size: 11.5px; color: var(--blue);
  background: var(--canvas); padding: 3px 9px; border-radius: 20px;
}
.CourseCard__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.CourseCard__steps { color: var(--muted); font-size: 12.5px; font-weight: 700; }

.Difficulty { font-family: var(--font-display); font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; text-transform: uppercase; letter-spacing: .05em; }
.Difficulty--beginner { background: #2E4A22; color: var(--green); }
.Difficulty--intermediate { background: #4A3A1E; color: var(--orange); }
.Difficulty--advanced { background: #4A2230; color: var(--red); }
.SoonTag { font-family: var(--font-display); font-size: 11px; font-weight: 700; color: var(--purple); text-transform: uppercase; letter-spacing: .06em; font-style: normal; }

/* ---------------- Modal ---------------- */
.Modal { border: none; border-radius: 14px; background: var(--panel); color: var(--text); padding: 0; max-width: 520px; width: calc(100vw - 40px); box-shadow: var(--shadow); }
.Modal__card { padding: 26px; display: flex; flex-direction: column; gap: 18px; margin: 0; }
.Modal__card h2 { font-size: 22px; }
.Modal__actions { display: flex; justify-content: flex-end; gap: 10px; }
.Modal__error { color: var(--red); font-size: 13px; margin: 0; }
.Field { display: flex; flex-direction: column; gap: 8px; }
.Field > span { font-size: 13px; color: var(--muted); font-weight: 700; }
.Field input {
  background: var(--canvas); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r-chunk); padding: 10px 12px; font-size: 15px;
}
.Field input:focus { border-color: var(--green); outline: none; }

.PlatformPick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.PlatformPick__opt input { position: absolute; opacity: 0; }
.PlatformPick__card {
  display: flex; flex-direction: column; gap: 2px; padding: 12px;
  background: var(--canvas); border: 2px solid var(--line); border-radius: var(--r-chunk);
  cursor: pointer; position: relative; height: 100%;
}
.PlatformPick__card strong { font-family: var(--font-display); font-size: 14px; }
.PlatformPick__card small { color: var(--muted); font-size: 11.5px; }
.PlatformPick__opt input:checked + .PlatformPick__card { border-color: var(--green); }
.PlatformPick__opt.is-soon .PlatformPick__card { opacity: .55; cursor: default; }
.PlatformPick__opt input:focus-visible + .PlatformPick__card { outline: 2px solid var(--blue); }

/* ---------------- IDE layout ---------------- */
.Ide { display: flex; flex: 1; min-height: 0; }
.Ide__main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.Ide__topRow {
  display: flex; align-items: center; height: 46px; flex-shrink: 0;
  background: var(--panel); border-bottom: 1px solid var(--line); padding-right: 12px;
}
.Ide__body { flex: 1; display: flex; min-height: 0; position: relative; }

/* course panel */
.CoursePanel {
  width: 280px; flex-shrink: 0; background: var(--panel);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  overflow-y: auto;
}
.CoursePanel__head { padding: 16px 16px 8px; position: relative; }
.CoursePanel__eyebrow { font-family: var(--font-code); font-size: 11px; color: var(--purple); letter-spacing: .12em; text-transform: uppercase; }
.CoursePanel__head h2 { font-size: 18px; }
.CoursePanel__hide, .CoursePanel__show {
  position: absolute; top: 14px; right: 10px; background: var(--raised); border: none;
  color: var(--muted); width: 24px; height: 24px; border-radius: 6px; cursor: pointer;
}
.CoursePanel__show { position: static; margin: 8px 0 0 4px; align-self: flex-start; height: 42px; }
.CourseSteps { list-style: none; margin: 6px 0; padding: 0 10px; }
.CourseSteps li {
  padding: 7px 10px; border-radius: var(--r-chunk); font-size: 13px; color: var(--muted);
  cursor: pointer; display: flex; gap: 9px; align-items: baseline;
}
.CourseSteps li:hover { background: var(--raised); }
.CourseSteps li.is-current { background: var(--raised); color: var(--text); font-weight: 700; }
.CourseSteps li.is-done { color: var(--green); }
.CourseSteps .n { font-family: var(--font-code); font-size: 11px; opacity: .8; }
.CoursePanel__step { padding: 12px 18px; font-size: 13.5px; color: var(--text); border-top: 1px solid var(--line); flex: 1; }
.CoursePanel__step h3 { font-size: 15px; margin-bottom: 8px; }
.CoursePanel__step p { margin: 0 0 10px; color: var(--muted); }
.CoursePanel__step code {
  background: var(--canvas); color: var(--yellow); padding: 1px 6px;
  border-radius: 4px; font-size: 12px;
}
.CoursePanel__step .goal { border-left: 3px solid var(--green); padding: 6px 10px; background: var(--canvas); border-radius: 0 6px 6px 0; color: var(--text); }
.CoursePanel__nav { display: flex; justify-content: space-between; padding: 12px; border-top: 1px solid var(--line); }
.stepFail {
  margin: 10px 0 0; padding: 8px 12px; border-left: 3px solid var(--red);
  background: rgba(255,74,95,.08); border-radius: 0 6px 6px 0;
  color: var(--red); font-size: 13px; list-style: none;
  animation: nudge .3s ease;
}
.stepFail li { margin: 3px 0; }
@keyframes nudge { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* file tabs + toolbox */
.FileTabs { display: flex; align-items: flex-end; gap: 2px; padding: 0 8px; height: 100%; overflow-x: auto; }
.FileTab {
  font-family: var(--font-code); font-weight: 700; font-size: 13px;
  color: var(--muted); background: transparent; border: none; cursor: pointer;
  padding: 9px 16px; border-radius: 8px 8px 0 0; height: 38px; white-space: nowrap;
}
.FileTab:hover { color: var(--text); background: var(--raised); }
.FileTab.is-active { color: var(--text); background: var(--canvas); }
.FileTab .epic-dot { color: var(--purple); margin-left: 5px; }

.Toolbox { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ToolBtn {
  width: 30px; height: 30px; border-radius: var(--r-chunk); border: none;
  background: var(--raised); color: var(--text); cursor: pointer; font-size: 14px;
}
.ToolBtn:disabled { opacity: .35; cursor: default; }
.ToolBtn:not(:disabled):hover { background: var(--line); }

.EpicSwitch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.EpicSwitch input { position: absolute; opacity: 0; }
.EpicSwitch__track {
  width: 38px; height: 20px; border-radius: 20px; background: var(--raised);
  position: relative; transition: background .15s ease; display: inline-block;
  box-shadow: inset 0 0 0 1px var(--line);
}
.EpicSwitch__thumb {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); transition: transform .15s ease, background .15s ease;
}
.EpicSwitch input:checked + .EpicSwitch__track { background: var(--purple); }
.EpicSwitch input:checked + .EpicSwitch__track .EpicSwitch__thumb { transform: translateX(18px); background: #fff; }
.EpicSwitch__label { font-family: var(--font-display); font-weight: 800; font-size: 12px; letter-spacing: .07em; color: var(--purple); }
.EpicSwitch input:focus-visible ~ .EpicSwitch__label { outline: 2px solid var(--blue); border-radius: 4px; }

/* file sidebar */
.FileSidebar {
  width: 190px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 12px 0;
}
.FileSidebar__title {
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  padding: 0 14px 10px; color: var(--muted); text-overflow: ellipsis; overflow: hidden; white-space: nowrap;
}
.FileTree { list-style: none; margin: 0; padding: 0 8px; flex: 1; overflow-y: auto; }
.FileTree li {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-code); font-size: 13px; color: var(--muted);
  padding: 6px 10px; border-radius: var(--r-chunk); cursor: pointer;
}
.FileTree li:hover { color: var(--text); background: var(--raised); }
.FileTree li.is-active { color: var(--text); background: var(--raised); box-shadow: inset 2px 0 0 var(--green); }
.FileTree .fi { width: 10px; height: 10px; border-radius: 3px; background: var(--mblue); flex-shrink: 0; }
.FileTree li[data-epic="1"] .fi { background: var(--purple); }
.FileSidebar__add {
  margin: 8px 14px 0; background: none; border: 1px dashed var(--line); color: var(--muted);
  border-radius: var(--r-chunk); padding: 7px; cursor: pointer; font-size: 12.5px; font-weight: 700;
}
.FileSidebar__add:hover { color: var(--green); border-color: var(--green-d); }

.ServerDot { display: flex; align-items: center; gap: 8px; padding: 12px 14px 2px; font-size: 11.5px; color: var(--muted); }
.ServerDot__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.ServerDot.is-online .ServerDot__dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.ServerDot.is-online .ServerDot__text { color: var(--green); }

/* ---------------- Code window: the canvas ---------------- */
.CodeWindow {
  flex: 1; min-width: 0; position: relative; overflow: auto;
  background: var(--canvas);
  background-image: radial-gradient(circle, rgba(86,104,168,.35) 1.2px, transparent 1.2px);
  background-size: 26px 26px;
}
.BlockCanvas { padding: 22px 26px 120px; min-height: 100%; }

/* structural rows */
.brow { display: flex; align-items: flex-start; gap: 3px; margin: 5px 0; position: relative; }
.brow.is-dragging { opacity: .35; }
.blist { list-style: none; margin: 0; padding: 0 0 0 30px; position: relative; }
.blist::before {  /* dotted guide, like the reference */
  content: ''; position: absolute; left: 12px; top: 2px; bottom: 2px; width: 2px;
  background-image: radial-gradient(circle, #5A76D9 1.4px, transparent 1.4px);
  background-size: 2px 9px; background-repeat: repeat-y;
}
.blist > li { list-style: none; }

/* chunk segments */
.seg {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-code); font-weight: 700; font-size: 13.5px;
  padding: 4px 9px; border-radius: var(--r-chunk); white-space: nowrap;
  line-height: 1.35;
}
.seg svg, .seg .ico { flex-shrink: 0; }
.seg--vis     { background: var(--salmon); color: #fff; }
.seg--type    { background: var(--chip); color: #C9C4E4; }
.seg--sig     { background: var(--mblue); color: #fff; }
.seg--call    { background: var(--green); color: #1E2A0E; }
.seg--enum    { background: var(--orange); color: #3A2508; }
.seg--string  { background: var(--yellow); color: #3A3208; }
.seg--number  { background: var(--pink); color: #4A1414; }
.seg--field   { background: var(--purple); color: #fff; }
.seg--kw      { background: var(--mblue); color: #fff; }
.seg--punc    { background: transparent; color: #8F89B5; padding: 4px 2px; font-weight: 700; }
.seg--header  { background: var(--chip); color: #9B96B8; font-weight: 500; }
.seg--header b { color: #C9C4E4; font-weight: 700; }
.seg--brace   { background: transparent; color: #8F89B5; padding: 4px 4px; }

/* editable values pulse on hover */
.seg--editable { cursor: pointer; position: relative; }
.seg--editable:hover { box-shadow: 0 0 0 2px rgba(255,255,255,.55); }
.seg input, .seg select {
  font: inherit; color: inherit; background: rgba(255,255,255,.25);
  border: none; border-radius: 4px; padding: 0 4px; min-width: 30px; max-width: 340px;
}
.seg select { appearance: none; }

/* drag handle behavior: whole statement rows are draggable */
.brow[draggable="true"] { cursor: grab; }
.brow[draggable="true"]:active { cursor: grabbing; }
.brow .rowDel {
  visibility: hidden; border: none; background: none; color: var(--muted);
  font-size: 11px; cursor: pointer; padding: 5px 4px; border-radius: 4px;
}
.brow:hover > .rowDel { visibility: visible; }
.brow .rowDel:hover { color: #fff; background: var(--red); }

/* insertion points */
.plusRow { margin: 2px 0; }
.plusBtn {
  width: 20px; height: 20px; border-radius: 50%; border: none; cursor: pointer;
  background: #423E60; color: #B9B4D8; font-size: 13px; line-height: 1;
  transition: transform .1s ease, background .1s ease;
}
.plusBtn:hover { background: var(--green); color: #1E2A0E; transform: scale(1.15); }
.dropSlot { height: 6px; border-radius: 3px; margin: 1px 0 1px 30px; transition: height .1s ease, background .1s ease; }
.dropSlot.is-over { height: 26px; background: rgba(166,224,91,.25); outline: 2px dashed var(--green); }
/* while any chunk (or palette block) is being dragged, arm every slot */
body.is-chunk-drag .dropSlot { height: 14px; background: rgba(86,168,245,.16); }
body.is-chunk-drag .dropSlot.is-over { height: 26px; background: rgba(166,224,91,.25); }

/* structural buttons like the reference ("Add Field", "Add Method") */
.addDecl {
  display: inline-flex; align-items: center; gap: 7px; margin: 6px 0;
  background: none; border: none; color: var(--blue); cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
}
.addDecl .plusBtn { background: var(--mblue); color: #fff; }
.addDecl:hover { color: #8CC4F8; }

.TrashZone {
  position: absolute; /* pinned by JS during drags */
  left: 50%; bottom: 18px; transform: translateX(-50%);
  background: rgba(20,17,35,.92); border: 2px dashed var(--red); color: var(--red);
  padding: 12px 26px; border-radius: 12px; font-weight: 700; font-size: 14px;
  display: none; z-index: 30; position: fixed;
}
.TrashZone.is-visible { display: block; }
.TrashZone.is-over { background: var(--red); color: #fff; }

/* ---------------- Palette drawer ---------------- */
.Palette {
  width: 340px; flex-shrink: 0; background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
/* palette previews: mini chunks that wrap, so the whole block is visible */
.Palette .seg {
  font-size: 10.5px; padding: 2px 6px; border-radius: 5px;
}
.Palette .brow { flex-wrap: wrap; gap: 2px; margin: 2px 0; row-gap: 2px; }
.Palette .dropSlot, .Palette .blist::before { display: none; }
.Palette .blist { padding-left: 0; }
.Palette__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; font-family: var(--font-display); font-weight: 700; font-size: 15px;
}
.Palette__close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.Palette__close:hover { color: var(--red); }
.Palette__cats { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 12px; }
.Palette__cat {
  font-family: var(--font-display); font-weight: 600; font-size: 12px;
  background: var(--raised); color: var(--muted); border: none; cursor: pointer;
  padding: 5px 12px; border-radius: 20px;
}
.Palette__cat.is-active { background: var(--green); color: #1E2A0E; }
.Palette__list { list-style: none; margin: 0; padding: 4px 12px 20px; overflow-y: auto; flex: 1; }
.Palette__item {
  margin: 7px 0; cursor: grab; border-radius: var(--r-chunk);
  transition: transform .08s ease;
}
.Palette__item:hover { transform: translateX(-3px); }
.Palette__item .desc { display: block; font-size: 11.5px; color: var(--muted); padding: 3px 4px 0; }

/* ---------------- Epic editor ---------------- */
.EpicEditor { position: absolute; inset: 0; display: flex; background: var(--canvas); }
.EpicEditor__gutter {
  padding: 18px 10px 18px 16px; font-family: var(--font-code); font-size: 14px;
  line-height: 1.6; color: #565179; text-align: right; user-select: none; white-space: pre;
  border-right: 1px solid var(--line); min-width: 46px;
}
.EpicEditor__scroll { position: relative; flex: 1; overflow: auto; }
.EpicEditor__highlight, .EpicEditor__input {
  margin: 0; padding: 18px; font-family: var(--font-code); font-size: 14px;
  line-height: 1.6; tab-size: 4; white-space: pre; overflow-wrap: normal;
}
.EpicEditor__highlight { position: absolute; inset: 0; pointer-events: none; color: var(--text); min-width: 100%; }
.EpicEditor__input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background: transparent; color: transparent; caret-color: var(--green);
  border: none; resize: none; outline: none;
}
/* epic syntax palette mirrors chunk colors */
.tok-kw { color: var(--blue); font-weight: 700; }
.tok-type { color: var(--orange); }
.tok-str { color: var(--yellow); }
.tok-num { color: var(--pink); }
.tok-call { color: var(--green); }
.tok-com { color: #6C678E; font-style: italic; }
.tok-field { color: var(--purple); }

/* ---------------- Smart console ---------------- */
.SmartConsole { flex-shrink: 0; background: var(--panel); border-top: 1px solid var(--line); }
.SmartConsole__tabs { display: flex; align-items: center; gap: 2px; padding: 6px 10px 0; }
.ConsoleTab {
  font-family: var(--font-display); font-weight: 600; font-size: 12.5px;
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 6px 14px; border-radius: 8px 8px 0 0;
}
.ConsoleTab.is-active { color: var(--text); background: var(--canvas); }
.ConsoleTab__badge {
  background: var(--red); color: #fff; border-radius: 10px; font-size: 10px;
  padding: 1px 6px; margin-left: 4px;
}
.SmartConsole__spacer { flex: 1; }
.SaveState { font-family: var(--font-code); font-size: 11.5px; color: var(--muted); margin-right: 10px; }
.SaveState.is-dirty { color: var(--orange); }
.SaveState.is-saving { color: var(--blue); }
.SmartConsole__collapse { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.SmartConsole__pane { height: 150px; overflow-y: auto; background: var(--canvas); }
.SmartConsole.is-collapsed .SmartConsole__pane { display: none; }
.ConsoleLog { list-style: none; margin: 0; padding: 8px 14px; font-family: var(--font-code); font-size: 12.5px; line-height: 1.7; }
.ConsoleLog li { color: var(--muted); }
.ConsoleLog li .t { color: #565179; margin-right: 10px; font-size: 11px; }
.ConsoleLog li.success { color: var(--green); }
.ConsoleLog li.error { color: var(--red); }
.ConsoleLog li.info { color: var(--text); }

/* standalone JS: preview canvas surface */
.PreviewStage { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 8px; padding: 10px; }
#previewFrame { width: 360px; height: 360px; border: 1px solid var(--line); border-radius: 8px; background: #1c1a2b; }
.PreviewStage__hint { color: var(--muted); font-size: 11.5px; margin: 0; }
.SmartConsole__pane[data-pane="preview"] { height: 400px; }

/* link dialog bits */
.LinkSteps { color: var(--muted); font-size: 14px; margin: 0; padding-left: 20px; }
.LinkSteps li { margin: 4px 0; }
.LinkCode {
  display: flex; align-items: center; gap: 12px;
  background: var(--canvas); border-radius: var(--r-chunk); padding: 12px 16px;
}
.LinkCode code { font-size: 18px; font-weight: 700; color: var(--green); letter-spacing: .05em; flex: 1; }
.LinkHint { color: var(--muted); font-size: 13px; margin: 0; }

/* ---------------- responsive + a11y ---------------- */
@media (max-width: 900px) {
  .Hero { grid-template-columns: 1fr; }
  .Landing__strip { grid-template-columns: 1fr; }
  .TopNav { display: none; }
  .Xp__amount { display: none; }
  .CoursePanel { position: absolute; z-index: 15; height: 100%; box-shadow: var(--shadow); }
  .FileSidebar { width: 150px; }
  .Palette { position: absolute; right: 0; height: 100%; z-index: 15; box-shadow: var(--shadow); }
  .PlatformPick { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .DemoChunk { opacity: 1; transform: none; }
}
