/*css file:spinner*/
.BerryBotIcon {
  background-image: url("../images/morBerry.svg");
  background-repeat: no-repeat;
  margin-left:1rem;
  margin-top:0.5rem;
  padding: 0.1em;
  width: 30px !important;
  height: 100% !important;
  line-height: 50px;
  min-height: 50px;
  vertical-align: middle;
}
.PicoBricksGoIcon {
  background-image: url("../images/go_renkli.svg");
  background-repeat: no-repeat;
  margin-top:0.5rem;
  margin-left: 0.4rem;
  width: 30px !important;
  height: 100% !important;
  vertical-align: middle;
}
  /*css file:style.css*/
  
@font-face {
    font-family: 'Source_Code_Pro';
    src: url("../fonts/Source_Code_Pro/static/SourceCodePro-Regular.ttf") format("opentype");
    font-weight: normal;
    font-style: normal;
  }
  
  body, html {
    height: 100%;
    margin: 0;
    background-color: #fff;
    font-family: 'Source_Code_Pro';
    background-size:auto;
    background-repeat: no-repeat;
  }
  
  .bg {
    /* The image used */
    background: url('../images/background.png'); 
  
    /* Full height */
    height: 100%; 
  
    /* Center and scale the image nicely */
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
  }
  
  .blocklySvg {
    background: #f4f4ec;
  }
  
  canvas {
    background-color: transparent;
    z-index:200;
  }
  
  .savingButton {
    content: url('../images/savefile.gif');
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 5rem; 
    visibility: visible;
    border-style: none;
    border-width: 0px;
    z-index: 101;
    cursor: pointer;
    margin: 0.3rem;
    opacity: 0.8;
    visibility: hidden;
  }
  
  .progressBar {
    position: absolute;
    top: 55%;
    left: 40%;
    width: 20%; 
    border-width: 0px;
    z-index: 101;
    opacity: 0.8;
    visibility: hidden;
  }

  #spinnerBLE {
    position: absolute;
    top: 45%;
    left: 40%;
    width: 20%; 
    color:rgba(196, 27, 27, 0.8);
    border-width: 0px;
    z-index: 101;
    visibility: hidden;
  }
  #spinnerBLE .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.4rem;
  }
  .carousel-control-prev-icon,
  .carousel-control-next-icon {
    background-color: #57b45b;
    border-radius: 50%;
    padding: 10px;
  }

  .carousel-control-prev-icon:hover,
  .carousel-control-next-icon:hover {
    background-color: #3d8c45; 
  }
  .carousel-text {
    margin-left: 60px; 
    margin-right: 60px;
  }

  .transparentButton {
    background-color: transparent; 
    color: white; 
    border-style: solid;
    border-width: 1px;
    border-color: white;
    padding: 5px;
  }

  .openConnectButton{
    content: url('../images/buttons/connect.webp');
    width: 5rem; 
    visibility: visible;
    border-style: none;
    border-width: 0px;
    z-index: 101;
    cursor: pointer;
    margin: 0.3rem;
  }
  
  .openConnectButton:hover{
    opacity: 0.85;
  }
  
  .savePythonButton{
    content: url('../images/buttons/upload.png');
    width: 12rem; 
    visibility: visible;
    border-style: none;
    border-width: 0px;
    z-index: 101;
    cursor: pointer;
    margin: 0.3rem;
  }
  
  .savePythonButton:hover{
    opacity: 0.85;
  }
  
  .runPythonButton{
    content: url('../images/buttons/run.webp');
    width: 5rem; 
    visibility: visible;
    border-style: none;
    border-width: 0px;
    z-index: 101;
    cursor: pointer;
    margin: 0.3rem;
  }
  
  .runPythonButton:hover{
    opacity: 0.85;
  }
  
  .documentsButton{
    content: url('../images/buttons/doc.webp');
    width: 5rem; 
    visibility: visible;
    border-style: none;
    border-width: 0px;
    z-index: 101;
    cursor: pointer;
    margin: 0.3rem;
  }
  
  .documentsButton:hover{
    opacity: 0.85;
  }
  
  .notConnectedButton{
    content: url('../images/buttons/notconnected.webp');
    width: 5rem; 
    visibility: visible;
    border-style: none;
    border-width: 0px;
    z-index: 101;
    cursor: pointer;
    margin: 0.3rem;
  }
  
  .notConnectedButton:hover{
    opacity: 0.85;
  }
  
  .connectedButtonBLE{
    content: url('../images/buttons/connectedBLE.webp');
    width: 5rem; 
    visibility: visible;
    border-style: none;
    border-width: 0px;
    z-index: 101;
    cursor: pointer;
    margin: 0.3rem;
  }
  
  .connectedButtonBLE:hover{
    opacity: 0.85;
  }
  
  .notConnectedButtonBLE{
    content: url('../images/buttons/notConnectedBLE.webp');
    width: 5rem; 
    visibility: visible;
    border-style: none;
    border-width: 0px;
    z-index: 101;
    cursor: pointer;
    margin: 0.3rem;
  }
  
  .notConnectedButtonBLE:hover{
    opacity: 0.85;
  }
  
  .connectedButton{
    content: url('../images/buttons/connected.webp');
    width: 5rem; 
    visibility: visible;
    border-style: none;
    border-width: 0px;
    z-index: 101;
    cursor: pointer;
    margin: 0.3rem;
  }
  
  .connectedButton:hover{
    opacity: 0.85;
  }
  
  .openCodeButton{
    content: url('../images/buttons/codepanel.webp');
    width: 5rem; 
    visibility: visible;
    border-style: none;
    border-width: 0px;
    z-index: 101;
    cursor: pointer;
    margin: 0.3rem;
  }
  
  .openCodeButton:hover{
    opacity: 0.85;
  }
  
  .runButton{
    content: url('../images/buttons/run.webp');
    width: 5rem; 
    visibility: visible;
    border-style: none;
    border-width: 0px;
    z-index: 101;
    cursor: pointer;
    margin: 0.3rem;
  }
  
  .runButton:hover{
    opacity: 0.85;
  }
  
  .runButton-d{
    content: url('../images/buttons/run-d.png');
    width: 5rem; 
    visibility: visible;
    border-style: none;
    border-width: 0px;
    z-index: 101;
    cursor: pointer;
    margin: 0.3rem;
  }
  
  .stopButton{
    content: url('../images/buttons/stop.webp');
    width: 5rem; 
    visibility: visible;
    border-style: none;
    border-width: 0px;
    z-index: 101;
    cursor: pointer;
    margin: 0.3rem;
  }
  
  .stopButton:hover{
    opacity: 0.85;
  }
  
  .stopButton-d{
    content: url('../images/buttons/stop-d.png');
    width: 5rem; 
    visibility: visible;
    border-style: none;
    border-width: 0px;
    z-index: 101;
    cursor: pointer;
    margin: 0.3rem;
  }
  
  .connectButton
  {
    background-color: #fd5d0a;
    color: white;
    font-weight: bold;
    font-size: 11pt;
  }
  
  .connectButton:hover
  {
    color: white;
  }
  
  .disconnectButton
  {
    background-color: #fd5d0a;
    color: white;
    font-weight: bold;
    font-size: 11pt;
  }
  
  .disconnectButton:hover
  {
    color: white;
  }
  
  .gotoEditorButton
  {
    background-color: #fd5d0a;
    color: white;
    font-weight: bold;
    font-size: 11pt;
  }
  
  .gotoEditorButton:hover
  {
    color: white;
  }
  
  .codeButton{
    margin:1px;
    background-color: #2dfe32; 
    color: #0d277d; 
    font-size: 1vw; 
    font-family: sans-serif; 
    width: 9vw;  
  }
  
  .connectDevicePanel
  {
    margin: 5px;
    padding: 10px; 
    background-color: #fff; 
    border-radius: 5px;
    cursor: pointer;
    font-size: small;
  }
  
  .blockButton{
    margin:1px;
    background-color: #fafe32; 
    color: #0d277d; 
    font-size: 1vw; 
    font-family: sans-serif; 
  }
  
  .img-fluid {
    max-width: 100%;
    height: auto;
  }
  .img-responsive {
    display: block;
    max-width: 100%;
    height: auto;
  } 
  
  .blocklyDiv
  {
    color: white;
    padding: 1px;
    font-family: cursive, sans-serif;
    font-size: 2vw;
    color: black;
  }
  
  /* width */
  ::-webkit-scrollbar {
    width: 10px;
  }
  
  /* Track */
  ::-webkit-scrollbar-track {
    background: white; 
  }
   
  /* Handle */
  ::-webkit-scrollbar-thumb {
    background: #CECDCE; 
  }
  
  /* Handle on hover */
  ::-webkit-scrollbar-thumb:hover {
    background: #CECDCE;
  }
  
  /*Loader*/
  
  .spinner {
    width: 100px;
    height: 80px;
    text-align: center;
    font-size: 20px;
  
    position: absolute;
    top: 50%;
    left: 50%;
  }
  
  .spinner > div {
    background-color: #fff;
    height: 100%;
    width: 6px;
    display: inline-block;
    
    -webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;
    animation: sk-stretchdelay 1.2s infinite ease-in-out;
  }
  
  .spinner .rect2 {
    -webkit-animation-delay: -1.1s;
    animation-delay: -1.1s;
  }
  
  .spinner .rect3 {
    -webkit-animation-delay: -1.0s;
    animation-delay: -1.0s;
  }
  
  .spinner .rect4 {
    -webkit-animation-delay: -0.9s;
    animation-delay: -0.9s;
  }
  
  .spinner .rect5 {
    -webkit-animation-delay: -0.8s;
    animation-delay: -0.8s;
  }
  
  @-webkit-keyframes sk-stretchdelay {
    0%, 40%, 100% { -webkit-transform: scaleY(0.4) }  
    20% { -webkit-transform: scaleY(1.0) }
  }
  
  @keyframes sk-stretchdelay {
    0%, 40%, 100% { 
      transform: scaleY(0.4);
      -webkit-transform: scaleY(0.4);
    }  20% { 
      transform: scaleY(1.0);
      -webkit-transform: scaleY(1.0);
    }
  }
  
  .tab
  {
    padding: 10px;
  }
  
  .menuButton:hover
  {
    opacity: 0.8;
  }
  
  .vertical-center {
    margin: 0;
    position: absolute;
    top: 50%;
    -ms-transform: translateY(-50%);
    transform: translateY(-50%);
  }
  
  /* Change background color of buttons on hover */
  .tab button:hover {
    color: #ff3333;
  }
  
  /* Create an active/current tablink class */
  .tab button.active {
    color: #ff3333;
  }
  
  .tab button.active:hover {
    color: #ff3333;
  }
  
  .ace_editor {
    border: 1px solid lightgray;
    margin: auto;
    width: 100%;
  }
  
  
  /* Blockly*/
  
  #importExport {
    font-family: monospace;
  }
  
  .ioLabel>.blocklyFlyoutLabelText {
    font-style: italic;
  }
  
  .blocklyFlyoutLabelText {
    fill: white !important;
  }
  .blocklyFlyoutHeading>.blocklyFlyoutLabelText {
    font-size: 1.5rem;
  }
  line.blocklyFlyoutLine {
    stroke: white;
  }
  .blocklyFlyoutLabelIcon {
    font-family: 'Font Awesome\ 5 Free';
    font-size: 1.5rem;
    font-weight: 900;
    fill: white;
  }
  
  .blocklyTreeRow {
    height: 50px !important;
    margin: 0 0 3px 0 !important;
    padding: 4px 25px !important;
  }

  /* Force override for toolbox rows */
  .blocklyToolboxDiv .blocklyTreeRow {
    height: 50px !important;
    padding: 4px 25px !important;
    margin: 0 0 3px 0 !important;
  }

  /* Even more specific override */
  div.blocklyToolboxDiv div.blocklyTreeRow {
    height: 50px !important;
    padding: 4px 25px !important;
    margin: 0 0 3px 0 !important;
  }

  .blocklyTreeRoot {
    padding: 0 0 4px 0 !important;
  }

  .blocklyToolboxDiv {
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .basicBlocks
  {
    background: url('../images/buttons/Basic1.png');
    background-repeat: no-repeat; 
    background-size: cover;
    margin: 0 .3em;
    padding: 0.2em;
    width: 30px !important;
    height: 100% !important;
    line-height: 45px;
    min-height: 45px;
    vertical-align: middle;
  }
  
  .blocklyTreeIconCustom {
    background: none !important;
    font-family: 'Font Awesome\ 5 Free';
    font-weight: 900;
    font-size: 1.5rem;
    margin: 0 .3em;
    padding: 0.2em;
    width: 30px !important;
    height: 100% !important;
    line-height: 45px;
    min-height: 45px;
    vertical-align: middle;
  }
  .blocklyTreeIconCustom::before {
    content: "\f12e";
  }
  .blocklyTreeIconCustom.logic::before {
    content: "\f074";
  }
  .blocklyTreeIconCustom.loops::before {
    content: "\f01e";
  }
  .blocklyTreeIconCustom.math::before {
    content: "\f1ec";
  }
  .blocklyTreeIconCustom.text::before {
    content: "\f031";
  }
  .blocklyTreeIconCustom.lists::before {
    content: "\f0ca";
  }
  .blocklyTreeIconCustom.colour::before {
    content: "\f53f";
  }
  .blocklyTreeIconCustom.variables::before {
    content: "\f0c9";
  }
  .blocklyTreeIconCustom.functions::before {
    content: "\f141";
  }

  /*css file:navbar-resp*/

  @media (max-width: 1201px) and (min-width: 991px){
    #btRun{
      max-width: 10%;
    }
    #btStopCode{
      max-width: 10%; 
    }
    #btConnect{
      max-width: 10%;
    }
    #btConnectBLE{
      max-width: 10%;
    }
    #btDocuments{
      max-width: 10%;
    }
    #btCode{
      max-width: 10%;
    }
    #navbarResp{
      max-width: 50%;
    }
    #editorType{
      color: white; 
      margin: 5px;
      font-size: 12px;
    }
    #editorTypeResp{
      margin-left:3rem !important;
    }
    #sliderResp{
      margin-left:5.5rem !important;
      margin-right: 0rem !important;
    }
    #simulatorResp{
      margin-left: 0rem !important;
    }
    #simulatorIcon{
      max-height:1.6rem;
      margin-left:0.5rem;
    }
    #navbarDarkDropdownMenuLink{
      padding:5px;
    }
    #langSelect{
      float:right;
      margin-left:1rem;
    }
    .switch{
      max-width:40%;
      max-height:40%;
    }
  }


  /*css file:modal*/
  /* The Modal (background) */
.modal-custom {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    padding-top: 10vh; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(93,160,254); /* Fallback color */
    background-color: rgba(93,160,254,0.9); /* Black w/ opacity */
    z-index: 999;
  }
  
  /* Modal Content */
  .modal-content-custom {
    position: relative;
    background-color: #fefefe;
    margin: auto;
    padding: 0;
    border: 1px solid #888;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
    -webkit-animation-name: animatetop;
    -webkit-animation-duration: 0.4s;
    animation-name: animatetop;
    animation-duration: 0.4s
  }
  
  /* Add Animation */
  @-webkit-keyframes animatetop {
    from {top:-300px; opacity:0} 
    to {top:0; opacity:1}
  }
  
  @keyframes animatetop {
    from {top:-300px; opacity:0}
    to {top:0; opacity:1}
  }
  
  /* The Close Button */
  .close-custom {
    color: white;
    float: right;
    font-size: 28px;
    font-weight: bold;
  }
  
  .close-custom:hover,
  .close-custom:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
  }
  
  .modal-header-custom {
    padding: 2px 16px;
    background-color: #5cb85c;
    color: white;
  }
  
  .modal-body-custom {padding: 2px 16px;}
  
  .modal-footer-custom {
    padding: 2px 16px;
    background-color: #5cb85c;
    color: white;
  }

  /*css file:leftpanel*/
  .sidepanel {
    width: 0;
    position: fixed;
    z-index: 99;
    height: 85vh;
    top: 10vh;
    right: 0;
    background-color: #fff;
    overflow-x: hidden;
    transition: 0.5s;
    padding-top: 0px;
    resize: horizontal;
}

/*css file:dropdown*/
.dropbtn {
    background-color: transparent;
    color: white;
    box-sizing: border-box;
    border: none;
    cursor: pointer;
    font-size: medium;
  }
  
  .dropdown {
    position: relative;
    display: inline-block;
  }
  
  .dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 12rem;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    font-size: 0.8rem;
  }
  
  .dropdown-content a {
    color: black;
    padding: 10px;
    text-decoration: none;
    display: block;
    text-align: left;
  }
  
  .dropdown-content a:hover {background-color: #f1f1f1}
  
  .dropdown:hover .dropdown-content {
    display: block;
  }
  
  .dropdown:hover .dropbtn {
    background-color: hsla(0, 0%, 0%, 0.15);
  }

  
  /*css file:toogle*/
  .switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
  }
  
  .switch input { 
    opacity: 0;
    width: 0;
    height: 0;
  }
  
  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #fff;
    -webkit-transition: .4s;
    transition: .4s;
  }
  
  .slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: #fc5d4f;
    -webkit-transition: .4s;
    transition: .4s;
  }
  
  input:checked + .slider {
    background-color: #fff;
  }
  
  input:focus + .slider {
    box-shadow: 0 0 1px #fff;
  }
  
  input:checked + .slider:before {
    -webkit-transform: translateX(26px);
    -ms-transform: translateX(26px);
    transform: translateX(26px);
  }
  
  /* Rounded sliders */
  .slider.round {
    border-radius: 34px;
  }
  
  .slider.round:before {
    border-radius: 50%;
  }


/* ITL brand: cream sidebar and workspace */
.blocklyToolboxDiv {
    background-color: #f4f4ec !important;
}

/* "Restored your last project" message (js/autosave.js) */
.restored-notice {
    position: fixed;
    left: 50%;
    bottom: 56px;
    transform: translateX(-50%);
    z-index: 2000;
    align-items: center;
    gap: 14px;
    padding: 10px 10px 10px 16px;
    max-width: calc(100vw - 32px);
    background: #131111;
    color: #f4f4ec;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(19, 17, 17, 0.25);
    font-size: 0.95rem;
}

.restored-notice button {
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
}

.restored-notice-action {
    background: #fc5d4f;
    color: #131111;
    padding: 5px 12px;
    font-weight: 600;
}

.restored-notice-action:hover {
    background: #ff7468;
}

.restored-notice-close {
    background: transparent;
    color: #f4f4ec;
    font-size: 1.3rem;
    line-height: 1;
    padding: 2px 6px;
}


/* ===================================================================
   Python editor: VS Code Light+ look (js/code-editor-style.js)
   =================================================================== */

:root {
    --itl-coral: #fc5d4f;
    --itl-cream: #f4f4ec;
    --itl-ink: #131111;
    --code-bg: #ffffff;
    --code-chrome: #f3f3f3;          /* tab bar */
    --code-border: #e0e0e0;
    --code-text: #1f1f1f;
    --code-text-muted: #5f5f5f;
    --code-hover: rgba(19, 17, 17, 0.06);
    --code-focus: #0066bf;
    --ui-font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
    --code-font: "Source_Code_Pro", Consolas, "Cascadia Mono", Menlo, monospace;
}

/* Edge to edge: cancel the page container's side padding (Bootstrap .container-fluid). */
#panelPython {
    margin: 0 calc(var(--bs-gutter-x, 0.75rem) * -1);
    padding: 0;
}

.code-window {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 72px);      /* layoutEditors() sets the exact height */
    background: var(--code-bg);
    overflow: hidden;
    font-family: var(--ui-font);
}

/* Tab bar */
.code-tabs {
    display: flex;
    flex: none;
    height: 38px;
    background: var(--code-chrome);
    border-bottom: 1px solid var(--code-border);
}

.code-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    background: var(--code-bg);
    color: var(--code-text);
    font-size: 14px;
    border-right: 1px solid var(--code-border);
    box-shadow: inset 0 2px 0 var(--itl-coral);   /* active tab marker, as in VS Code */
    margin-bottom: -1px;                           /* merge into the editor below */
}

.code-tab-icon {
    color: #3776ab;
    font-size: 15px;
}

/* Editor area */
#panelPython #editorPython {
    flex: 1 1 auto;
    min-height: 0;
    width: auto !important;
    height: auto !important;
    margin: 0;
    border-radius: 0;
}

/* Status bar */
.code-statusbar {
    display: flex;
    flex: none;
    align-items: stretch;
    height: 28px;
    background: var(--itl-coral);
    color: var(--itl-ink);
    font-size: 13px;
    line-height: 28px;
    white-space: nowrap;
    overflow: hidden;
}

.sb-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
}

button.sb-item {
    cursor: pointer;
}

button.sb-item:hover {
    background: rgba(19, 17, 17, 0.1);
}

button.sb-item:focus-visible {
    outline: 2px solid var(--itl-ink);
    outline-offset: -2px;
}

.sb-spacer {
    flex: 1;
}

.sb-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 2px solid var(--itl-ink);
    background: transparent;
}

#sbBoard.is-connected .sb-dot {
    background: var(--itl-ink);
}

#sbSaved {
    display: none;
}

#sbSaved.is-visible {
    display: inline-flex;
}

@media (max-width: 720px) {
    .sb-optional {
        display: none;
    }
}

/* Editor theme: VS Code Light+ colours (all at least 4.5:1 on white) */
.ace-itl-light {
    background-color: #ffffff;
    color: #1f1f1f;
}
.ace-itl-light .ace_gutter {
    background: #ffffff;
    color: #6e7681;
}
.ace-itl-light .ace_gutter-active-line {
    background: transparent;
    color: #0b216f;
}
.ace-itl-light .ace_marker-layer .ace_active-line {
    background: transparent;
    box-shadow: inset 0 0 0 2px #eeeeee;
}
.ace-itl-light .ace_marker-layer .ace_selection {
    background: #add6ff;
}
.ace-itl-light.ace_editor:not(.ace_focus) .ace_marker-layer .ace_selection {
    background: #e5ebf1;
}
.ace-itl-light .ace_marker-layer .ace_selected-word {
    background: rgba(87, 87, 87, 0.12);
    border: none;
}
.ace-itl-light .ace_marker-layer .ace_bracket {
    margin: -1px 0 0 -1px;
    background: rgba(0, 100, 0, 0.1);
    border: 1px solid #b9b9b9;
}
.ace-itl-light .ace_cursor {
    color: #000000;
    border-left-width: 2px;
}
.ace-itl-light .ace_indent-guide {
    background: linear-gradient(to left, #d3d3d3 1px, transparent 1px);
}
.ace-itl-light .ace_fold {
    background-color: #e5ebf1;
    border-color: #6e7681;
}
.ace-itl-light .ace_invisible {
    color: #c8c8c8;
}

.ace-itl-light .ace_keyword.ace_control { color: #af00db; }
.ace-itl-light .ace_keyword,
.ace-itl-light .ace_storage.ace_type,
.ace-itl-light .ace_keyword.ace_operator.ace_logical,
.ace-itl-light .ace_constant.ace_language,
.ace-itl-light .ace_variable.ace_language { color: #0000ff; }
.ace-itl-light .ace_keyword.ace_operator,
.ace-itl-light .ace_paren,
.ace-itl-light .ace_punctuation { color: #1f1f1f; }
.ace-itl-light .ace_string { color: #a31515; }
.ace-itl-light .ace_constant.ace_numeric { color: #098658; }
.ace-itl-light .ace_comment { color: #008000; font-style: normal; }
.ace-itl-light .ace_entity.ace_name.ace_function,
.ace-itl-light .ace_support.ace_function,
.ace-itl-light .ace_meta.ace_decorator { color: #795e26; }
.ace-itl-light .ace_support.ace_class,
.ace-itl-light .ace_support.ace_type,
.ace-itl-light .ace_entity.ace_name.ace_type { color: #267f99; }
.ace-itl-light .ace_constant.ace_other { color: #0070c1; }
.ace-itl-light .ace_identifier { color: #001080; }
.ace-itl-light .ace_invalid { color: #cd3131; }

/* Autocomplete list and its description, matching the editor */
.ace_editor.ace_autocomplete {
    border: 1px solid #c8c8c8;
    box-shadow: 0 4px 12px rgba(19, 17, 17, 0.12);
    background: #ffffff;
    color: #1f1f1f;
    font-family: var(--code-font);
    font-size: 14px;
}
.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {
    background: #e8e8e8;
}
.ace_editor.ace_autocomplete .ace_completion-highlight {
    color: #0066bf;
    font-weight: 600;
}
.ace_tooltip.ace_doc-tooltip {
    max-width: 420px;
    padding: 8px 10px;
    border: 1px solid #c8c8c8;
    border-radius: 4px;
    background: #f8f8f8;
    color: #1f1f1f;
    font-family: var(--ui-font);
    font-size: 13px;
    line-height: 1.45;
    white-space: normal;
    box-shadow: 0 4px 12px rgba(19, 17, 17, 0.12);
}
.ace_tooltip.ace_doc-tooltip b {
    font-family: var(--code-font);
    font-weight: 600;
}

/* ===================================================================
   Serial Monitor: VS Code-style panel (js/bottompanel.js)
   Block mode: docked along the bottom of the window.
   Python mode: moved inside the code window, between editor and status bar.
   =================================================================== */

.serial-panel {
    display: flex;
    flex-direction: column;
    background: var(--code-bg);
    border-top: 1px solid var(--code-border);
    font-family: var(--ui-font);
}

.serial-panel.is-docked {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;       /* above Blockly's toolbox (40), below dragged blocks (50) and its menus */
    box-shadow: 0 -2px 8px rgba(19, 17, 17, 0.06);
}

.code-window .serial-panel {
    flex: none;
}

.serial-header {
    display: flex;
    align-items: center;
    flex: none;
    height: 36px;
    padding: 0 8px 0 4px;
    background: var(--code-bg);
}

.serial-tab {
    height: 100%;
    padding: 0 12px;
    border: none;
    background: transparent;
    color: #424242;
    font: 500 14px var(--ui-font);
    box-shadow: inset 0 -2px 0 var(--itl-coral);
    cursor: pointer;
}

.serial-panel.is-collapsed .serial-tab {
    box-shadow: none;
    color: var(--code-text-muted);
}

.serial-spacer {
    flex: 1;
}

.serial-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #424242;
    font-size: 14px;
    cursor: pointer;
}

.serial-tab:hover,
.serial-action:hover {
    background: var(--code-hover);
}

.serial-tab:focus-visible,
.serial-action:focus-visible {
    outline: 2px solid var(--code-focus);
    outline-offset: -2px;
}

/* Font Awesome swaps <i> for an inline <svg>, so style both. */
.serial-toggle i,
.serial-toggle svg {
    transition: transform 200ms cubic-bezier(0.25, 1, 0.5, 1);
}

.serial-panel.is-collapsed .serial-toggle i,
.serial-panel.is-collapsed .serial-toggle svg {
    transform: rotate(180deg);
}

.serial-body {
    height: 220px;
    border-top: 1px solid var(--code-border);
}

.code-window .serial-body {
    height: 30vh;
    max-height: 320px;
}

.serial-panel.is-collapsed .serial-body {
    display: none;
}

.serial-body textarea {
    display: block;
    width: 100%;
    height: 100%;
    padding: 8px 14px;
    border: none;
    outline: none;
    resize: none;
    background: var(--code-bg);
    color: var(--code-text);
    font: 14px/1.5 var(--code-font);
}

@media (prefers-reduced-motion: reduce) {
    .serial-toggle i,
    .serial-toggle svg {
        transition: none;
    }
}


/* ===================================================================
   Block mode: Python code generated from the blocks ("</> Py").
   Sits on the right, between the header and the Serial Monitor;
   layoutEditors() sets top/bottom, the sash on its left edge resizes it.
   =================================================================== */

.code-side {
    position: fixed;
    top: 56px;
    right: 0;
    bottom: 36px;
    z-index: 44;                     /* above Blockly's toolbox (40), below the Serial Monitor (45) */
    width: 37.5vw;                   /* the sash changes this */
    max-width: 70vw;
    display: flex;
    background: var(--code-bg);
    border-left: 1px solid var(--code-border);
    box-shadow: -2px 0 8px rgba(19, 17, 17, 0.06);
    /* Closed: slid off to the right. Sliding uses transform, not width. */
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 200ms cubic-bezier(0.25, 1, 0.5, 1), visibility 0s linear 200ms;
}

.code-side.is-open {
    transform: none;
    visibility: visible;
    transition: transform 200ms cubic-bezier(0.25, 1, 0.5, 1);
}

.code-side.is-resizing {
    transition: none;
    user-select: none;
}

.code-side-sash {
    flex: none;
    width: 5px;
    margin-right: -5px;              /* overlay the window's edge instead of taking space */
    position: relative;
    z-index: 2;                      /* above the editor window, whose layers stay inside it */
    cursor: ew-resize;
    background: transparent;
    transition: background-color 150ms ease-out;
}

.code-side-sash:hover,
.code-side-sash:focus-visible,
.code-side.is-resizing .code-side-sash {
    background: var(--itl-coral);
    outline: none;
}

.code-side-window {
    position: relative;
    z-index: 1;                      /* keep Ace's gutter layer from covering the sash */
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    font-family: var(--ui-font);
}

.code-side .code-tabs {
    align-items: stretch;
}

.code-tab-note {
    flex: 1;
    align-self: center;
    padding: 0 12px;
    color: var(--code-text-muted);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.code-tab-close {
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    margin-right: 6px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #424242;
    font-size: 15px;
    cursor: pointer;
}

.code-tab-close:hover {
    background: var(--code-hover);
}

.code-tab-close:focus-visible {
    outline: 2px solid var(--code-focus);
    outline-offset: -2px;
}

.code-side #editorBlockPython {
    flex: 1 1 auto;
    min-height: 0;
    width: auto !important;
    height: auto !important;
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    .code-side,
    .code-side-sash {
        transition: none;
    }
}

/* Header logo: the ITL mark as an app-style tile */
/* A square cell in the header's corner (like VS Code's app icon), the full
   height of the header, with the logo centred in it. The negative margin
   cancels the column's left padding (half the Bootstrap gutter) so the cell
   starts at the edge of the window. */
.brand-logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    flex: none;
    width: 56px;
    margin-left: calc(var(--bs-gutter-x, 1.5rem) * -0.5);
    margin-right: 1rem;
    line-height: 0;
}

.brand-logo {
    display: block;
    width: 41px;
    height: 32px;
    object-fit: contain;
    object-position: center;
}

.brand-logo-link:focus-visible {
    outline: 2px solid var(--itl-cream);
    outline-offset: 3px;
}
