/* The Jozu Labs — shared styles
   Direction: a night-shift lab bench. Graphite surfaces, four signal colours
   (coral = the agent, sky = data, sun = tools/actions, mint = success),
   a chunky grotesque for headings and a mono face for anything the machine "says". */

:root {
  --bg: #101218;
  --bg2: #151821;
  --panel: #1b1f29;
  --panel2: #222734;
  --line: #2c3240;
  --ink: #eef0f5;
  --muted: #9aa3b5;
  --faint: #6b7385;
  --coral: #ff7a59;
  --sky: #5cc8ff;
  --sun: #ffd166;
  --mint: #6ee7b7;
  --rose: #ff6b8b;
  --display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --r: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body);
  font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 22px 22px;
}
a { color: var(--sky); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--sun); outline-offset: 2px; border-radius: 6px; }
code, .mono { font-family: var(--mono); font-size: .92em; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; text-wrap: balance; margin: 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 12px max(16px, env(safe-area-inset-left)); background: rgba(16,18,24,.86);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 18px; white-space: nowrap; }
.brand .logo { width: 28px; height: 28px; border-radius: 50%; background: conic-gradient(from 0deg, var(--coral), var(--sun), var(--mint), var(--sky), var(--coral)); position: relative; flex: none; animation: spin 8s linear infinite; }
.brand .logo::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--bg); }
@keyframes spin { to { transform: rotate(360deg); } }
.crumb { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.crumb b { color: var(--ink); font-weight: 600; }
.dots { display: flex; gap: 5px; margin-left: auto; }
.dots a { width: 10px; height: 10px; border-radius: 50%; background: var(--line); display: block; }
.dots a.done { background: var(--mint); }
.dots a.here { outline: 2px solid var(--coral); outline-offset: 2px; }
.iconbtn { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 15px; }
@media (max-width: 640px) { .dots { display: none; } .crumb { margin-left: auto; } }

/* ---------- lesson layout ---------- */
.lesson { max-width: 1480px; margin: 0 auto; padding: 48px clamp(16px, 4vw, 72px) 96px; display: grid; gap: 64px; }
.intro { display: grid; gap: 16px; max-width: 900px; }
.eyebrow { font-family: var(--mono); font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--coral); }
.intro h1 { font-size: clamp(36px, 6vw, 64px); font-weight: 800; letter-spacing: -.02em; }
.lede { font-size: 19px; color: var(--muted); max-width: 70ch; margin: 0; }
.goals { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.goals span { font-size: 13px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: var(--bg2); }

.step { display: grid; gap: 20px; }
.step + .step { padding-top: 8px; }
.step-head { display: flex; align-items: center; gap: 14px; }
.step-num { font-family: var(--mono); font-size: 14px; color: var(--bg); background: var(--sun); border-radius: 8px; min-width: 30px; height: 30px; display: grid; place-items: center; font-weight: 700; flex: none; }
.step h2 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 700; }
.prose { max-width: 78ch; color: #d7dbe5; display: grid; gap: 12px; font-size: 16.5px; }
.prose p { margin: 0; }
.prose strong { color: var(--ink); }
.note { border-left: 3px solid var(--sky); background: rgba(92,200,255,.07); padding: 14px 18px; border-radius: 0 12px 12px 0; color: #d7dbe5; max-width: 90ch; line-height: 1.6; }
.note.tip { border-color: var(--sun); background: rgba(255,209,102,.07); }
.note.warn { border-color: var(--rose); background: rgba(255,107,139,.08); }

/* ---------- interactive lab panels ---------- */
.lab { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.lab-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-height: 58px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--panel2); }
.lab-head .title { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-right: auto; display: flex; align-items: center; gap: 8px; }
.lab-head .title::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 10px var(--mint); }
.lab-body { padding: 20px; }
@media (max-width: 640px) { .lab-body { padding: 14px; } .lab-head { padding: 10px 14px; } }
.lab canvas { display: block; width: 100%; border-radius: 10px; background: var(--bg2); touch-action: none; }
.split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.split > * { min-width: 0; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }

.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 8px 14px; line-height: 1.2; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); font-size: 14px; font-weight: 500; white-space: nowrap; transition: transform .08s, background .15s, border-color .15s; }
.btn:hover { border-color: var(--faint); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--coral); border-color: var(--coral); color: #1a0d08; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.on { border-color: var(--sun); color: var(--sun); background: rgba(255,209,102,.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row > input[type=text] { flex: 1 1 200px; min-width: 0; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field input[type=range] { width: 100%; accent-color: var(--coral); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; border: 1px solid var(--line); background: var(--bg2); color: var(--muted); }
.stat { display: grid; gap: 4px; align-content: start; padding: 12px 14px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.stat .k { font-size: 11px; line-height: 1.35; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; }
.stat .v { font-family: var(--mono); font-size: 20px; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.log { font-family: var(--mono); font-size: 13px; line-height: 1.55; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-y: auto; max-height: 340px; min-height: 120px; }
.log .l { padding: 3px 0; border-bottom: 1px dashed rgba(255,255,255,.05); animation: rise .3s ease-out; }
.log .who { font-weight: 700; margin-right: 6px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
input[type=text], input[type=email], textarea, select { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none; width: 100%; }
input[type=text]:focus, input[type=email]:focus, textarea:focus, select:focus { border-color: var(--coral); }
.hint { font-size: 13px; color: var(--faint); }

/* ---------- quiz ---------- */
.quiz { display: grid; gap: 14px; }
.q { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; display: grid; gap: 14px; }
.q h3 { font-family: var(--body); font-size: 17px; font-weight: 600; }
.q .opts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.q .opt { text-align: left; padding: 12px 16px; height: 100%; line-height: 1.45; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); display: flex; gap: 10px; align-items: baseline; }
.q .opt .key { font-family: var(--mono); color: var(--faint); font-size: 12px; }
.q .opt:hover:not(:disabled) { border-color: var(--faint); }
.q .opt.right { border-color: var(--mint); background: rgba(110,231,183,.1); }
.q .opt.wrong { border-color: var(--rose); background: rgba(255,107,139,.1); animation: shake .35s; }
.q .opt:disabled { cursor: default; }
.q .why { font-size: 14px; color: var(--muted); border-left: 3px solid var(--mint); padding-left: 12px; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.passed { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; padding: 18px; border-radius: var(--r); background: linear-gradient(120deg, rgba(110,231,183,.14), rgba(92,200,255,.1)); border: 1px solid rgba(110,231,183,.4); }
.passed b { font-family: var(--display); font-size: 22px; }

/* ---------- lesson footer nav ---------- */
.pager { display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 24px; }
.pager a { text-decoration: none; color: var(--ink); display: grid; gap: 2px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); min-width: 0; max-width: 100%; }
.pager a small { color: var(--faint); font-size: 12px; }
.pager a.next { text-align: right; margin-left: auto; border-color: var(--coral); }
.pager a:hover { border-color: var(--sun); }

/* confetti layer */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* ---------- difficulty levels ---------- */
.lvl { display: inline-block; font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; padding: 2px 9px; border-radius: 999px; margin-right: 6px; border: 1px solid currentColor; text-transform: uppercase; }
.lvl0 { color: #6ee7b7; } .lvl1 { color: #5cc8ff; } .lvl2 { color: #ffd166; } .lvl3 { color: #ff7a59; } .lvl4 { color: #c39bff; }
.intro .eyebrow { color: var(--muted); }

/* shared bits used by the newer lessons */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tcard { text-align: left; padding: 14px 16px; line-height: 1.45; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); display: grid; gap: 6px; transition: border-color .15s, transform .1s, background .15s; }
.tcard:hover:not(:disabled) { border-color: var(--faint); }
.tcard.sel { border-color: var(--sun); background: rgba(255,209,102,.07); }
.tcard.good { border-color: var(--mint); background: rgba(110,231,183,.08); }
.tcard.bad { border-color: var(--rose); background: rgba(255,107,139,.08); }
.tcard small { color: var(--faint); font-size: 12px; }
.meter { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--mint); transition: width .5s; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-row .chip.got { color: var(--sun); border-color: var(--sun); }
.stage3d { position: relative; height: 460px; border-radius: 10px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #1f2533, #12151c); cursor: grab; }
.stage3d canvas { border-radius: 0 !important; background: transparent !important; }
.tag3d { position: absolute; transform: translate(-50%, -50%); font-family: var(--mono); font-size: 11.5px; color: var(--muted); pointer-events: none; white-space: nowrap; text-shadow: 0 1px 3px #000; }
@media (max-width: 640px) { .stage3d { height: 360px; } }

/* ---------- access-code lock ---------- */
.unlock-wrap { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(10,12,16,.72); backdrop-filter: blur(6px); animation: rise .25s ease-out; }
.unlock-card { width: min(440px, 100%); display: grid; gap: 14px; padding: 26px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.unlock-card h2 { font-size: 28px; }
.unlock-card p { margin: 0; color: var(--muted); font-size: 15px; }
.unlock-card .btn { justify-content: center; }
.unlock-card.nope { animation: shake .35s; }
.unlock-icon { font-size: 40px; }
body.locked main { filter: blur(7px); pointer-events: none; user-select: none; max-height: 100vh; overflow: hidden; }
body.locked .unlock-wrap { background: rgba(10,12,16,.55); }
.unlock-perks { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14.5px; display: grid; gap: 4px; }
.unlock-buy { width: 100%; min-height: 46px; font-size: 15.5px; }
.unlock-price { font-weight: 600; opacity: .85; }
.unlock-or { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.unlock-or::before, .unlock-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn.ghost { background: transparent; }
.unlock-recover { display: grid; gap: 8px; justify-items: center; }
.unlock-recover[hidden] { display: none; }
.unlock-recover form { width: 100%; }
.unlock-recover input { flex: 1; min-width: 0; }
.linkbtn { background: none; border: 0; padding: 2px 4px; color: var(--muted); font: inherit; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover, .linkbtn:focus-visible { color: var(--ink); }
/* feedback-for-access form (preview sites) */
.fb-form { display: grid; gap: 10px; }
.fb-label { font-weight: 600; font-size: 14.5px; }
.fb-stars { display: flex; gap: 4px; }
.fb-stars button { background: none; border: 0; padding: 2px 4px; font-size: 30px; line-height: 1; color: var(--line); cursor: pointer; transition: transform .1s; }
.fb-stars button.on { color: var(--sun); }
.fb-stars button:hover, .fb-stars button:focus-visible { transform: scale(1.15); }
.fb-form textarea { resize: vertical; min-height: 70px; font: inherit; color: inherit; }
.fb-form select, .fb-form input[type=email] { font: inherit; color: inherit; }
.fb-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.fb-code { font-family: var(--mono); font-size: clamp(20px, 5vw, 26px); font-weight: 700; letter-spacing: .06em; color: var(--mint); word-break: break-all; padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid rgba(110,231,183,.45); text-align: center; }
.fb-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.fb-check input { margin-top: 3px; accent-color: var(--coral); }
