:root {
  --navy: #111827;
  --navy-2: #172033;
  --ink: #111827;
  --paper: #f3f1ea;
  --white: #fffefa;
  --muted: #687184;
  --line: #d8d8d2;
  --lime: #d5f66f;
  --coral: #ff7964;
  --violet: #b49cf6;
  --blue: #78c9e8;
  --yellow: #ffd767;
  --green: #70d4ae;
  --shadow: 0 24px 70px rgba(17, 24, 39, .16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, textarea, select, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 100; padding: .7rem 1rem; background: var(--lime); color: var(--navy); font-weight: 800; }
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }

.site-header { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 72px; padding: 0 clamp(1rem, 4vw, 4.5rem); border-bottom: 1px solid rgba(255,255,255,.12); background: rgba(17, 24, 39, .93); color: white; backdrop-filter: blur(18px); }
.brand { display: inline-flex; gap: .25rem; align-items: center; width: fit-content; color: inherit; font: 900 .9rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; text-decoration: none; }
.brand span:nth-child(2) { color: var(--lime); }
.brand-bracket { color: var(--coral); }
nav { display: flex; align-items: center; gap: 1.7rem; }
nav a, .nav-button { border: 0; background: transparent; color: white; font-size: .82rem; font-weight: 750; text-decoration: none; cursor: pointer; }
.header-progress { justify-self: end; display: flex; align-items: center; gap: .8rem; color: #cbd0da; font: 700 .72rem/1 ui-monospace, monospace; }
.header-progress b { color: var(--lime); }
.mini-progress { width: 85px; height: 5px; overflow: hidden; border-radius: 5px; background: rgba(255,255,255,.15); }
.mini-progress i { display: block; width: 0; height: 100%; background: var(--lime); transition: width .35s ease; }

.hero { display: grid; grid-template-columns: .85fr 1.15fr; gap: clamp(3rem, 7vw, 8rem); align-items: center; min-height: calc(100vh - 72px); padding: clamp(4rem, 8vw, 8rem) clamp(1.2rem, 6vw, 7rem); background: var(--navy); color: white; overflow: hidden; }
.eyebrow { display: flex; align-items: center; gap: .6rem; margin: 0 0 1.4rem; color: var(--muted); font: 800 .72rem/1.2 ui-monospace, monospace; letter-spacing: .09em; text-transform: uppercase; }
.hero .eyebrow { color: #aeb7c8; }
.eyebrow span { color: var(--coral); font-size: .65rem; }
.hero h1 { max-width: 820px; margin: 0; font-size: clamp(3.5rem, 7.2vw, 8rem); line-height: .88; letter-spacing: -.068em; }
.hero h1 em { color: var(--lime); font-family: Georgia, serif; font-weight: 400; }
.hero-lead { max-width: 640px; margin: 2rem 0 0; color: #c6ccd7; font-size: clamp(1.05rem, 1.5vw, 1.28rem); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.6rem; margin-top: 2.4rem; }
.primary-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-width: 210px; padding: 1rem 1.15rem; border: 0; border-radius: 3px; background: var(--lime); color: var(--navy); box-shadow: 7px 7px 0 var(--coral); font-weight: 850; text-decoration: none; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.primary-button:hover { transform: translate(3px, 3px); box-shadow: 4px 4px 0 var(--coral); }
.secondary-link { color: white; font-weight: 800; text-underline-offset: .3rem; }
.privacy-note { display: flex; align-items: center; gap: .5rem; margin-top: 2.8rem; color: #9099aa; font-size: .8rem; }
.privacy-note span { color: var(--green); }

.system-map { position: relative; min-height: 610px; }
.map-caption { position: absolute; top: 0; right: 0; color: #8892a4; font: 750 .68rem/1 ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; }
.system-card { position: absolute; width: min(360px, 64%); min-height: 225px; padding: 1.5rem; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 26px 55px rgba(0,0,0,.23); color: var(--navy); }
.system-card > div { display: flex; justify-content: space-between; align-items: center; }
.system-card small { font: 800 .66rem/1 ui-monospace, monospace; letter-spacing: .08em; }
.tech-icon { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(17,24,39,.25); border-radius: 50%; font: 800 .8rem/1 ui-monospace, monospace; }
.system-card h2 { margin: 1rem 0 0; font-size: clamp(3.1rem, 5vw, 5.2rem); line-height: .9; letter-spacing: -.06em; }
.system-card p { margin: .6rem 0 1.3rem; }
.system-card code { display: block; padding: .65rem; background: rgba(17,24,39,.1); font-size: .76rem; }
.html-card { top: 7%; left: 0; z-index: 3; background: var(--coral); transform: rotate(-4deg); }
.css-card { top: 35%; right: 1%; z-index: 2; background: var(--lime); transform: rotate(3deg); }
.php-card { bottom: 0; left: 5%; z-index: 1; background: var(--violet); transform: rotate(-2deg); }
.map-arrow { position: absolute; z-index: 5; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: white; color: var(--navy); font-size: 1.25rem; box-shadow: var(--shadow); }
.arrow-one { top: 31%; left: 48%; }
.arrow-two { top: 66%; right: 26%; }

.lab-section { padding: clamp(5rem, 9vw, 9rem) clamp(1.2rem, 5vw, 6rem); }
.lab-heading { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 3rem; max-width: 1480px; margin: 0 auto 3rem; }
.lab-heading h2 { margin: 0; font-size: clamp(2.8rem, 5vw, 5.8rem); line-height: .94; letter-spacing: -.055em; }
.lab-stats { display: flex; align-items: stretch; border: 1px solid var(--line); background: var(--white); }
.lab-stats > div { display: flex; flex-direction: column; justify-content: center; min-width: 110px; padding: .8rem 1.1rem; border-right: 1px solid var(--line); }
.lab-stats strong { font: 900 1.6rem/1 ui-monospace, monospace; }
.lab-stats span { margin-top: .35rem; color: var(--muted); font-size: .7rem; }
.progress-button { padding: 0 1.2rem; border: 0; background: var(--navy); color: white; font-size: .78rem; font-weight: 800; cursor: pointer; }

.lab-shell { display: grid; grid-template-columns: 310px 1fr; max-width: 1480px; min-height: 720px; margin: 0 auto; border: 1px solid var(--line); background: var(--white); box-shadow: var(--shadow); }
.mission-map { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #eceae3; }
.mission-map-title { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem 1.3rem; border-bottom: 1px solid var(--line); font: 850 .72rem/1 ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.reset-button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; }
.world-list { flex: 1; min-height: 0; overflow-y: auto; }
.world-tabs { display: grid; grid-template-columns: repeat(3, 1fr); position: sticky; top: 0; z-index: 2; border-bottom: 1px solid var(--line); background: #eceae3; }
.world-tab { min-width: 0; padding: .75rem .25rem; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.world-tab:last-child { border-right: 0; }
.world-tab span, .world-tab b { display: block; }
.world-tab span { font: 850 .72rem/1 ui-monospace, monospace; }
.world-tab b { margin-top: .35rem; font: 700 .65rem/1 ui-monospace, monospace; }
.world-tab.active { background: var(--navy); color: white; }
.world-tab.active b { color: var(--lime); }
.world-group { border-bottom: 1px solid var(--line); }
.world-label { display: flex; justify-content: space-between; padding: 1rem 1.25rem .7rem; color: var(--muted); font: 800 .68rem/1 ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.world-label b { color: var(--ink); }
.mission-button { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: .7rem; width: 100%; padding: .8rem 1.2rem; border: 0; border-left: 4px solid transparent; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.mission-button:hover { background: rgba(255,255,255,.6); }
.mission-button.active { border-left-color: var(--coral); background: var(--white); }
.mission-number { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid #c9c9c1; border-radius: 50%; font: 750 .68rem/1 ui-monospace, monospace; }
.mission-button.complete .mission-number { border-color: var(--green); background: var(--green); color: var(--navy); }
.mission-button span:nth-child(2) { font-size: .82rem; font-weight: 720; }
.complete-mark { color: #279b75; font-weight: 900; }
.map-tip { display: flex; gap: .75rem; margin: auto 1rem 1rem; padding: 1rem; border: 1px solid #d7d4ca; background: rgba(255,255,255,.55); }
.map-tip > span { display: grid; flex: 0 0 24px; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--blue); font-weight: 900; }
.map-tip p { margin: 0; color: var(--muted); font-size: .74rem; }

.mission-panel { padding: clamp(1.5rem, 4vw, 4rem); min-width: 0; }
.mission-header { display: flex; justify-content: space-between; gap: 2rem; align-items: flex-start; }
.mission-breadcrumb { margin: 0 0 .55rem; color: var(--coral); font: 800 .7rem/1 ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.mission-header h3 { margin: 0; font-size: clamp(2rem, 3.6vw, 4rem); line-height: .95; letter-spacing: -.045em; }
.mission-time { flex: 0 0 auto; padding: .45rem .7rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: 750 .7rem/1 ui-monospace, monospace; }
.mission-objective { display: grid; grid-template-columns: 95px 1fr; gap: 1.1rem; max-width: 850px; margin: 2rem 0; padding: 1.1rem; border-left: 4px solid var(--yellow); background: #faf8f1; }
.mission-objective span { color: var(--muted); font: 800 .68rem/1.4 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .08em; }
.mission-objective p { margin: 0; font-weight: 650; }
.challenge-stage { min-height: 310px; }
.challenge-prompt { margin: 0 0 1rem; color: var(--muted); }
.code-window { overflow: hidden; border: 1px solid #30384a; border-radius: 8px; background: #111827; color: #edf0f4; box-shadow: 0 18px 40px rgba(17,24,39,.18); }
.window-bar { display: flex; align-items: center; gap: .35rem; padding: .7rem .9rem; border-bottom: 1px solid #2e3749; background: #182135; }
.window-bar i { width: 9px; height: 9px; border-radius: 50%; background: #ff7667; }
.window-bar i:nth-child(2) { background: #ffd767; }
.window-bar i:nth-child(3) { background: #70d4ae; }
.window-bar span { margin-left: .5rem; color: #8892a4; font: 700 .67rem/1 ui-monospace, monospace; }
.code-window pre { overflow-x: auto; margin: 0; padding: 1.25rem; font: 500 .9rem/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
.code-window .token-tag { color: #ff8e7c; }
.code-window .token-value { color: #d5f66f; }
.code-window .token-key { color: #b49cf6; }
.code-window .token-var { color: #78c9e8; }
.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-top: 1rem; }
.choice-button { min-height: 70px; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--ink); text-align: left; font-weight: 680; cursor: pointer; }
.choice-button code { font: 650 .82rem/1.5 ui-monospace, monospace; }
.choice-button:hover { border-color: #9aa1af; }
.choice-button.selected { border-color: var(--violet); background: #f0ebff; box-shadow: inset 0 0 0 2px var(--violet); }
.choice-button.correct-choice { border-color: var(--green); background: #e6f9f1; }

.split-workspace { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; }
.editor-pane, .preview-pane { min-width: 0; }
.editor-pane { background: #111827; }
.pane-title { display: flex; justify-content: space-between; padding: .65rem .8rem; border-bottom: 1px solid rgba(255,255,255,.12); color: #8f98a9; font: 750 .65rem/1 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .08em; }
.preview-pane .pane-title { border-bottom-color: var(--line); color: var(--muted); }
.code-editor { display: block; width: 100%; min-height: 250px; resize: vertical; padding: 1rem; border: 0; outline: 0; background: #111827; color: #e9edf3; font: 500 .86rem/1.65 ui-monospace, Consolas, monospace; tab-size: 2; }
.preview-frame { display: block; width: 100%; min-height: 250px; border: 0; background: white; }
.control-workspace { display: grid; grid-template-columns: .8fr 1.2fr; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; }
.controls { padding: 1.3rem; background: #f5f3ec; }
.control-row { margin-bottom: 1.2rem; }
.control-row label { display: flex; justify-content: space-between; margin-bottom: .55rem; font-size: .78rem; font-weight: 750; }
.control-row output { color: var(--coral); font-family: ui-monospace, monospace; }
.control-row input[type="range"] { width: 100%; accent-color: var(--coral); }
.control-row select { width: 100%; padding: .7rem; border: 1px solid var(--line); background: white; }
.live-stage { display: grid; min-height: 300px; place-items: center; padding: 2rem; background: repeating-linear-gradient(45deg, #fafafa, #fafafa 12px, #f2f2f2 12px, #f2f2f2 24px); }
.target-card { max-width: 260px; border: 4px solid var(--navy); background: var(--lime); color: var(--navy); box-shadow: 8px 8px 0 var(--coral); font-weight: 800; }
.target-box { display: flex; width: 100%; min-height: 240px; border: 3px dashed #a7adba; background: white; }
.target-box span { padding: .9rem; border-radius: 5px; background: var(--violet); font-weight: 800; }
.sequence-list { display: grid; gap: .65rem; }
.sequence-item { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: .8rem; padding: .8rem; border: 1px solid var(--line); background: white; }
.sequence-index { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: white; font: 800 .76rem/1 ui-monospace, monospace; }
.sequence-item strong { font-size: .85rem; }
.sequence-controls { display: flex; gap: .3rem; }
.sequence-controls button { width: 32px; height: 32px; border: 1px solid var(--line); background: #f4f2ec; cursor: pointer; }

.feedback { display: flex; gap: .9rem; margin-top: 1.2rem; padding: 1rem; border: 1px solid var(--line); background: #f7f7f3; }
.feedback.success { border-color: #77cbae; background: #e9f8f2; }
.feedback.error { border-color: #eaa99e; background: #fff0ed; }
.feedback-icon { display: grid; flex: 0 0 32px; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--line); font-weight: 900; }
.feedback.success .feedback-icon { background: var(--green); }
.feedback.error .feedback-icon { background: var(--coral); }
.feedback strong { font-size: .85rem; }
.feedback p { margin: .2rem 0 0; color: var(--muted); font-size: .82rem; }
.mission-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.mission-actions > div { display: flex; gap: .7rem; }
.hint-button { border: 0; background: transparent; color: var(--muted); font-size: .78rem; font-weight: 750; cursor: pointer; }
.hint-button span { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: .3rem; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); }
.check-button, .next-button { padding: .8rem 1.1rem; border: 0; border-radius: 3px; background: var(--navy); color: white; font-weight: 800; cursor: pointer; }
.next-button { background: var(--lime); color: var(--navy); }
.hint-text { margin: 1rem 0 0; padding: .8rem 1rem; border-left: 3px solid var(--yellow); background: #fffae9; color: #5d5a4e; font-size: .8rem; }
.learning-loop { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.4rem; max-width: 1480px; margin: 3rem auto 0; color: var(--muted); font: 850 .75rem/1 ui-monospace, monospace; letter-spacing: .1em; }
.learning-loop i { color: var(--coral); font-style: normal; }

footer { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 120px; padding: 2rem clamp(1.2rem, 4vw, 4.5rem); background: var(--navy); color: white; }
footer p { color: #8f98a9; font-size: .78rem; }
.footer-link { justify-self: end; border: 0; background: transparent; color: white; font-weight: 750; cursor: pointer; }

dialog { width: min(760px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); padding: clamp(2rem, 5vw, 4rem); border: 0; border-radius: 12px; background: var(--white); color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(17,24,39,.8); backdrop-filter: blur(7px); }
.dialog-close { position: absolute; top: 1rem; right: 1rem; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 1.4rem; cursor: pointer; }
.dialog-kicker { margin: 0 0 .8rem; color: var(--coral); font: 800 .7rem/1 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .09em; }
dialog h2 { margin: 0 0 2rem; font-size: clamp(2.4rem, 5vw, 4rem); line-height: .95; letter-spacing: -.05em; }
.glossary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.glossary-grid > div { padding: 1rem; background: var(--white); }
.glossary-grid dt { font-weight: 850; }
.glossary-grid dd { margin: .3rem 0 0; color: var(--muted); font-size: .82rem; }
.progress-ring { display: grid; place-items: center; width: 130px; height: 130px; margin: 0 auto 2rem; border-radius: 50%; background: conic-gradient(var(--green) 0%, #e1e1dc 0); position: relative; }
.progress-ring::after { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--white); }
.progress-ring strong { position: relative; z-index: 1; font: 900 1.5rem/1 ui-monospace, monospace; }
.world-summary { margin-bottom: 1.5rem; border-top: 1px solid var(--line); }
.summary-row { display: grid; grid-template-columns: 90px 1fr auto; align-items: center; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.summary-row strong { font-size: .78rem; }
.summary-bar { height: 7px; border-radius: 8px; background: #e3e3dd; overflow: hidden; }
.summary-bar i { display: block; height: 100%; background: var(--violet); }
.summary-row span { color: var(--muted); font: 750 .7rem/1 ui-monospace, monospace; }
.copy-progress { margin: 0 auto; }
.copy-message { min-height: 1.2rem; text-align: center; color: var(--muted); font-size: .76rem; }

@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr; }
  .system-map { width: min(720px, 100%); margin: 0 auto; }
  .lab-heading { grid-template-columns: 1fr; }
  .lab-shell { grid-template-columns: 250px 1fr; }
  .split-workspace, .control-workspace { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .site-header { grid-template-columns: 1fr auto; min-height: 64px; }
  .site-header nav { display: none; }
  .header-progress { font-size: 0; }
  .mini-progress { width: 68px; }
  .hero { min-height: auto; padding-top: 4.5rem; }
  .hero h1 { font-size: clamp(3.25rem, 16vw, 5.2rem); }
  .system-map { min-height: 700px; }
  .system-card { width: 82%; }
  .html-card { top: 5%; }
  .css-card { top: 36%; }
  .php-card { bottom: 0; }
  .map-arrow { display: none; }
  .lab-stats { width: 100%; overflow-x: auto; }
  .lab-shell { grid-template-columns: 1fr; }
  .mission-map { border-right: 0; border-bottom: 1px solid var(--line); }
  .world-list { display: block; overflow: visible; }
  .world-tabs { position: static; }
  .world-group { max-height: 430px; overflow-y: auto; border-right: 0; }
  .map-tip { display: none; }
  .mission-objective { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: 1fr; }
  .mission-actions { align-items: flex-start; flex-direction: column; }
  .mission-actions > div { width: 100%; }
  .check-button, .next-button { flex: 1; }
  footer { grid-template-columns: 1fr auto; }
  footer p { display: none; }
  .glossary-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
