@charset "UTF-8";
/* lucasgame academy — arcade-dark, light(💡)-accent theme.
   Big touch targets, ≥16px text everywhere (iPad: no zoom-on-focus). */

/* ---------- Free Play: game on TOP, editor BELOW (vertical) ----------
   A touch wider than the lesson view — not a blown-up stage. */
body.freeplay main { flex-direction: column; align-items: stretch; }
body.freeplay #game-pane { position: static; width: 100%; max-width: 580px; align-self: center; flex: 0 0 auto; }
body.freeplay canvas#board { max-width: 500px; }
body.freeplay #panel { width: 100%; flex: 1 1 auto; }
.fp-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.fp-chip {
  border: 1px solid #3a2f6b; background: var(--pane-2); color: var(--ink);
  border-radius: 999px; padding: .4rem .85rem; font-size: .92rem; cursor: pointer;
  font-family: ui-monospace, Menlo, monospace;
}
.fp-chip.active { border-color: var(--light); color: var(--light); box-shadow: 0 0 8px #ffd34d44; }
.fp-chip.bonus { border-style: dashed; border-color: var(--good); }
.fp-chip.locked { opacity: .5; cursor: not-allowed; font-family: inherit; }
.fp-tile { border-style: dashed !important; border-color: var(--light) !important; }
.fp-tile .num { filter: drop-shadow(0 0 6px var(--light)); }
.fp-ideas { opacity: .85; margin: .5rem 0; }

:root {
  --bg: #131022;
  --pane: #1d1932;
  --pane-2: #251f40;
  --ink: #efeaff;
  --muted: #9c93c0;
  --light: #ffd34d;        /* the 💡 accent — the academy's color */
  --good: #6ee787;
  --bad: #ff6b81;
  --locked: #161226;
  --radius: 14px;
  font-size: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* principle 17: hidden means gone */

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

code, pre, textarea, .cm-editor { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; }

/* ---------- header ---------- */
header {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem;
  padding: .7rem 1.1rem; border-bottom: 1px solid #2c2450;
}
.brand { display: flex; align-items: center; gap: .6rem; }
.logo { font-size: 1.7rem; filter: drop-shadow(0 0 8px var(--light)); }
.wordmark { font-size: 1.15rem; letter-spacing: .02em; }
.wordmark b { color: var(--light); }
.tagline { font-size: .72rem; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; }
.world { color: var(--muted); font-size: .95rem; display: flex; align-items: center; gap: .6rem; }
#lights { color: var(--light); }
.lang {
  background: var(--pane-2); color: var(--ink); border: 1px solid #3a2f6b;
  border-radius: 8px; padding: .35rem .5rem; font-size: .95rem; cursor: pointer;
}

/* ---------- step rail ---------- */
#rail { display: flex; gap: .45rem; padding: .65rem 1.1rem; flex-wrap: wrap; }
#rail button {
  border: 1px solid #3a2f6b; background: var(--pane); color: var(--ink);
  padding: .5rem .95rem; border-radius: 999px; font-size: .95rem; cursor: pointer;
}
#rail button.active { border-color: var(--light); color: var(--light); box-shadow: 0 0 10px #ffd34d44; }
#rail button.done::before { content: "\002705\0000A0"; }   /* ✅ + nbsp (escaped: host-charset-proof) */
#rail button.soon { opacity: .4; cursor: default; }
#rail button.lockedstep { opacity: .55; }
#rail button.lockedstep::after { content: "\0000A0\01F512"; }   /* nbsp + 🔒 */

/* ---------- layout ---------- */
main {
  flex: 1; display: flex; gap: 1.1rem; padding: 0 1.1rem 1.1rem; align-items: flex-start;
  flex-wrap: wrap;
}
#game-pane {
  background: var(--pane); border-radius: var(--radius); padding: .9rem;
  display: flex; flex-direction: column; align-items: center; gap: .55rem;
  flex: 0 1 480px; min-width: 300px;
  position: sticky; top: .5rem;
}
#panel { flex: 1 1 460px; min-width: 300px; display: flex; flex-direction: column; gap: .8rem; }

#cabinet-title { font-weight: 700; color: var(--light); }
canvas#board {
  width: 100%; max-width: 448px; height: auto;
  border-radius: 10px; background: #0d0a1a; touch-action: none;
}
#score { color: var(--muted); min-height: 1.2em; }
#status { min-height: 1.4em; text-align: center; font-size: .95rem; }
#status .friendly { color: var(--light); }
#status .raw { display: block; color: var(--muted); font-size: .78rem; }
#status .ok { color: var(--good); }

/* d-pad: real buttons, thumb-sized */
#dpad {
  display: grid; gap: .35rem;
  grid-template-areas: ". u ." "l d r";
}
#dpad button {
  width: 64px; height: 52px; font-size: 1.3rem; border-radius: 12px;
  border: 1px solid #3a2f6b; background: var(--pane-2); color: var(--ink); cursor: pointer;
}
#dpad button:active { background: var(--light); color: #1a1505; }
#dpad .up { grid-area: u; } #dpad .left { grid-area: l; }
#dpad .down { grid-area: d; } #dpad .right { grid-area: r; }
/* left-right games (breakout): only the side arrows steer the paddle */
body.lr-controls #dpad .up, body.lr-controls #dpad .down { display: none; }

/* ---------- panel cards ---------- */
.cardbox {
  background: var(--pane); border-radius: var(--radius); padding: 1rem 1.1rem;
}
.cardbox h2 { margin: .1rem 0 .5rem; font-size: 1.12rem; color: var(--light); }
.cardbox h3 { margin: .8rem 0 .3rem; font-size: 1rem; }
.cardbox p, .cardbox li { line-height: 1.55; }
.muted { color: var(--muted); }
blockquote { border-left: 3px solid var(--light); margin: .6rem 0; padding: .15rem .8rem; color: var(--ink); background: var(--pane-2); border-radius: 0 8px 8px 0; }

button.action {
  border: none; border-radius: 10px; padding: .65rem 1.05rem; font-size: 1rem; cursor: pointer;
  background: var(--light); color: #1a1505; font-weight: 700;
}
button.action.secondary { background: var(--pane-2); color: var(--ink); border: 1px solid #3a2f6b; }
button.action:disabled { opacity: .45; cursor: default; }
.btnrow { display: flex; gap: .55rem; flex-wrap: wrap; margin: .6rem 0; }

/* Free Play: a prominent "back to the floor" nav — green so it reads as
   "leave & keep progressing", distinct from the gold ▶ Play action. */
.fp-nav { margin: 0 0 .55rem; }
button.fp-back {
  border: none; border-radius: 10px; padding: .55rem 1rem; font-size: 1rem; cursor: pointer;
  background: var(--good); color: #0d2417; font-weight: 800;
  box-shadow: 0 2px 0 #2f7d4f;
}
button.fp-back:hover { filter: brightness(1.07); }
.fp-backhint { font-size: .92rem; margin: .35rem 0 0; }

/* ---------- predict ---------- */
.choices { display: flex; flex-direction: column; gap: .45rem; margin: .6rem 0; }
.choices button {
  text-align: left; padding: .6rem .8rem; border-radius: 10px; font-size: 1rem; cursor: pointer;
  background: var(--pane-2); color: var(--ink); border: 1px solid #3a2f6b;
}
.choices button.picked-right { border-color: var(--good); color: var(--good); }
.choices button.picked-wrong { border-color: var(--bad); color: var(--bad); }
.choices button.reveal-right { border-color: var(--good); }
.verdict { margin: .5rem 0; }

/* ---------- code: locked scaffold + editor ---------- */
pre.code, pre.locked {
  margin: 0; padding: .6rem .8rem; font-size: .92rem; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word;
}
pre.code { background: #0d0a1a; border-radius: 10px; }
pre.locked { background: var(--locked); color: #a89dd0; position: relative; }
pre.locked::after { content: "\01F512"; position: absolute; right: .55rem; top: .35rem; font-size: .8rem; opacity: .6; }   /* 🔒 */
.editor-stack { border: 1px solid #3a2f6b; border-radius: 10px; overflow: hidden; }
.editor-host { background: #0d0a1a; }
.editor-host .cm-editor { font-size: 1rem; }
.editor-host textarea {
  width: 100%; min-height: 11rem; border: 0; outline: none; resize: vertical;
  background: #0d0a1a; color: var(--ink); font-size: 1rem; line-height: 1.5; padding: .6rem .8rem;
}

/* ---------- function card ---------- */
/* iPad rule: JSON examples and signatures are long UNBREAKABLE strings —
   without overflow-wrap:anywhere they punch out of the box on narrow
   screens (user-reported on iPad, 2026-06-12). Never remove these. */
.fncard { background: var(--pane-2); border-radius: 10px; padding: .7rem .9rem; font-size: .92rem; overflow-wrap: anywhere; }
.fncard .sig { color: var(--light); font-family: ui-monospace, Menlo, monospace; overflow-wrap: anywhere; }
.fncard table { border-collapse: collapse; margin-top: .4rem; width: 100%; table-layout: fixed; }
.fncard td { padding: .22rem .5rem .22rem 0; vertical-align: top; overflow-wrap: anywhere; }
.fncard td.k { color: var(--good); font-family: ui-monospace, Menlo, monospace; width: 5.5rem; }
.fncard td.ex { color: var(--muted); font-family: ui-monospace, Menlo, monospace; width: 38%; }
.fncard .live { margin-top: .55rem; border-top: 1px dashed #3a2f6b; padding-top: .5rem; }
.fncard .live b { color: var(--light); }

/* ---------- the arcade floor ---------- */
.floortabs { display: flex; gap: .5rem; margin: .6rem 0 .2rem; flex-wrap: wrap; }
.floortabs button {
  border: 1px solid #3a2f6b; background: var(--pane-2); color: var(--ink);
  padding: .5rem 1rem; border-radius: 999px; font-size: .95rem; cursor: pointer;
}
.floortabs button.active { border-color: var(--light); color: var(--light); }
.floortabs button.flocked { opacity: .5; }

.floor { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .8rem; margin-top: .8rem; }
.cabinet {
  display: flex; flex-direction: column; gap: .35rem; text-align: left; cursor: pointer;
  background: var(--pane-2); border: 1px solid #3a2f6b; border-radius: var(--radius);
  padding: .9rem 1rem; color: var(--ink); font-size: 1rem; min-height: 9.5rem;
}
.cabinet:hover { border-color: var(--light); }
.cabinet .num { font-size: 1.6rem; font-weight: 800; color: var(--light); font-family: ui-monospace, Menlo, monospace; }
.cabinet .cab-title { font-weight: 700; text-transform: capitalize; }
.cabinet .cab-hook { color: var(--muted); font-size: .85rem; line-height: 1.4; flex: 1; }
.cabinet .cab-state { font-size: .9rem; }
.cabinet.fixed { border-color: #6ee78766; }
.cabinet.fixed .cab-state { color: var(--good); }
.cabinet.locked { opacity: .55; }
.cabinet.locked:hover { border-color: #3a2f6b; }
.cabinet.soon { opacity: .35; cursor: default; }

/* ---------- create form ---------- */
.createform { display: flex; gap: .55rem; flex-wrap: wrap; margin: .6rem 0; }
.createform input {
  flex: 1 1 220px; background: #0d0a1a; border: 1px solid #3a2f6b; border-radius: 10px;
  color: var(--ink); font-size: 1rem; padding: .6rem .8rem;
}
.createform input::placeholder { color: #6f6694; }

/* ---------- hints ---------- */
.hintbox {
  background: var(--pane-2); border-left: 3px solid var(--light);
  border-radius: 0 10px 10px 0; padding: .3rem .9rem; margin: .4rem 0;
}
.hintbox p { margin: .5rem 0; line-height: 1.5; }

/* ---------- checks ---------- */
.checks { display: flex; flex-direction: column; gap: .4rem; margin-top: .5rem; }
.check {
  display: flex; align-items: center; gap: .6rem; background: var(--pane-2);
  border-radius: 10px; padding: .5rem .7rem;
}
.check .icon { width: 1.4rem; text-align: center; }
.check .name { flex: 1; }
.check button { font-size: .85rem; padding: .3rem .6rem; border-radius: 8px; border: 1px solid #3a2f6b; background: transparent; color: var(--muted); cursor: pointer; }
.check.pass { outline: 1px solid #6ee78744; }
.check.fail { outline: 1px solid #ff6b8166; }

.banner {
  background: linear-gradient(135deg, #ffd34d22, #6ee78722);
  border: 1px solid var(--light); border-radius: var(--radius);
  padding: .9rem 1rem; font-size: 1.05rem; text-align: center;
}

footer { padding: .7rem 1.1rem; color: var(--muted); font-size: .85rem; border-top: 1px solid #2c2450; }
footer b { color: var(--light); }

/* ---------- narrow screens (iPad portrait / phone) ---------- */
@media (max-width: 760px) {
  main { flex-direction: column; }
  #game-pane { position: static; width: 100%; flex-basis: auto; }
}
