@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap");
:root {
  --ink: #0f1a14; --muted: #5d6b63; --paper: #fbfcf9; --line: #dfe6df;
  --green: #107c41; --green-dark: #0b5e31; --green-soft: #e3f3e8;
  --accent: #ffb020; --red: #c62828; --head: #f1f4f1;
}
* { box-sizing: border-box; margin: 0; }
body { font-family: Inter, system-ui, sans-serif; color: var(--ink); background: var(--paper); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
code { font-family: "JetBrains Mono", monospace; font-size: .9em; background: var(--head); padding: 1px 5px; border-radius: 4px; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }
nav { padding: 16px 0; border-bottom: 1px solid var(--line); background: #fff; }
nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; text-decoration: none; letter-spacing: -0.02em; }
.logo i { width: 28px; height: 28px; border-radius: 7px; background: var(--green); display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 5px; }
.logo i b { background: #fff; border-radius: 1px; }
.logo i b:nth-child(4) { background: var(--accent); }
.crumb { font-size: 14px; color: var(--muted); }
main { padding: 28px 0 56px; display: grid; gap: 24px; }

.prog { display: flex; gap: 6px; }
.prog i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.prog i.done { background: var(--green); }
.prog i.cur { background: var(--accent); }

[hidden] { display: none !important; }
.btn { display: inline-block; text-decoration: none; font: inherit; font-weight: 600; background: var(--green); color: #fff; padding: 11px 20px; border-radius: 10px; border: 0; cursor: pointer; }
.btn:hover { background: var(--green-dark); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: 8px 14px; font-size: 14px; border-radius: 6px; }

.drill { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px -30px rgba(15,26,20,.3); overflow: hidden; }
.drill-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.tag { font-size: 12px; font-weight: 600; color: var(--green); background: var(--green-soft); padding: 4px 9px; border-radius: 999px; }
.num { font-size: 13px; color: var(--muted); }
.task { padding: 18px 18px 8px; font-size: 16px; }
.fbar { display: flex; align-items: center; gap: 8px; padding: 10px 18px; }
.fbar .ref { font-family: "JetBrains Mono", monospace; font-size: 13px; color: var(--muted); background: var(--head); border: 1px solid var(--line); padding: 8px 10px; border-radius: 6px; min-width: 46px; text-align: center; }
.fbar .fx { font-style: italic; color: var(--muted); font-size: 14px; }
.fbar input { flex: 1; min-width: 0; font-family: "JetBrains Mono", monospace; font-size: 15px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; outline: none; }
.fbar input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.fbar input:disabled { background: var(--head); color: var(--muted); }
.sheet-wrap { overflow-x: auto; }
table.sheet { border-collapse: collapse; width: 100%; font-size: 14px; font-family: "JetBrains Mono", monospace; }
.sheet th, .sheet td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; min-width: 64px; white-space: nowrap; }
.sheet th { background: var(--head); color: var(--muted); font-weight: 500; text-align: center; font-size: 12px; }
.sheet td.rowh { background: var(--head); color: var(--muted); text-align: center; font-size: 12px; width: 36px; min-width: 36px; }
.sheet td.head { font-weight: 600; }
.sheet td.num { text-align: right; }
.sheet td:not(.rowh):not(.target) { cursor: pointer; }
.sheet td.picked { background: #fff4dc; }
.sheet th:first-child, .sheet td.rowh { position: sticky; left: 0; z-index: 1; }
.sheet td.target { outline: 2px solid var(--green); outline-offset: -2px; background: #f4fbf6; cursor: pointer; min-width: 90px; }
.sheet td.ok { background: var(--green-soft); color: var(--green-dark); font-weight: 600; }
.sheet td.bad { background: #fdeaea; color: var(--red); }
.drill-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px 18px; border-top: 1px solid var(--line); }
.feedback { font-size: 14px; min-height: 20px; flex: 1; }
.feedback.ok { color: var(--green-dark); }
.feedback.bad { color: var(--red); }
.actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.hint { font: inherit; font-size: 13px; color: var(--muted); text-decoration: underline dotted; background: none; border: 0; cursor: pointer; white-space: nowrap; }

.finish { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 40px 28px; text-align: center; }
.trophy { width: 56px; height: 56px; border-radius: 50%; background: var(--green); color: #fff; font-size: 28px; font-weight: 700; display: grid; place-items: center; margin: 0 auto 16px; }
.finish h2 { font-size: 28px; letter-spacing: -0.02em; margin-bottom: 8px; }
.finish p { color: var(--muted); max-width: 34em; margin: 0 auto 22px; }
.cta-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.finish .note { font-size: 13px; margin: 18px 0 0; }

.learn { color: var(--muted); font-size: 15px; display: grid; gap: 10px; }
.learn h3 { color: var(--ink); font-size: 15px; }
footer { padding: 24px 0; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

@media (max-width: 600px) {
  .drill-foot { flex-direction: column; }
  .actions { width: 100%; justify-content: space-between; }
  .crumb { display: none; }
  .fbar .fx { display: none; }
  .sheet th, .sheet td { padding: 6px 7px; min-width: 0; font-size: 12px; }
  .sheet td.target { min-width: 64px; }
  .fbar input { font-size: 16px; }
}

/* Phone → computer handoff box under the drill (built by drill.js) */
.handoff { margin-top: 16px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.handoff-title { font-size: 14px; margin-bottom: 12px; }
.handoff .signup-msg { margin: 10px 0 0 !important; color: var(--muted); }
.handoff .copy { font-size: 13px; }

/* Email signup on lesson finish screens (built by drill.js) */
.signup { margin: 28px auto 0; padding-top: 24px; border-top: 1px solid var(--line); max-width: 30em; }
.signup-title { font-weight: 600; color: var(--ink) !important; margin: 0 auto 10px !important; }
.signup-row { display: flex; gap: 8px; }
.signup-row input[type=email] { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; }
.signup-row input[type=email]:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.gotcha { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.signup-msg { font-size: 13px; margin: 10px auto 0 !important; }
.signup-msg.bad { color: #b42318 !important; }
@media (max-width: 480px) { .signup-row { flex-direction: column; } }

/* Level test (test.html / test.js) */
.intro, .result { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 36px 28px; }
.intro h1 { font-size: 34px; line-height: 1.15; letter-spacing: -0.03em; margin-bottom: 12px; }
.intro .lead { font-size: 17px; color: var(--muted); margin-bottom: 18px; }
.intro .rules { color: var(--muted); font-size: 14px; padding-left: 20px; margin-bottom: 24px; display: grid; gap: 6px; }
.challenge { display: inline-block; background: #fff4dc; color: #8a5a00; font-weight: 600; font-size: 14px; padding: 6px 12px; border-radius: 8px; margin-bottom: 16px; }
.prog i.miss { background: #e7b4b4; }
.result { text-align: center; }
.result .score { font-size: 64px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; color: var(--green); }
.result .score span { font-size: 28px; color: var(--muted); font-weight: 600; }
.result h2 { font-size: 28px; margin: 10px 0 6px; letter-spacing: -0.02em; }
.result > p { color: var(--muted); max-width: 32em; margin: 0 auto; }
.result .squares { font-size: 22px; letter-spacing: 2px; margin: 14px auto 6px; }
.result .pct { font-weight: 600; color: var(--ink); margin-top: 8px; }
.share { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 22px 0 6px; }
.copied { font-size: 13px; color: var(--green-dark) !important; }
.next-step { margin: 26px auto 0; padding-top: 24px; border-top: 1px solid var(--line); max-width: 30em; }
.next-step h3 { font-size: 18px; margin-bottom: 6px; }
.next-step p { color: var(--muted); margin-bottom: 14px; }
.next-step .or { margin: 18px 0 10px; font-size: 14px; }
.signup-msg.ok { color: var(--green-dark); font-weight: 600; }
.review { text-align: left; max-width: 32em; margin: 26px auto 18px; padding: 18px 0 0; border-top: 1px solid var(--line); list-style: none; display: grid; gap: 8px; font-size: 14px; }
.review li span { display: inline-block; width: 18px; font-weight: 700; }
.review .r-ok span { color: var(--green); }
.review .r-miss span { color: var(--red); }
.review code { display: block; margin: 2px 0 0 18px; white-space: normal; word-break: break-all; }
@media (max-width: 600px) {
  .intro, .result { padding: 26px 18px; }
  .intro h1 { font-size: 28px; }
}

/* "I'm building the same for SQL" box (sheet.js sqlNotify), under the email signup on finish/result screens */
.sql-notify { margin: 24px auto 0; max-width: 30em; text-align: left; background: var(--head); border-radius: 12px; padding: 16px 18px; }
.sql-notify .sql-title { font-size: 14px; color: var(--ink) !important; margin: 0 0 10px !important; max-width: none !important; }
.sql-notify .signup-msg:empty { display: none; }
.sql-notify .signup-msg { margin: 8px 0 0 !important; }
