* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  color-scheme: dark;
  --bg: #191c1d;
  --panel: #232728;
  --editor: #1c2021;
  --border: #3b4341;
  --text: #ecf0eb;
  --muted: #a4aea9;
  --green: #9ad99f;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  font: 15px/1.5 Inter, system-ui, 'Segoe UI', sans-serif;
}
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, select, input, textarea { font: inherit; color: inherit; }
button, select, input:not([type=checkbox]), textarea {
  border: 1px solid var(--border); border-radius: 6px; background: var(--editor);
}
button, select { padding: .48rem .82rem; }
button, select, summary { cursor: pointer; }
button:hover, select:hover { border-color: #82968a; }
button:disabled { opacity: .55; cursor: wait; }
a { color: var(--green); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.frame { width: min(100% - 40px, 960px); margin: 0 auto; }
.topbar { background: var(--panel); border-bottom: 1px solid var(--border); }
.topbar nav { min-height: 60px; display: flex; align-items: center; gap: 18px; }
.brand, .section-name, .playground-link { text-decoration: none; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-size: 18px; font-weight: 700; }
.brand span { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 7px; background: #9ad99f; color: #152c1c; font: 700 16px/1 var(--mono); }
.section-name { padding-left: 17px; border-left: 1px solid var(--border); color: var(--muted); }
.playground-link { margin-left: auto; color: var(--muted); }
.playground-link:hover, .section-name:hover { color: var(--text); }
main { padding-block: clamp(30px, 5vw, 64px) 60px; }
.lesson-tools, .actions, .dialog-head, .dialog-actions, .card-head { display: flex; align-items: center; gap: 12px; }
.lesson-tools { flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.lesson-tools select { max-width: 100%; color: var(--text); }
#copy { margin-left: auto; color: var(--text); }
#copy-status:empty { display: none; }
#manual-copy { display: block; margin-top: 12px; }
#manual-copy input { width: 100%; padding: .45rem; }
h1 { font-size: clamp(32px, 5vw, 48px); line-height: 1.12; letter-spacing: -.045em; margin: 28px 0 10px; overflow-wrap: anywhere; }
h2 { margin: 0; font-size: 16px; line-height: 1.4; font-weight: 650; }
.prompt { max-width: 72ch; margin: 0 0 30px; color: #c4ccc6; font-size: 17px; white-space: pre-line; overflow-wrap: anywhere; }
.workspace { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; gap: 16px; }
.card, #output-panel, dialog { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.card { min-width: 0; overflow: hidden; }
.card-head { min-height: 48px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.file { color: var(--muted); font: 12px var(--mono); margin-left: auto; }
#answer { display: block; width: 100%; min-height: 210px; resize: vertical; border: 0; border-radius: 0; padding: 16px; }
#answer:focus-visible { outline-offset: -2px; }
#answer, .source, #output, #checks code { font: 14px/1.6 var(--mono); tab-size: 4; }
.actions { border-top: 1px solid var(--border); padding: 12px 16px; flex-wrap: wrap; }
button.primary { background: var(--green); border-color: var(--green); color: #152719; font-weight: 650; }
button.primary:hover { background: #b8e6bc; }
.toggle { display: inline-flex; gap: 5px; align-items: center; color: var(--muted); font-size: 14px; }
input[type=checkbox] { accent-color: var(--green); width: 16px; height: 16px; }
#checks { margin: 0; padding: 0; list-style: none; }
#checks li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
#checks code { overflow-wrap: anywhere; white-space: pre-wrap; }
#checks small { flex: none; color: var(--muted); }
#checks [data-state=pass] { color: var(--green); }
#checks [data-state=fail] { color: #ffad94; }
#result { margin: 12px 16px; font-size: 14px; }
#result:empty { display: none; }
#checks li:last-child { border-bottom-color: transparent; }
#output-panel { margin-top: 16px; }
summary { padding: 11px 16px; font-weight: 600; }
#output { margin: 0; padding: 14px 16px; border-top: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
dialog { color: var(--text); width: min(calc(100% - 24px), 560px); max-height: 92vh; padding: 0; }
dialog::backdrop { background: rgb(10 13 12 / .76); }
dialog form { padding: 22px; }
.dialog-head { justify-content: space-between; }
.dialog-head h2 { font-size: 22px; }
.form-intro, .hint { color: var(--muted); font-size: 14px; }
.form-intro { margin: 5px 0 15px; }
dialog label { display: block; margin: 12px 0 4px; font-weight: 600; }
dialog input, dialog textarea { display: block; width: 100%; padding: 7px 10px; }
dialog textarea { resize: vertical; }
.hint { margin: 0 0 6px; }
.dialog-actions { margin-top: 16px; justify-content: flex-end; }
#form-error { color: #ffad94; }
@media (max-width: 700px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .frame { width: calc(100% - 28px); }
  .topbar nav { gap: 10px; }
  .section-name { padding-left: 10px; }
}
@media (max-width: 440px) {
  .playground-link { display: none; }
  #create { margin-left: auto; }
  .lesson-tools { gap: 8px; }
  .lesson-tools select { max-width: 100%; min-width: 0; }
  #copy { margin-left: 0; }
}
