:root {
  --ink: #1d2923;
  --muted: #5c6961;
  --paper: #fffef9;
  --canvas: #edf1ec;
  --line: #cbd4cc;
  --green: #24543c;
  --green-light: #e1eee5;
  --blue: #315e78;
  --blue-light: #e4eef4;
  --red: #a33b35;
  --red-light: #f7e4e1;
  --code: #17251e;
  --radius: 8px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, system-ui, sans-serif; line-height: 1.55; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #e0a52b; outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 50; padding: .65rem .9rem; background: var(--ink); color: white; }
.skip-link:focus { top: 1rem; }
.app-header { position: sticky; top: 0; z-index: 20; min-height: 4.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding: .65rem max(.8rem, calc((100vw - 1500px) / 2)); background: rgba(255,254,249,.96); backdrop-filter: blur(12px); }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--ink); text-decoration: none; }
.brand-mark { width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: white; font: 700 1.35rem Georgia, serif; }
.brand strong, .brand small { display: block; line-height: 1.1; }
.brand small { margin-top: .15rem; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.cycle-label { color: var(--muted); font-size: .82rem; }
main { width: min(1500px, calc(100% - 20px)); margin: 0 auto; padding: 2rem 0 4rem; }
h1, h2, p { margin-top: 0; }
h1, h2 { font-family: Georgia, serif; line-height: 1.06; }
h1 { margin-bottom: .8rem; font-size: clamp(2.5rem, 5vw, 5rem); }
h2 { margin-bottom: .55rem; font-size: clamp(1.7rem, 3vw, 2.6rem); }
.eyebrow { margin: 0 0 .4rem; color: var(--red); font-size: .73rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.intro, .identity-panel, .set-toolbar, .problem-nav, .algorithm-panel, .state-panel, .completion { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.intro { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .65fr); gap: 2rem; padding: clamp(1.4rem, 4vw, 3rem); }
.intro p { max-width: 75ch; color: var(--muted); }
.intro .app-slogan { margin:.35rem 0 .8rem; color:var(--navy); font-size:clamp(1.25rem,2.4vw,1.9rem); letter-spacing:-.025em; }
.login-slogan { margin:-.2rem 0 1rem; color:var(--muted); font-size:1.05rem; font-weight:700; }
.intro ol { margin: 0; padding-left: 1.5rem; }
.header-right { display: flex; align-items: center; gap: 1rem; }
.teacher-link { color: var(--green); font-size: .82rem; font-weight: 850; text-decoration: none; }
.teacher-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.learner-status { display: flex; align-items: center; gap: .65rem; border-left: 1px solid var(--line); padding-left: 1rem; color: var(--muted); font-size: .8rem; }
.learner-status span { font-weight: 800; color: var(--ink); }
.text-button { border: 0; padding: .25rem; background: transparent; color: var(--green); font-size: .78rem; font-weight: 850; text-decoration: underline; text-underline-offset: 3px; }
.identity-panel { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(520px, 1.2fr); gap: 1.5rem; align-items: center; margin-top: 1rem; padding: 1.4rem; }
.identity-panel p { color: var(--muted); }
.identity-panel .privacy-note { margin-bottom: 0; font-size: .85rem; }
.identity-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; align-items: start; }
.identity-form input { width: 100%; min-height: 2.75rem; border: 1px solid var(--line); border-radius: 5px; padding: .5rem; background: white; color: var(--ink); }
.identity-form button { grid-column: 1 / -1; justify-self: end; }
.set-toolbar { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(560px, 1.5fr); gap: 1.5rem; margin-top: 1rem; padding: 1.2rem; }
.set-toolbar p { color: var(--muted); }
.set-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; }
label span { display: block; margin-bottom: .25rem; color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
select, input[type=file] { width: 100%; min-height: 2.75rem; border: 1px solid var(--line); border-radius: 5px; padding: .5rem; background: white; color: var(--ink); }
.problem-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding: .8rem 1rem; }
.problem-nav span { display: block; color: var(--muted); font-size: .8rem; }
.problem-nav button + button { margin-left: .4rem; }
.trace-workspace { display: grid; grid-template-columns: minmax(360px, .85fr) minmax(620px, 1.35fr); gap: 1rem; margin-top: 1rem; }
.algorithm-panel, .state-panel { min-width: 0; overflow: hidden; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.language-badge, .step-badge { flex: 0 0 auto; border-radius: 999px; padding: .35rem .6rem; background: var(--blue-light); color: var(--blue); font-size: .75rem; font-weight: 850; }
.problem-prompt, .problem-goal { margin: 1rem 1.2rem; }
.problem-goal { border-left: 4px solid var(--green); padding: .65rem .8rem; background: var(--green-light); }
.code-view { margin: 0; min-height: 300px; overflow: auto; padding: .8rem 0; background: var(--code); color: #f4f7f4; font: .88rem/1.7 "SFMono-Regular", Consolas, monospace; }
.code-line { display: block; padding: 0 1rem; white-space: pre; }
.code-line.current { background: #315f47; box-shadow: inset 5px 0 #f1c75b; }
.line-number { display: inline-block; width: 2rem; color: #91a499; user-select: none; }
.memory-view { padding: .85rem 1rem; border-bottom: 1px solid var(--line); background: #f7f9f6; }
.memory-title { margin-bottom: .55rem; color: var(--muted); font-size: .75rem; font-weight: 850; text-transform: uppercase; }
.memory-cells { display: flex; flex-wrap: wrap; gap: .35rem; }
.memory-cell { min-width: 3rem; text-align: center; }
.memory-index { display: block; color: var(--muted); font: .68rem monospace; }
.memory-value { display: block; border: 1px solid var(--line); padding: .4rem .6rem; background: white; font-family: monospace; }
.step-instruction { margin: 0; padding: .8rem 1rem; color: var(--muted); font-size: .85rem; }
.table-scroll { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th, td { min-width: 78px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .55rem; text-align: center; }
th { background: var(--canvas); color: var(--muted); font-size: .72rem; }
th:first-child, td:first-child { min-width: 52px; }
th:last-child, td:last-child { border-right: 0; }
tr.current-row td { background: var(--green-light); }
td input { width: 100%; min-width: 58px; border: 1px solid #91a499; border-radius: 4px; padding: .42rem; text-align: center; background: white; }
.pending-cell { color: #9aa49d; font-size: .75rem; font-style: italic; }
.feedback { margin: .8rem 1rem 0; border-left: 5px solid var(--red); padding: .8rem 1rem; background: var(--red-light); }
.feedback.correct { border-color: var(--green); background: var(--green-light); }
.trace-actions { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem; }
.primary-button, .secondary-button { border-radius: 5px; padding: .65rem .9rem; font-weight: 850; }
.primary-button { border: 1px solid var(--green); background: var(--green); color: white; }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); }
.completion { margin-top: 1rem; padding: 1.5rem; text-align: center; }
.completion-actions { margin-bottom: 1.4rem; }
.trace-receipt { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(420px, 1.2fr); gap: 1.2rem; align-items: center; border-top: 1px solid var(--line); padding: 1.4rem 0 0; text-align: left; }
.trace-receipt h3 { margin: 0 0 .45rem; font: 700 1.35rem/1.15 Georgia, serif; }
.trace-receipt p { margin-bottom: 0; color: var(--muted); }
.receipt-download { border: 1px solid var(--line); border-radius: 6px; padding: 1rem; background: #f7f9f6; }
.receipt-download .receipt-identity { margin: 0; color: var(--ink); font-weight: 850; }
.receipt-download .receipt-id { margin: .25rem 0 .8rem; font-family: ui-monospace, monospace; font-size: .78rem; }
.download-status { min-height: 1.4rem; margin: .6rem 0 0 !important; font-size: .82rem; }
.error-message { position: fixed; right: 1rem; bottom: 1rem; max-width: 420px; border-radius: 6px; padding: 1rem; background: #7d2d29; color: white; }
@media (max-width: 1050px) { .identity-panel, .set-toolbar, .trace-workspace, .trace-receipt { grid-template-columns: 1fr; } .set-controls { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 650px) { .intro { grid-template-columns: 1fr; } .identity-form, .set-controls { grid-template-columns: 1fr; } .identity-form button { grid-column: auto; width: 100%; } .problem-nav, .app-header { align-items: flex-start; } .cycle-label { display: none; } .learner-status { border-left: 0; padding-left: 0; } .problem-nav { flex-direction: column; } .problem-nav > div:last-child { width: 100%; display: grid; grid-template-columns: 1fr 1fr; } .problem-nav button + button { margin-left: 0; } }

/* Dr. Teach Tech shared application shell */
:root { --ink:#263238; --muted:#52626a; --paper:#fffdfc; --canvas:#f5f0e6; --line:#17324d; --green:#2a9d9f; --green-light:#e3f1f0; --blue:#17324d; --blue-light:#e7eff2; --red:#c65327; --red-light:#fbe8df; --code:#17283a; --radius:12px; --shadow:5px 6px 0 rgba(23,50,77,.14); }
body { background-color:var(--canvas); background-image:linear-gradient(rgba(23,50,77,.035) 1px,transparent 1px),linear-gradient(90deg,rgba(23,50,77,.035) 1px,transparent 1px); background-size:22px 22px; font-family:"Atkinson Hyperlegible",Arial,Helvetica,sans-serif; }
.app-header { min-height:4.25rem; border:0; border-bottom:4px solid var(--green); padding-block:.55rem; background:var(--blue); color:white; box-shadow:0 3px 0 rgba(23,50,77,.2); }
.brand { color:white; }
.brand small { color:#d9e5e9; }
.brand-mark { position:relative; border:2px solid white; background:transparent; }
.brand-mark::before,.brand-mark::after,.brand-mark span { content:""; position:absolute; inset:7px 11px; border-radius:999px; background:white; }
.brand-mark::before { transform:rotate(60deg); }
.brand-mark::after { transform:rotate(-60deg); }
.app-identity { margin-right:auto; border-left:1px solid rgba(255,255,255,.35); padding-left:1rem; font-weight:900; }
.app-identity small { display:block; color:#d9e5e9; font:700 .62rem ui-monospace,SFMono-Regular,Menlo,monospace; letter-spacing:.08em; text-transform:uppercase; }
.header-right { gap:.55rem; }
.teacher-link,.learner-status,.learner-status span,.autosave-status { color:white; }
.autosave-status { font:700 .66rem ui-monospace,SFMono-Regular,Menlo,monospace; white-space:nowrap; }
.header-button { min-height:2.25rem; border:1px solid rgba(255,255,255,.55); border-radius:7px; padding:.42rem .65rem; background:transparent; color:white; font-size:.72rem; font-weight:800; }
.header-button:hover { background:rgba(255,255,255,.1); }
.header-button-primary { border-color:#f3c64e; color:var(--blue); background:#f3c64e; }
h1,h2,h3,.trace-receipt h3 { color:var(--blue); font-family:"Atkinson Hyperlegible",Arial,Helvetica,sans-serif; font-weight:900; letter-spacing:-.025em; }
.eyebrow { color:var(--green); font-family:ui-monospace,SFMono-Regular,Menlo,monospace; letter-spacing:.12em; }
.intro,.identity-panel,.set-toolbar,.problem-nav,.algorithm-panel,.state-panel,.completion,.progress-dashboard,.data-settings { border:1px solid var(--blue); box-shadow:var(--shadow); }
.identity-panel { align-items:stretch; overflow:hidden; padding:0; }
.identity-panel > div:first-child { padding:1.4rem; }
.login-brand { display:flex; align-items:center; gap:.65rem; margin:-1.4rem -1.4rem 1rem; border-bottom:3px solid var(--green); padding:.8rem 1rem; background:var(--blue); color:white; }
.login-brand strong,.login-brand small { display:block; line-height:1.1; }
.login-brand small { font:700 .64rem ui-monospace,monospace; letter-spacing:.1em; text-transform:uppercase; }
.mini-mark { width:2rem; height:2rem; display:grid; place-items:center; border:1px solid white; border-radius:50%; font-weight:900; }
.privacy-note { border-left:4px solid var(--green); padding:.75rem .85rem; background:var(--blue-light); }
.identity-form { padding:1.4rem; background:var(--paper); }
.identity-form label small { display:block; margin-top:.3rem; color:var(--muted); font-size:.72rem; font-weight:500; text-transform:none; }
.identity-form > .login-guide,.identity-form > .resume-card,.identity-form > .signin-backup { grid-column:1/-1; }
.login-guide { text-align:center; text-decoration:none; }
.resume-card { border:1px solid var(--blue); border-left:6px solid #f3c64e; border-radius:9px; padding:1rem; background:#fff8dc; }
.resume-card h3 { margin:.1rem 0 .35rem; }
.resume-card p { margin-bottom:.75rem; }
.resume-actions { display:flex; flex-wrap:wrap; gap:.55rem; }
.signin-backup { display:grid; gap:.35rem; border-top:1px solid #cad3d6; padding-top:1rem; color:var(--muted); font-size:.82rem; }
.signin-backup strong { color:var(--blue); }
#signin-load-backup,#load-backup { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
.backup-upload { display:inline-flex; justify-content:center; align-items:center; cursor:pointer; }
.activity-status { margin-top:.8rem!important; border-left:4px solid #f3c64e; padding:.5rem .7rem; background:#fff8dc; color:var(--blue)!important; font-weight:800; }
.progress-dashboard { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin-top:1rem; overflow:hidden; background:var(--paper); }
.progress-dashboard > div { padding:1rem; border-right:1px solid var(--line); }
.progress-dashboard > div:last-child { border-right:0; }
.progress-dashboard span,.progress-dashboard strong,.progress-dashboard small { display:block; }
.progress-dashboard span { color:var(--muted); font-size:.74rem; font-weight:850; text-transform:uppercase; }
.progress-dashboard strong { color:var(--blue); font-size:2rem; line-height:1.1; }
.progress-dashboard small { color:var(--muted); }
.primary-button { border-color:var(--blue); background:var(--blue); }
.secondary-button { border-color:var(--blue); color:var(--blue); }
.code-line.current { background:#28516a; box-shadow:inset 5px 0 #f3c64e; }
.step-badge,.language-badge { background:#fff2c4; color:var(--blue); }
.data-settings { margin-top:1rem; padding:1rem 1.2rem; background:var(--paper); }
.data-settings summary { cursor:pointer; color:var(--blue); font-weight:850; }
.data-actions { display:flex; flex-wrap:wrap; gap:.6rem; margin:1rem 0; }
.danger-button { border:1px solid var(--red); border-radius:5px; padding:.65rem .9rem; background:white; color:var(--red); font-weight:850; }
.app-footer { border-top:1px solid rgba(23,50,77,.35); padding:1.25rem; color:var(--blue); font:800 .72rem ui-monospace,SFMono-Regular,Menlo,monospace; letter-spacing:.04em; text-align:center; text-transform:uppercase; }
.app-footer span { color:var(--green); }
.error-message[data-tone="success"] { border:1px solid var(--green); background:var(--green-light); color:var(--blue); }
@media (max-width:1150px) { .autosave-status,.learner-status,.app-identity small { display:none!important; } }
@media (max-width:780px) { .app-header { position:static; align-items:center; flex-wrap:wrap; } .app-identity { order:2; } .header-right { width:100%; order:3; overflow-x:auto; padding-bottom:.2rem; } .header-right>* { flex:0 0 auto; } }
@media (max-width:650px) { .progress-dashboard { grid-template-columns:1fr; } .progress-dashboard>div { border-right:0; border-bottom:1px solid var(--line); } .identity-form>.login-guide,.identity-form>.resume-card,.identity-form>.signin-backup { grid-column:auto; } }
@media (prefers-reduced-motion:reduce) { html { scroll-behavior:auto; } *,*::before,*::after { transition-duration:.01ms!important; animation-duration:.01ms!important; } }
