:root { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif; color: #16264d; background: #f4f7fd; }
* { box-sizing: border-box; }
body { margin: 0; }
header { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 22px clamp(16px, 3vw, 36px); background: #17295c; color: white; }
.heading { min-width: 0; }
.back { color: #c8dcff; font-size: 14px; }
h1 { font-size: clamp(24px, 3vw, 34px); margin: 8px 0 4px; }
header p { margin: 0; color: #d8e3ff; font-size: 14px; }
.connection { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
#connection-status { font-size: 14px; color: #dce9ff; }
#connection-status.connected { color: #a2f7c4; }
button { appearance: none; border: 0; border-radius: 10px; background: #e4ebf8; color: #182951; font: inherit; font-weight: 700; min-height: 46px; padding: 10px 16px; cursor: pointer; touch-action: manipulation; }
button:hover:not(:disabled) { filter: brightness(.94); }
button:focus-visible, a:focus-visible { outline: 3px solid #ffbf47; outline-offset: 3px; }
button:disabled { opacity: .45; cursor: default; }
#connect, #run { background: #366ae2; color: white; }
#stop { background: #ffe8e8; color: #9a2532; }
.prerequisite { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 260px); align-items: center; gap: 24px; margin: 20px clamp(16px, 3vw, 36px) 0; padding: 18px 22px; border: 2px solid #df6721; border-radius: 16px; background: #fff7ef; }
.prerequisite-label { margin: 0 0 5px; color: #8b3a12; font-size: 14px; font-weight: 700; }
.prerequisite h2 { margin: 0 0 8px; font-size: clamp(21px, 2.5vw, 28px); line-height: 1.35; }
.prerequisite p { line-height: 1.6; }
.prerequisite-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; font-weight: 700; }
.prerequisite a { color: #9a3c08; text-underline-offset: 3px; }
.board-photo { margin: 0; text-align: center; }
.board-photo img { display: block; width: 100%; height: auto; border: 1px solid #eddbcb; border-radius: 10px; background: white; }
.board-photo figcaption { margin-top: 5px; color: #714c38; font-size: 12px; }
main { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; padding: 20px clamp(16px, 3vw, 36px) 32px; }
.editor, .help { border: 1px solid #dce5f5; border-radius: 16px; background: white; overflow: hidden; }
.editor-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #dce5f5; }
.actions { display: flex; gap: 8px; }
.tap-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 16px; border-bottom: 1px solid #dce5f5; background: #f5f9ff; font-size: 14px; }
.tap-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.tap-buttons button { min-width: 80px; background: #347d50; color: white; }
#tap-hint { color: #667490; }
#blockly { height: max(530px, calc(100vh - 230px)); width: 100%; }
.help { padding: 8px 20px 20px; font-size: 14px; line-height: 1.65; }
.help h2 { font-size: 17px; margin: 18px 0 6px; }
.firmware-choices { margin-top: 12px; padding: 10px 12px; border: 1px solid #c6d6f4; border-radius: 10px; background: #f1f5ff; }
.firmware-choices p { margin: 5px 0; }
.help details { margin: 16px 0; padding: 10px 12px; border: 1px solid #dce5f5; border-radius: 10px; }
.help summary { cursor: pointer; font-weight: 700; }
.settings { display: grid; gap: 10px; padding-top: 14px; }
.settings label { display: grid; gap: 4px; font-weight: 600; }
.settings label.check { display: flex; align-items: center; gap: 7px; }
.settings input:not([type="checkbox"]), .settings select { width: 100%; min-height: 38px; padding: 5px 8px; border: 1px solid #b9c9e4; border-radius: 7px; background: white; color: #16264d; font: inherit; }
.settings input[type="checkbox"] { width: 20px; height: 20px; }
.settings button { background: #366ae2; color: white; }
.help ol { padding-left: 1.5em; margin-top: 8px; }
.help li { margin-bottom: 8px; }
.browser-help { border-left: 4px solid #e9992e; background: #fff6e6; padding: 10px; }
.help a { color: #2454df; }
#log { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 80px; max-height: 220px; overflow: auto; padding: 12px; border-radius: 8px; background: #eff3fb; font: 12px/1.5 ui-monospace, SFMono-Regular, monospace; }
.code-preview, #wire-preview { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; border-radius: 8px; background: #eff3fb; font: 12px/1.5 ui-monospace, SFMono-Regular, monospace; }
.small { color: #667490; font-size: 12px; }
@media (max-width: 850px) { main { grid-template-columns: 1fr; } #blockly { height: min(62vh, 620px); min-height: 430px; } }
@media (max-width: 700px) { .prerequisite { grid-template-columns: 1fr; padding: 16px; } .board-photo { max-width: 300px; } }
@media (max-width: 600px) { header { display: block; } .connection { margin-top: 14px; justify-content: space-between; } .editor-bar { flex-wrap: wrap; } .help { padding-top: 0; } }
