/* The lesson screen: the Blackout family (dark, Chakra Petch, JetBrains Mono, cyan Run). Sized in rem, and the rem
   follows the window so the whole screen fits the LaunchPad's small frame and a big monitor alike (16px at 1024x768). */
:root {
  --night: #0f1828;
  --deep: #0b1220;
  --panel: #152238;
  --rule: #24344f;
  --text: #e8eef8;
  --dim: #8c9bb4;
  --run: #3ee8ff;
  --slot: #ffb547;
  --cloud: #d9e6ff;
  --right: #4ade80;
  --wrong: #ff7a7a;
  --c-fn: #7cc4ff;
  --c-str: #ffd38a;
  --c-kw: #ff8fb0;
  --c-num: #c4a7ff;
  --c-com: #6f80a0;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: min(1.5625vw, 2.0833vh); }
html, body { height: 100%; }
body { background: var(--night); color: var(--text); font-family: 'Chakra Petch', system-ui, sans-serif; overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 0.15rem solid var(--run); outline-offset: 0.15rem; }
[hidden] { display: none !important; }

#app { position: relative; height: 100%; display: flex; flex-direction: column; padding: 1.9rem 2.75rem 0; }

/* the top: the step's job, the next move, the cloud */
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; flex: none; }
.dots { display: flex; gap: 0.5rem; margin-bottom: 1.1rem; min-height: 0.4rem; }
.dots i { width: 1.6rem; height: 0.38rem; border-radius: 0.2rem; background: var(--rule); }
.dots i.done { background: #3c5a86; }
.dots i.now { background: var(--run); }
h1 { font-size: 2.5rem; font-weight: 700; line-height: 1.05; }
.next { margin-top: 0.5rem; font-size: 1.3rem; color: var(--dim); font-weight: 500; min-height: 1.7rem; }
.actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.7rem; }
.solo { display: flex; gap: 0.5rem; }
.open { display: inline-flex; align-items: center; gap: 0.6rem; border: 0.1rem solid var(--cloud); color: var(--cloud); border-radius: 0.5rem; padding: 0.6rem 1.1rem; font-weight: 600; font-size: 1.05rem; text-decoration: none; white-space: nowrap; }
.open:hover { background: rgba(217, 230, 255, 0.08); }
.open svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.ghost { background: transparent; border: 0.07rem solid var(--rule); color: var(--dim); border-radius: 0.5rem; padding: 0.45rem 0.9rem; font-weight: 600; font-size: 0.95rem; }
.ghost:hover { color: var(--text); border-color: #3c5a86; }

/* waiting for the tutor */
.wait { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; color: var(--dim); font-size: 1.4rem; padding-bottom: 6rem; }
.wait svg { width: 5rem; height: 5rem; fill: none; stroke: var(--cloud); stroke-width: 1.2; stroke-linejoin: round; opacity: 0.6; }

/* the code */
.codebox { position: relative; margin-top: 2rem; background: var(--panel); border: 0.07rem solid var(--rule); border-radius: 0.9rem; padding: 1.8rem 1.9rem 1.2rem; flex: none; }
.code { font-family: var(--mono); font-size: 1.65rem; line-height: 1.75; padding-right: 9rem; }
.line { display: flex; white-space: pre; }
.ln { color: #43557a; width: 2.75rem; flex: none; user-select: none; }
.s { color: var(--c-str); } .n { color: var(--c-num); } .k { color: var(--c-kw); } .f { color: var(--c-fn); } .c { color: var(--c-com); } .p { color: #b5c2d8; }
.slot { display: inline-flex; align-items: center; color: var(--slot); border: 0.13rem solid var(--slot); border-radius: 0.45rem; padding: 0 0.45rem; margin: 0 0.1rem; background: rgba(255, 181, 71, 0.08); box-shadow: 0 0 0 0.3rem rgba(255, 181, 71, 0.1); }
.slot input { background: transparent; border: 0; outline: 0; color: var(--slot); font-family: var(--mono); font-size: 1.65rem; width: 1ch; min-width: 1ch; padding: 0; caret-color: var(--slot); }
.slot:focus-within { box-shadow: 0 0 0 0.3rem rgba(255, 181, 71, 0.22); }

/* the editor (steps 5 and 6): a textarea over its own coloured copy */
.editor { display: flex; font-family: var(--mono); font-size: 1.45rem; line-height: 1.75; margin-right: 9rem; min-height: 5.3rem; }
.gutter { color: #43557a; width: 2.75rem; flex: none; user-select: none; white-space: pre; }
.field { position: relative; flex: 1; }
.paint, .field textarea { font-family: var(--mono); font-size: 1.45rem; line-height: 1.75; white-space: pre; overflow: hidden; tab-size: 2; letter-spacing: 0; word-spacing: 0; }
.paint { position: absolute; inset: 0; pointer-events: none; color: var(--text); }
.field textarea { position: relative; display: block; width: 100%; resize: none; border: 0; outline: 0; background: transparent; color: transparent; caret-color: var(--run); min-height: 5.3rem; }
.field textarea::selection { background: rgba(62, 232, 255, 0.25); color: transparent; }
.editor:focus-within { box-shadow: inset 0.15rem 0 0 var(--run); }

.buttons { position: absolute; right: 1.6rem; top: 1.8rem; display: flex; flex-direction: column; align-items: flex-end; gap: 0.6rem; }
.run { background: var(--run); color: #062a33; font-weight: 700; font-size: 1.4rem; border: 0; border-radius: 0.5rem; padding: 0.7rem 2.1rem; }
.run:hover { filter: brightness(1.08); }
.run:disabled { opacity: 0.5; cursor: default; }
.said { margin-top: 1.1rem; padding-top: 1rem; border-top: 0.07rem dashed var(--rule); font-size: 1.15rem; color: var(--dim); min-height: 2.7rem; display: flex; align-items: center; gap: 0.7rem; }
.said svg { width: 1.6rem; height: 1.6rem; flex: none; fill: none; stroke: var(--cloud); stroke-width: 1.8; stroke-linejoin: round; }
.said .mono { font-family: var(--mono); font-size: 1.05rem; color: var(--text); }
.said.sent { color: var(--cloud); }
.said.bad { color: var(--wrong); }
.said.good { color: var(--right); }
.said .tag { font-family: var(--mono); font-size: 0.8rem; font-weight: 700; padding: 0.15rem 0.45rem; border-radius: 0.3rem; margin-left: 0.3rem; }
.tag.created { color: #86efac; background: rgba(74, 222, 128, 0.12); }
.tag.updated { color: #fcd34d; background: rgba(252, 211, 77, 0.12); }

/* the question */
.q { position: absolute; left: 0; right: 0; bottom: 0; background: var(--deep); border-top: 0.13rem solid var(--rule); padding: 1.6rem 2.75rem 1.4rem; }
.q h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: 1.2rem; }
.choices { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0.9rem; }
.choice { border: 0.1rem solid var(--rule); border-radius: 0.6rem; padding: 1.15rem 1.1rem; font-size: 1.2rem; font-weight: 600; background: var(--panel); text-align: left; line-height: 1.25; }
.choice:hover:not(:disabled) { border-color: #3c5a86; }
.choice.picked { border-color: var(--run); box-shadow: inset 0 0 0 0.07rem var(--run); }
.choice.right { border-color: var(--right); box-shadow: inset 0 0 0 0.07rem var(--right); }
.choice.wrong { border-color: var(--wrong); box-shadow: inset 0 0 0 0.07rem var(--wrong); }
.choice:disabled { cursor: default; }
.q-note { margin-top: 1rem; font-size: 1rem; color: var(--dim); min-height: 1.4rem; }

/* step 0: three lines, three places */
.match { position: relative; flex: 1; display: grid; grid-template-columns: 1fr 18.75rem; column-gap: 6.5rem; align-content: start; margin-top: 2.1rem; }
.lines, .places { display: grid; gap: 1.4rem; position: relative; z-index: 1; }
.mline { background: var(--panel); border: 0.1rem solid var(--rule); border-radius: 0.75rem; padding: 1.35rem 1.4rem; font-family: var(--mono); font-size: 1.2rem; white-space: pre; text-align: left; min-height: 7.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.mline.sel { border-color: var(--slot); box-shadow: 0 0 0 0.3rem rgba(255, 181, 71, 0.12); }
.mline.done { border-color: #3c5a86; }
.mline.right { border-color: var(--right); }
.mline.wrong { border-color: var(--wrong); }
.mline .fix { font-family: 'Chakra Petch', sans-serif; font-size: 0.95rem; color: var(--wrong); white-space: normal; }
.place { height: 7.5rem; border: 0.1rem dashed #34476a; border-radius: 0.75rem; display: flex; align-items: center; gap: 1.1rem; padding: 0 1.25rem; background: transparent; font-weight: 700; font-size: 1.4rem; text-align: left; }
.place.done { border-style: solid; border-color: #3c5a86; background: rgba(60, 90, 134, 0.12); }
.place.ready { border-color: var(--slot); }
.place svg { width: 4rem; height: 4rem; flex: none; fill: none; stroke: #9fb6db; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.wires path { fill: none; stroke: #3c5a86; stroke-width: 2.5; }
.wires path.right { stroke: var(--right); }
.wires path.wrong { stroke: var(--wrong); stroke-dasharray: 6 6; }

.end { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.8rem; padding-bottom: 6rem; }
.end h2 { font-size: 3rem; }
.end p { font-size: 1.4rem; color: var(--dim); }
