*{box-sizing:border-box} :root{--paper:#f7f5ee;--ink:#284b43;--muted:#78827a;--border:#dedfd4;--green:#315d4c;--accent:#d7e6bd;--mono:ui-monospace,"SFMono-Regular",Consolas,"Liberation Mono",monospace}body{margin:0;background:var(--paper);color:var(--ink);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;font-size:14px}button,input,textarea{font:inherit}button{cursor:pointer;color:inherit;border:0;background:none;border-radius:8px;transition:background .15s,transform .15s}button:hover:not(:disabled){background:#e9ecdf}button:active:not(:disabled){transform:translateY(1px)}button:disabled{cursor:default;opacity:.45}button:focus-visible,a:focus-visible,input:focus-visible,summary:focus-visible{outline:3px solid #b2caa2;outline-offset:3px}[hidden]{display:none!important}.topbar{max-width:1560px;margin:auto;padding:22px 44px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}.brand{font-size:23px;letter-spacing:-1px;font-weight:750;color:var(--ink);text-decoration:none;display:flex;align-items:center;gap:10px}.brand-mark{display:grid;place-items:center;background:var(--green);color:#ecedc7;width:35px;height:35px;border-radius:11px;font-size:29px;line-height:1}.brand-note{font-size:12px;letter-spacing:0;font-weight:400;color:var(--muted);border-left:1px solid #d4d9cb;margin-left:12px;padding-left:20px}.header-actions{display:flex;gap:22px;align-items:center;font-size:12px;color:var(--muted)}.quiet{padding:7px 9px;font-size:12px}.header-actions button{border:1px solid var(--border);padding:9px 14px;background:#fbfaf5}main{max-width:1460px;margin:auto;padding:30px 44px 20px}.intro{display:flex;justify-content:space-between;align-items:center;margin-bottom:25px}.eyebrow{font-size:10px;letter-spacing:2px;font-weight:750;color:#879377;margin:0 0 10px}h1{font-family:Georgia,"Times New Roman",serif;font-size:36px;font-weight:400;letter-spacing:-1.2px;margin:0 0 10px}h1 em{font-weight:400;color:#718767}.intro>div>p:last-child{margin:0;color:var(--muted);font-size:13px}.edition{display:flex;gap:12px;align-items:center;border-left:1px solid var(--border);padding-left:22px}.edition>span{font-family:Georgia,serif;font-size:42px;color:#a6b296}.intro .edition p{font-size:9px;letter-spacing:1.8px;line-height:1.7}.workspace{display:grid;grid-template-columns:minmax(0,1.12fr) minmax(0,1fr);gap:22px;align-items:start}.game-card,.code-card,.helper-card{border:1px solid var(--border);background:#fffef9;border-radius:15px;overflow:hidden;box-shadow:0 5px 18px #284b4304}.panel-heading{height:54px;display:flex;align-items:center;justify-content:space-between;padding:0 18px;gap:8px}.panel-heading>div{display:flex;align-items:center;gap:10px}.panel-heading strong{font-size:13px;font-weight:600}.subtle{color:#93998e;font-size:11px;border-left:1px solid #dde0d5;padding-left:10px}.status-dot{width:7px;height:7px;background:#80a76d;border-radius:50%}.stage-wrap{position:relative;margin:0 9px;overflow:hidden;border-radius:8px;background:#ecdccc}canvas{display:block;width:100%;height:auto;outline:none;touch-action:none}canvas:focus-visible{box-shadow:inset 0 0 0 3px #315d4c}.boot-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:10px;background:#f3edddd9;font-size:18px}.boot-overlay small{font-size:12px;color:var(--muted)}.win-banner{position:absolute;top:18%;left:50%;transform:translateX(-50%);width:75%;text-align:center;padding:22px;border-radius:12px;background:#fffcebe8;font-family:Georgia,serif;font-size:30px;box-shadow:0 8px 30px #284b4320;pointer-events:none}.win-banner small{display:block;font-family:system-ui;font-size:12px;margin-top:8px}.game-footer{display:flex;justify-content:space-between;align-items:center;height:45px;padding:0 19px;font-size:11px;color:#7d857b}kbd{font:10px var(--mono);padding:3px 6px;background:#f4f4ec;border:1px solid #e0e2d8;border-radius:4px;color:var(--ink)}.separator{padding:0 8px;color:#c5c9bd}#score{font-weight:600;color:#6a8062}.touch-controls{display:none;gap:12px;padding:8px 15px 14px}.touch-controls button{padding:10px 20px;background:#edf0e3;touch-action:none}.touch-controls button:last-child{margin-left:auto}.helper-card{margin-top:18px;padding:18px 19px}.helper-heading{display:flex;align-items:center;gap:11px}.pip-avatar{width:35px;height:35px;border-radius:50%;display:grid;place-items:center;background:#e9eddb;color:#718951;font-size:28px}.helper-heading h2{font-size:14px;margin:0 0 3px;font-weight:650}.helper-heading p{font-size:11px;color:var(--muted);margin:0}.helper-badge{margin-left:auto;color:#728365;font-size:9px;border:1px solid #dce3cf;padding:5px 7px;border-radius:5px;letter-spacing:.6px;text-transform:uppercase}.ideas{display:flex;flex-wrap:wrap;gap:6px;margin:15px 0 12px}.ideas button{font-size:11px;padding:7px 10px;border:1px solid #e1e4d7;background:#f8f9f0;border-radius:20px}.conversation{max-height:185px;overflow:auto;scrollbar-width:thin;font-size:13px;line-height:1.65}.message{padding:0 0 10px}.message p{margin:0;white-space:pre-wrap}.message.user{margin-left:30px;padding:9px 12px;background:#f0f2e7;border-radius:9px;margin-bottom:12px}.message .experiment{font-size:12px;color:#74875d;margin-top:7px}.message.error{color:#9c583e}.suggestion{margin:6px 0 12px;border:1px solid #dde4d2;border-radius:9px;overflow:hidden}.suggestion-label{display:flex;align-items:center;justify-content:space-between;font-size:9px;letter-spacing:1px;padding:5px 10px;background:#f4f6ed}.suggestion pre{font:11px/1.65 var(--mono);margin:0;padding:7px 12px;white-space:pre-wrap;overflow-wrap:anywhere}.before{background:#f9efea;color:#9b735c}.after{background:#eef4e6;color:#476b38}.suggestion-actions{display:flex;justify-content:space-between;align-items:center;padding:8px 10px;font-size:10px;color:var(--muted);gap:10px}.small-primary{background:#e2eccf;padding:7px 10px;font-size:11px;color:#3e5d32}#ask-form{margin-top:12px;display:flex;gap:8px;align-items:center;background:#f9faf3;border:1px solid #dce2d3;border-radius:9px;padding:5px 6px 5px 12px}#question{min-width:0;width:100%;border:none;background:transparent;outline:none;padding:7px 0;font-size:12px;color:var(--ink)}#question::placeholder{color:#98a08f}#ask{background:var(--green);color:#fff;width:31px;height:31px;flex-shrink:0;font-size:20px}#ask:hover{background:#426d57}.code-icon{font:14px var(--mono);color:#819777}.language-badge{font:10px var(--mono);border:1px solid #e0e5d6;background:#f3f5ec;border-radius:5px;padding:4px 8px;color:#738266}.file-tab{height:36px;background:#f3f5ec;border-top:1px solid #e3e7db;border-bottom:1px solid #e3e7db;display:flex;align-items:center;justify-content:space-between;padding:0 18px;font:11px var(--mono)}#code-state{font-family:system-ui;color:#98a08e;font-size:10px}.editor-wrap{position:relative;display:flex;height:439px;background:#fcfcf6;overflow:hidden;font:12px/20px var(--mono)}#line-numbers{width:43px;flex-shrink:0;text-align:right;padding:15px 9px 15px 0;color:#b9bfad;overflow:hidden;user-select:none;border-right:1px solid #eef0e6;white-space:pre}.number-line{height:20px}.number-line.active{color:#6f8a43;background:#e5edcc;border-radius:4px;font-weight:700}.code-scroll{position:relative;flex:1;min-width:0;overflow:hidden}#editor,#syntax{position:absolute;inset:0;width:100%;height:100%;margin:0;padding:15px 12px;border:0;tab-size:4;font:inherit;line-height:20px;letter-spacing:0;white-space:pre;overflow:auto}#syntax{pointer-events:none;color:#385d50;scrollbar-width:none}#editor{resize:none;background:transparent;color:transparent;caret-color:#294c3d;outline:none;-webkit-text-fill-color:transparent;scrollbar-width:thin}#editor::selection{background:#a8c79a66}.token-comment{color:#9da58e;font-style:italic}.token-string{color:#ad793f}.token-number{color:#a276ab}.token-keyword{color:#558793;font-weight:600}.syntax-line{display:inline-block;min-width:100%;height:20px}.syntax-line.active{background:#edf1d9}.line-note{min-height:36px;padding:10px 16px;background:#f2f5e7;border-top:1px solid #e1e7d1;font-size:11px;color:#7c8d63}.run-bar{display:flex;align-items:center;justify-content:space-between;padding:14px 16px 8px}.primary{background:var(--green);color:#fff;padding:11px 18px;font-size:12px;font-weight:550}.primary:hover:not(:disabled){background:#426c56}.code-bottom{display:flex;justify-content:space-between;gap:12px;padding:2px 18px 16px;color:#97a18e;font-size:9px}.error-box{padding:14px 18px;background:#fcf0e8;color:#9c6246;font-size:12px;line-height:1.5}.error-box p{margin:5px 0;white-space:pre-wrap;overflow-wrap:anywhere}.pocket-guide{border-top:1px solid var(--border);padding:0 18px;color:#7a876e;background:#fafbf3}.pocket-guide summary{cursor:pointer;padding:15px 0;font-size:11px;display:flex;justify-content:space-between}.pocket-guide dl{margin:0 0 18px;font-size:11px;line-height:1.5}.pocket-guide dt{font-family:var(--mono);color:#4c7056;margin-top:10px}.pocket-guide dd{margin:3px 0}.page-footer{display:flex;justify-content:space-between;color:#a1a692;font-size:10px;margin-top:22px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(min-width:1500px){.editor-wrap{height:479px;font-size:13px;line-height:21px}#editor,#syntax{line-height:21px}.number-line,.syntax-line{height:21px}}@media(max-width:1050px){main{padding:24px}.topbar{padding:18px 24px}.brand-note{display:none}.workspace{gap:16px}.editor-wrap{font-size:11px}.subtle{display:none}h1{font-size:31px}}@media(max-width:780px){.workspace{grid-template-columns:1fr}.topbar{padding:14px 18px}.header-actions>span{display:none}.brand{font-size:20px}main{padding:24px 16px}.intro{margin-bottom:20px}h1{font-size:28px}.edition{display:none}.intro>div>p:last-child{font-size:12px}.code-card{margin-top:2px}.editor-wrap{height:455px;font-size:12px}.touch-controls{display:flex}.page-footer{gap:20px;line-height:1.7}.helper-card{padding:16px}.game-footer{padding:0 13px}}@media(prefers-reduced-motion:reduce){button{transition:none}}
/* Pip's optional voice controls are shared by lesson and game panels. */
.pip-voice { padding: 0 14px; }
.pip-compose-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; width: 100%; }
.pip-voice-controls { display: contents; }
#ask-form { flex-direction: column; align-items: stretch; }
#ask-form input { min-width: 0; width: 100%; }
.pip-voice-controls button { padding: 8px 12px; border-radius: 9px; }
.pip-voice-controls .pip-talk { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; background: var(--green); color: white; border: 1px solid #244737; font-weight: 650; box-shadow: 0 2px 3px #183b2926; }
.pip-voice-controls .pip-talk::before { content: ''; width: 18px; height: 18px; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='9' y='2' width='6' height='13' rx='3'/%3E%3Cpath d='M5 10v2a7 7 0 0 0 14 0v-2M12 19v3M8 22h8' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.pip-voice-controls .pip-talk:hover:not(:disabled) { background: #426c56; }
.pip-voice-controls .pip-talk[aria-pressed="true"] { background: #843e32; border-color: #713127; }
.pip-voice-controls .pip-talk[aria-pressed="true"]::before { mask: none; width: 12px; height: 12px; border-radius: 2px; }
.pip-voice-controls .pip-talk[aria-pressed="true"]:hover:not(:disabled) { background: #984b3d; }
.pip-voice-status { font-size: .82rem; line-height: 1.4; margin: 8px 0; }
#workshop-main[data-game="sokoban"] .touch-controls{display:flex;flex-wrap:wrap;gap:8px}#workshop-main[data-game="sokoban"] .touch-controls button{min-width:44px}#workshop-main[data-game="sokoban"] .game-footer{flex-wrap:wrap;gap:6px}

.workshop-actions { display:flex; align-items:center; gap:12px; }
#game-downloads { position:relative; }
#game-downloads summary { display:flex; align-items:center; gap:18px; cursor:pointer; list-style:none; border:1px solid #cbd5bf; border-radius:8px; background:#fffdf5; padding:10px 14px; font-size:12px; min-height:44px; }
#game-downloads summary::-webkit-details-marker { display:none; }
#game-downloads summary:hover, #game-downloads[open] summary { background:#e9edde; }
.game-download-options { position:absolute; z-index:20; right:0; top:calc(100% + 8px); width:270px; padding:6px; border:1px solid #d6dccb; border-radius:12px; background:#fffdf5; box-shadow:0 12px 32px #243d3326; }
.game-download-options button { display:block; width:100%; padding:14px 12px; text-align:left; }
.game-download-options strong { display:flex; justify-content:space-between; align-items:center; gap:12px; font-size:13px; }
.game-download-options strong span { font:11px var(--mono); color:#718069; }
.game-download-options small { display:block; margin-top:6px; font-size:11px; line-height:1.5; color:#647364; }
.game-download-options button+button { border-top:1px solid #e3e7d9; border-radius:0 0 6px 6px; }
#export-status:empty { display:none; }
#export-status { font-size:12px; line-height:1.6; padding:10px 14px; margin:0 0 16px; border-radius:8px; background:#edf1e3; }
@media(max-width:650px) { .workshop-heading { flex-wrap:wrap; }.workshop-actions { width:100%; justify-content:space-between; } }

#workshop-main[data-game="asteroids"] .touch-controls { display:flex; flex-wrap:wrap; gap:8px; }
#workshop-main[data-game="asteroids"] .game-footer,#workshop-main[data-game="invaders"] .game-footer { flex-wrap:wrap; gap:6px; }

/* Expanded play reuses the live canvas and controls inside a modal page. */
.game-view-actions { display: flex; gap: 4px; flex-shrink: 0; }
.game-view-actions #expand-game { background: #edf0e3; }
.game-expanded { overflow: hidden; }
#expanded-game { width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--paper); color: var(--ink); }
#expanded-game[open] { display: flex; }
#expanded-game .game-card { display: flex; flex-direction: column; width: 100%; height: 100%; border: 0; border-radius: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#expanded-game .panel-heading, #expanded-game .game-footer, #expanded-game .touch-controls { flex-shrink: 0; }
#expanded-game .stage-wrap { flex: 1; min-height: 0; margin: 0; border-radius: 0; background: #13271f; }
#expanded-game canvas { width: 100%; height: 100%; object-fit: contain; }
#expanded-game .game-footer { gap: 16px; height: auto; min-height: 45px; padding-top: 8px; padding-bottom: 8px; }
#expanded-game #score { flex-shrink: 0; }
@media (pointer: coarse) { #expanded-game .touch-controls { display: flex; } }
@media (max-width: 600px) {
  #game-card .panel-heading { height: auto; min-height: 54px; padding: 10px 12px; flex-wrap: wrap; }
  #game-card .game-view-actions { margin-left: auto; }
  #expanded-game .game-footer { flex-wrap: wrap; gap: 6px 12px; }
  #expanded-game .touch-controls { flex-wrap: wrap; gap: 8px; }
  #expanded-game .touch-controls button { padding: 10px 16px; }
}
