/* Python 3D Lab */
.wd { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; margin-top: 10px; }
.wd-list { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; }
/* a roomy editor: folding the building blocks away gives the code the space */
.wd-panel[data-panel="code"] .lk-editor { min-height: 380px; }
/* the robot lab's layout: lesson and code on the left, the 3D stage on the right */
.wd-main { min-width: 0; display: grid; grid-template-columns: minmax(380px, 1fr) minmax(0, 1.25fr); gap: 12px; align-items: start; }
.wd-main > .wd-panel[data-panel="play"] { grid-column: 2; grid-row: 1 / span 5; min-width: 0; }
@media (max-width: 1100px) {
  .wd-main { grid-template-columns: minmax(0, 1fr); }
  .wd-main > .wd-panel[data-panel="play"] { grid-column: auto; grid-row: auto; }
}
.wd-stage { position: relative; height: clamp(440px, 72vh, 820px); min-height: 440px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: #9ed8ff; box-shadow: 0 18px 46px -34px rgba(15,23,42,.6); }
.wd-stage canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
.wd-stage canvas:focus { box-shadow: inset 0 0 0 3px #f59e0b; }
@media (max-width: 640px) { .wd-stage { height: min(68vh, 620px); min-height: 380px; } .wd-build-head > span:nth-child(2) { flex-basis: 100%; } }
.wd-hud { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.wd-hud > * { pointer-events: auto; }
#wd-score { padding: 6px 14px; border-radius: 999px; background: rgba(15, 23, 42, .65); color: #fff; font-weight: 700; font-size: 18px; }
.wd-hint { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(15, 23, 42, .65); color: #fff; font-size: 13px; white-space: nowrap; pointer-events: none; }
.wd-bubble { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); padding: 8px 14px; border-radius: 14px; background: #fff; color: #111; font-weight: 600; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); }
.wd-message { position: absolute; top: 40%; left: 0; right: 0; text-align: center; font: 700 clamp(26px, 5vw, 46px) system-ui; color: #fff; text-shadow: 0 3px 0 #0f172a, 0 0 18px rgba(0, 0, 0, .5); pointer-events: none; }
.wd-message.is-in { animation: wd-pop .5s ease; }
@keyframes wd-pop { from { transform: scale(.6); opacity: 0; } }
.wd-pad { display: none; position: absolute; right: 12px; bottom: 12px; grid-template-columns: repeat(3, 46px); grid-template-rows: repeat(2, 46px); gap: 4px; }
.wd-pad button { border-radius: 12px; background: rgba(15, 23, 42, .55); color: #fff; font-size: 18px; touch-action: none; user-select: none; }
.wd-pad [data-key="arrowup"] { grid-column: 2; } .wd-pad [data-key="arrowleft"] { grid-column: 1; grid-row: 2; }
.wd-pad [data-key=" "] { grid-column: 3; grid-row: 1; } .wd-pad [data-key="arrowright"] { grid-column: 3; grid-row: 2; } .wd-pad [data-key="arrowdown"] { grid-column: 2; grid-row: 2; }
@media (pointer: coarse) { .wd-pad { display: grid; } .wd-hint { display: none; } }
.wd-main .lk-title { margin-top: 14px; }
.wd-ref { margin-top: 14px; }
.wd-ref pre { font-size: 12.5px; }
@media (max-width: 900px) { .wd { grid-template-columns: minmax(0, 1fr); } .wd-list { position: static; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }

/* Tabs: Instructions, Your code, Play, Result */
.wd-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; padding: 4px; border-radius: 14px; background: #f1ebe2; }
.wd-tabs button { flex: 1 1 auto; border: 0; border-radius: 10px; padding: 9px 12px; background: transparent; font-weight: 600; color: #57534e; cursor: pointer; }
.wd-tabs button[aria-selected="true"] { background: #fff; color: #1c1917; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.wd-panel[hidden] { display: none; }

/* ---- Instructions: clear type, colour and gentle motion ---- */
.wd-panel[data-panel="lesson"] { color: #1e293b; }
.wd-panel[data-panel="lesson"] .lk-title { margin: 6px 0 10px; font-size: clamp(1.6rem, 2.6vw, 2.1rem); line-height: 1.15; color: #0f172a; }
.wd-panel[data-panel="lesson"] .lk-explain { font-size: 1.02rem; line-height: 1.75; color: #334155; max-width: 760px; }
.wd-panel[data-panel="lesson"] .lk-explain p { margin: 0 0 12px; }
.wd-panel[data-panel="lesson"] .lk-explain code:not(pre code) { padding: 1px 6px; border-radius: 6px; background: #fef3c7; color: #92400e; font-size: .92em; }
.wd-panel[data-panel="lesson"] .lk-explain pre { margin: 10px 0 16px; padding: 14px 16px; border-radius: 14px; background: #0f172a; color: #e2e8f0; font-size: 14px; line-height: 1.6; box-shadow: inset 4px 0 0 #f59e0b, 0 8px 24px -12px rgba(15,23,42,.45); }
.wd-panel[data-panel="lesson"] .lk-task { position: relative; margin: 18px 0 14px; padding: 14px 16px 14px 52px; border-radius: 14px; font-size: 1.02rem; line-height: 1.6; color: #422006; background: linear-gradient(135deg, #fffbeb, #fef3c7); border: 1px solid #fcd34d; box-shadow: 0 10px 24px -18px rgba(180,83,9,.6); animation: wd-rise .45s ease both; }
.wd-panel[data-panel="lesson"] .lk-task::before { content: "🎯"; position: absolute; left: 14px; top: 12px; font-size: 22px; }
.wd-panel[data-panel="lesson"] .lk-task b { color: #92400e; }
.wd-panel[data-panel="lesson"] .lk-explain > * { animation: wd-rise .5s ease both; }
.wd-panel[data-panel="lesson"] .lk-explain > *:nth-child(2) { animation-delay: .08s; }
.wd-panel[data-panel="lesson"] .lk-explain > *:nth-child(3) { animation-delay: .16s; }
.wd-panel[data-panel="lesson"] .lk-explain > *:nth-child(4) { animation-delay: .24s; }
.wd-panel[data-panel="lesson"] .wd-ref { border-radius: 14px; border: 1px dashed #cbd5e1; background: #f8fafc; }
.wd-panel[data-panel="lesson"] .wd-ref summary { cursor: pointer; padding: 6px 2px; color: #334155; }
.wd-panel:not([hidden]) { animation: wd-fade .3s ease both; }
.wd-tabs button { transition: background .2s ease, color .2s ease, transform .15s ease; }
.wd-tabs button:hover { color: #1c1917; transform: translateY(-1px); }
.wd-tabs button[aria-selected="true"] { color: #b45309; }
@keyframes wd-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes wd-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .wd-panel:not([hidden]), .wd-panel[data-panel="lesson"] .lk-task, .wd-panel[data-panel="lesson"] .lk-explain > * { animation: none; }
}

/* ---- Edit objects: toolbar and properties panel ---- */
.wd-edit { margin-bottom: 12px; }
.wd-edit-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wd-buildbar { margin-top: 10px; padding: 13px 15px; border: 1px solid #d6d3d1; border-radius: 16px; background: linear-gradient(145deg, #fffdf8, #f5f0e7); box-shadow: 0 12px 30px -24px rgba(28,25,23,.5); }
.wd-buildbar[hidden] { display: none; }
.wd-build-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; color: #292524; font-size: 13px; }
.wd-build-head > span:nth-child(2) { flex: 1 1 320px; color: #57534e; }
.wd-build-count { padding: 4px 9px; border-radius: 999px; background: #e7e5e4; color: #44403c; font-weight: 800; white-space: nowrap; }
.wd-palette { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.wd-palette button { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 5px 11px; border: 1px solid #e7e5e4; border-radius: 11px; background: #fff; color: #44403c; font-size: 13px; font-weight: 700; }
.wd-palette button[aria-pressed="true"] { border-color: #15803d; box-shadow: 0 0 0 2px rgba(21,128,61,.18); color: #166534; }
.wd-palette button i { width: 20px; height: 20px; border: 1px solid rgba(0,0,0,.12); border-radius: 5px; background: var(--block); box-shadow: inset 0 2px rgba(255,255,255,.3), inset 0 -3px rgba(0,0,0,.12); }
.wd-palette button[data-block-color="eraser"] i { box-shadow: none; }
.wd-build-note { margin: 10px 0 0; color: #57534e; font-size: 12px; line-height: 1.5; }
.wd-build-note code { padding: 2px 5px; border-radius: 5px; background: #e7e5e4; color: #292524; }
.wd-buildbar button:focus-visible, [data-build="toggle"]:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
[data-build="toggle"][aria-pressed="true"] { background: #166534; border-color: #166534; color: #fff; }
.wd-edit-hint { font-size: 13px; color: #64748b; flex: 1 1 260px; }
.wd-edit [data-edit="toggle"][aria-pressed="true"] { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.wd-inspector { margin-top: 10px; padding: 14px 16px; border-radius: 14px; border: 1px solid #e7e5e4; background: #fff; box-shadow: 0 10px 24px -18px rgba(28,25,23,.45); animation: wd-rise .3s ease both; }
.wd-insp-title { margin: 0 0 10px; font-size: 15px; color: #1e293b; }
.wd-insp-title span { color: #64748b; font-weight: 500; }
.wd-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.wd-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: .04em; }
.wd-fields input[type="number"] { padding: 6px 8px; border-radius: 8px; border: 1px solid #d6d3d1; font-size: 14px; color: #1c1917; background: #fdfcfa; }
.wd-fields input[type="number"]:focus { outline: 2px solid #f59e0b; outline-offset: 1px; }
.wd-fields input[type="color"] { width: 100%; height: 34px; padding: 2px; border-radius: 8px; border: 1px solid #d6d3d1; background: #fff; cursor: pointer; }
.wd-fields input[type="range"] { accent-color: #b45309; }
.wd-insp-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.wd-insp-copied { font-size: 13px; color: #15803d; font-weight: 600; }

/* ---- Your player and Tools ---- */
.wd-look-tip { margin: 0 0 12px; font-size: 14px; color: #475569; }
.wd-look select { padding: 6px 8px; border-radius: 8px; border: 1px solid #d6d3d1; font-size: 14px; background: #fdfcfa; color: #1c1917; }
.wd-look input[type="color"] { width: 100%; height: 34px; padding: 2px; border-radius: 8px; border: 1px solid #d6d3d1; background: #fff; cursor: pointer; }
.wd-look .wd-fields { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.wd-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.wd-tool { padding: 14px; border-radius: 16px; border: 1px solid #e7e5e4; background: #fff; box-shadow: 0 10px 24px -20px rgba(28,25,23,.5); animation: wd-rise .35s ease both; transition: transform .2s ease, box-shadow .2s ease; }
.wd-tool:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -20px rgba(28,25,23,.55); }
.wd-tool-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.wd-tool-head b { display: block; font-size: 16px; color: #0f172a; }
.wd-tool-head small { display: block; color: #64748b; line-height: 1.45; margin-top: 2px; }
.wd-tool-icon { font-size: 30px; line-height: 1; }
.wd-tool-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { .wd-tool, .wd-tool:hover { animation: none; transition: none; transform: none; } }

/* ---- Mission list groups: practice and challenges ---- */
.wd-group { margin: 14px 0 6px; padding: 0 4px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #92400e; }
.wd-group:first-child { margin-top: 0; }

/* ---- Practice / Missions switch ---- */
.wd-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; padding: 4px; border-radius: 14px; background: #f1ebe2; }
.wd-modes button { border: 0; border-radius: 10px; padding: 9px 8px; background: transparent; font-weight: 700; color: #57534e; cursor: pointer; transition: background .2s ease, color .2s ease; }
.wd-modes button[aria-selected="true"] { background: #fff; color: #b45309; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---- Code blocks: click to add the Python for them ---- */
.wd-blocks { display: grid; gap: 10px; margin: 0 0 12px; padding: 12px; border-radius: 16px; background: #f8fafc; border: 1px solid #e2e8f0; }
.wd-block-group { display: grid; gap: 6px; }
.wd-block-name { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--g); }
.wd-block-row { display: flex; flex-wrap: wrap; gap: 6px; }
.wd-block { border: 0; border-radius: 10px; padding: 7px 12px; background: var(--g); color: #fff; font-weight: 700; font-size: 13px; cursor: pointer; box-shadow: 0 4px 10px -6px var(--g); transition: transform .15s ease, box-shadow .15s ease; }
.wd-block:hover { transform: translateY(-2px); box-shadow: 0 10px 18px -10px var(--g); }
.wd-block:active { transform: translateY(0) scale(.98); }
@media (prefers-reduced-motion: reduce) { .wd-block, .wd-block:hover { transition: none; transform: none; } }

/* calm: panels, lesson text, tools and the inspector just appear – no sliding in one after another */
.wd-panel:not([hidden]), .wd-panel[data-panel="lesson"] .lk-task, .wd-panel[data-panel="lesson"] .lk-explain > *, .wd-inspector, .wd-tool { animation: none; }
.wd-tool:hover, .wd-tabs button:hover { transform: none; }
