@layer reset, theme;
@layer reset{
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  body, html {
    width: 100%;
    height: 100%;
  }
  
  body {
    font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: #fbfbfb;
    color: #333;
    overflow: hidden;
    display: flex;
    justify-content: stretch;
    align-items: stretch;
  }
  
}

body.dark {
  background-color: #282828;
  color: #ccc;
}

.layout {
  flex: 1;
  display: flex;
  min-width: 80px;
  background-color: #fcfcfc;
  position: relative;
}
.dark .layout {
  background-color: #333;
}

#root {
  flex: 1;
  display: grid;
}

#root canvas {
  position: absolute;
  top: 0;
  left: 0;
}

#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}
#overlay .above-error * {
  pointer-events: auto;
}

#dropModal {
  display: none;
  position: fixed;
  padding: 5px;
  text-align: center;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  z-index: 5000;
}

jscadui-gizmo {
  position: absolute;
  top: 15px;
  right: 15px;
  --cube-size: 100px;
  --cube-line-color: #f2f2f2dd;
/*  --cube-corner-radius: 5px;*/
}
.dark jscadui-gizmo {
  --cube-line-color: #333333dd;
  --cube-bg: #111;
  --cube-fg: #999;
  --cube-bg-hover: #555560;
  --cube-fg-hover: #ccc;
}

a {
  color: #08d;
  text-decoration: none;
  cursor: pointer;
}
.dark a {
  color: #19d;
}
a:active,
a:focus,
a:hover {
  color: #06a;
}
.dark a:active,
.dark a:focus,
.dark a:hover {
  color: #6be;
}
.dark a:focus-visible {
  outline: 1px solid #eee;
}
button, select, input {
  padding: 4px 6px;
  border: 1px solid #888;
  border-radius: 2px;
  background-color: #fdfdfd;
  font-size: 12pt;
  color: #222;
  cursor: pointer;
}
button:hover,
select:hover {
  background-color: #f6f6f6;
}
h1 {
  margin-bottom: 10px;
}
h2 {
  font-weight: normal;
  font-size: 16pt;
}
input {
  border: 1px solid #999;
  border-radius: 3px;
  transition: border 0.3s;
}
input:focus {
  outline: none;
  border: 1px solid #555;
}
input[type="checkbox"],
input[type="color"],
input[type="radio"],
input[type="range"] {
  margin: 0 5px;
  cursor: pointer;
}
.nospin{
  appearance:textfield;
  -moz-appearance: textfield;
}
.nospin::-webkit-outer-spin-button, 
.nospin::-webkit-inner-spin-button{
  -webkit-appearance: none; 
  margin: 0; 
}

p {
  margin-bottom: 10px;
}

.container {
  position: absolute;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: stretch;
}
#viewer {
  position: relative;
  overflow: hidden;
  touch-action: none;
}

/* editor style */
#editor {
  position: relative;
  width: 400px;
  max-width: calc(100vw - 80px);
}
#editor.transition {
  transition: width 0.5s;
}
#editor.closed {
  width: 0px !important;
}
#editor-drawer {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#editor-container {
  width: 100%;
  height: calc(100vh - 60px);
  flex: 1;
}
#editor-hint, #editor-hint2 {
  position: absolute;
  bottom: 10px;
  right: calc(min(10px, 100% - 180px)); /* push right when editor is small */
  color: #66666688;
  white-space: nowrap;
  font-size: 10pt;
  user-select: none;
}
#editor-hint {
  bottom: 30px;
}
.dark #editor-hint {
  color: #dddddd88;
}

/* editor file navigation */
#editor-nav {
  display: none;
  position: relative;
  margin-right: 1px;
  margin-bottom: 1px;
}
#editor-nav.visible {
  display: block;
}
#editor-nav button {
  border-radius: 0;
  color: #444;
  font-family: monospace;
  font-size: 8pt;
  outline-offset: -1px;
  padding: 4px 10px;
  text-align: left;
  display: block;
  width: 100%;
}
#editor-nav button:focus {
  outline: 1px solid #888;
  background-color: #f6f6f9;
}
#editor-file {
  width: 100%;
  border: 1px solid #bbb;
}
#editor-file::after {
  content: "▼";
  position: absolute;
  right: 6px;
  display: inline-block;
  vertical-align: middle;
  pointer-events: none;
}
#editor-nav.open #editor-file {
  border: 1px solid #888;
}
#editor-files {
  position: absolute;
  width: 100%;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  display: none;
  border: 1px solid #888;
  border-top: none;
  box-shadow: 0 10px 10px -5px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  list-style: none;
}
#editor-nav.open #editor-files {
  display: block;
}
#editor-files button {
  border: none;
  outline-offset: 0;
}
#editor-files button:focus {
  background-color: #f6f6f9;
}
.dark #editor-nav button {
  background-color: #333;
  color: #bbb;
}
.dark #editor-nav button:focus {
  outline: 1px solid #aaa;
}
.dark #editor-nav button:hover {
  background-color: #444450;
}
.dark #editor-files button:focus {
  background-color: #444450;
}
.dark #editor-file {
  border: 1px solid #666;
}

#editor-toggle {
  background-color: #ebf;
  position: absolute;
  width: 16px;
  height: 90px;
  left: -16px;
  top: 50%;
  margin-top: -45px;
  border-top: 1px solid #444;
  border-left: 1px solid #444;
  border-bottom: 1px solid #444;
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
  padding: 5px;
  display: flex;
  cursor: col-resize;
  touch-action: none;
}
.dark #editor-toggle {
  background-color: #657;
}
#editor-toggle::after {
  content: "\27E9";
  display: flex;
  align-items: center;
}
.closed #editor-toggle::after {
  content: "\27E8";
}
.cm-editor {
  height: 100%;
}
.cm-gutters {
  border-right: none !important;
  user-select: none;
}
/* highlight focus using gutters not outline */
.cm-focused {
  outline: none !important;
}
.ͼ2 .cm-activeLine {
  background-color: #eeeeee88;
}
.cm-focused .cm-activeLine {
  background-color: #cceeff44;
}
.dark .cm-focused .cm-gutters,
.dark .cm-focused .cm-activeLine {
  background-color: #7777bb44;
}
.dark .cm-gutters,
.dark .cm-activeLine {
  background-color: #5e5e6e66;
  color: #aaa;
}
.dark .cm-activeLineGutter {
  background-color: #667;
}
.dark .cm-cursor {
  border-left-color: #ddd;
}
.dark .cm-selectionBackground {
  background-color: #666677bb !important;
}

/* code theme */
/* keyword */
.dark .ͼb {
  color: #c8d;
}
/* numeric */
.dark .ͼd {
  color: #bbc281;
}
/* strings */
.dark .ͼe {
  color: #e48f7f;
}
/* vars */
.dark .ͼg {
  color: #3af;
}
/* key */
.dark .ͼl {
  color: #87ceff;
}
/* comment */
.dark .ͼm {
  color: #5ba25b;
}

/* menu style */
#menu {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3000;
  max-height: calc(100vh - 70px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
#menu-button {
  border: none;
  padding: 2px 4px;
  background-color: transparent;
}
#menu-button:hover {
  color: #111;
}
.dark #menu-button {
  color: #ddd;
}
.dark #menu-button:hover {
  color: #eee;
}
#menu-button::after {
  padding-left: 5px;
  content: "\25bc";
}
.open #menu-button::after {
  content: "\25b2";
}
#menu-content {
  display: none;
  padding: 10px;
  border: 1px solid #888;
  background-color: #f8f8f8;
  overflow-y: auto;
  box-shadow: 0 5px 10px -5px rgba(0, 0, 0, 0.25);
}
.dark #menu-content {
  background-color: #444;
  border: 1px solid #555;
}
.open #menu-content {
  display: block;
}
#menu-content h2 {
  border-bottom: 1px solid #111;
  margin-bottom: 5px;
  padding-right: 30px;
}
.dark #menu-content h2 {
  border-bottom: 1px solid #999;
}
#menu-content ul {
  margin-bottom: 10px;
  list-style-type: none;
}
#menu-content li {
  display: flex;
  padding-left: 5px;
  margin-bottom: 1px;
}
#menu-content label {
  flex: 1;
  cursor: pointer;
  user-select: none;
}

#model-options {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid #aaaaaa88;
  border-radius: 5px;
	position: absolute;
  bottom: 10px;
	left: 10px;
  z-index: 2000;
  max-height: calc(100% - 50px);
  min-width: 300px;
  display: flex;
  flex-direction: column;
}
#paramsHeader {
  flex-shrink: 0;
}
#paramsDiv {
  flex: 1;
  overflow-y: auto;
  overflow-x: visible;
  min-height: 0;
}
.dark #model-options {
  background: rgba(40, 40, 40, 0.5);
  border: 1px solid #33333344;
}

@layer reset{
  #paramsDiv {
    button{
      padding: 0;
      background: none;
    }
  }
}

#paramsDiv {
  display: flex;
  flex-direction: column;
}
#paramsDiv > .form-line:first-child {
  margin-top: 5px;
}
#paramsDiv button {
  margin-right: 2px;
}
#paramsDiv select {
  font-size: 10pt;
  padding: 2px 4px;
}
#paramsDiv .form-line {
  min-width: 260px;
  display: flex;
  margin: 2px 10px;
}
#paramsDiv .form-line > label {
  display: inline-block;
  min-width: 100px;
  flex: 1;
  margin-right: 5px;
}

#paramsDiv .form-line i {
  display: none;
}
#paramsDiv .form-line[type="color"] i,
#paramsDiv .form-line[type="range"] i,
#paramsDiv .form-line[type="slider"] i {
  display: inline;
  padding: 0 5px;
  margin-left: 5px;
  border: solid 1px #eee;
}
#paramsDiv .form-line[type="range"] input,
.dark #paramsDiv .form-line[type="color"] i,
.dark #paramsDiv .form-line[type="range"] i,
.dark #paramsDiv .form-line[type="slider"] i {
  border: solid 1px #666;
}

/* groups */
#paramsDiv .form-line[type="group"] {
  position: relative;
  background: linear-gradient(180deg, #00000014, transparent);
  padding: 5px 10px;
  margin: 10px 0 0 0;
}
#paramsDiv .form-line[type="group"]:first-child {
  margin-top: 0;
}
#paramsDiv .form-line[type="group"]:before {
  content: "\25bc";
  padding-right: 10px;
  padding-top: 3px;
  cursor: pointer;
}
#paramsDiv .form-line[type="group"][closed="1"]:before {
  content: "\25ba";
}
#paramsDiv .form-line[type="group"] label {
  font-weight: 500;
  font-size: 1.2em;
  cursor: pointer;
}
#paramsDiv .form-line[type="group"]:hover {
  color: #222;
}
.dark #paramsDiv .form-line[type="group"]:hover {
  color: #ddd;
}
#paramsDiv .form-line[closed="1"]:not([type="group"]) {
  display: none;
}

#paramsDiv .form-line input[type="number"] {
  width: 60px;
}
#paramsDiv .form-line input[type="range"] {
  flex: 1;
}
#paramsDiv .form-line input[type="date"] {
  cursor: text;
}
#paramsDiv .form-line [type="radio"] label {
  cursor: pointer;
}
#paramsDiv .jscad-param-buttons {
  display: none;
}
#paramsDiv{
  .form-line[type="range"],.form-line[type="slider"]{
    margin-bottom: 20px;
    position: relative;
    input{
      text-align: right;
    }
    input:last-child{
      position: absolute;
      bottom: -18px;
      width: 100%;
      left: 0;
      margin-left: 0;      
    }
  }
}
.export-panel  {
  margin: 5px;
  display: flex;
  align-items: stretch;
}
.export-panel button,
.export-panel select {
  border-radius: 0;
}
.export-panel button {
  border-bottom-right-radius: 4px;
  border-top-right-radius: 4px;
}
.export-panel select {
  border-bottom-left-radius: 4px;
  border-top-left-radius: 4px;
}

#progress progress{
  display: none;
}
#progress {
  position: absolute;
  bottom: 10px;
  right: 10px;
  accent-color: #27c;
}
.dark #progress {
  accent-color: #2e96ea;
}
#progressText {
  font-size: small;
  text-align: right;
}

.above-error {
  flex: 1;
  position: relative;
}
#error-bar {
  width: 100%;
  max-height: 0;
  padding: 0;
  background-color: #dd111199;
  font-family: monospace;
  overflow-y: auto;
  transition: max-height 0.4s;
  pointer-events: all;
}
#error-bar.visible {
  max-height: 40%;
  padding: 10px;
}
#error-bar label {
  font-weight: bold;
}
#error-message {
  white-space: pre;
}

#welcome {
  position: absolute;
  top: 20%;
  padding: 30px;
  border-radius: 10px;
  background-color: rgba(240, 240, 240, 0.8);
  backdrop-filter: blur(10px);
  z-index: 4000;
}
#welcome ul li {
  margin-left: 20px;
}
.welcome-dismiss {
  float: right;
  cursor: pointer;
  color: #555;
  user-select: none;
}
.welcome-dismiss input {
  cursor: pointer;
}
.dark #welcome {
  background-color: rgba(30, 30, 30, 0.8);
}
.dark .welcome-dismiss {
  color: #888;
}
@media (min-width: 768px) {
  #welcome {
    width: 500px;
    margin-left: -250px;
    left: calc(50% - 200px);
  }
}
/* Mobile */
@media (max-height: 480px) {
  #welcome {
    top: 20px;
    bottom: 20px;
    overflow-y: auto;
  }
}
@media (max-width: 767px) {
  #welcome {
    width: 90%;
    left: 5%;
  }
  #editor {
    width: 0;
  }
  jscadui-gizmo {
    --cube-size: 70px;
  }
}
