.custom-scrollbar-track {
    background-color: black;
    position: relative;
    flex-shrink: 0; 
    z-index: 2;
}
#scrollbar-Y {
    width: var(--scrollbar-size);
}
#scrollbar-X {
    height: var(--scrollbar-size);
    z-index: 3;
}

.custom-scrollbar-thumb {
    background-color: rgb(216, 122, 98);
    border-radius: 6px;
    position: absolute;
    left: 0;
    top: 0;
    cursor: grab;
}
#scrollbar-Y-thumb {
    margin-left: 4px;
    width: 60%;
}
#scrollbar-X-thumb {
    margin-top: 4px;
    height: 60%;
}
.custom-scrollbar-thumb:active {
    cursor: grabbing;
}

#sim-wrapper-inner {
    position: relative;
    display: flex;
    flex-flow: column;
}
#sim-lower{
    position: absolute;
    width: 100%;
    bottom: calc(-1*(var(--scrollbar-size) + var(--tickaxis-x-height) + 2px));
}
#sim {
    height: 100%;
    width: 100%;
    border: 2px solid #f07777;
    overflow: hidden;
    /*for scrollbar*/
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    z-index: 2;
}
.tickaxis-wrapper {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    
    pointer-events: none;
    overflow: auto;
    /*for scrollbar*/
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}
#tickaxis-wrapper-y {
    padding-left: -1em;
    padding-right: 0.5em;
    width: var(--tickaxis-y-width);
    min-width: 2em;
}
#tickaxis-wrapper-x {
    height: 2em;
}

.tickaxis {
    position: relative;
    display: flex;
    gap: calc(var(--grid-spacing) - var(--gridline-size));
}
#tickaxis-y {
    flex-flow: column-reverse;
    text-align: right;
    margin-top: 2px;
    height: var(--plane-height);
}
#tickaxis-x {
    height: 2em;
    flex-flow: row;
    align-self: flex-end;
    margin-left: 2px;
    width: var(--plane-width);
    
}
gridtick {
    background-color: rgb(138, 138, 138);
    overflow: visible;
}
#tickaxis-y > gridtick {
    height: var(--gridline-size);
    line-height: 1.2rem;
}
#tickaxis-x > gridtick {
    width: var(--gridline-size);
    height: 1rem;
    text-indent: 0.2rem;
}

#timebar-wrapper {
    position: absolute;
    left: 12%;
    top: 10px;
    width: 66%;
    z-index: 3;
    font-family: var(--font);
}
#upper-timebar-wrapper {
    font-size: 0.8rem;
    margin-bottom: 0.6rem;
    height: 0.79rem;
}
#upper-timebar-wrapper input {
    margin: 0;
    margin-right: 0.5rem;
    width: 0.85rem;
    height: 0.85rem;
}
#lower-timebar-wrapper {
    position: relative;
    height: 40px;
    margin-bottom: 0.6rem;
    background-color: #2a7b9b5d;
}
#timebar {
    position: absolute;
    width: 95%;
    left: 2.5%;
    top: 40%;
    height: 5px;
    background-color: rgb(173, 206, 196);
}
#timebar-thumb {
    height: 16px;
    width: 30px;
    background-color: #2a7b9b;
    box-shadow: 0 2px 10px  rgba(0, 0, 0, 0.4);
    border: 1px solid wheat;
    margin-top: -6px;
    cursor: grab;
}
#timebar-thumb:hover {
    background-color: #27b0e6;
}
#timebar-value {
    position: absolute;
    height: 100%;
    right: 0;
    transform: translateX(100%);
    background-color: #2a7b9b5d;
}
#timebar-value > parameter {
    height: inherit;
    padding: 0;
    padding-right: 1rem;
}
#timebar-stats {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    width: 120%;
    font-size: 0.84rem;
}
.stat-box {
    background-color: #2a7b9b5d;
    padding: 1rem;
    height: fit-content;
}
#timebar-pos-wrapper {
    display: grid;
    grid-template-columns: 3.5rem 1fr 1fr; 
    gap: 1rem;
    row-gap: 0.8rem;
    text-align: center;
}
.timebar-pos {color: #a6d0dd;}

#general-stats {
    display: flex;
    flex-flow: column;
    gap: 0.6rem;
    align-content: flex-start;
}
#timechart-wrapper {
    display: flex;
    flex-flow: column;
    width: fit-content;
    gap: 0.6rem;
    background-color: #16485c77;
}
#timechart-wrapper-inner {
    display: flex
}
.timechart {
    width: 16rem;
}

#chartmode-butts > span {
    position: relative;
    padding: 0.3rem 1rem;
    padding-top: 0;
    font-size: 0.9rem;
}
#chartmode-butts > span.selected {
    background-color: rgb(151, 69, 48);
}
#chartmode-butts > span:hover {
    background-color: rgba(255, 102, 0, 0.3);
}
#chartmode-butts > span.selected:hover {
    background-color: rgba(255, 72, 0, 0.46);
}

#plane{
    position: relative;
    display: flex;
    overflow: hidden;
    width: var(--plane-width);
    height: var(--plane-height);
    transform-origin: 0 0;
    pointer-events: auto;
    background: linear-gradient(90deg,rgba(42, 123, 155, 0.2) 0%, rgba(87, 199, 171, 0.2) 50%, rgba(114, 237, 83, 0.2) 100%);
    z-index: 3;
}


.grid {
    position: absolute;
    bottom: 0;
    display: flex;
    gap: calc(var(--grid-spacing) - var(--gridline-size));
}
#grid-y {
    flex-flow: row;
    height: 100%;
}
#grid-x {
    flex-flow: column-reverse;
    width: 100%;
}
#grid-y > gridline {
    height: 100%;
    width: var(--gridline-size);
    min-width: var(--gridline-size);
    background-color: var(--grid-color);
}
#grid-x > gridline {
    width: 100%;
    height: var(--gridline-size);
    min-height: var(--gridline-size);
    background-color: var(--grid-color);
}

ball {
    position: absolute;
    width: var(--ball-size);
    height: var(--ball-size);
    left: calc(12rem);
    bottom: calc(12rem);
    z-index: 3;
    border-radius: 50%;
    background-color: beige;
    cursor: grab;
}
.ghost {
    background-color: rgb(91, 174, 223);
    opacity: 0.5;
}
ground {
    position: absolute;
    bottom: calc(2*var(--grid-spacing) - var(--ground-size)) !important;
    height: 20px;
    border-top: 2px solid beige;
    width: 100%;
    z-index: 3;
    cursor: grab;
}

trail {
    position: absolute;
    height: calc(var(--ball-size)*0.15);
    width: calc(var(--ball-size)*0.15);
    border-radius: 50%;
    background-color: rgba(245, 245, 220, 0.4);
}