/* ============ Scale Kingdom — fantasy village builder theme ============ */
:root {
  --grass-1: #7cc242;
  --grass-2: #5fa832;
  --grass-3: #3f7f22;
  --wood-1: #b5793f;
  --wood-2: #8a5426;
  --wood-3: #5b3414;
  --stone-1: #e9e1cc;
  --stone-2: #d4c8a8;
  --stone-3: #a8997a;
  --parch: #fbf3dc;
  --ink: #2b1d0e;
  --ink-soft: #5a4630;
  --gold: #ffcc2e;
  --gold-dark: #c98a00;
  --green: #6ccf3b;
  --green-dark: #3b8c17;
  --blue: #3fa9f5;
  --blue-dark: #1d6db3;
  --red: #f0503c;
  --red-dark: #a3241a;
  --purple: #b05cf0;
  --purple-dark: #6f2aa8;
  --outline: #23160a;
  --radius: 14px;
  --shadow: 0 5px 0 rgba(0,0,0,.35);
  --font-head: 'Lilita One', 'Trebuchet MS', sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.08) 0 2px, transparent 3px) 0 0/38px 38px,
    radial-gradient(circle at 70% 80%, rgba(0,0,0,.06) 0 2px, transparent 3px) 0 0/52px 52px,
    linear-gradient(180deg, var(--grass-1), var(--grass-2) 60%, var(--grass-3));
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: var(--blue-dark); }
h1, h2, h3, .head { font-family: var(--font-head); font-weight: 400; letter-spacing: .5px; }
.stroke {
  color: #fff;
  text-shadow: -2px -2px 0 var(--outline), 2px -2px 0 var(--outline), -2px 2px 0 var(--outline), 2px 2px 0 var(--outline), 0 4px 0 var(--outline);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px;
  background: repeating-linear-gradient(90deg, var(--wood-1) 0 46px, var(--wood-2) 46px 48px);
  border-bottom: 4px solid var(--wood-3);
  box-shadow: 0 4px 0 rgba(0,0,0,.25);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand-icon { font-size: 28px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
.brand-text { font-family: var(--font-head); font-size: 24px; color: #fff;
  text-shadow: -2px -2px 0 var(--outline), 2px -2px 0 var(--outline), -2px 2px 0 var(--outline), 2px 2px 0 var(--outline), 0 3px 0 var(--outline); }
.resources { margin-left: auto; display: flex; gap: 10px; }
.res {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,.45); border: 2px solid var(--outline); border-radius: 20px;
  padding: 2px 12px 2px 6px; color: #fff; font-family: var(--font-head); font-size: 17px;
}
.res span { font-size: 18px; }
.menu-btn { display: none; font-size: 24px; background: var(--gold); border: 3px solid var(--outline); border-radius: 10px; cursor: pointer; }

/* ---------- side nav ---------- */
.sidenav {
  position: fixed; top: 60px; left: 0; bottom: 0; width: 220px; z-index: 40;
  padding: 14px 10px; overflow-y: auto;
  background: linear-gradient(180deg, rgba(60,36,14,.92), rgba(40,24,8,.95));
  border-right: 4px solid var(--outline);
}
.sidenav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 6px; border-radius: 12px;
  color: #fff; text-decoration: none; font-family: var(--font-head); font-size: 17px; letter-spacing: .4px;
  border: 2px solid transparent;
}
.sidenav a:hover { background: rgba(255,255,255,.1); }
.sidenav a.active { background: linear-gradient(180deg, var(--gold), #f3a712); color: var(--ink); border-color: var(--outline); box-shadow: 0 3px 0 var(--outline); }
main { margin-left: 220px; padding: 24px; max-width: 1400px; }

/* ---------- panels ---------- */
.panel {
  background: linear-gradient(180deg, var(--parch), var(--stone-1));
  border: 3px solid var(--outline); border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 -4px 0 rgba(0,0,0,.08), inset 0 3px 0 rgba(255,255,255,.7);
  padding: 20px;
}
.panel.wood {
  background: repeating-linear-gradient(0deg, var(--wood-1) 0 22px, var(--wood-2) 22px 24px);
  color: #fff;
}
.banner {
  display: inline-block; position: relative;
  background: linear-gradient(180deg, #e2483a, #b02a1e); color: #fff;
  border: 3px solid var(--outline); border-radius: 10px; padding: 6px 22px;
  font-family: var(--font-head); font-size: 22px; box-shadow: 0 4px 0 var(--outline);
  text-shadow: 0 2px 0 var(--outline);
}
.page-title { margin: 0 0 6px; font-size: 40px; }
.page-sub { margin: 0 0 22px; color: #fff; font-weight: 700; text-shadow: 0 2px 0 rgba(0,0,0,.4); font-size: 17px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-head); font-size: 18px; letter-spacing: .5px; color: #fff;
  padding: 9px 20px; border-radius: 12px; border: 3px solid var(--outline); cursor: pointer;
  background: linear-gradient(180deg, #8ee35a 0%, var(--green) 50%, var(--green-dark) 100%);
  box-shadow: 0 4px 0 var(--outline), inset 0 2px 0 rgba(255,255,255,.5);
  text-shadow: 0 2px 0 rgba(0,0,0,.45); text-decoration: none; user-select: none;
  transition: transform .06s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--outline); }
.btn.gold { background: linear-gradient(180deg, #ffe680, var(--gold) 50%, var(--gold-dark)); color: var(--ink); text-shadow: 0 1px 0 rgba(255,255,255,.6); }
.btn.blue { background: linear-gradient(180deg, #8fd0ff, var(--blue) 50%, var(--blue-dark)); }
.btn.red { background: linear-gradient(180deg, #ff9284, var(--red) 50%, var(--red-dark)); }
.btn.purple { background: linear-gradient(180deg, #dca6ff, var(--purple) 50%, var(--purple-dark)); }
.btn.grey { background: linear-gradient(180deg, #eee, #bbb 50%, #888); color: var(--ink); text-shadow: none; }
.btn.small { font-size: 14px; padding: 5px 12px; border-width: 2px; box-shadow: 0 3px 0 var(--outline); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.chip {
  display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 20px;
  border: 2px solid var(--outline); background: var(--stone-2); color: var(--ink);
}
.chip.easy { background: #b6ef8f; } .chip.medium { background: #ffe07a; } .chip.hard { background: #ff9a8a; }

/* ---------- grid cards ---------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { position: relative; padding: 18px; }
.card h3 { margin: 6px 0 8px; font-size: 21px; }
.card p { margin: 0 0 12px; color: var(--ink-soft); }

/* ---------- home village ---------- */
.hero { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-bottom: 24px; }
.hero h1 { font-size: 52px; margin: 0; }
.hero p { color: #fff; font-weight: 800; font-size: 19px; text-shadow: 0 2px 0 rgba(0,0,0,.4); max-width: 640px; }
.village {
  position: relative; display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.building { position: relative;
  text-decoration: none; color: var(--ink); text-align: center; padding: 18px 14px 16px;
  transition: transform .12s;
}
.building:hover { transform: translateY(-5px) rotate(-1deg); }
.building .ico { font-size: 58px; filter: drop-shadow(0 5px 0 rgba(0,0,0,.25)); display: block; }
.building .name { font-family: var(--font-head); font-size: 21px; margin-top: 6px; }
.building .desc { font-size: 14px; color: var(--ink-soft); margin-top: 4px; }
.building .lvl { position: absolute; top: -12px; right: -10px; }
.building.featured { grid-column: span 2; background: linear-gradient(180deg, #fff3c4, #ffd76a); }
.stats-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 20px 0; }
.stat { flex: 1; min-width: 160px; text-align: center; }
.stat b { display: block; font-family: var(--font-head); font-size: 32px; }
.progress { height: 18px; background: #3b2a16; border: 2px solid var(--outline); border-radius: 10px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(180deg, #a6f27a, var(--green) 60%, var(--green-dark)); transition: width .4s; }
.progress.gold > div { background: linear-gradient(180deg, #fff09a, var(--gold) 60%, var(--gold-dark)); }

/* ---------- library / blog ---------- */
.learn-layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.chapters { max-height: calc(100vh - 110px); overflow-y: auto; position: sticky; top: 80px; padding: 14px; }
.chapter-title { font-family: var(--font-head); font-size: 17px; margin: 14px 0 6px; color: var(--wood-3); }
.chapter-title:first-child { margin-top: 0; }
.lesson-link {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 14px;
}
.lesson-link:hover { background: rgba(0,0,0,.06); }
.lesson-link.active { background: var(--gold); border: 2px solid var(--outline); }
.lesson-link .num { min-width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--stone-2); border: 2px solid var(--outline); font-size: 12px; }
.lesson-link.done .num { background: var(--green); color: #fff; }
.article { padding: 32px 40px; font-size: 18px; line-height: 1.7; }
.article h1 { font-size: 36px; margin: 6px 0 4px; line-height: 1.15; }
.article h2 { font-size: 25px; margin: 28px 0 8px; color: var(--wood-3); }
.article h3 { font-size: 20px; margin: 20px 0 6px; }
.article p { margin: 0 0 14px; }
.article ul, .article ol { margin: 0 0 14px; padding-left: 26px; }
.article li { margin-bottom: 6px; }
.article code { background: #efe3c2; padding: 1px 6px; border-radius: 5px; font-size: .92em; }
.article pre { background: #2b1d0e; color: #ffe9b0; padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-size: 15px; line-height: 1.5; border: 3px solid var(--outline); }
.article blockquote { margin: 0 0 14px; padding: 12px 16px; border-left: 6px solid var(--gold); background: #fff6d6; border-radius: 0 10px 10px 0; }
.article table { border-collapse: collapse; margin: 0 0 16px; width: 100%; font-size: 16px; }
.article th, .article td { border: 2px solid var(--stone-3); padding: 6px 10px; text-align: left; }
.article th { background: var(--stone-2); }
.article .meta { color: var(--ink-soft); font-weight: 700; font-size: 14px; }
.article-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.tldr { background: #e5f6d6; border: 3px dashed var(--green-dark); border-radius: 12px; padding: 12px 16px; margin: 18px 0; }

/* ---------- quiz ---------- */
.quiz-wrap { max-width: 820px; margin: 0 auto; }
.mode-cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.q-card { padding: 26px; }
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.q-text { font-size: 21px; font-weight: 800; line-height: 1.4; margin: 6px 0 18px; }
.options { display: grid; gap: 10px; }
.opt {
  text-align: left; font: inherit; font-weight: 700; font-size: 17px;
  padding: 12px 16px; border-radius: 12px; border: 3px solid var(--outline); cursor: pointer;
  background: #fff; box-shadow: 0 3px 0 var(--outline); color: var(--ink);
}
.opt:hover:not([disabled]) { background: #fff8db; }
.opt.correct { background: #b6ef8f; }
.opt.wrong { background: #ff9a8a; }
.opt[disabled] { cursor: default; }
.explain { margin-top: 16px; padding: 12px 16px; border-radius: 12px; background: #fff6d6; border: 2px dashed var(--gold-dark); }
.journey-map { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.journey-node {
  width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--outline);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-head);
  background: var(--stone-2); box-shadow: 0 3px 0 var(--outline);
}
.journey-node.done { background: var(--green); color: #fff; }
.journey-node.current { background: var(--gold); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.12); } }
.stars { font-size: 46px; letter-spacing: 6px; }
.stars .off { filter: grayscale(1) brightness(.6); }

/* ---------- forms ---------- */
select, input[type=text], input[type=number], textarea {
  font: inherit; padding: 8px 12px; border-radius: 10px; border: 3px solid var(--outline); background: #fff; color: var(--ink);
}
textarea { width: 100%; min-height: 200px; resize: vertical; line-height: 1.6; font-size: 16px; }
label.field { display: block; font-weight: 800; margin-bottom: 12px; }
label.field > * { display: block; margin-top: 4px; }

/* ---------- long answers ---------- */
.long-layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.keypoint { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--stone-3); }
.keypoint.hit::before { content: '✅'; }
.keypoint.miss::before { content: '❌'; }

/* ---------- media ---------- */
.video-card iframe { width: 100%; aspect-ratio: 16/9; border: 3px solid var(--outline); border-radius: 10px; background: #000; }
.creator-card .avatar { font-size: 44px; }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.book-card .cover {
  height: 150px; border-radius: 8px; border: 3px solid var(--outline); display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 10px; font-family: var(--font-head); font-size: 18px; color: #fff; margin-bottom: 10px;
  text-shadow: 0 2px 0 rgba(0,0,0,.5);
}
.affiliate-note { font-size: 13px; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.5); margin: 0 0 16px; }

/* ---------- editor ---------- */
.editor-shell { display: grid; grid-template-columns: 210px 1fr 230px; height: calc(100vh - 150px); min-height: 560px;
  border: 3px solid var(--outline); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #fff; }
.editor-shell.with-brief { grid-template-columns: 210px 1fr 300px; }
.ed-palette, .ed-props { background: var(--parch); overflow-y: auto; padding: 10px; }
.ed-palette { border-right: 3px solid var(--outline); }
.ed-props { border-left: 3px solid var(--outline); }
.ed-palette h4, .ed-props h4 { font-family: var(--font-head); font-weight: 400; margin: 10px 0 6px; font-size: 15px; color: var(--wood-3); }
.pal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pal-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 8px;
  border: 2px solid var(--stone-3); background: #fff; cursor: grab; font-size: 11px; font-weight: 800; text-align: center; user-select: none;
}
.pal-item:hover { border-color: var(--outline); background: #fff8db; }
.pal-item .pi { font-size: 22px; line-height: 1; }
.pal-item svg { width: 34px; height: 24px; }
.ed-main { position: relative; display: flex; flex-direction: column; min-width: 0; }
.ed-toolbar { display: flex; gap: 6px; padding: 6px 8px; background: var(--stone-1); border-bottom: 3px solid var(--outline); flex-wrap: wrap; align-items: center; }
.tool { font: inherit; font-weight: 800; font-size: 13px; padding: 4px 10px; border: 2px solid var(--outline); border-radius: 8px; background: #fff; cursor: pointer; }
.tool.on { background: var(--gold); }
.tool:hover { background: #fff8db; }
.ed-canvas { flex: 1; position: relative; overflow: hidden; background: #fbfaf6; cursor: default; }
.ed-canvas svg { width: 100%; height: 100%; display: block; touch-action: none; }
.ed-canvas.panning { cursor: grabbing; }
.ed-text-input { position: absolute; z-index: 5; font: 600 14px var(--font-body); text-align: center; border: 2px solid var(--blue); border-radius: 6px; padding: 4px; resize: none; background: #fff; min-height: 0; }
.node-hover .port { opacity: 1; }
.port { opacity: 0; cursor: crosshair; }
g.node:hover .port { opacity: 1; }
.ed-props .row { margin-bottom: 10px; font-size: 13px; font-weight: 800; }
.ed-props .row input, .ed-props .row select { width: 100%; margin-top: 3px; padding: 4px 8px; border-width: 2px; font-size: 13px; }
.swatches { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--outline); cursor: pointer; }
.ed-hint { position: absolute; bottom: 8px; left: 10px; font-size: 12px; color: #776; pointer-events: none; }
.ed-zoom { position: absolute; bottom: 8px; right: 10px; display: flex; gap: 4px; }

/* ---------- practice ---------- */
.brief h3 { margin: 4px 0 6px; }
.brief ul { padding-left: 18px; margin: 4px 0 10px; font-size: 14px; }
.brief p { font-size: 14px; margin: 4px 0 10px; }

/* ---------- Build & Defend (playground) ---------- */
.play-layout { display: grid; grid-template-columns: 230px 1fr 300px; gap: 14px; align-items: start; }
.shop { padding: 12px; }
.shop h3 { margin: 0 0 8px; font-size: 20px; }
.shop-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; margin-bottom: 6px; border-radius: 10px;
  background: #fff; border: 2px solid var(--outline); cursor: grab; font-weight: 800; font-size: 14px; user-select: none;
  box-shadow: 0 2px 0 var(--outline);
}
.shop-item:hover { background: #fff8db; }
.shop-item .si { font-size: 24px; }
.shop-item small { display: block; font-weight: 600; color: var(--ink-soft); font-size: 11px; }
.battlefield {
  position: relative; height: 620px; border-radius: var(--radius); border: 4px solid var(--outline); overflow: hidden;
  background:
    radial-gradient(circle at 15% 25%, rgba(255,255,255,.14) 0 12px, transparent 13px),
    radial-gradient(circle at 75% 65%, rgba(0,0,0,.08) 0 18px, transparent 19px),
    repeating-linear-gradient(45deg, #6dbb3a 0 20px, #66b235 20px 40px);
  box-shadow: var(--shadow), inset 0 0 40px rgba(0,0,0,.25);
}
.battlefield svg.roads { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.bf-building {
  position: absolute; width: 96px; text-align: center; cursor: grab; user-select: none;
  transform: translate(-50%, -50%);
}
.bf-building .base {
  width: 76px; height: 64px; margin: 0 auto; border-radius: 14px; border: 3px solid var(--outline);
  background: linear-gradient(180deg, #e6dbbf, #b9a57c); display: flex; align-items: center; justify-content: center;
  font-size: 36px; box-shadow: 0 6px 0 rgba(0,0,0,.35); position: relative;
}
.bf-building.selected .base { outline: 4px solid var(--gold); outline-offset: 2px; }
.bf-building.linking .base { outline: 4px dashed var(--blue); outline-offset: 2px; }
.bf-building .label { font-family: var(--font-head); font-size: 13px; color: #fff; margin-top: 4px; line-height: 1.1;
  text-shadow: -1px -1px 0 var(--outline), 1px -1px 0 var(--outline), -1px 1px 0 var(--outline), 1px 1px 0 var(--outline); }
.bf-building .hp { height: 8px; background: #3b2a16; border: 2px solid var(--outline); border-radius: 6px; margin: 3px auto 0; width: 70px; overflow: hidden; }
.bf-building .hp > div { height: 100%; width: 0%; background: var(--green); transition: width .4s, background .4s; }
.bf-building.overloaded .base { animation: shake .3s infinite; background: linear-gradient(180deg, #ffb0a0, #e2483a); }
.bf-building.overloaded .base::after { content: '🔥'; position: absolute; top: -18px; right: -12px; font-size: 26px; }
.bf-building .badge { position: absolute; top: -14px; left: -14px; white-space: nowrap; font-size: 10px; font-weight: 800; background: var(--gold); border: 2px solid var(--outline); border-radius: 8px; padding: 0 5px; }
@keyframes shake { 25% { transform: translateX(-2px) rotate(-2deg); } 75% { transform: translateX(2px) rotate(2deg); } }
.troop { position: absolute; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--outline); background: var(--gold); pointer-events: none; z-index: 4; }
.troop.bad { background: var(--red); }
.bf-overlay { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 6; }
.mission-card { padding: 14px; }
.mission-card h3 { margin: 0 0 4px; }
.req { font-size: 14px; padding: 4px 0; border-bottom: 1px dashed var(--stone-3); }
.req.ok::before { content: '✅ '; } .req.fail::before { content: '❌ '; } .req.todo::before { content: '⬜ '; }
.report { font-size: 14px; }
.report .line { padding: 6px 0; border-bottom: 1px dashed var(--stone-3); }
.missions-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.db-choice { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin: 12px 0; }
.db-choice button { text-align: left; font: inherit; padding: 12px; border-radius: 12px; border: 3px solid var(--outline); background: #fff; cursor: pointer; box-shadow: 0 3px 0 var(--outline); }
.db-choice button:hover { background: #fff8db; }
.db-choice button b { font-family: var(--font-head); font-weight: 400; font-size: 18px; display: block; }
.db-choice button small { color: var(--ink-soft); font-weight: 600; }

/* ---------- modal & toast ---------- */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(20,10,0,.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal.hidden { display: none; }
.modal-card { max-width: 720px; width: 100%; max-height: 90vh; overflow-y: auto; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(140px); z-index: 120;
  background: var(--gold); border: 3px solid var(--outline); border-radius: 14px; padding: 10px 20px; font-family: var(--font-head); font-size: 18px;
  box-shadow: 0 4px 0 var(--outline); transition: transform .25s; }
.toast.show { transform: translateX(-50%) translateY(0); }

.muted { color: var(--ink-soft); }
.row-flex { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { height: 18px; }
.center { text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .play-layout { grid-template-columns: 1fr; }
  .editor-shell, .editor-shell.with-brief { grid-template-columns: 170px 1fr; }
  .ed-props { display: none; }
  .ed-props.brief-panel { display: block; grid-column: 1 / -1; border-left: 0; border-top: 3px solid var(--outline); max-height: 260px; }
}
@media (max-width: 860px) {
  .sidenav { transform: translateX(-100%); transition: transform .2s; }
  .sidenav.open { transform: none; }
  main { margin-left: 0; padding: 16px; }
  .menu-btn { display: block; }
  .learn-layout, .long-layout { grid-template-columns: 1fr; }
  .chapters { position: relative; top: 0; max-height: 320px; }
  .article { padding: 20px 18px; font-size: 17px; }
  .building.featured { grid-column: auto; }
  .hero h1 { font-size: 38px; }
  .brand-text { font-size: 19px; }
  .res { font-size: 14px; padding: 2px 8px 2px 4px; }
  .editor-shell, .editor-shell.with-brief { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: 80vh; }
  .ed-palette { border-right: 0; border-bottom: 3px solid var(--outline); max-height: 130px; }
  .pal-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
  .battlefield { height: 480px; }
}
