:root { --panel: 218px; --brand: 201px; --gutter: 16px; color-scheme: light; font-family: Arial, Helvetica, sans-serif; color: #202529; }
* { box-sizing: border-box; }
html, body { height: 100%; width: 100%; overflow: hidden; background: white; }
#container { position: absolute; top: 248px; bottom: 68px; left: max(calc(var(--panel) + 2 * var(--gutter)), calc(var(--brand) + 2 * var(--gutter))); right: calc(var(--panel) + 2 * var(--gutter)); width: auto; height: auto; touch-action: none; }
#classroom-ui { visibility: hidden; }
#classroom-ui.ready { visibility: visible; }
.sidebar { position: fixed; top: var(--gutter); bottom: var(--gutter); width: var(--panel); display: flex; flex-direction: column; gap: 12px; overflow: auto; scrollbar-width: thin; padding-bottom: 2px; }
.sidebar.left { left: var(--gutter); } .sidebar.right { right: var(--gutter); }
.panel { border: 1px solid #d7dadd; border-radius: 14px; background: linear-gradient(135deg, #f5f6f7, #eceeef); padding: 8px; }
.panel h2 { font-size: 14px; letter-spacing: 1px; margin: 6px 8px 12px; font-weight: 700; }
.control { font: inherit; font-size: 15px; color: inherit; text-align: left; display: flex; align-items: center; gap: 12px; min-height: 49px; width: 100%; padding: 7px 10px; margin: 0; border: 1px solid transparent; border-radius: 9px; background: #ffffffb8; cursor: pointer; }
.control + .control { margin-top: 4px; }
.control:hover { background: white; border-color: #b7c4c9; }
.control[aria-pressed=true] { background: #e0f2ef; border-color: #279986; box-shadow: inset 3px 0 #279986; }
.control:focus-visible, dialog button:focus-visible { outline: 3px solid #087f8c; outline-offset: 2px; }
.control:disabled { opacity: .4; cursor: default; }
.control img, .control svg { width: 31px; height: 31px; object-fit: contain; flex-shrink: 0; }
.control svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.reset { min-height: 54px; background: white; border: 2px solid #40474b; font-weight: 700; font-size: 18px; box-shadow: 0 2px 4px #0000000d; }
.panel hr { border: 0; border-top: 1px solid #d5dadd; margin: 10px 3px; }
.hint { font-size: 12px; line-height: 1.5; color: #566168; padding: 8px 5px 1px; margin: 0; }
.speed { font-size: 12px; color: #566168; margin: 8px 8px 2px; text-align: center; }
.bottom { margin-top: auto; padding-top: 20px; }
#simulator-title { position: fixed; top: 10px; left: max(calc(var(--panel) + 2 * var(--gutter)), calc(var(--brand) + 2 * var(--gutter))); right: calc(var(--panel) + 2 * var(--gutter)); margin: 0; text-align: center; height: 228px; line-height: 1; color: #202529; }
#tooltip { position: fixed; z-index: 20; pointer-events: none; max-width: 265px; background: #252c30; color: white; padding: 10px 13px; border-radius: 8px; font: 13px/1.45 Arial, sans-serif; box-shadow: 0 3px 12px #0002; }
#tooltip[hidden] { display: none; }
dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); overflow: auto; padding: 24px; border: 1px solid #cdd4d7; border-radius: 16px; box-shadow: 0 16px 70px #0003; font: 15px/1.5 Arial,sans-serif; color: #202529; }
dialog::backdrop { background: #15262b55; }
dialog h2 { font-size: 21px; margin: 0 0 12px; } dialog h3 { font-size: 15px; margin: 18px 0 8px; }
dialog p { margin: 10px 0; } dialog ul { padding-left: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.dialog-actions button { font: inherit; padding: 9px 15px; border: 1px solid #aab7bc; border-radius: 7px; background: white; cursor: pointer; }
.dialog-actions .primary { background: #087f75; color: white; border-color: #087f75; }
.dialog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dialog-grid .control { font-size: 14px; }
.check { display: flex; gap: 9px; align-items: flex-start; padding: 10px 0; }
#status { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); background: #eef7f5; border: 1px solid #b7d9d1; border-radius: 8px; padding: 8px 14px; font-size: 13px; z-index: 5; pointer-events: none; }
#status:empty { display: none; }
@media (max-height: 760px) { .control { min-height: 41px; padding-top: 4px; padding-bottom: 4px; } .control img, .control svg { width: 28px; height: 28px; } .sidebar { gap: 8px; } .bottom { padding-top: 8px; } }
@media (max-width: 1050px) { :root { --panel: 175px; --gutter: 10px; } .control { font-size: 13px; gap: 8px; padding-left: 7px; padding-right: 7px; } .reset { font-size: 16px; } }
@media (max-width: 670px) { :root { --panel: 62px; --gutter: 5px; } .panel { padding: 4px; border-radius: 9px; } .control { justify-content: center; gap: 0; min-height: 44px; padding: 4px; } .control span, .panel h2, .hint, .speed { display: none; } .sidebar { gap: 6px; } .reset { border-width: 1px; } .bottom { padding-top: 8px; } }
@media (prefers-reduced-motion: reduce) { #container, #loading { transition: none; } }

#simulator-title img { height: 100%; width: auto; max-width: 100%; object-fit: contain; }
.brand { position: fixed; left: var(--gutter); bottom: var(--gutter); width: 201px; display: flex; align-items: center; flex-direction: column; gap: 6px; }
.brand img { width: 201px; height: 201px; object-fit: contain; }
.brand a { color: #146d7c; font-size: 12px; text-align: center; line-height: 1.4; width: 100%; }
.sidebar.left { bottom: 245px; }
#transport { position: fixed; bottom: 10px; left: max(calc(var(--panel) + 2 * var(--gutter)), calc(var(--brand) + 2 * var(--gutter))); right: calc(var(--panel) + 2 * var(--gutter)); display: flex; justify-content: center; gap: 10px; }
#transport .control { width: auto; min-width: 105px; justify-content: center; border-color: #bec9cc; margin: 0; background: #f4f7f7; }
#transport .control span { display: inline; }
#transport .control svg { width: 24px; height: 24px; }
#status { bottom: 70px; }
@media (max-height: 760px) { :root { --brand: 131px; } .brand { width: 131px; } .brand img { width: 131px; height: 131px; } .sidebar.left { bottom: 171px; } }
@media (max-width: 670px) { :root { --brand: 62px; } #container { bottom: 147px; } #transport { left: 106px; right: 5px; gap: 6px; } .brand { width: 96px; } .brand img { width: 96px; height: 96px; } .sidebar.left { bottom: 147px; } .brand a { font-size: 10px; } #transport .control { min-width: 74px; font-size: 12px; gap: 5px; } }

#classroom-ui [hidden], dialog [hidden] { display: none !important; }
#challenge-slot .control { border: 1px solid #9cbebc; background: #edf7f5; }
.current-challenge { color: #116b71; font-size: 13px; line-height: 1.4; margin: -4px 4px 0; font-weight: bold; }
#parts .control { position: relative; }
#parts .part-count { margin-left: auto; min-width: 23px; padding: 3px 5px; border-radius: 5px; background: #e8eef0; color: #31494e; font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
#restart-challenge { border-color: #9cbebc; margin-top: 8px; }
#challenge-picker, #challenge-instructions { width: min(760px, calc(100vw - 32px)); }
.challenge-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0; }
.challenge-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 64px; padding: 12px; border: 1px solid #c9d7d8; border-radius: 9px; background: #f8fbfb; color: #202529; text-align: left; font: inherit; cursor: pointer; }
.challenge-choice:hover, .challenge-choice[aria-current] { border-color: #087f75; background: #e8f5f2; }
.challenge-choice span, .challenge-book-page { color: #53666c; font-size: 13px; }
.challenge-variable { padding: 12px; background: #edf7f5; border: 1px solid #b9d6cf; border-radius: 9px; }
.challenge-variable input { width: 68px; padding: 6px; margin: 0 8px; border: 1px solid #a9babc; border-radius: 5px; font: inherit; }
.challenge-variable button { padding: 7px 10px; margin-top: 6px; border: 1px solid #087f75; border-radius: 5px; background: white; color: #11675f; font: inherit; cursor: pointer; }
.required-output { display: flex; flex-direction: row-reverse; justify-content: flex-end; flex-wrap: wrap; gap: 3px; padding: 12px 0; }
.output-marble { display: block; width: 19px; height: 19px; border-radius: 50%; flex: 0 0 19px; }
.output-marble.blue { border: 1px solid #154da0; background: radial-gradient(circle at 30% 25%, #b5dcff, #246bdf 45%, #073f99); }
.output-marble.red { border: 1px solid #ae1020; background: radial-gradient(circle at 30% 25%, #ffcfbf, #e02a35 45%, #9d091a); }
#challenge-instructions li { margin-bottom: 10px; }
@media (max-width: 670px) {
  #parts .part-count { display: block; position: absolute; right: -1px; bottom: 0; font-size: 10px; min-width: 16px; padding: 1px 3px; }
  .current-challenge { font-size: 10px; margin: 0; text-align: center; overflow-wrap: anywhere; }
  .challenge-list { grid-template-columns: 1fr; }
  .required-output { gap: 2px; }
  .output-marble { width: 13px; height: 13px; flex-basis: 13px; }
}
