html,
body {
  height: 100%;
}

body {
  background: #f0f0f0;
  font-family: sans-serif;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  /*disable pull to refresh */
  font-family: BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

label {
  user-select: none;
}

input:focus,
textarea:focus,
select:focus,
span:focus {
  outline: none;
}

tt {
  font-size: 0.9em;
  padding: 0.25rem 0.5rem;
  background: #eaeaea;
  margin: 0 0.25em;
  border-radius: 1rem;
  font-weight: bold;
}

.farSide {
  text-align: right;
}

html[dir="RTL"] .farSide {
  text-align: left;
}

/* Buttons */
button.icon,
label.button.icon {
  border-radius: 2rem;
  border: 1px solid transparent;
  background-color: transparent;
  color: #eee;
  padding: .25rem;
  transition: border-color ease .125s;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

button.icon:hover,
label.button.icon:hover {
  border: 1px solid #10D27F;
}

button.icon:active,
label.button.icon:active {
  border-color: #000;
}

button.disabled:hover {
  opacity: 0.6;
}

button.disabled {
  display: none;
}

button.icon.text,
label.icon.text {
  display: inline-flex;
  align-items: center;
  font-weight: bold;
  font-size: 1rem;
  padding: .25em .5em;
  white-space: nowrap;
}

button.icon.text::before,
label.icon.text::before {
  margin-right: .25rem;
}

h1 {
  font-weight: normal;
  font-size: 140%;
  margin-left: 5px;
  margin-right: 5px;
}

/* Top menu */
.top-menu {
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 .5rem 0 0;
  user-select: none;
  width: 100vw;
  box-sizing: border-box;
  background-color: #0A834F;
}

.top-menu>.logo {
  display: inline-block;
  align-items: center;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  min-width: 10rem;
  color: #eee;
  margin: 0 23px 0 0;
}

.top-menu>.logo:before {
  content: "";
  display: inline-block;
  width: calc(2*1.39rem);
  height: 2.2rem;
  background-size: cover;
  background-image: url(media/icon/logo.png);
  /*background-size: auto 4rem;*/
  /*background-position: left calc(-2rem*8) top; /* heigth * index in icons.svg */
  vertical-align: middle;
  margin-right: 0.5rem;
}

.top-menu>.tabs {
  margin: 0 0rem;
  display: flex;
  width: 100%;
  height: 90%;
  /* height: 100%; */
  /*overflow-x: auto;*/
  /* padding: .5rem 0; */
  padding: 0 0 5px 0;
  margin-top: 0.625rem;
}

.top-menu #channel_connect {
  display: flex;
  border-radius: 2rem;
  /*border: 1px solid #888;*/
  margin-right: .25rem;
  box-sizing: border-box;
  overflow: hidden;
}

.top-menu #channel_connect>a {
  -webkit-tap-highlight-color: transparent;
  display: inline-block;
  border-radius: 2rem;
  padding: .25rem;
  border: 1px solid transparent;
  box-sizing: content-box;
  margin: -1px;
  opacity: 0.6;
}

.top-menu #channel_connect>a.selected {
  opacity: 1;
  border: 1px solid #777;
  transition: box-shadow ease .125s;
  background-color: #fff;
}

.top-menu #channel_connect:hover>a.selected {
  box-shadow: -1px 0 3px #aaa;
}

#loadXML,
#put-file-select {
  display: none;
}

/* Channel Connect Panel */
.channel-panel {
  box-sizing: border-box;
  z-index: 999;
  position: fixed;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  width: 20.5rem;
  transition: .125s ease top, .125s ease opacity, .125s ease transform;
  background: #fff;
  border-radius: 1.5em;
  padding: 0.25rem;
  top: -15rem;
  right: 22rem;
  margin-right: 0;
  border: 1px solid #aaa;
  box-shadow: 0em 0em 0.5em rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: scale(0.5);
}

.channel-panel#show {
  top: .25rem;
  opacity: 1;
  transform: scale(1);
}

.channel-panel>div>span {
  width: 100%;
  border-radius: 2rem;
  color: #666;
  display: inline-block;
  box-sizing: border-box;
  text-align: left;
  padding: 0.5rem 0.5rem 0.125rem 0.5rem;
}

.channel-panel input,
#file_save_as input {
  border: none;
  padding: 0;
  height: 2rem;
  font-size: 1rem;
  display: inline-block;
  box-sizing: border-box;
  width: 100%;
}

.channel-panel input:focus {
  outline: 0 !important;
}

.channel-panel #url,
.channel-panel #password {
  border-bottom: 1px solid #ccc;
}

.channel-panel #url {
  margin-bottom: 1rem;
}

.channel-panel #url:disabled {
  background-color: #fff;
}

#bluetoothButton,
#serialButton,
#networkButton,
#scanButton {
  display: inline-flex;
  align-items: center;
}

.channel-panel .icon:before {
  margin-right: .25rem;
}

.channel-panel>div {
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 1.25rem;
  text-align: end;
  width: 100%;
}

.checkswitch {
  -webkit-tap-highlight-color: transparent;
  display: flex;
  justify-content: space-between;
  line-height: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

input.checkswitch[type="checkbox"] {
  -webkit-tap-highlight-color: transparent;
  display: none;
}

.checkswitch input:checked~span {
  background: #0A834F;

}

.checkswitch span {
  width: 2.5em;
  height: 1.5em;
  background: grey;
  display: inline-block;
  border-radius: 1.5em;
  position: relative;
  line-height: 1.5rem;
}

.checkswitch span::after {
  content: "";
  position: absolute;
  top: 0.074em;
  left: 0.075em;
  width: 1.35em;
  height: 1.35em;
  background: rgb(255, 255, 255);
  border-radius: 1.35em;
  transition: left 0.25s ease-out 0s, transform 0.25s ease-out 0s;
  box-shadow: rgb(0 0 0 / 20%) 0px 1px 3px;
}

.checkswitch input:checked~span::after {
  left: -0.27em;
  transform: translateX(100%);
}

#scanButton {
  line-height: 1.25rem;
  font-size: 0.8rem;
  margin: 0.125rem;
  padding-right: 0.5rem;
}

#bluetoothButton,
#serialButton,
#networkButton {
  font-weight: bold;
  line-height: 1.75rem;
  font-size: 1rem;
  width: 100%;
}

.channel-panel>div:first-of-type {
  margin: 0.25rem 0;
}

#connectButton {
  /*border: none;
  background: none;*/
}

#channelButton {
  border-color: #aaa;
  margin: -1px;
  background: #fff;
}

#channel_connect.wait,
#toolbarButton.wait {
  animation: blinking 1s infinite;
}

@keyframes blinking {
  0% {
    background-color: #fff;
  }

  50% {
    background-color: #6aa8fb;
  }

  100% {
    background-color: #fff;
  }
}

#networkButton,
#serialButton {
  margin-top: -1px;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

#scanButton:hover:before {
  animation: spin 1s linear infinite;
}

/* Tabs */
.tabs>div {
  min-width: 20.625rem !important;
  transition: box-shadow ease .125s, background-color linear .125s, border-color linear .125s, color linear .125s;
  margin: 0 0.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0B995C;
  font-size: 18px;
  font-weight: 900;
  color: #eee;
}

@media (max-width:88rem) {
  .tabs>div {
    padding: .25rem;
  }
}

.tabs>div.tabon {
  white-space: nowrap;
  background: #065231;
  color: #fff;
  border: none;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}

.tabs>div.taboff {
  cursor: pointer;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}

.tabs>div.taboff:hover {
  border: 1px solid #065231;
  color: #065231;
}

#tab_blocks {
  box-sizing: border-box;
}
#tab_blocks::before {
  content: url(./media/tabs/program.png);
  margin: .4rem 1rem 0 0;
}

#tab_files {
  margin: 0 .625rem;
  box-sizing: border-box;
}
#tab_files::before {
  content: url(./media/tabs/python.png);
  margin: .4rem 1rem 0 0;
}

#tab_console {
  box-sizing: border-box;
}
#tab_console::before {
  content: url(./media/tabs/console.png);
  margin: .4rem 1rem 0 0;
}

.tabs>div.tabmin {
  border-top-style: none !important;
  border-left-style: none !important;
  border-right-style: none !important;
}

.tabs>div.tabmax {
  border-top-style: none !important;
  border-left-style: none !important;
  border-right-style: none !important;
  width: 99%;
  padding-left: 10px;
  padding-right: 10px;
  text-align: right;
}

html[dir=rtl] td.tabmax {
  text-align: left;
}

table {
  border-collapse: collapse;
  margin: 0;
  padding: 0;
  border: none;
}

td {
  padding: 0;
  vertical-align: top;
}

#content_blocks.off,
#content_iot.off {
  visibility: hidden;
}

.content.off:not(#content_blocks):not(#content_iot) {
  display: none !important;
}

/* 三栏布局容器 */
.three-column-layout {
  display: flex;
  width: 100%;
  height: calc(100vh - 3rem);
  position: relative;
  top: 0;
  left: 0;
}

/* 左侧Blockly面板 */
.left-panel {
    width: 60%; /* 设置初始宽度，与右侧面板显示时的宽度一致 */
    height: 100%;
    display: flex;
    flex-direction: column;
    border-right: 2px solid #ddd;
    transition: width 0.3s ease;
    flex-shrink: 0;
    will-change: width;
}

/* 右侧面板容器 */
.right-panel {
    width: 40%;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, opacity 0.3s ease;
    overflow: visible;
    /* 设置初始状态为显示 */
    transform: translateX(0%);
    opacity: 1;
}

/* 右上Python代码面板 */
.right-top-panel {
  height: 60%;
  display: flex;
  flex-direction: column;
  border-bottom: 2px solid #ddd;
  transition: all 0.3s ease;
}

/* 右下控制台面板 */
.right-bottom-panel {
  height: 40%;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

/* 面板头部 */
.panel-header {
  background: #f5f5f5;
  padding: 8px 12px;
  border-bottom: 1px solid #ddd;
  font-weight: bold;
  color: #333;
  font-size: 14px;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 40px;
  box-sizing: border-box;
}

/* 面板标题文字半圆环背景 */
.panel-header span {
  position: relative;
  z-index: 2;
  padding: 4px 12px;
  border-radius: 15px;
  background: #0A834F;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  display: inline-block;
  font-size: 13px;
  color: white;
}

.panel-header span::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 17px;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.panel-header span:hover::before {
  opacity: 1;
}

.panel-header span:hover {
  background: #66BB6A;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 面板标题区域 */
.panel-title-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 复制代码按钮样式 */
.copy-code-btn {
  background: linear-gradient(135deg, #0A834F 0%, #66BB6A 100%);
  color: white !important;
  border: none;
  padding: 8px 14px;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(10, 131, 79, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  outline: none;
  min-width: 36px;
  min-height: 32px;
}

.copy-code-btn:hover {
  background: linear-gradient(135deg, #66BB6A 0%, #4CAF50 100%) !important;
  color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(10, 131, 79, 0.4);
}

.copy-code-btn:active {
  background: linear-gradient(135deg, #0A834F 0%, #66BB6A 100%) !important;
  color: white !important;
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(10, 131, 79, 0.3);
}

.copy-code-btn:focus {
  background: linear-gradient(135deg, #0A834F 0%, #66BB6A 100%) !important;
  color: white !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(10, 131, 79, 0.3);
}

/* AI助手按钮样式 */
.ai-console-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white !important;
  border: none;
  padding: 8px 14px;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.3s ease;
  margin-left: 8px;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  outline: none;
  min-width: 36px;
  min-height: 32px;
}

.ai-console-btn:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
  color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-console-btn:active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.ai-console-btn:focus {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

/* AI助手面板样式 */
.ai-assistant-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.ai-panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #ffffff;
    height: 48px;
    box-sizing: border-box;
}

.ai-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 18px;
  cursor: pointer;
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.ai-panel-close:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    transform: scale(1.05);
}

/* 切换右侧面板按钮样式 */
.toggle-panel-btn {
    background: #0A834F;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    margin-left: auto;
    z-index: 10;
    position: relative;
    flex-shrink: 0;
    min-width: 32px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-panel-btn:hover {
    background: #66BB6A;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ai-assistant-panel iframe {
  flex: 1;
  border: none;
  width: 100%;
  height: calc(100% - 60px);
}

/* 调整左侧面板为相对定位以支持AI面板 */
.left-panel {
  position: relative;
}

/* 当AI面板显示时，调整content_blocks的宽度 */
#content_blocks {
  transition: all 0.3s ease;
}

/* 代码编辑复选框样式 */
.code-edit-checkbox {
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: normal;
  cursor: pointer;
  user-select: none;
}

.code-edit-checkbox input[type="checkbox"] {
  margin-right: 6px;
  cursor: pointer;
}

.code-edit-checkbox span {
  color: white;
}

/* 串口输入区域样式 */
.serial-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #1a1a1a;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  height: 40px;
  box-sizing: border-box;
}

.serial-input {
  flex: 1;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: #2a2a2a;
  color: white;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  outline: none;
  transition: all 0.2s ease;
}

.serial-input:focus {
  border-color: #4CAF50;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.serial-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.send-serial-btn {
  background: #4CAF50;
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.send-serial-btn:hover {
  background: #66BB6A;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.send-serial-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* 清空控制台按钮 */
.clear-console-btn {
  background: linear-gradient(135deg, #f44336 0%, #e57373 100%);
  color: white !important;
  border: none;
  padding: 8px 14px;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(244, 67, 54, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  outline: none;
  min-width: 36px;
  min-height: 32px;
}

.clear-console-btn:hover {
  background: linear-gradient(135deg, #e57373 0%, #ef5350 100%) !important;
  color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.clear-console-btn:active {
  background: linear-gradient(135deg, #f44336 0%, #e57373 100%) !important;
  color: white !important;
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(244, 67, 54, 0.3);
}

.clear-console-btn:focus {
  background: linear-gradient(135deg, #f44336 0%, #e57373 100%) !important;
  color: white !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.3);
}

/* 面板内容 */
.panel-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Blockly工作区 */
#blocklyDiv {
  width: 100% !important;
  height: 100% !important;
}

/* Python代码编辑器 */
#content_file_code {
  width: 100%;
  height: 100%;
  border: none;
  resize: none;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  padding: 8px;
  box-sizing: border-box;
}

/* Python代码编辑器CodeMirror容器 - 强制显示原生滚动条 */
.CodeMirror {
  height: 100% !important;
  width: 100% !important;
  overflow: auto !important;
  white-space: nowrap !important;
  position: relative !important;
  box-sizing: border-box !important;
  padding-right: 0px !important;
  margin-right: 0px !important;
  transition: all 0.3s ease;
}

/* 完全隐藏CodeMirror自定义滚动条系统 */
.CodeMirror-vscrollbar,
.CodeMirror-hscrollbar,
.CodeMirror-scrollbar-filler,
.CodeMirror-gutter-filler {
  display: none !important;
  visibility: hidden !important;
}

/* 重置CodeMirror-scroll - 关键：覆盖负边距和隐藏滚动条的设置 */
.CodeMirror-scroll {
  overflow: auto !important;
  margin-right: 0px !important;
  margin-bottom: 0px !important;
  padding-right: 0px !important;
  padding-bottom: 0px !important;
  height: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* 重置CodeMirror-sizer - 移除透明边框 */
.CodeMirror-sizer {
  border-right: 0px solid transparent !important;
  margin-right: 0px !important;
  margin-bottom: 0px !important;
  padding-right: 0px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* 强制滚动条对齐到最右侧 */
.CodeMirror {
  overflow: auto !important;
}

.CodeMirror .CodeMirror-scroll {
  overflow: auto !important;
  margin-right: 0px !important;
  padding-right: 0px !important;
}

/* 自定义原生滚动条样式 - 与Blockly滚动条保持一致 */
.CodeMirror::-webkit-scrollbar {
  width: 16px !important;
  height: 16px !important;
  background: transparent !important;
  position: absolute !important;
  right: 0px !important;
}

.CodeMirror::-webkit-scrollbar-track {
  background: transparent !important;
  border-radius: 0px !important;
  border: none !important;
}

.CodeMirror::-webkit-scrollbar-thumb {
  background: #ccc !important;
  border-radius: 0px !important;
  border: none !important;
  min-height: 20px !important;
}

.CodeMirror::-webkit-scrollbar-thumb:hover {
  background: #bbb !important;
}

.CodeMirror::-webkit-scrollbar-thumb:active {
  background: #aaa !important;
}

.CodeMirror::-webkit-scrollbar-corner {
  background: transparent !important;
}

/* 控制台终端 */
#terminal {
  width: 100% !important;
  height: 100% !important;
}

.content {
  margin: 0;
  direction: ltr;
  display: block;
  width: 100%;
  height: 100%;
}

pre.content {
  border: 1px solid #ccc;
  overflow: scroll;
  padding: 0;
}

#content_blocks,
#content_device,
#content_code,
#content_console,
#content_files,
#content_device,
#content_programs,
#content_mqtt,
#content_iot {
  width: 100%;
  height: 100%;
  position: relative;
}

#content_blocks {
  transition: all 0.3s ease;
  will-change: width, transform;
}

#content_device,
#content_code,
#content_console {
  overflow-y: auto;
  overflow-x: hidden;
}

/* 文件保存控件 */
#file_save_as {
  padding: 8px;
  background: #f9f9f9;
  border-bottom: 1px solid #ddd;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

#file_save_as input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
}

#file_save_as button {
  padding: 4px 12px;
  font-size: 12px;
}

#content_device #device_img {
  max-width: 75rem;
  width: 100%;
}

.blocklySvg {
  border-top: none !important;
}

#content_console #file-boxes button {
  white-space: nowrap;
  margin-left: .25rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  color: #327ae7;
  border: 1px solid #327ae7;
  border-radius: 1.5rem;
  background-color: #fff;
  font-size: 0.8rem;
}

#content_xml {
  resize: none;
  outline: none;
  border: none;
  font-family: monospace;
  width: 100%
}

#content_console {
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
  transition: all 0.3s ease;
}

#content_console #term {
  padding: 0;
  background: #000;
  margin: 0;
  overflow: hidden;
  border-radius: 0;
  transition: box-shadow ease .125s;
  box-shadow: none;
  overscroll-behavior: none;
  /*disable chrome pull to refresh */
  width: 100%;
  height: calc(100% - 40px);
}

#tipsGeneric,
#languageIcon {
  display: inline-flex;
  align-items: center;
  border: 1px solid #aaa;
  padding: .5rem;
  border-radius: 2rem;
  opacity: 0.8;
  margin: .5rem 0;
}

#languageIcon {
  border: none;
}

#tipsGeneric:before {
  margin-right: .25rem;
}

#content_console #term.on {
  box-shadow: -0.25rem 0rem .75rem #6aa8fb, .25rem .25rem .75rem #7b49ad;
}

#content_console button {
  line-height: 1.5rem;
  font-size: 0.8rem;
}

#content_console>div,
#content_console>div>span {
  display: inline-flex;
  align-items: center;
}

#file-boxes {
  flex-wrap: wrap;
  justify-content: center;
  user-select: none;
}

/* Files */
#content_files {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

/* Python编辑器容器 */
#content_files .panel-content {
  overflow: hidden;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

#file-boxes #file-header,
#file-boxes #file-status {
  padding: 0 .25em 0 .5em;
  text-align: center;
}

#file-boxes #file-header {
  display: flex;
  height: 2.5rem;
  align-items: center;
  justify-content: space-between;
  font-weight: bold;
  /*border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  border-right: 1px solid #ccc;*/
}

#file-boxes #file-header>span {
  flex-grow: 2;
}

#file_save_as {
  height: 2.5rem;
  /*border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc;*/
  display: flex;
  align-items: center;
  padding: 0 .5rem 0 1.85rem
}

#file_save_as.py #updateXMLButton,
#file_save_as.py #generated2DeviceButton {
  display: none;
}

#file_save_as.bipes-xml #editor2DeviceButton,
#file_save_as.bipes-xml #generated2DeviceButton {
  display: none;
}

#file_save_as.bipes-py #editor2DeviceButton,
#file_save_as.bipes-py #updateXMLButton {
  display: none;
}

#file_save_as input {
  font-weight: bold;
  border-left: 1px solid #ccc;
  padding-left: .5rem;
}

#file-boxes #file-status {
  height: 1.5rem;
  line-height: 1.5rem;
  border-bottom: 1px solid #ccc;
  border-right: 1px solid #ccc;
  color: #666;
  font-size: 0.85rem;
  overflow: hidden;
  font-weight: bold;
  background: #f7f7f7;
}

#filesPanel {
  display: none;
  width: 18rem;
  height: calc(100vh - 8rem);
  overflow-y: auto;
  padding: 0.25rem 0.5rem;
  border-right: 1px solid #eee;
  color: #eee;
  box-sizing: border-box;
}

#filesPanel h2,
.account-panel h2 {
  font-size: 1rem;
  display: flex;
  align-items: center;
  margin: 0;
  height: 2.5rem;
  color: #eee;
}

#fileList>div,
#fileTemplate>div,
#blocks2Code>div,
#ProjectList>div {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  margin: 0.25rem 0;
  padding: 0.25rem;
  border-radius: .25rem;
  border: 1px solid #eee;
  cursor: pointer;
  min-height: 2rem;
  font-size: 0.9rem;
}

#fileList>div>div:last-child,
#ProjectList>div>div:last-child {
  flex-shrink: 0;
}

#fileList .runText,
#ProjectList .runText {
  width: 100%;
  font-family: monospace;
}

#fileTemplate>div,
#blocks2Code>div {
  align-items: center;
  word-break: break-word;
  font-family: monospace;
}

#fileList>div>div,
#ProjectList>div>div {
  display: inline-flex;
  align-items: center;
  word-break: break-word;
}

#fileList .runText>span,
#blocks2Code>div>span {
  font-size: 0.8rem;
  border: 1px solid #7b49ad;
  border-radius: .75rem;
  padding: .175rem .25rem;
  color: #7b49ad;
  margin-left: .25rem;
  font-weight: bold;
  word-break: keep-all;
  font-family: sans-serif;
}

#fileList #runIcon {
  filter: brightness(0)
}

#filesPanel details,
.account-panel summary {
  overflow: hidden;
  transition: .125s ease border;
}

#filesPanel summary,
.account-panel summary {
  -webkit-tap-highlight-color: transparent;
  white-space: normal;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#filesPanel summary>h2:before,
.account-panel summary>h2:before {
  content: "\1433";
  margin-right: .5rem;
  transition: transform .25s ease;
  display: inline-block;
  font-weight: normal;
  font-size: 0.8rem;
  line-height: 1rem;
  color: #eee;
}

#filesPanel details[open] summary>h2:before,
.account-panel details[open] summary>h2:before {
  transform: rotateZ(90deg);
}

#ProjectList>div {
  transition: box-shadow ease .125s, background-color linear .125s, border-color linear .125s, color linear .125s;
}

#ProjectList>.current {
  box-shadow: 0 0.125em 0.25em rgba(0, 0, 0, 0.2);
  background: #3298dc;
  color: #fff;
  border-color: #3298dc;
}

#ProjectList .current span {
  filter: invert(1);
}

/* Toolbar */
@media (min-width: 60em) {
  .top-menu>.toolbar {
    display: flex;
    height: 2.125rem;
  }

  .top-menu>#toolbarButton {
    display: none;
  }
}

@media (max-width: 59.99em) {
  .top-menu>.toolbar {
    box-sizing: border-box;
    z-index: 999;
    position: fixed;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    height: 7rem;
    width: 20.5rem;
    transition: .125s ease right, .125s ease top, .125s ease opacity;
    background: #fff;
    border-radius: 1em;
    top: -5rem;
    right: -20rem;
    margin-right: 0;
    border: 1px solid #aaa;
    box-shadow: 0em 0em 0.5em rgba(0, 0, 0, 0.5);
    opacity: 0;
  }

  .top-menu>.toolbar#show {
    top: .25rem;
    right: .25rem;
    opacity: 1;
  }

  .toolbar>#channel_connect {
    order: 1;
    margin-right: 0;
    margin-left: .125rem;
  }

  .logo {
    font-size: 0 !important;
  }

  #toolbarButton {
    border-radius: 1rem;
    border: 1px solid #aaa;
    transition: .125s ease box-shadow;
  }

  #toolbarButton:hover {
    box-shadow: 0em 0em 0.25em #aaa;
  }

  .channel-panel {
    right: -16rem;
    top: 3.5rem;

  }

  .channel-panel#show {
    right: .25rem;
    top: 3.5rem;
  }
}

/* Sprited icons. */

button.icon:before,
#deviceSelect.icon:before,
a.icon:before,
span.icon:before,
label.icon:before {
  content: "";
  background-size: cover;
  background-image: url(media/tabs/buttons.png);
  /* width: 1.5rem;
  height: 1.5rem; */
  width: 1.625rem;
  height: 1.625rem;
  background-size: auto 3rem;
}

button.icon:before,
label.icon:before {
  display: block;
}

span.icon:before {
  display: inline-block;
}

button.icon.medium:before {
  width: 2.5rem;
  height: 2.5rem;
  background-size: auto 5rem;
}

#linkButton:before {
  background-position: left calc(-1.5rem*2) top;
  /* icon size * index on icons.svg*/
}

#saveButton:before,
#downloadIcon:before,
#newDownloadIcon:before {
  background-position: left calc(-1.5rem*2) top;
}

#loadButton:before {
  background-position: left calc(-1.5rem*3) top;

}

#trashButton:before,
#trashIcon:before {
  background-position: left calc(-1.5rem*4) top;
}

#toolsButton:before {
  background-position: left calc(-1.5rem*5) top;
}

#notificationButton:before {
  background-position: left calc(-1.5rem*4) top;
}

#deviceSelect:before {
  background-position: left calc(-1.5rem*7) top;
}

#runButton:before,
#runIcon:before {
  transition: background ease .125s;
  background-position: left -1.5rem top;
}

#runButton.on:before {
  background-position: left -1.5rem top 1.5rem;
}

#languageIcon:before {
  background-position: left calc(-1.5rem*6) top;
}

#serialButton:before,
#channelButton.webserial:before {
  background-position: left calc(-1.5rem*9) top;
}

#networkButton:before,
#channelButton.websocket:before {
  background-position: left calc(-1.5rem*10) top;
}

#toolbarButton:before {
  background-position: left calc(-2.5rem*11) top;
}

#toolbarButton.on:before {
  background-position: left calc(-2.5rem*11) bottom;
}

#forumButton:before {
  background-position: left calc(-1.5rem*12) top;
}

#bluetoothButton:before,
#channelButton.webbluetooth:before {
  background-position: left calc(-1.5rem*15) top;
}

#connectButton:before {
  background-position: left top;
}

#connectButton.on:before {
  background-position: left top 1.5rem;
}

#scanButton:before {
  background-position: left calc(-1.5rem*14) top;
}

#settingsGeneric:before {
  background-position: left calc(-1.5rem*16) top;
}

#tipsGeneric:before {
  background-position: left calc(-1.5rem*17) top;
}

#refreshFilesList:before {
  background-position: left calc(-1.5rem*18) top;
}

#putFileButton:before,
#editor2DeviceButton:before,
#generated2DeviceButton:before {
  background-position: left calc(-1.5rem*19) top;
}

#updateXMLButton:before {
  background-position: left calc(-1.5rem*20) bottom;
}

#accountButton:before {
  background-position: left calc(-1.5rem*22) top;
}

#newProjectButton:before {
  background-position: left calc(-1.5rem*23) top;
}


@media (max-width: 710px) {
  .tab_collapse {
    display: none;
  }
}

/*Select*/
#deviceSelect {
  display: inline-flex;
  align-items: center;
  border: 1px solid #327ae7;
  border-radius: 2rem;
  padding-left: .5rem;
}

#device_selector {
  /* A reset of styles of select object */
  appearance: none;
  background-color: transparent;
  border: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  height: 2rem;
  color: #327ae7;
  font-size: 0.8rem;
  font-weight: bold;
}

#device_selector:focus {
  color: hsl(0, 0%, 0%);
}

@media (max-width: 59.99em) {
  #device_selector {
    width: 15rem;
  }
}

/* Run button */
#runButton {
  border: none;
  border: 1px solid #10D27F;
  /*margin: -1px;*/
  opacity: 1;
  /*padding: 0.25rem .4rem;*/
  background: #10D27F;
  /*transition: box-shadow ease .125s;*/
  border-radius: 0.5rem;
  margin-left: 1.25rem;
}

#runButton:hover {
  box-shadow: -1px 0 3px #eee;
}

/* Privacy link */
.privacyLink {
  font-family: Roboto, Arial, Helvetica, sans-serif;
  font-size: small;
  text-decoration: none;
}

#languageMenu {
  border: none;
  height: 2rem;
  width: 100%;
  border-radius: 1rem;
  background: #fff;
  padding: .25em;
}

.account-panel,
.notify-panel,
.notify {
  user-select: none;
  transition: top ease .5s, right ease .5s, opacity ease .125s, background linear .5s, margin-right ease .125s;
  transition-delay: 0s, 0s, .1s, 0s, 0s;
  color: #222;
  opacity: 0;
  background: #fff;
}

@media (min-width: 60em) {

  .account-panel,
  .notify-panel {
    border-radius: 1rem;
    margin: 0.5em;
    border: 1px solid #aaa !important;
  }
}

/* Notifications */
.notify {
  z-index: 997;
  right: -18em;
  bottom: .5em;
  padding: 1em;
  position: fixed;
  box-shadow: 0 .125em .5em rgba(0, 0, 0, .6);
  background: #0A824E;
  color: #fff;
}

.notify#show {
  opacity: 1;
  right: .5em;
}

.notify hr {
  border: none;
  height: 1px;
  background-color: #fff;
}

.notify-panel>span,
.notify {
  border-radius: .25rem;
}

.notify-panel>span {
  background: #fff;
  padding: 1em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: .25rem 0;
  transition: box-shadow ease .125s;
  box-sizing: border-box;
  border: solid 1px #ccc;
}

.notify-panel>span:hover {
  border-color: #aaa;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

.notify-panel>span>span {
  cursor: pointer;
  opacity: .6;
  transition: opacity linear .125s;
}

.notify-panel>span>span:hover {
  opacity: 1;
}

.notify-panel,
.account-panel {
  position: fixed;
  overflow-y: auto;
  z-index: 998;
  width: 20rem;
  padding: 0 .5em;
  top: 3.5rem;
  bottom: 0;
  right: -22em;
  background: #fefefe;
  border-left: solid 1px #ccc;
  display: flex;
  box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.5);
}

.account-panel {
  flex-direction: column;
  justify-content: space-between;
}

.notify-panel {
  flex-direction: column-reverse;
  justify-content: end;
}

@media (max-width: 59.99em) {

  .notify-panel,
  .account-panel {
    padding-top: 4.5rem;
  }
}

.notify-panel#show,
.account-panel#show {
  opacity: 1;
  right: 0;
}

/* Progress Bar */
.progress-bar {
  z-index: 500;
  position: fixed;
  left: 0;
  right: 0;
  overflow: hidden;
  height: 0;
  transition: .125s ease height;
  top: 3.375rem;
}

.progress-bar#on {
  height: .25em;
}

.progress-bar div {
  content: '';
  position: absolute;
  height: 100%;
  background: #3298dc;
}

.progress-bar div {
  width: 0%;
  transition: .125s linear width;
}

@-webkit-keyframes progress {
  0% {
    left: 100%;
    transform: translateX(0);
  }

  100% {
    left: 0;
    transform: translateX(-100%);
  }
}

#account_header {
  font-size: 1.25rem;
  margin: .5em 0;
  display: block;
}

#account_user {
  border-bottom: 1px dashed #666;
  font-weight: bold;
  padding-bottom: .125rem;
}

/* 顶部下拉菜单 */
.toolsButton {
  position: relative;
  float: right;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  min-width: 8rem;
  overflow: auto;
  box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, .3);
  right: 0;
  top: 3rem;
  z-index: 1;
  border-radius: 0.2rem;
}

.dropdown-content label {
  color: black;
  padding: 0.4rem 0.4rem;
  text-decoration: none;
  display: block;
  font-family: 微软雅黑;
  font-size: 0.8rem;
}

.dropdown-content label:hover {
  background-color: #e5e5e5;
  cursor: pointer;
}

.show {
  display: inline-block;
}

.dropdown-content label:before {
  content: "";
  display: inline-block;
  width: 1rem;
  height: 1rem;
  background-size: cover;
  vertical-align: middle;
  margin-right: 0.5rem;
  margin-top: -0.2rem;
}

#save_py_to_dev_main::before {
  background-image: url(media/tools/Save_16x16.png);
}

#open_py_from_local::before {
  background-image: url(media/tools/Open_16x16.png);
}

.split-line {
  background-color: #aaa;
  height: 0.0625rem;
  margin-left: 0.125rem;
  margin-right: 0.125rem;
}

.logic-icon {
  /* background-image: url(./media/toolbox/toolbox.png); */
  background: url(./media/ui/logic.png) no-repeat;
  /* background-position: 0rem 0px; */
  border-color: rgb(91, 128, 165);
  /* background-color: rgb(91, 128, 165); */
}

.loop-icon {
  /* background-image: url(./media/toolbox/toolbox.png); */
  background: url(./media/ui/loop.png) no-repeat;
  /* background-position: -1.25rem 0px; */
  border-color: rgb(91, 165, 91);
  /* background-color: rgb(91, 165, 91); */
}

.math-icon {
  /* background-image: url(./media/toolbox/toolbox.png); */
  background: url(./media/ui/math.png) no-repeat;
  /* background-position: -2.5rem 0px; */
  border-color: rgb(91, 103, 165);
  /* background-color: rgb(91, 103, 165); */
}

.text-icon {
  /* background-image: url(./media/toolbox/toolbox.png); */
  background: url(./media/ui/text.png) no-repeat;
  /* background-position: -3.75rem 0px; */
  border-color: rgb(91, 165, 140);
  /* background-color: rgb(91, 165, 140); */
}

.lists-icon {
  /* background-image: url(./media/toolbox/toolbox.png); */
  background: url(./media/ui/lists.png) no-repeat;
  /* background-position: -5rem 0px; */
  border-color: rgb(116, 91, 165);
  /* background-color: rgb(116, 91, 165); */
}

.variable-icon {
  /* background-image: url(./media/toolbox/toolbox.png); */
  background: url(./media/ui/variable.png) no-repeat;
  /* background-position: -6.25rem 0px; */
  border-color: rgb(165, 91, 128);
  /* background-color: rgb(165, 91, 128); */
}

.procedure-icon {
  /* background-image: url(./media/toolbox/toolbox.png); */
  background: url(./media/ui/procedure.png) no-repeat;
  /* background-position: -7.5rem 0px; */
  border-color: rgb(153, 91, 165);
  /* background-color: rgb(153, 91, 165); */
}

.IO-i-icon {
  /* background-image: url(./media/toolbox/toolbox.png); */
  background: url(./media/ui/IO-i.png) no-repeat;
  /* background-position: -8.75rem 0px; */
  border-color: rgb(51, 204, 0);
  /* background-color: rgb(51, 204, 0); */
}

.IO-o-icon {
  /* background-image: url(./media/toolbox/toolbox.png); */
  background: url(./media/ui/IO-o.png) no-repeat;
  /* background-position: -10rem 0px; */
  border-color: rgb(255, 102, 102);
  /* background-color: rgb(255, 102, 102); */
}

.comm-icon {
  /* background-image: url(./media/toolbox/toolbox.png); */
  background: url(./media/ui/comm.png) no-repeat;
  /* background-position: -11.25rem 0px; */
  border-color: rgb(204, 153, 51);
  /* background-color: rgb(204, 153, 51); */
}

.sensor-icon {
  /* background-image: url(./media/toolbox/toolbox.png); */
  background: url(./media/ui/sensor.png) no-repeat;
  /* background-position: -12.5rem 0px; */
  border-color: rgb(51, 204, 255);
  /* background-color: rgb(51, 204, 255); */
}

.actuator-icon {
  /* background-image: url(./media/toolbox/toolbox.png); */
  background: url(./media/ui/actuator.png) no-repeat;
  /* background-position: -13.75rem 0px; */
  border-color: rgb(204, 102, 204);
  /* background-color: rgb(204, 102, 204); */
}

.monitor-icon {
  /* background-image: url(./media/toolbox/toolbox.png); */
  background: url(./media/ui/monitor.png) no-repeat;
  /* background-position: -15rem 0px; */
  border-color: rgb(153, 153, 255);
  /* background-color: rgb(153, 153, 255); */
}

.network-icon {
  background-image: url(./media/toolbox/toolbox.png);
  background-position: -16.25rem 0px;
  border-color: rgb(85, 102, 204);
  background-color: rgb(85, 102, 204);
}

.control-icon {
  background-image: url(./media/toolbox/toolbox.png);
  background-position: -17.5rem 0px;
  border-color: rgb(68, 204, 204);
  background-color: rgb(68, 204, 204);
}

.com-block {
  width: 1.25rem;
  height: 1.25rem;
  border: none !important;
  background-size: 100% 100%;
  /* border: 1px solid white; */
  /* border-radius: 0.625rem; */
  /* justify-self: center; */
  /* vertical-align: middle; */
}

#example-container {
  display: none;
  position: absolute;
  top: 48px;
  right: 0;
  min-width: 200px;
  min-height: 50px;
  max-height: calc(100vh - 150px);
  height: auto;
  border-radius: 3px;
  padding: 3px 5px 3px 3px;
  background: #fff;
  box-shadow: 0 2px 5px rgb(0 0 0 / 50%);
  overflow: hidden;
}
.example-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid #ddd9d9 ;
}
.example-header > span {}
.example-header > div {
  width: 28px;
  height: 28px;
  background-image: url('./media/ui/close.svg');
  background-size: 100% 100%;
  cursor: pointer;
}
.demo-container {
  display: block;
  height: auto;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  overflow-x: auto;
}

#com-mask {
  display: none;
  position: fixed;
  z-index: 1113;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  background: rgba(0, 0, 0, .4);
}

.update-libs-container {
  display: inline-block;
  width: 520px;
  height: auto;
  margin: 12% 0 0 0;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08),0 3px 6px -4px rgba(0, 0, 0, 0.12),0 9px 28px 8px rgba(0, 0, 0, 0.05);
  background: #ffffff;
  box-sizing: border-box;
  /* text-align: left;
  vertical-align: middle; */
}
.libs-header {
  display: flex;
  justify-content: space-between;
}

.libs-header > span {
  color: rgba(0, 0, 0, 0.88);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.5;
  word-wrap: break-word;
}
.libs-close {
  width: 28px;
  height: 28px;
  background-image: url('./media/ui/close.svg');
  background-size: 100% 100%;
  cursor: pointer;
}
.libs-content {
  margin: 0;
  padding: 0;
  max-height: 200px;
  height: auto;
  padding: 0 0 12px 0;
  overflow: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}
.libs-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 0 12px;
}
.download-lib {
  color: #fff;
  background-color: #409eff;
  border-color: #409eff;
  font-size: 14px;
  padding: 4px 12px;
  border-radius: 4px;
  box-shadow: none;
  border: none;
  cursor: pointer;
}

.ai-icon {
  display: none;
  z-index: 1000;
  position: absolute;
  bottom: 25px;
  right: 25px;
  width: 46px;
  height: 46px;
  cursor: pointer;
}

.toolsDropdown {
  margin: 0 0 0 2rem;
}