/* DesignClass DrawingClass: look and feel. Brand tokens and header shared with DesignClass Render and Nets. */
/* Fonts are hosted alongside the app (Poppins + JetBrains Mono, SIL Open Font Licence): no third-party requests */
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/poppins-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/poppins-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/poppins-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/poppins-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 800; font-display: swap; src: url("../assets/fonts/poppins-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); }
/* DesignClass brand tokens (Brand & Style Guide 1.0) */
:root {
  --ink: #0A1020; --ink2: #121B36; --paper: #F4F2EC; --white: #FFFFFF;
  --blue: #2448FF; --blue-d: #1630D6; --cyan: #4FE3FF;
  --text: #121726; --pencil: #4D566A; --field: #C9CDD8;
  --danger: #E0352B; --ok: #1f9d55; --warn: #c27c0e;
  --line: rgba(18, 23, 38, .14); --line-dark: rgba(160, 195, 255, .22);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sans: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --panel-w: 320px; --tool-w: 76px; --header-h: 60px; --status-h: 40px;
  --blueprint:
    linear-gradient(rgba(120, 170, 255, .07) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(120, 170, 255, .07) 1px, transparent 1px) 0 0 / 40px 40px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font: 400 13px/1.45 var(--sans); color: var(--text); background: var(--paper); display: flex; flex-direction: column; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.ico { width: 22px; height: 22px; flex: none; display: block; }

/* ---------------------------------------------------------------- header */
.site-header {
  height: var(--header-h); flex: none; position: relative; z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 0 clamp(10px, 1.6vw, 20px); color: var(--white);
  background: radial-gradient(60% 180% at 85% 0%, rgba(36, 72, 255, .38), transparent 70%), var(--blueprint), var(--ink);
  border-bottom: 1px solid var(--line-dark);
}
.site-header :focus-visible { outline-color: var(--white); }
.brand { display: block; line-height: 0; flex: none; }
.brand img { height: 36px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; padding-left: 14px; border-left: 1px solid var(--line-dark); }
.eyebrow { font: 500 .64rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--cyan); white-space: nowrap; }
.app-name { font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; white-space: nowrap; }
.app-name .accent { color: var(--cyan); }
.mode-seg { display: flex; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 3px; margin-left: 8px; }
.mode-seg button { border: 0; background: transparent; color: #cdd6f4; font-weight: 600; font-size: .78rem; padding: 6px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.mode-seg button:hover { color: #fff; background: rgba(255,255,255,.1); }
.mode-seg button.active { background: var(--cyan); color: var(--ink); }
.header-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }

/* ---------------------------------------------------------------- buttons */
.btn {
  --h: 36px; display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: var(--h); padding: 0 1em; border-radius: 999px; border: 1.5px solid var(--text);
  background: transparent; color: var(--text); font-weight: 600; font-size: .8rem; line-height: 1.1;
  cursor: pointer; white-space: nowrap; user-select: none; text-align: center;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.btn:hover { background: var(--text); color: var(--white); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: var(--white); box-shadow: 0 8px 20px -10px var(--blue); }
.btn.primary:hover { background: var(--blue-d); border-color: var(--blue-d); }
.btn.ghost { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.5); color: var(--white); }
.btn.ghost:hover { background: rgba(255,255,255,.16); }
.btn.small { --h: 32px; padding: 0 .9em; font-size: .76rem; }
.btn.tiny { --h: 26px; padding: 0 .7em; font-size: .72rem; }
.btn.block { width: 100%; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.icon-only { padding: 0; width: var(--h); }
.btn.icon-only .ico { width: 18px; height: 18px; }
.btn:disabled { opacity: .45; pointer-events: none; }

/* ---------------------------------------------------------------- layout */
.layout { flex: 1; display: grid; grid-template-columns: var(--tool-w) minmax(0, 1fr) var(--panel-w); min-height: 0; }
body.panel-hidden .layout { grid-template-columns: var(--tool-w) minmax(0, 1fr) 0; }
body.panel-hidden .panel { display: none; }

/* ---------------------------------------------------------------- toolbar */
.toolbar { background: var(--ink2); color: #dfe6ff; overflow-y: auto; overflow-x: hidden; padding: 6px 6px 20px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; scrollbar-color: #6f82b8 transparent; }
.toolbar .grp-title { font: 600 .58rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: #7186bb; padding: 10px 4px 4px; text-align: center; }
.toolbar .grp { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.tool-btn { position: relative; border: 0; background: transparent; color: inherit; border-radius: 9px; height: 34px; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.tool-btn:hover { background: rgba(255,255,255,.1); }
.tool-btn.active { background: var(--blue); color: #fff; box-shadow: 0 6px 14px -6px var(--blue); }
.tool-btn .ico { width: 20px; height: 20px; }
/* BGE: labelled buttons, two to a row, so the whole toolbar (dimensions, iso box, library) fits a school-laptop screen.
   Each group starts at the height of its icons and labels and grows with the window, in proportion to its number of
   rows (--rows, counted from its buttons), until every row is 48px. A window too short even for that scrolls. */
body.mode-bge { --tool-w: 132px; }
body.mode-bge .toolbar { padding: 4px 3px; gap: 0; }
body.mode-bge .toolbar .grp { --rows: 1; grid-template-columns: 1fr 1fr; flex: var(--rows) 0 auto; min-height: min-content; max-height: calc(var(--rows) * 50px - 2px); }
body.mode-bge .toolbar .grp:has(> :nth-child(3)) { --rows: 2; }
body.mode-bge .toolbar .grp:has(> :nth-child(5)) { --rows: 3; }
body.mode-bge .toolbar .grp:has(> :nth-child(7)) { --rows: 4; }
body.mode-bge .toolbar .grp:has(> :nth-child(9)) { --rows: 5; }
body.mode-bge .toolbar .grp:has(> :nth-child(11)) { --rows: 6; }
body.mode-bge .toolbar .grp:has(> :nth-child(13)) { --rows: 7; }
body.mode-bge .toolbar .grp:has(> :nth-child(15)) { --rows: 8; }
body.mode-bge .toolbar .grp-title { flex: none; padding: 6px 4px 1px; }
body.mode-bge .tool-btn { height: auto; min-height: 0; flex-direction: column; gap: 1px; padding: 1px 2px; }
body.mode-bge .tool-btn .ico { flex: none; width: 18px; height: 18px; }
.tool-btn .tl { display: none; font-size: .6rem; font-weight: 600; line-height: 1.05; text-align: center; }
body.mode-bge .tool-btn .tl { display: block; }
.tip { position: fixed; z-index: 100; background: var(--ink); color: #fff; padding: 8px 11px; border-radius: 10px; max-width: 290px; font-size: .76rem; line-height: 1.4; pointer-events: none; box-shadow: 0 12px 28px -12px rgba(0,0,0,.6); }
.tip b { color: var(--cyan); display: block; font-size: .8rem; margin-bottom: 2px; }
.tip kbd { font-family: var(--mono); font-size: .7rem; background: rgba(255,255,255,.14); border-radius: 4px; padding: 0 4px; }

/* ---------------------------------------------------------------- work area */
.work { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.optbar { flex: none; min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: var(--white); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.optbar .tool-name { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: .86rem; padding-right: 8px; border-right: 1px solid var(--line); }
.optbar .tool-name .ico { width: 20px; height: 20px; color: var(--blue); }
.optbar label.opt { display: flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--pencil); white-space: nowrap; }
.optbar select, .optbar input[type=number], .optbar input[type=text] { height: 30px; border: 1px solid var(--field); border-radius: 8px; padding: 0 8px; background: #fff; color: var(--text); font-size: .78rem; }
.optbar input[type=number] { width: 74px; }
.optbar .seg { display: inline-flex; border: 1px solid var(--field); border-radius: 9px; overflow: hidden; }
.optbar .seg button { border: 0; background: #fff; padding: 0 10px; height: 28px; font-size: .74rem; cursor: pointer; border-right: 1px solid var(--field); white-space: nowrap; }
.optbar .seg button:last-child { border-right: 0; }
.optbar .seg button.active { background: var(--blue); color: #fff; }
.optbar .spacer { flex: 1; }
.optbar .layer-pick { display: flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--pencil); }
.optbar .swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,.25); display: inline-block; }
.canvas-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #d9dce3; }
#canvas { position: absolute; inset: 0; display: block; outline: none; touch-action: none; cursor: crosshair; }
#canvas.pick { cursor: pointer; }
#canvas.select { cursor: default; }
#canvas.panning { cursor: grabbing; }
.view-tools { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 4px; z-index: 5; }
.view-tools button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.94); cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text); box-shadow: 0 6px 14px -10px rgba(0,0,0,.5); }
.view-tools button:hover { background: var(--text); color: #fff; }
.view-tools button.on { background: var(--blue); color: #fff; }
.view-tools .ico { width: 18px; height: 18px; }
.hint-card { position: absolute; left: 12px; top: 12px; max-width: 340px; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 12px; padding: 10px 34px 10px 12px; font-size: .78rem; box-shadow: 0 16px 32px -24px rgba(0,0,0,.5); z-index: 4; }
.hint-card b { display: block; font-size: .84rem; margin-bottom: 2px; }
.hint-card .x { position: absolute; top: 6px; right: 6px; border: 0; background: none; cursor: pointer; color: var(--pencil); width: 24px; height: 24px; padding: 2px; }
.text-editor { position: absolute; z-index: 8; min-width: 120px; border: 2px solid var(--blue); border-radius: 6px; background: rgba(255,255,255,.97); padding: 2px 6px; font-family: Arial, Helvetica, sans-serif; resize: none; outline: none; line-height: 1.3; white-space: pre; overflow: hidden; }
.ctx-menu { position: absolute; z-index: 9; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 5px; min-width: 190px; box-shadow: 0 18px 40px -18px rgba(0,0,0,.55); }
.ctx-menu button { display: flex; width: 100%; align-items: center; gap: 9px; border: 0; background: none; padding: 7px 10px; border-radius: 8px; cursor: pointer; text-align: left; font-size: .8rem; }
.ctx-menu button:hover { background: #eef1ff; }
.ctx-menu button .ico { width: 17px; height: 17px; color: var(--pencil); }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.ctx-menu .k { margin-left: auto; font: 500 .66rem var(--mono); color: var(--pencil); }
.toast { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 12px; font-size: .8rem; max-width: min(640px, 90%); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 10; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--danger); }
.boot-status { position: absolute; inset: 30% 10% auto; background: #fff; border-radius: 14px; padding: 18px; border: 2px solid var(--danger); text-align: center; z-index: 20; }

/* ---------------------------------------------------------------- right panel */
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--paper); border-left: 1px solid var(--line); }
.tabs { display: flex; flex: none; border-bottom: 1px solid var(--line); background: #fff; }
.tabs button { flex: 1; border: 0; background: none; padding: 11px 2px 9px; font-size: .74rem; font-weight: 600; color: var(--pencil); cursor: pointer; border-bottom: 3px solid transparent; }
.tabs button.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-body { flex: 1; overflow-y: auto; padding: 12px 12px 40px; min-height: 0; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; box-shadow: 0 18px 34px -30px rgba(18,23,38,.5); }
.card h3 { margin: 0 0 8px; font-size: .84rem; display: flex; align-items: center; gap: 8px; }
.card h3 .ico { width: 18px; height: 18px; color: var(--blue); }
.card h4 { margin: 10px 0 6px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pencil); }
.field { display: grid; grid-template-columns: 104px 1fr; align-items: center; gap: 8px; margin: 6px 0; font-size: .78rem; }
.field > span { color: var(--pencil); }
.field input[type=text], .field input[type=number], .field select, .field textarea { width: 100%; height: 30px; border: 1px solid var(--field); border-radius: 8px; padding: 0 8px; background: #fff; font-size: .78rem; min-width: 0; }
.field textarea { height: auto; min-height: 56px; padding: 6px 8px; resize: vertical; font-family: Arial, sans-serif; }
.field input[type=color] { width: 44px; height: 28px; border: 1px solid var(--field); border-radius: 6px; padding: 0 2px; background: #fff; }
.field .row { display: flex; gap: 6px; align-items: center; }
.field.wide { grid-template-columns: 1fr; }
.check { display: flex; align-items: center; gap: 8px; font-size: .78rem; margin: 6px 0; cursor: pointer; }
.muted { color: var(--pencil); font-size: .74rem; }
.help-text { font-size: .76rem; color: var(--pencil); margin: 4px 0 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: .76rem; }
.kv b { font-family: var(--mono); font-weight: 500; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
/* layers */
.layer-list { display: flex; flex-direction: column; gap: 4px; }
.layer-row { display: grid; grid-template-columns: 20px 1fr 26px 26px 26px; align-items: center; gap: 4px; padding: 5px 6px; border-radius: 9px; background: #fff; border: 1px solid var(--line); font-size: .76rem; cursor: pointer; }
.layer-row.current { border-color: var(--blue); box-shadow: inset 3px 0 0 var(--blue); }
.layer-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-row .name small { display: block; color: var(--pencil); font-size: .64rem; }
.layer-row .ib { width: 26px; height: 26px; border: 0; background: none; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--pencil); padding: 0; }
.layer-row .ib:hover { background: #eef1ff; color: var(--text); }
.layer-row .ib .ico { width: 16px; height: 16px; }
.layer-row .ib.off { color: var(--danger); }
.lt-sample { display: block; width: 100%; height: 6px; margin-top: 2px; }
/* library */
.lib-search { width: 100%; height: 34px; border: 1px solid var(--field); border-radius: 10px; padding: 0 10px; margin-bottom: 8px; background: #fff; }
.lib-cats { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.lib-cats button { border: 1px solid var(--field); background: #fff; border-radius: 999px; padding: 3px 9px; font-size: .7rem; cursor: pointer; }
.lib-cats button.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.lib-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.lib-item { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 4px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .64rem; text-align: center; line-height: 1.15; min-height: 92px; }
.lib-item:hover { border-color: var(--blue); box-shadow: 0 8px 18px -12px var(--blue); }
.lib-item.active { border-color: var(--blue); background: #eef1ff; }
.lib-item svg { width: 100%; height: 58px; }

/* ---------------------------------------------------------------- status bar */
/* The prompt is the pupil's step-by-step instruction, so it wraps to two lines rather than losing its end.
   The bar keeps a constant height whatever the prompt says (the drawing would jump if it changed). */
.statusbar { min-height: var(--status-h); flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 4px 10px; background: var(--ink); color: #dfe6ff; font-size: .74rem; border-top: 1px solid var(--line-dark); }
.prompt { flex: 1 1 0; min-width: 0; color: #fff; font-weight: 500; line-height: 1.25; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.cmd { display: flex; align-items: center; gap: 6px; flex: 0 1 220px; min-width: 180px; }
.cmd-label { font: 600 .6rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--cyan); }
#cmdInput { flex: 1; height: 28px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; padding: 0 9px; font: 500 .78rem var(--mono); min-width: 0; }
#cmdInput::placeholder { color: rgba(220,230,255,.45); }
#cmdInput:focus { outline: 2px solid var(--cyan); outline-offset: 0; background: rgba(255,255,255,.14); }
.coords { font: 500 .72rem var(--mono); white-space: nowrap; color: #c9d3ee; min-width: 150px; text-align: right; }
.toggles { display: flex; gap: 3px; }
.toggles button { border: 1px solid rgba(255,255,255,.22); background: transparent; color: #8fa0cf; font: 700 .62rem var(--mono); letter-spacing: .04em; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.toggles button.on { background: rgba(79,227,255,.16); color: var(--cyan); border-color: rgba(79,227,255,.6); }

/* ---------------------------------------------------------------- modal */
.modal { position: fixed; inset: 0; background: rgba(10,16,32,.55); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: #fff; border-radius: 20px; max-width: 760px; width: 100%; max-height: calc(100vh - 32px); overflow: auto; padding: 22px 24px; box-shadow: 0 40px 80px -30px rgba(0,0,0,.6); position: relative; }
.modal-card h2 { margin: 0 0 6px; font-size: 1.3rem; letter-spacing: -.01em; }
.modal-card h3 { margin: 16px 0 6px; font-size: .95rem; }
.modal-card p, .modal-card li { font-size: .84rem; }
.modal-card .close { position: absolute; top: 12px; right: 12px; border: 0; background: none; cursor: pointer; width: 34px; height: 34px; border-radius: 10px; }
.modal-card .close:hover { background: #eef1ff; }
.modal-card table { border-collapse: collapse; width: 100%; font-size: .8rem; }
.modal-card td, .modal-card th { border-bottom: 1px solid var(--line); padding: 5px 6px; text-align: left; vertical-align: top; }
.modal-card kbd, .modal-card code { font-family: var(--mono); font-size: .76rem; background: #eef1ff; border-radius: 5px; padding: 1px 5px; }
.mode-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.mode-cards button { border: 2px solid var(--field); background: #fff; border-radius: 14px; padding: 12px 10px; cursor: pointer; text-align: left; font-size: .76rem; }
.mode-cards button b { display: block; font-size: 1rem; margin-bottom: 2px; }
.mode-cards button.active, .mode-cards button:hover { border-color: var(--blue); background: #eef1ff; }
.export-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.export-grid button { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 12px; cursor: pointer; text-align: left; font-size: .76rem; color: var(--pencil); }
.export-grid button b { display: block; color: var(--text); font-size: .9rem; }
.export-grid button:hover { border-color: var(--blue); box-shadow: 0 10px 22px -16px var(--blue); }
.check-list { list-style: none; padding: 0; margin: 8px 0; }
.check-list li { padding: 7px 10px; border-radius: 10px; margin-bottom: 5px; background: #f6f7fb; display: flex; gap: 8px; align-items: flex-start; }
.check-list li.bad { background: #fdecea; }
.check-list li.warn { background: #fff4de; }
.check-list li.good { background: #e7f6ee; }

/* ---------------------------------------------------------------- printing */
#printArea { display: none; }
@media print {
  @page { margin: 0; }
  body > *:not(#printArea) { display: none !important; }
  body { display: block; overflow: visible; background: #fff; height: auto; }
  #printArea { display: block !important; }
  #printArea svg { display: block; page-break-after: always; }
}

/* ---------------------------------------------------------------- small screens */
.wide-only { }
/* Too narrow for the prompt beside the typing box: the prompt gets the whole top row of the status bar.
   One line holds every prompt down to about 960px wide. */
@media (max-width: 1319px) {
  .prompt { flex: 1 1 100%; -webkit-line-clamp: 1; line-clamp: 1; min-height: 1.25em; }
  .cmd { flex: 1 1 180px; }
}
@media (max-width: 1100px) {
  :root { --panel-w: 280px; }
  .eyebrow { display: none; }
}
/* Below 960px the longest prompts need two lines: always keep room for both so the bar never changes height */
@media (max-width: 960px) {
  .prompt { -webkit-line-clamp: 2; line-clamp: 2; height: 2.5em; }
}
/* Narrow screens: the right panel folds into a rail of tab names at the right edge of the drawing.
   It opens over the drawing while the pupil points at it, works in it or after a tab is chosen (body.panel-open),
   and folds away again when they click back on the drawing. */
@media (max-width: 860px) {
  :root { --tool-w: 58px; --panel-rail: 34px; }
  body.mode-bge { --tool-w: 76px; } /* one column, wide enough for the labels ("Rectangle", "Construction line") */
  .brand-text { display: none; }
  .layout { position: relative; grid-template-columns: var(--tool-w) minmax(0, 1fr) var(--panel-rail); }
  .panel { overflow: hidden; }
  .panel .tabs { flex-direction: column; border-bottom: 0; }
  .panel .tabs button { flex: none; writing-mode: vertical-rl; padding: 12px 0; border-bottom: 0; border-left: 3px solid transparent; }
  .panel .tabs button.active { border-left-color: var(--blue); }
  .panel .tab-body { display: none; }
  :is(.panel:hover, .panel:focus-within, body.panel-open .panel) { position: absolute; top: 0; right: 0; bottom: 0; width: min(320px, 90vw); z-index: 25; box-shadow: -20px 0 40px -20px rgba(0,0,0,.4); }
  :is(.panel:hover, .panel:focus-within, body.panel-open .panel) .tabs { flex-direction: row; border-bottom: 1px solid var(--line); }
  :is(.panel:hover, .panel:focus-within, body.panel-open .panel) .tabs button { flex: 1; writing-mode: horizontal-tb; padding: 11px 2px 9px; border-left: 0; border-bottom: 3px solid transparent; }
  :is(.panel:hover, .panel:focus-within, body.panel-open .panel) .tabs button.active { border-bottom-color: var(--blue); }
  :is(.panel:hover, .panel:focus-within, body.panel-open .panel) .tab-body { display: block; }
  .coords, .cmd-label { display: none; }
  .toolbar .grp, body.mode-bge .toolbar .grp { grid-template-columns: 1fr; }
  body.mode-bge .toolbar .grp { flex: none; max-height: none; }
  .mode-seg button { padding: 6px 8px; }
}
/* Only a phone is too narrow for Save in the header (Ctrl+S and Export › Save project still work there) */
@media (max-width: 640px) {
  .wide-only { display: none; }
}
