:root {
    --tooltipWidth: 25vw; /* tooltips will be expanded to this horizontal size by description text before wrapping */
}

html {
    background-color: #808080;
    width:100vw;
    height:100vh;
    overflow:hidden;
}

div {
    box-sizing: border-box;
}

div.fullscreen {
    width:100vw;
    height:100vh;
    top:0px;
    left:0px;
    position:absolute;

    -webkit-user-select: none;  /* Chrome all / Safari all */
    -moz-user-select: none;     /* Firefox all */
    -ms-user-select: none;      /* IE 10+ */
    user-select: none;
}

#uicontainer, #floatercontainer {
    pointer-events:none;
}

#uicontainer>* {
    pointer-events:auto;
    position:absolute;
}

canvas {
    /*background-color: white;*/
    border: 0px none transparent;
}

.dragging {
    cursor:move;
}

.hovering>div>canvas {
    cursor:pointer;
}

.uibackground {
    background:#202020;
    font-family: "courier new", "courier", monospace;
    color: #E0E0E0;
}

.error {
    color:#FF2222;
}

button {
    background-color:#202020;
    font-family: "courier new", "courier", monospace;
    font-size: 14px;
    color: #E0E0E0;
    border: 1px solid #707070;
    border-radius: 0;
    cursor: pointer;
}
button:hover {
    border: 1px solid #BBBBBB;
}
button:active {
    border: 1px solid #FFFFFF;
}

/* ######################################################################## */

.SelectionWindow {
    position: absolute;
    transition: bottom 0.15s;
    transition-timing-function: ease-in-out;
}

.SelectionDisplay {
    position: absolute;
    width: 300px;
    height: 150px;
    pointer-events:auto;
}

.ButtonGrid {
    position: absolute;
    height:150px;
    overflow: hidden;
}

.ButtonGrid.background, .ButtonGridInner {
    background:#202020;
}

.ButtonGridInner {
    top:0px;
    left:var(--scroll);
    position:relative;
    height:100%;
    max-height:100%;
    padding:0 2px 2px 0;

    display:inline-grid;
    grid-template-rows: auto;
    grid-template-columns: repeat(var(--columns), auto);
}

.ButtonGridScroll {
    top:0px;
    position:absolute;
    display:inline-block;
    height:100%;
    width:36px;
    background-color:#808080;
    z-index:10;
    cursor:pointer;
}
.ButtonGridScroll:hover {
    background-color:#A0A0A0;
}
.ButtonGridScroll:active {
    background-color:#C0C0C0;
    color:#FFFFFF;
}

.ButtonGridScroll::after {
    width:100%;
    height:20%;
    text-align:center;
    display:block;
    position:absolute;
    font-size:36px;
    top:calc(50% - 19px);
}
.ButtonGridScroll.left::after {
    content:"<";
}
.ButtonGridScroll.right::after {
    content:">";
}

.ButtonGridScroll:not(.disabled)::before {
    content:"";
    position:absolute;
    top:0;
    height:100%;
    width:25px;
    pointer-events:none;
}
.ButtonGridScroll.left:not(.disabled)::before {
    left:100%;
    background-image: linear-gradient(to right, rgba(0,0,0,0.5), rgba(0,0,0,0));
}
.ButtonGridScroll.right:not(.disabled)::before {
    right:100%;
    background-image: linear-gradient(to left, rgba(0,0,0,0.5), rgba(0,0,0,0));
}

.ButtonGridScroll.disabled {
    background-color:#404040;
    color:#606060;
    cursor:auto;
}

.Button {
    position:relative;
    width:72px;
    height:72px;
    margin:2px 0 0 2px;
    background-color:#606060;
    cursor:pointer;
}

.Button.disabled {
    cursor:auto;
}

.Button.disabled:after {
    position:absolute;
    content:"";
    width:100%;
    height:100%;
    background-color:rgba(255,0,0,0.1);
    pointer-events:none;
}

.Button.DisplayButton {
    position:absolute;
    right: 0;
    bottom: 0;
}

.Button.DisplayButton.disabled {
    display:none;
}

.BuildGrid {
    --width: 0px;

    top: 0px;
    left: 100%;
    max-width: var(--width);
}

.Tooltip {
    position:absolute;
    --x:10;
    --y:10;

    left: calc(var(--x) * 1px);
    top: calc(var(--y) * 1px);

    pointer-events:none;
    z-index:1000;

    display:flex;
    flex-direction: row;
    max-width:var(--tooltipWidth);
}

.TooltipInner {
    flex-basis:var(--tooltipWidth);
    flex-grow:1;
    flex-shrink:1;

    padding:8px;
}

.TooltipInner>h1 {
    white-space:nowrap;
    font-size: 18px;
}

.TooltipInner .item {
    color:#FFAA44;
    font-weight:bold;
}

.TooltipIcon {
    --icon: none;

    display:inline-block;
    position:relative;
    /*background-color: white;*/
    height:0.8em;
    width:0.8em;
    bottom: -0.05em;

    background-image: var(--icon);
    background-size: 100% 100%;
    margin:0 2px 0 2px;
}

.ResourceList {
    white-space: nowrap;
}
.ResourceList>span {
    margin-right:3px;
}
.ResourceList .insufficient {
    color:#FF2222;
}

.ResourceListWindow {
    position:absolute;
    top:50px;
    left:0;
}
.ResourceDisplay {
    padding:4px;
}
.ResourceIcon {
    width:24px;
    height:24px;
    background-image:var(--icon);
    background-size:100% 100%;
    display:inline-block;
}
.ResourceCounter {
    display:inline-block;
    margin: 0 4px 0 4px;
    width:100px;
    background-color:black;
    padding: 2px 5px 2px 5px;
    position:relative;
    top:-6px;
}

.ProgressBar {
    --progress:0;

    position:relative;
    width:100px;
    height:20px;

    background-color: black;
}

.ProgressBarInner, .ProgressBarGhost {
    position:absolute;
    width: calc(var(--progress) * 100%);
    height:100%;
    left:0px;
    top:0px;
}
.ProgressBarInner {
    transition: width 0.05s;
    transition-timing-function: linear;

    background-color: #AAAAAA;
}
.ProgressBarGhost {
    transition: width 0.5s;
    transition-timing-function: linear;
    transition-delay: 0.5s;

    background-color: #202020;
}

.WaveTracker {
    position:absolute;
    width: 100%;
    height: 50px;

    top:0px;
    left:0px;

    padding: 8px 8px 8px 88px;
}

.WaveBar {
    position:relative;
    width:100%;
    height:100%;
    background-color:black;
    overflow:hidden;
    border: 1px solid #606060;
}

.WaveBar .bar {
    position:absolute;
    height:100%;
    width:calc(var(--width) + 2px);
    top:0;
    left:var(--left);

    border-left:2px solid rgba(255,64,64,1);
    border-right:2px solid rgba(255,64,64,1);
}

.WaveCounter {
    position:absolute;
    width:88px;
    left:0px;
    top:17px;
    text-align:center;
    font-weight:bold;
}

.bar:first-child {
    border-left: 0px none;
}

.WaveBar .spawnTimer {
    background-color: #700000;
}

.WaveBar .waveTimer {
    background-image: linear-gradient(to right, black, #404040);
}

.Floater {
    font-family: "courier new", "courier", monospace;
    font-size: 15px;
    text-align:center;

    color: yellow;
    font-weight: bold;

    text-shadow: 1px 1px black;
}

.ResourcePopup {
    font-family: "courier new", "courier", monospace;
    font-size: 15px;
    text-align:center;

    color: white;
    font-weight: bold;

    text-shadow: 1px 1px black;
}

.LifeDisplay {
    width:34vw;
    height:30px;
    top:50px;
    left:33vw;
}

.LifeDisplay .ProgressBar {
    top: 0px;
    width: calc(34vw - 10px);
    height: 25px;
    left:5px;
}

.LifeDisplay .ProgressBarInner {
    background-color: #DD2222;
}
.LifeDisplay .ProgressBarGhost {
    background-color: #771111;
}
.LifeDisplay .text {
    position:absolute;
    width:100%;
    top:2px;
    left:0;
    text-align:center;
    color:white;
    text-shadow: 0 0 4px black, 0 0 3px black, 0 0 3px black;
    font-size: 20px;
    font-weight:bold;
}

.GameOver {
    background-color: rgba(0,0,0,0.5);
}
.GameOver div {
    position:absolute;
    left:50vw;
    top:50vh;
    transform:translate(-50%,-50%);
    text-align:center;
    padding:0 5px 15px 5px;
}
.GameOver p {
    width:80%;
    margin: 4px auto 20px auto;
}
.GameOver button {
    display:block;
    margin:4px auto 4px auto;
    width: 250px;
    height: 40px;
}

.ExitButton {
    left:50vw;
    top: 85px;
    transform:translate(-50%,0);
    padding: 6px 10px 6px 10px;
    box-shadow: 0 0 3px black;
}

.MainMenu {
    text-align:center;
    background-color: #551111;

    font-family: "courier new", "courier", monospace;
    color: white;
    box-shadow: 0 0 30vh black inset;
}
.MainMenu button {
    font-size: 32px;
    font-weight:bold;
    width:400px;
    height:50px;
    margin-top: 15px;
    box-shadow: 0 0 10px black;
}

.LoadScreen {
    text-align:center;

    background:url("assets/images/spirograph_spin.svg") no-repeat center;
    background-color: #551111;
    background-size:contain;
    background-origin: content-box;
    padding: 20vh;
    box-sizing:border-box;

    font-family: "courier new", "courier", monospace;
    color: white;
    box-shadow: 0 0 30vh black inset;
}


.note {
    position: relative;
    left: 55px;

    background-color: #DDDDCC;
    width:1000px;
    height:760px;
    text-align:left;
    max-height: calc(100vh - 200px);

    color: #0d378e;
    font-weight: bold;
    margin: 0 auto 0 auto;
    box-shadow: 5px 8px 10px rgba(0,0,0,0.4);
}
.note div {
    position:relative;
    top:0;
    left:0;
    padding: 10px 30px 20px 30px;
    height:100%;
    width:100%;
    overflow-y: auto;
    box-sizing: border-box;
}
.note::after {
    position:absolute;
    content:"";
    width: 300px;
    height: 620px;
    background-image: url("assets/images/pl.png");
    top:0px;
    left: -245px;
}

/* ######################################################################## */

.top { top: 0px; }
.bottom { bottom:0px; }
.left { left:0px; }
.right { right:0px; }
.hidden { display: none; }
.nowrap { white-space:nowrap; }