* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-size: 100%;
    font: inherit;
}



/* frame default style */
.frame {
    display: grid;
    background-color: #fff;
    /* overflow-x: hidden; */
    width: 100%;
    max-width: 100% !important;
    /* background-color: transparent; */
}

.page, .page * {
    /* font-family: 'Times'; */
    /* background-color: inherit; */
    background-color: transparent;
    color: inherit;
    column-gap: 0;
    grid-column: span 1;
    z-index: 1;
    /* top: auto;
    right: auto;
    bottom: auto;
    left: auto; */
    transform: rotate(0deg) skew(0deg);
    border-style: solid;
    border-width: 0px;
    border-color: #000000;
}

.frame .page {
    /* display: block; */
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    font-size: 16px;
    margin: 8px;
    line-height: 1.0;
    font-family: inherit;
    font-family: 'Geist-Regular';
    /* background-color: #fff; */
    /* background-color: inherit; */
    color: #000;
    text-align: left;
    text-transform: initial;
    position: relative;
    /* row-gap: 0px; */
}

.page * {
    text-align: inherit;
    text-transform: inherit;
    font-family: inherit;
}

.frame p {
    display: block;
    margin-top: 1em;
    margin-bottom: 1em;
    margin-left: 0;
    margin-right: 0;
}

.frame h1 {
    display: block;
    font-size: 2em;
    margin-top: 0.67em;
    margin-bottom: 0.67em;
    margin-left: 0;
    margin-right: 0;
    font-weight: bold;
}

.frame h2 {
    display: block;
    font-size: 1.5em;
    margin-top: 0.83em;
    margin-bottom: 0.83em;
    margin-left: 0;
    margin-right: 0;
    font-weight: bold;
}

.frame h3 {
    display: block;
    font-size: 1.17em;
    margin-top: 1em;
    margin-bottom: 1em;
    margin-left: 0;
    margin-right: 0;
    font-weight: bold;
}

.frame h4 {
    display: block;
    margin-top: 1.33em;
    margin-bottom: 1.33em;
    margin-left: 0;
    margin-right: 0;
    font-weight: bold;
}

.frame img {
    display: inline-block;
    max-width: 100%;
    color: initial !important;
    /* background: transparent !important; */
    font: initial !important;
}

.frame a {
    color: blue;
    text-decoration: underline;
    cursor: auto;
}

.frame a:visited {
    color: purple;
    text-decoration: underline;
    cursor: auto;
}







/* btns */
.btns {
    position: fixed;
    top: 4px;
    background: #fff;
    display: flex;
    flex-wrap: wrap;
    z-index: 250;
    padding: 4px;
    background: rgba(250,250,250,.9);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: 8px;
    border: solid 1px #bbb;
    box-shadow: rgba(0,0,0,.2) 0 4px 10px 4px;
    font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
    padding-top: 22px;
}

.actionbtns {
    right: 146px;
}

.modebtns {
    right: 8px;
}

.btn {
    width: 40px;
    height: 40px;
    /* top: 8px; */
    background: #eee;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    /* z-index: 200; */
    font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
    background: none;
    border: none;
    position: relative;
}

.btn svg {
    stroke: #666;
}

.btn:hover svg {
    stroke: #000;
}

.btns-title {
    position: absolute;
    top: 0px;
    left: 0;
    font-size: 11px;
    padding: 1px 0;
    padding: 2px 8px;
    text-transform: uppercase;
    letter-spacing: .2px;
    display: block;
    color: #666;
    font-weight: bold;
    /* text-align: center; */
    width: 100%;
    border-top-right-radius: 4px;
    border-top-left-radius: 4px;
    border-bottom: solid 1px #bbb;
}

.viewmode #viewbtn, .structuremode #structurebtn, .stylemode #stylebtn {
    background: #fff;
    border: solid 1px #bbb;
}

.viewmode #viewbtn svg, .structuremode #structurebtn svg, .stylemode #stylebtn svg {
    stroke: #222;
}

.btn:after {
    content: attr(title);
    display: none;
    position: absolute;
    font-size: 14px;
    background-color: rgba(0,0,0,.8);
    color: #fff;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 4%;
    font-smoothing: antialiased;
    -webkit-font-smoothing: antialiased;
    padding: 4px 9px;
    border-radius: 8px;
    pointer-events: none;
}

.btn--disabled {
    /* opacity: .4; */
    /* pointer-events: none; */
}

.btn--disabled:hover:after {
    display: none !important;
}

.btn--disabled svg, .btn--disabled:hover svg {
    stroke: #ccc;
    cursor: not-allowed;
}

.btn:hover:after {
    display: block;
}

.viewmode #viewbtn:after, .structuremode #structurebtn:after, .stylemode #stylebtn:after {
    display: none;
}

#stylebtn:after {
    right: 240px;
}

#structurebtn:after {
    right: 200px;
}

#viewbtn:after {
    right: 160px;
}

#savebtn:after {
    right: 102px;
}

#randomizebtn:after {
    right: 62px;
}




/* settings */
.settings {
    display: none;
    position: fixed;
    top: 80px;
    right: 8px;
    width: 450px;
    /* max-height: calc(100% - 56px - 8px); */
    max-height: calc(100% - 56px - 8px - 100px);
    background: #eee;
    border: solid 1px #bbb;
    font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
    font-size: 16px;
    border-radius: 4px;
    overflow: auto;
    z-index: 200;
    user-select: none;

    /* background: rgba(237,237,237,.9); */
    background: rgba(250,250,250,.9);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: rgba(0,0,0,.2) 0 4px 10px 4px;

    /* opacity: .3; */
    /* right: -400px; */
    /* transition: all .2s; */
}

.settings:hover {
    /* opacity: 1; */
    /* right: 8px; */
}

.settings-help {
    width: 424px;
    margin: 12px;
    padding: 12px 12px 16px 12px;
    padding: 12px;
    background: #ddd;
    display: flex;
    border-radius: 4px;
}

.settings-help-icon {
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    display: block;
    margin-right: 12px;
    font-size: 16px;
    /* border: solid 1px #666; */
    color: #fff;
    background: #888;
    border-radius: 100%;
    text-indent: -1px;
    font-family: monospace;
}

.settings-help p {
    flex: 1;
    font-size: 12px;
    line-height: 1.3;
    color: #444;
}

.form {
    /* display: none; */
}

.form-section {
    padding: 12px 12px 16px 12px;
    border-bottom: solid 1px #ddd;
}

.settings-empty {
    display: none;
}

.settings-empty, .settings-title {
    padding: 12px;
    font-size: 20px;
    /* color: #444; */
    color: #222;
}

.settings-title {
    border-bottom: solid 1px #bbb;
    position: sticky;
    top: 0;
    background: #eee;
    background: #fff;
    z-index: 100;
    cursor: move;
}

.stylesettings-title {
    /* font-weight: bold; */
    border-bottom: dotted 1px #222;
}

.form h2 {
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #444;
}

.form label {
    font-size: 12px;
    color: #444;
}

.form-part {
    height: 20px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: 8px;
    align-items: center;
    margin-bottom: 4px;
    position: relative;
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 20px;
}

.form-range, .form-select, .form-number, .form-color {
    grid-column: span 3;
}

.form-color {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    width: 100%;
    height: 24px;
    background: none;
}

.form-range:disabled {
    cursor: not-allowed;
    opacity: .6;
    filter: grayscale(100%);
}

.form-range {
    -webkit-appearance: none;
    appearance: none;
    height: 20px;
    background: transparent;
}

.form-range:disabled::-webkit-slider-runnable-track {
    background: #efeeef !important;
    border: solid 1px #b4b5b4 !important;
}

.form-range:disabled::-moz-range-track {
    background: #efeeef;
    border: solid 1px #b4b5b4;
}

.form-range:disabled::-ms-track {
    background: #efeeef;
    border: solid 1px #b4b5b4;
}

.form-range::-webkit-slider-runnable-track {
    height: 8px;
    background: #efeeef;
    border: solid 1px #b4b5b4;
    border-radius: 4px;
    margin-left: 2px;
    margin-right: 2px;
}

.form-range::-moz-range-track {
        height: 6px;
        background: #efeeef;
        border: solid 1px #b4b5b4;
        border-radius: 4px;
        margin-left: 2px;
        margin-right: 2px;
}

.form-range::-ms-track {
    height: 8px;
    background: #efeeef;
    border: solid 1px #b4b5b4;
    border-radius: 4px;
    margin-left: 2px;
    margin-right: 2px;
}

.form-range:hover::-webkit-slider-runnable-track {
    background: #e4e4e4;
    border: solid 1px #aaaaaa;
}

.form-range:hover::-moz-range-track {
    background: #e4e4e4;
    border: solid 1px #aaaaaa;
}

.form-range:hover::-ms-track {
    background: #e4e4e4;
    border: solid 1px #aaaaaa;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 100%;
    margin-top: -5px;
    background: #2573fe;
    border: none;
}

.form-range::-moz-range-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 100%;
    background: #2573fe;
    border: none;
}

.form-range::-ms-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 100%;
    margin-top: -5px;
    background: #2573fe;
    border: none;
}


.form-range::-webkit-slider-thumb:hover {
    background: #1b5cc7;
}

.form-range::-moz-range-thumb:hover {
    background: #1b5cc7;
}

.form-range::-ms-thumb:hover {
    background: #1b5cc7;
}

.form-color {
}

.form-color:disabled {
}

.form-color::-webkit-color-swatch {
    border: solid 1px #777777;
}

.form-color:disabled::-webkit-color-swatch {
    appearance: none !important;
    background: none !important;
    border: solid 1px #ccc;
    cursor: not-allowed;
}

.form-color:disabled::-moz-color-swatch {
    appearance: none !important;
    background: none !important;
}

.form-color:disabled+.form-colorlabel {
    display: none;
}

.form-color:after {
    content: attr(value);
    position: absolute;
    top: 0;
    font-size: 10px;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    mix-blend-mode: difference;
      /* update value in JS? */
      /* not easy. maybe try again, or maybe remove :after altogether. */
      /* find better blend mode? */
    display: none;
}

.form-colorlabel {
    /* border: solid 1px green; */
    top: 4px;
    height: 16px;
    position: absolute;
    font-size: 11px;
    line-height: 15px;
    padding-left: 4px;
    width: 64%;
    box-sizing: border-box;
    pointer-events: none;
    color: #fff;
    grid-column: span 3;
    /* mix-blend-mode: difference; */
    /* width: 7ch; */
    /* font-family: monospace; */
    background: linear-gradient(to right, rgba(0,0,0,.6), rgba(0,0,0,0) 40%);
    margin-left: 3px;

    display: none;
}

.form-checkbox {
    grid-column: span 3;
    /* appearance: none; */
}

.form-checkbox+label {
    grid-column: 4 / span 1;
}

.form-toggle {
    grid-column: span 3;
    -moz-appearance: none;
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    cursor: pointer;
    display: block;
}

.form-toggle:before {
    content: '';
    display: block;
    background: #999;
    display: block;
    height: 20px;
    width: 46px;
    border-radius: 20px;
}

.form-toggle:checked:before {
    background: #2674fe;
}

.form-toggle:after {
    content: '';
    display: block;
    background: #fff;
    width: 16px;
    height: 16px;
    position: absolute;
    top: 2px;
    left: 2px;
    border-radius: 100%;
    transition: all .2s;
}

.form-toggle:checked {
}

.form-toggle:checked:after {
    left: 28px;
}

.form-dependence {
    display: none;
}

.form-dependence .form-range {
    grid-column: 2 / span 2;
}

.form-dependence .form-checkbox, .form-dependence .form-toggle {
    grid-column: 1 / span 1;
}

.form-btns {
    grid-column: 1 / span 3;
    border: none;
    grid-template-columns: repeat(3,1fr);
    display: flex;
    /* outline: solid 1px red; */
    flex-basis: 100%;
    padding: 2px 2px 0px 2px;
}

.form-btns + .legend {
    grid-column: 4 / span 1;
    font-size: 12px;
    color: #444;
    cursor: default;
}

.form-btns .form-radio {
    border: 0;
    clip: rect(0, 0, 0, 0);
    height: 1px;
    overflow: hidden;
    padding: 0;
    position: absolute !important;
    white-space: nowrap;
    width: 1px;
}

.form-btns .form-radio+label:not(:last-of-type) {
    border-right: none;
}

.form-btns .form-radio + label {
    background: #fff;
    border: solid 1px #666;
    height: 18px;
    flex-basis: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-btns .form-radio:checked + label {
    background: #2674fe;
    color: #fff;
}

.form-btns .form-radio:checked + label svg {
    filter: invert(1);
}

/* custom font select */
#font {
    display: none;
    position: fixed;
    right: 0;
}

.customfontselect {
    position: relative;
    /* width: 200px; */
    grid-column: span 3;
}

.customfontselect:after {
    position: absolute;
    right: 8px;
    top: 8px;
    /* content: '↓'; */
    content: '';
    width: 0px;
    height: 0px;
    border-style: solid;
    border-width: 6px 6px 0 6px;
    border-color: #000 transparent transparent transparent;
    pointer-events: none;
}
  
.selectedoption {
    cursor: pointer;
    padding: 1px 4px;
    border: 1px solid #666;
    background: #fff;
    margin-left: 2px;
    margin-right: 2px;
}

.closecustomselect {
    /* background: rgba(0,0,0,.5); */
    /* background: transparent; */
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 600;
}

.customfontoptions {
    z-index: 700;
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    position: fixed;
    top: 0;
    margin-top: 10px;
    margin-bottom: 10px;
    right: 470px;
    width: 420px;
    font-size: 20px;
    max-height: calc(100% - 20px);
    overflow: auto;
    background: #fff;
    background: rgba(250,250,250,.8);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: solid 1px #bbb;
    user-select: none;
    padding: 6px;
    border-radius: 8px;
    box-shadow: rgba(0,0,0,.2) 0 4px 10px 4px;
}

.customfontoptions li {
    padding: 2px 10px 2px 20px;
    cursor: pointer;
    border-radius: 4px;
    line-height: 1.2;
}

.customfontoptions li:hover {
    background-color: #2573fe;
    color: #fff;
}

.customfontoptions hr {
    border: none;
    border-top: solid 1px #ccc;
    margin: 6px 0;
}

.customfontoptions hr:last-of-type {
    display: none;
}

.selection::before {
    content: '✓';
    font-family: 'JetBrainsMono' !important;
    display: inline-block;
    position: absolute;
    left: 10px;
}

.disabledoption {
    /* color: #aaa; */
    opacity: .2;
    pointer-events: none;
    cursor: not-allowed !important;
}
    


/* body.viewmode * {
    background: red !important;
}

body.structuremode * {
    background: green !important;
}

body.stylemode * {
    background: blue !important;
} */



/* style mode & structure mode */

.stylemode {
}

.stylemode .frame, .structuremode .frame {
    user-select: none;
    cursor: pointer;
}

.stylemode .editable {
/* .stylemode .editable, .structuremode .editable { */
    outline: solid 4px rgba(64, 224, 208, .35);
}

.stylemode .selected {
    outline: solid 6px rgba(64, 224, 208, 1);
}

.page {
    outline-offset: 4px;
}

.frame {
    outline-offset: -4px;
}

/* structure mode */

/* .structuremode .frame {
    user-select: none;
    cursor: default;
} */

.structuremode .highlighted {
    outline: solid 6px lightsalmon;
}

.structuremode #structuresettings .highlighted {
    outline: none;
    border: solid 1px lightsalmon;
    box-shadow: lightsalmon 0px 0px 0px 2px;
}



/* .nth-0 {
    background: rgba(250,0,0,.3);
}

.nth-1 {
    background: rgba(250,0,0,.4);
}

.nth-2 {
    background: rgba(250,0,0,.5);
}

.nth-3 {
    background: rgba(250,0,0,.6);
}

.nth-4 {
    background: rgba(250,0,0,.7);
}

.nth-5 {
    background: rgba(250,0,0,.8);
}

.nth-6 {
    background: rgba(250,0,0,.9);
}

.nth-7 {
    background: rgba(250,0,0,1);
} */

.elements {
    display: flex;
    flex-direction: column;
    padding: 8px 12px 12px 12px;
}

.element, .element-1st, .element-2nd {
    /* display: flex;
    justify-content: space-between;
    align-items: center; */
    padding: 8px 16px;
    margin: 2px;
    background: #fff;
    position: relative;
    border-radius: 8px;
    margin-left: 30px;
    user-select: none;
    border: solid 1px #ccc;
    /* margin-right: 30px; */
    /* transition: all .1s linear; */
}

.element-1st {
    margin-left: 0;
    background: #fefefe;
    color: #999;
}

.element-2nd {
    margin-left: 15px;
    opacity: .8;
    background: #fefefe;
    color: #999;
}

.movedelement--clicked {
    background: lightyellow;
    transition: all .1s linear;
}

.movedelement--down {
    transform: translateY(-38px);
}

.movedelement--up {
    transform: translateY(38px);
}

#structuresettings .buttons {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 90px;
    display: flex;
    justify-content: flex-end;
}

.element:hover {
    /* font-weight: bold; */
}

#structuresettings .buttons button {
    width: 30px;
    cursor: pointer;
    display: block;
    border: none;
    border-radius: none;
    background: inherit;
    font-weight: bold;
}

#structuresettings  .buttons button:hover {
    /* background: lightcoral; */
    color: lightcoral;
}

#structuresettings .buttons button:active {
    color: #000;
}

.down {
    border-radius: 0 8px 8px 0;
}

.up.disabled,
.down.disabled {
    pointer-events: none;
    opacity: 0.2;
}

.stylethiselement {
    /* width: 36px;
    height: 36px; */
    display: block;
    /* position: absolute; */
    /* top: 0; */
    /* right: -36px; */
    appearance: none;
    border: none;
    background: none;
    cursor: pointer;
}

.stylethiselement svg {
    stroke: #000;
    stroke-width: 1.5;
}

.stylethiselement:hover svg {
    stroke: lightsalmon;
}



/* visual grid */

.visualgrid {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* width: 100vw;
    height: 100vh; */
    height: 100%;
    width: 100%;
    z-index: 150;
    pointer-events: none;
    /* background: rgba(0,0,0,.5); */
}

.stylemode .visualgrid {
    display: grid;
}

.visualgrid-item {
    /* border-right: dashed 1px red; */
    display: block;
}

.visualgrid-item:nth-of-type(even) {
    background: rgba(0,0,0,.2);
}

/* .visualgrid-item:last-of-type {
    border-right: none;
} */




#mydiv {
    position: absolute;
    z-index: 900;
    background-color: #f1f1f1;
    border: 1px solid #d3d3d3;
    text-align: center;
  }
  
  #mydivheader {
    padding: 10px;
    cursor: move;
    z-index: 10;
    background-color: #2196F3;
    color: #fff;
  }