/********** Panel (simple / fancy) **********/

.osui-panel {
    pointer-events: auto;
    position: relative;
    overflow: visible;
    outline: none; /* for macos */
    z-index: 0; /* Panel */
}

.osui-panel-simple {
    --edge-thickness:       0.35714em;      /* 5px @ font size 1.4em (14px) */

    background-color: rgba(var(--background-light), var(--panel-transparency));
    border: var(--border-small) solid rgb(var(--icon));
    border-radius: var(--radius-large);
    margin: calc(var(--edge-thickness) + var(--pad-x-small));
}

.osui-panel-fancy-outer {
    --edge-thickness:       0.35714em;      /* 5px @ font size 1.4em (14px) */
    --border-radius-outer:  0.71429em;      /* 10px @ font size 1.4em (14px) */

    height: 100%;

    background-color: rgba(var(--background-light), calc(var(--panel-transparency) * 0.5));
    border-radius: var(--border-radius-outer);
    box-shadow: 0px 0px 5px 1px rgba(var(--shadow), 0.25);
    padding: var(--edge-thickness); /* outside of border padding */
    overflow: hidden;

    /* Need for scroll bars to appear on proper layer */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.osui-panel-fancy-border {
    height: 100%;

    background-color: rgba(var(--background-light), var(--panel-transparency));
    border: var(--border-small) solid rgb(var(--icon));
    border-radius: var(--radius-large);
    padding: var(--pad-small);
    overflow: hidden;

    /* Need for scroll bars to appear on proper layer */
    display: flex;
    flex-direction: column;
}

.osui-window .osui-panel-fancy-border {
    border: var(--border-small) solid rgb(var(--button-light));
}
.osui-window.osui-active-window .osui-panel-fancy-border {
    border: var(--border-small) solid rgb(var(--icon));
}

.osui-panel-fancy-inside {
    height: 100%;
    width: 100%;
    background-color: rgba(var(--icon-light), calc(var(--panel-transparency) * 0.05));
    border-radius: var(--radius-small);
    margin: 0;
    padding: var(--pad-x-small) 0;
    overflow: hidden;

    /* Need for scroll bars to appear on proper layer */
    display: flex;
    flex-direction: column;
}

/********** Scroller ********/

.osui-scroller {
    overflow: auto;
}

/********** Shrinkable **********/

.osui-shrinkable {
    background-color: transparent;
    border: solid var(--border-small) rgba(var(--shadow), 0.25);
    border-radius: var(--radius-large);
    margin: var(--pad-x-small);
    box-shadow: inset 0 0 var(--pad-small) 0 rgba(var(--midlight), 0.5); /* inner-glow */
    overflow: hidden;
}
.osui-shrinkable.osui-borderless {
    border: solid var(--border-small) transparent;
    margin-bottom: 0;
    box-shadow: none;
    overflow: visible;
}
.osui-shrinkable.osui-borderless.osui-expanded {
    border-bottom: none;
}

/* Shrinkable Title Div */
.osui-shrink-title {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    min-height: calc(var(--row-height));
    overflow: hidden;

    cursor: default;
    color: rgba(var(--text-light), 1.0);
    background-color: rgba(var(--icon), 0.35);

    box-shadow: inset 0 0 var(--pad-small) 0 rgba(var(--midlight), 0.5); /* inner-glow */
    text-shadow: var(--minus) var(--pixel) rgba(var(--shadow), 0.5);

    border-bottom: solid var(--border-micro) transparent;
    border-top: solid var(--border-micro) transparent;
    border-top-left-radius: var(--radius-small);
    border-top-right-radius: var(--radius-small);
    padding: 0 var(--pad-medium); /* vertical horizontal */
}
.osui-shrink-title:hover {
    color: rgba(var(--highlight), 1.0)
}
.osui-shrinkable.osui-borderless .osui-shrink-title {
    outline: solid var(--border-small) rgba(var(--shadow), 0.25);
    border-radius: var(--radius-small);
}

/* Title Icon */
.osui-shrink-icon > * {
    filter: var(--drop-shadow);
}
.osui-shrink-icon {
    flex-grow: 0;
    flex-shrink: 0;

    position: relative;
    display: flex;
    margin: 0.15em;
    height: calc(var(--arrow-size) * 3.5);
    min-height: calc(var(--arrow-size) * 3.5);
}
.osui-shrink-icon.osui-has-icon {
    width: calc(var(--arrow-size) * 3.5);
    min-width: calc(var(--arrow-size) * 3.5);
}

/* Title Text */
.osui-shrink-text {
    flex-grow: 1;
    flex-shrink: 2;

    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;

    padding-left: 0.2em;
}

/* Title Arrow */
.osui-shrink-arrow {
    flex-grow: 0;
    flex-shrink: 1;

    position: relative;
    content: '';
    margin: 0 0.35em; /* vertical horizontal */
    width: 0;
    height: 0;
    transform: translateX(25%);
    z-index: 101; /* Shrink Arrow */
    border: var(--arrow-size) solid transparent;
    border-color: transparent transparent transparent rgba(var(--text));
    transition: transform var(--menu-timing);
}
.osui-shrink-arrow-clicker {
    position: absolute;
    content: '';
    width: 1.7em;
    height: 1.7em;
    left: calc(1.7em * -0.5);
    top: calc(1.7em * -0.5);
    cursor: pointer;
}
.osui-shrinkable.osui-expanded .osui-shrink-title .osui-shrink-arrow {
    transform: rotate(90deg) translateX(25%);
}
.osui-shrink-title:hover .osui-shrink-arrow {
    border-color: transparent transparent transparent rgba(var(--highlight));
}

/* Shrinkable Body Div */
.osui-shrink-body {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    border-bottom-left-radius: var(--radius-small);
    border-bottom-right-radius: var(--radius-small);
    padding: var(--pad-small);
    overflow: hidden;
    pointer-events: auto;
}
.osui-shrinkable.osui-borderless .osui-shrink-body {
    padding-bottom: 0;
}
.osui-shrinkable:not(.osui-expanded) .osui-shrink-body {
    pointer-events: none;
    display: none;
}
.osui-shrinkable.osui-expanded:not(.osui-borderless) .osui-shrink-body {
    border-top: solid var(--border-small) rgba(var(--shadow), 0.25);
}

/* Borderless Property List Row */
.osui-shrinkable.osui-borderless .osui-property-row {
    width: calc(100% + (var(--pad-small) * 5)) !important;
    margin-left: calc(var(--pad-small) * -2.5) !important;
    margin-right: calc(var(--pad-small) * -2.5) !important;
}

/********** Tabbed **********/

.osui-tabbed {
    position: relative;
    max-height: 100%;
    padding: var(--pad-small);
}

/* Collection of Panels */
.osui-tab-panels {
    height: 100%;
    width: 100%;
    overflow: hidden;

    /* Need for scroll bars to appear on proper layer */
    display: flex;
    flex-direction: column;
}

/* Interior panel of a Tabbed Panel */
.osui-tab-panels .osui-tab-panel {
    display: flex; /* needed for scroll bars to appear on proper layer */
    flex-direction: column;
    pointer-events: auto;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.osui-tab-panels .osui-tab-panel.osui-hidden {
    display: none;
    pointer-events: none;
}

/* Collection of Tabs */
.osui-tabs {
    position: absolute;
    display: flex;
    flex-direction: column;
    margin-top: calc(-1 * var(--pad-x-small));
    z-index: 101; /* Tabs */
}

.osui-tabs.osui-left-side {
    left: calc((var(--tab-size) / -2.0) + 0.42858em); /* --pixel x 6 */
}

.osui-tabs.osui-right-side {
    right: calc((var(--tab-size) / -2.0) + 0.42858em); /* --pixel x 6 */
}

.osui-tab-button {
    --tab-timing: 200ms;

    width: var(--tab-size);
    height: var(--tab-size);
    display: flex;
    align-items: center;
    justify-content: center;

    color: rgba(var(--text), 1.0);
    background-color: transparent;
    border: none;
    border-radius: var(--tab-size);
    outline: none;
    margin: var(--pad-x-small);
    margin-right: var(--pad-x-small);
    margin-top: -0.2em;
    margin-bottom: -0.2em;
    transform: scale(70%);
    transition: margin var(--tab-timing) ease-in-out, transform var(--tab-timing) ease-in-out;
}

.osui-tab-button.osui-selected {
    color: rgba(var(--highlight), 1.0);
    margin-top: var(--pad-x-small);
    margin-bottom: var(--pad-x-small);
    transform: scale(100%);
}

/* Tab Image */
.osui-tab-button .osui-vector-box {
    position: absolute;
    border: none;
    border-radius: var(--tab-size);
    outline: none;
    width: 100%;
    height: 100%;
    overflow: hidden;
    filter: contrast(75%) grayscale(100%) brightness(75%);
}

.osui-tab-button.osui-selected .osui-vector-box {
    filter: none;
}

.osui-tab-button:hover .osui-vector-box,
.osui-tab-button:active .osui-vector-box {
    filter: brightness(120%) !important;
}

.osui-tab-button:active .osui-vector-box .osui-image {
    transform: translate(0, 0.07em);
}

/* Tab Image Border / Shadow */
.osui-tab-icon-border {
    cursor: pointer;
    position: absolute;
    width: 100%;
    height: 100%;
    border: 0.21em solid rgba(var(--icon));
    border-radius: calc(var(--tab-size) * 0.7);
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.osui-tab-button:hover .osui-tab-icon-border {
    box-shadow:
        inset 0 var(--pixel) var(--pixel) var(--pixel) rgba(var(--white), 0.50),
        inset 0 var(--minus) var(--pixel) var(--pixel) rgba(var(--black), 0.35);
}

.osui-tab-button:active .osui-tab-icon-border {
    box-shadow:
        inset 0 var(--pixel) var(--pixel) var(--pixel) rgba(var(--black), 0.35),
        inset 0 var(--minus) var(--pixel) var(--pixel) rgba(var(--black), 0.35);
}

.osui-tab-button.osui-selected .osui-tab-icon-border {
    border: 0.15em solid rgb(var(--icon));
}

/* Title Bar Class for top of Tabbed Panel */
.osui-tab-title {
    --font-size-increase:   1.3;
    --border-radius-title:  0.35714em;

    position: relative;
    display: block;
    flex-shrink: 0; /* don't allow title to shrink */
    color: rgba(var(--text-light), 1);
    background-color: transparent;
    background-image: linear-gradient(to bottom, rgba(var(--icon-light), 0.5), rgba(var(--icon-dark), 0.5));
    border: 0;
    border-radius: calc(var(--border-radius-title) / var(--font-size-increase));
    outline: solid calc(var(--border-small) / var(--font-size-increase)) rgba(var(--shadow), 0.25);
    box-shadow: /* pop-out-shadow */
        inset var(--minus) var(--pixel) var(--pixel) var(--pixel) rgba(var(--white), 0.1),
        inset var(--pixel) var(--minus) var(--pixel) var(--pixel) rgba(var(--black), 0.1);
    text-shadow: calc(var(--minus) * var(--font-size-increase)) calc(var(--pixel) * var(--font-size-increase)) rgba(var(--shadow), 0.5);
    text-align: center;
    overflow: hidden;

    font-size: calc(100% * var(--font-size-increase));
    margin: var(--pad-small);
    margin-top: var(--pad-micro);
    margin-bottom: var(--pad-x-small);
    padding-top: var(--pad-medium);
    padding-bottom: var(--pad-medium);
    min-height: 1.867em;
}

.osui-tab-title-text {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    margin: auto;
    font-size: 100%;
    user-select: all;
}

.osui-tab-title-text::selection {
    color: rgba(var(--icon), 1);
    background-color: rgba(var(--blacklight), 1);
}

/********** Titled **********/

.osui-titled {
    height: 100%;
    width: 100%;
    overflow: hidden;
    display: flex; /* needed for scroll bars to appear on proper layer */
    flex-direction: column;
}

.osui-title-arrow {
    position: absolute;
    content: '';
    font-size: var(--font-size);
    pointer-events: none;
    width: 0;
    height: 0;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    transform: translateY(-25%) scale(1.0, -1.0);
    border: 0.5em solid transparent;
    border-color: rgba(var(--text)) transparent transparent transparent;
    transition: transform var(--menu-timing);
}
.osui-title-arrow-click {
    position: absolute;
    cursor: pointer;
    content: '';
    pointer-events: all;
    width: 2em;
    height: 2em;
    top: 0;
    bottom: 0;
    margin-top: auto;
    margin-bottom: auto;
    right: 0.25em;
    z-index: 101; /* Title Arrow */
}
.osui-title-arrow-click:hover .osui-title-arrow {
    border-color: rgba(var(--highlight)) transparent transparent transparent;
}
.osui-titled.osui-expanded .osui-tab-title .osui-title-arrow {
    transform: translateY(25%);
}

/***** Window *****/

.osui-window {
    --window-z-index: 200;

    position: fixed;
    padding: var(--pad-small);
    opacity: calc(90% + (10% * var(--panel-transparency)));
    z-index: var(--window-z-index); /* Window */
}

.osui-window:not(.osui-active-window) div::-webkit-scrollbar-thumb:horizontal {
    background: linear-gradient(to left, rgba(var(--button-light), 1), rgba(var(--button-dark), 1));
    border-radius: calc(var(--scroll-size) / 2.0);
}
.osui-window:not(.osui-active-window) div::-webkit-scrollbar-thumb:vertical {
    background: linear-gradient(to bottom, rgba(var(--button-light), 1), rgba(var(--button-dark), 1));
    border-radius: calc(var(--scroll-size) / 2.0);
}

.osui-panel-button.osui-title-bar {
    color: rgba(var(--highlight), 0.5);
    border: var(--border-small) solid rgb(var(--button-light));
    border-radius: 9999px;
    background-color: rgba(var(--background-dark), 1.0);
    background-image: linear-gradient(to bottom, rgba(var(--background-light), 0.5), rgba(var(--background-dark), 0.5));
    box-shadow: none;
    text-shadow: none;
    text-align: center;
    left: 0;
    right: 0;
    min-width: 6em;
    min-height: 1.6em;
    margin-left: auto;
    margin-right: auto;
}

.osui-active-window .osui-panel-button.osui-title-bar {
    color: rgba(var(--highlight), 1);
    background-image: linear-gradient(to bottom, rgba(var(--icon-light), 0.5), rgba(var(--icon), 0.5));
    border: var(--border-small) solid rgb(var(--icon));
    text-shadow: var(--minus) var(--pixel) rgba(var(--shadow), 0.5);
}
