/**
https://github.com/cgloeckner/pyvtt/

Copyright (c) 2020-2022 Christian Glöckner
License: MIT (see LICENSE for details)
*/

img {
    transform: translateZ(0); /* chrome-workaround against blurry downscale */
}

body {
    font-family: sans;
    font-size: 11pt;
    
    overflow: hidden;
}

div.container {
    position: absolute;
    
    background-image: url('/static/background.jpg');
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    background-color: black;
    height: 100%;
    width: 100%;
}

div#popup {
    display: none;
    
    text-align: center;
    
    position: absolute;
    top: 50%;
    left: 50%;
    
    color: red;
    
    font-size: large;
    transform: translate(-50%,-50%);
    
    height: 25px;
    width: 400px;
    background-color: rgba(0, 0, 0, 0.75);
    padding: 15px;
    
    border: 1px solid white;
    border-radius: 10px;
    
    z-index: 500;
}

div#hint {
    display: none;
    
    text-align: center;
    
    position: absolute;
    bottom: 60px;
    left: 50%;
    
    color: white;
    
    font-size: medium;
    transform: translate(-50%, 0%);
    
    height: 15px;
    width: 400px;
    background-color: rgba(0, 0, 0, 0.85);
    padding: 15px;
    
    border: 1px solid white;
    border-radius: 10px;
    
    z-index: 500;
}

hr {
    border: 1px solid white;
}

p {
    margin-bottom: 5px;
}

table.status > tbody > tr > th {
    width: 150px;
}

table.status > tbody > tr > th.medium {
    width: 100px;
}

table.status > tbody > tr > th.small {
    width: 25px;
}

a {
    color: grey;
    text-decoration: none;
}

a:hover {
    color: white;
}

#auth,
span.links {   
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 100;
    padding: 3px;
    
    color: white;
}

#auth {
    border: 1px solid black;
    background-color: rgba(100, 100, 100, 0.25);
    border-radius: 10px;

    padding: 5px;
    bottom: 20px;
}

#auth img.favicon {
    width: 20px;
    vertical-align: text-top;
}

#auth a,
span.links a {
    padding: 5px;
}

div.form {
    margin-left: auto;
    margin-right: auto;
    width: 300px;
}

input {
    color: black;
}

input[type=text],
input[type=password] {
    border: 1px solid white;
    padding: 5px;
    background: white;
    outline: 1px solid white;
    outline-offset: 3px;
    text-align: center;
    margin: 5px;
    width: 250px;
}

div.dropzone {
    border: 1px solid white;
    padding: 10px;
    outline: 1px solid white;
    outline-offset: 3px;
}

div.dropzone > p {
    padding-top: 80px;
    padding-bottom: 80pX;
}
 
input[type=submit],
input[type=button],
input[type=color] {
    background: white;
    border-radius: 2px;
    border: 0px;
    padding: 10px 30px;
    margin: 5px; 
    width: 200px;
    height: 50px;
}

input[type=button].login_button {
    width: 250px;
}

input[type=file] {
    border: 1px solid white; 
    outline: 1px solid white;
    outline-offset: 3px;
    padding: 10px;
    color: white;
    text-transform: uppercase;
}

input[type=submit]:hover,
input[type=button]:hover,
input[type=color]:hover {
    cursor: pointer;
    background: #99ff66;
}

div.menu {
    display: block;
    
    width: calc(100% - 250px);
    
    padding: 5px;
    color: white;
    border-radius: 10px;
    text-align: center;
    
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);

    min-width: 500px;
}

div.walloftext {
    margin-left: auto;
    margin-right: auto;
    max-width: 800px;
    max-height: 540px;
    
    text-align: left;
    overflow-y: auto;
    scrollbar-color: white black;
}

div.menu > img.logo {
    height: 200px;
    width: auto;
}

div.menu > div#countdown {
    width: 300px;  
    height: 125px;
    
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, 100px);
    
    background-color: rgba(20, 20, 20, 0.95);
    border-radius: 15px;
    border: 1px solid black;
    
    padding: 15px;
    margin: 5px;
}

div.menu > div#countdown > h1 > span.small {
    font-size: initial;
}

div.menu table {
    margin-left: auto;
    margin-right: auto;
}

div.menu > img,
div.menu > table tr td img,
div.menu > input[type=image] {
    width: 16px;
}

div.menu table > input {
    display: inline;
    width: 100px;
}

div#game {
    display: none;
    height: 100%;
}

/* --- GM Schedule Overlay ------------------------------------------ */

div#schedule {
    display: none;
    
    width: 500px;
    height: 250px;
    border: 1px solid red;
    top: 50%;
    left: 50%;
    position: absolute;
    transform: translate(-50%,-50%);
    
    border: 1px solid white;
    
    background-color: rgba(0, 0, 0, 0.85);
    border-radius: 10px;
    padding: 5px;
    margin: 5px;
    
    z-index: 10;
}

div#schedule > form > p > select,
div#schedule > form > p > input {
    padding: 5px;
}

div#schedule > form > p > input[type=number] {
    width: 80px;
}

/* --- GM Area ------------------------------------------------------ */

div.horizdropdown {
    width: calc(100% - 10px);
    
    overflow-x: hidden; 
    z-index: 10;
}

div.horizdropdown > div#gmdrop {
    display: inline-block;
    position: absolute;
    z-index: 15;
    
    top: -132px;
    
    width: calc(100% - 30px);
    overflow-x: auto;
    scrollbar-color: white black;
    
    height: 100px;
    border: 1px solid black;
    
    background-color: rgba(100, 100, 100, 0.25);
    border-radius: 10px;
    padding: 5px;
    margin: 5px;
    
    padding: 10px; 
}

div.horizdropdown > img {
    position: absolute;
    top: 0px;
    right: 0px;
    
    width: 48px;
    
    filter: drop-shadow(0px 0px 10px white) 
          drop-shadow(0px 0px 0 white);
}

div.horizdropdown > div.gmhint {
    position: absolute;
    width: 100%;
    
    z-index: 10;

    user-select: none;
}

div.horizdropdown > div.gmhint > img#gmhint {
    position: relative;
    display: block;
    left: 50%;
    
    cursor: pointer;
    
    width: 32px; 
    
    filter: none;
}

div.horizdropdown > div.gmhint > img#gmhint:hover {
    filter: drop-shadow(0px 0px 10px white) 
          drop-shadow(0px 0px 0 white);
}

img.icon,
img.icon_only {
    width: 16px;
}

img.largeicon {
    width: 28px;
    padding: 5px;
    display: inline-block;
}

img.largeicon:hover { 
    cursor: pointer;
    
    filter: drop-shadow(0px 0px 10px white) 
          drop-shadow(0px 0px 0 white);
}


div#gmdrop > div.tools {
    vertical-align: top;
}

div#gmdrop > div {
    display: inline-block;
}


div#gmdrop > div.element > a > img.thumbnail,
div#gmdrop > div.element > img.thumbnail,
div#gmdrop > div.element > img.active {
    width: 100px;
    max-height: 56px;
    border-radius: 10px;
    display: block;
    padding: 5px;
}

div#gmdrop > div.element > img.active { 
    border: 3px groove white;
}

img.icon:hover,
div#gmdrop > div.element > img.thumbnail:hover,
div#gmdrop > div.element > a > img.thumbnail:hover {
    cursor: pointer;
    
    filter: drop-shadow(0px 0px 10px white) 
          drop-shadow(0px 0px 0 white);
}

.hint:hover {
    cursor: help;
}

div#gmdrop > div.element > div.controls {
    padding-top: 10px;
    width: 100px;
    text-align: center;
}

div#gmdrop > div.element > div.controls > span.warning {
    color: red;
    font-size: x-large;
    cursor: help;
}

img.schedule {
    position: absolute;
    top: 50%;
    right: 0; 
    transform: translate(0, -50%);
}

/* --- Drawing Controls --------------------------------------------- */

div#drawing {
    width: 66%;

    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);

    background-color: rgba(0, 0, 0, 0.80);
    padding: 15px;
    border-radius: 10px;
    
    z-index: 499;

    display: none;
}

div#drawing > div {
    color: white;
    padding: 10px;
}

div#drawing > div > label {
    color: white;
}

div#drawing > div > canvas#doodle {
    background-image: url("/static/canvas_transparent.png");
    background-repeat: repeat;

    max-width: 66%;

    display: block;
    margin-left: auto;
    margin-right: auto;
}

img.border {
    outline: 3px solid gold;
}

div.centered {
    text-align: center
}

div#drawing > div > div > input#pencolor,
div#drawing > div > div > button#upload {
    background: white;
    border-radius: 2px;
    border: 0px;
    padding: 5px;
    margin: 5px;      
    width: 150px;
    height: 25px;
}

div#drawing span.icons {
    float: right;
}

div#drawing > div > div > input#pencolor {
    width: 50px;
}

div#drawing > div > span > label {
    padding-left: 10px;
    color: white;
}

div#drawing > div > div > button#upload:hover {
    cursor: pointer;
    background: #99ff66;
}

div#drawing > div.options > span#pen {
    position: relative;
    left: 20px;
}

div#drawing > div.options > span#transparent {
    position: relative;
    left: 90px;
}

div#drawing > div.options > span#token {
    position: relative;
    left: 160px;
}

input#token_toolbox {
    display: none;
}

/* --- Tools -------------------------------------------------------- */

div#uploadscreen,
div#camerapreview,
div#assetsbrowser {
    width: 700px;
    height: 300px;

    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);

    background-color: rgba(0, 0, 0, 0.80);
    padding: 15px;
    border-radius: 10px;
    
    z-index: 499;

    display: none;
}

div#assetsbrowser {
    width: 50%;
    height: 50%;
    aspect-ratio: 16/9;
}

div#assetsbrowser > div#assets {
    padding: 10px;
    height: calc(100% - 45px);
    overflow-y: auto;
}

div#assetsbrowser > div#assets > img {
    margin: 5px;
    max-width: 96px;
    max-height: 96px;

    cursor: grab;
    vertical-align: middle;
}

div#assetsbrowser > div#assets > img:hover {
}

div#uploadscreen > span {
    padding: 10px;
}

div#camerapreview > span {
    padding: 7px;
    float: left;
}

div#uploadscreen > span > form > input[type=file] {
    border: 0; 
    outline: 0;
    outline-offset: 0px;
    padding: 10px;
    margin: 10px;
    color: white;
    text-transform: uppercase;
}

div#schedule img.close,
div#assetsbrowser img.close,
div#uploadscreen > img.close,
div#camerapreview > img.close {
    width: 32px;
    float: right;
    right: 15px;
    position: absolute;

    cursor: pointer;
    display: block;
}

div#camerapreview > img.reload {
    width: 32px;
    float: right;
    left: 15px;
    position: absolute;

    cursor: pointer;
    display: block;
}

div#schedule img.browse,
div#assetsbrowser img.browse {
    width: 32px;
    float: right;
    right: 47px;
    position: absolute;

    cursor: pointer;
    display: block;
}

div#camerapreview > span > video,
div#camerapreview > span > canvas {
    padding: 7px;
    width: 320px;
    height: 180px;

    cursor: pointer;
}

div#camerapreview > span > .largepreview {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
}
   
div#assetsbrowser > p,
div#uploadscreen > span > p,
div#camerapreview > span > p,
div#drawing > span > p {    
    color: white;
    user-select: none;
}

div#uploadscreen > span,
div#camerapreview > span {
    text-align: center;
}

/* --- Player Tools ------------------------------------------------- */

div#playertools {
    position: absolute;
    bottom: 20px;
    left: 5px;
}

/* --- Dicebox Layout ----------------------------------------------- */

div#dicebox {
    opacity: 0.0;
    display: none;
}

div.dice {
    user-select: none;
    position: absolute;
    
    z-index: 1;  
}

div.dice > div {
    position: relative;
}

div.dice > div > img {
    user-select: none;
    
    width: 48px;
    height: 48px;
}

div.dice > div > img:hover {
    cursor: grab;
    
    filter: drop-shadow(1px 1px 10px white) 
          drop-shadow(-1px -1px 0 white);
    
    bottom: 5px;
}

div.dice > div > img:active {
    cursor: grabbing;   
}

.shake {
    animation: shake 1s;
}

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.dicepoof {
    position: absolute;
    top: -5px;
    left: -5px;
    
    user-select: none;
    pointer-events: none;
    
    width: 64px;
    height: 64px;
    background: url('/static/dice_poof.png') left center;
    animation: dicepoof 0.66s steps(10);
}

@keyframes dicepoof {
    100% { background-position: -640px; }
}

div.rollbox {   
    user-select: none;
    pointer-events: none;
    
    position: absolute;
    
    display: inline-flex;
    flex-direction: row; 
    
    z-index: 1;
}

div.rollbox > span {
    position: relative;
    width: 54px; 
}

div.rollbox > span > span.roll { 
    user-select: none;
    pointer-events: none;
    
    width: 36px;
    height: 30px;
    
    display: inline-block;
    margin: 2px;
    padding: 5px;
    text-align: center; 
    color: black;
    
    overflow: clip; 
    
    background-color: rgba(255, 255, 255, 0.66);
    
    border-radius: 10px;   
}

div.rollbox > span > span.roll > span.result {
    font-size: x-large;
    font-weight: bolder;
    
    position: relative;
    top: -3px;
}

div.rollbox > span > span.roll > span.result > img {
    width: 28px;
    height: 28px;
    
    margin-top: -2px;
}

div.rollbox > span > span.roll > span.player {
    display: block;
    font-size: xx-small;
    
    white-space: nowrap;
    
    position: relative;
    top: -5px;
}

div.rollbox > span > span.maxroll > span.result { 
    text-shadow:
        -1px -1px 0 black,
        1px -1px 0 black,
        -1px 1px 0 black,
        1px 1px 0 black; 
    color: white;
    
}

div.rollbox > span > span.minani {
}

div.rollbox > span > span.maxani {
    position: absolute;
    top: -106px;
    left: -20px;
    
    z-index: 5;
    
    user-select: none;
    pointer-events: none;
    display: inline-block;
    
    width: 100px;
    height: 108px;
    background: url('/static/dice_max.png') left center;

    animation-name: dicemax;
    animation-duration: 0.75s;
    animation-timing-function: steps(12);
    animation-iteration-count: 1;
}

@keyframes dicemax {
    0% {background-position: 0px; }
    100% { background-position: -1200px; }
}

/* --- Players list ------------------------------------------------- */

div#players {
    position: absolute;
    height: 56px;
    display: table;
}

div#players > span.player {
    display: inline-block;
    padding: 10px;
    margin: 7px;
    font-size: larger;
    background-color: rgba(200, 200, 200, 0.5);
    border-radius: 10px;
    text-align: center;
    color: black;
    min-width: 80px;
    cursor: grab;
}

div#players > span.player:active {
    cursor: grabbing;
}

div#players > span > div.playermenu {
    position: absolute;
    display: none;
    
    width: calc(100% - 20px);
}

div#players > span > div.playermenu > img {
    width: 25px;
}

div#players > span > div.playermenu > img.left {
    float: left;
}

div#players > span > div.playermenu > img.right {
    float: right;
}

div#players > span > div.playermenu > img:hover {
    cursor: pointer;
    filter: invert(1.0)
        drop-shadow(1px 1px 10px white) 
        drop-shadow(-1px -1px 10px white);
}

/* --- Roll History ------------------------------------------------- */

div#rollhistory {
    width: 200px;
    height: 400px;
    
    position: absolute;
    top: 50px;  
    right: -175px;
    
    background-image: url('/static/dicetray.png');
    background-size: 200px 400px;
    margin: 5px;
}

div#rollhistory > div {
    position: absolute;
    display: none;
    
    width: 48px;
    height: 48px;    
    transform: translate(-50%, -50%);
    
    cursor: grab;
}

div#rollhistory > div:active {
    cursor: move;
}

div#rollhistory > div > img {
    position: absolute;
    width: 48px;

    hue-rotate: 90deg;
}

div#rollhistory > div > span {
    position: absolute;
    user-select: none;
    
    color: white;
    font-size: x-large;
    text-align: center;
    font-weight: bold;
    
    width: 48px;
    height: 48px;
    
    padding-top: 13px;
}

div#rollhistory > div > span > img {
    width: 28px;
    margin-top: -2px;
    filter: invert(1.0);
}

/* --- Map Footer --------------------------------------------------- */

div.mapfooter {
    position: absolute;
    bottom: 2px;
    width: 100%;
}

div#mapfooter {
    opacity: 0.0;
    display: none;
}

form#uploadform {
    display: none;
}

/* --- Battlemap Layout --------------------------------------------- */

div#login {
    position: relative;
    
    top: 50%;
    
    z-index: 10;
}

div.warning {
    position: absolute;
    top: 0px;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    
    color: red;
    font-size: xxx-large;
    text-align: center;
    
    -webkit-text-stroke-width: 2px;
    -webkit-text-stroke-color: black;
    
    animation: blink 2s linear infinite;
} 

@keyframes blink {
    0% {
        opacity: 0;
    }
    50% {
        opacity: .5;
    }
    100% {
        opacity: 1;
    }
}

div.battlemap {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

div.battlemap > div#draghint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    z-index: 9000;

    font-size: large;
    text-align: center;
    color: white;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
}

#draghint > span {
    cursor: pointer;
}

div.battlemap > canvas#battlemap {
    background-color: rgba(100, 100, 100, 0.25);
    border: 1px solid black;
    
    display: block;
    margin-left: auto;
    margin-right: auto;
}

div.battlemap > div#tokenbar {
    position: absolute;
    visibility: hidden;
    
    user-select: none;
}

div.battlemap > div#tokenbar > img {
    position: absolute;
    display: inline;
    height: 24px;
    margin: 0px;
    padding: 0px;
    filter: opacity(0.66)
        drop-shadow(1px 1px 10px #BDBDBD) 
        drop-shadow(-1px -1px 10px #BDBDBD);
}

div.battlemap > div#tokenbar > img#tokenBottom {
    top: 6px;
    cursor: s-resize;
}

div.battlemap > div#tokenbar > img#tokenTop {
    bottom: 6px;
    cursor: n-resize;
}

div.battlemap > div#tokenbar > img#tokenLock {
    cursor: not-allowed;
}
    
div.battlemap > div#tokenbar > img#tokenClone {
    cursor: copy;
}

div.battlemap > div#tokenbar > img#tokenRotate,
div.battlemap > div#tokenbar > img#tokenRotate:active {
    cursor: col-resize;
}
  
div.battlemap > div#tokenbar > img#tokenResize {
    cursor: row-resize;
}

div.battlemap > div#tokenbar > img#tokenLabel,
div.battlemap > div#tokenbar > img#tokenLabel:active {
    cursor: text;
}

div.battlemap > div#tokenbar > img#tokenLabelInc,
div.battlemap > div#tokenbar > img#tokenLabelDec {
    height: 42px;
}

div.battlemap > div#tokenbar > img:hover {
    cursor: pointer;
    filter: invert(1.0)
        drop-shadow(1px 1px 10px white) 
        drop-shadow(-1px -1px 10px white);
}

div.battlemap > div#tokenbar > img.dummy:hover {
    cursor: default;
}

div#ping,
div#fps,
div#assetsDownloading,
div#assetsUploading,
div#zoom,
div#version {
    position: absolute;
    color: grey;
    bottom: 0px;

    user-select: none;
    cursor: default;
}

#auth,
span.links {
    user-select: none;
}

div#ping {
    left: 0px;
    padding-left: 5px;
}

div#fps {
    left: 120px;
}
       
div#version {
    left: 200px;
}

div#assetsDownloading {
    left: 270px;
}

div#assetsUploading {
    left: 320px;
}

div#zoom {
    left: 370px;
    
    cursor: pointer;
}

div#zoom > img#beamLock {
    user-select: none;
    cursor: pointer;
}

div.audioplayer {
    z-index: 100;
    background-color: rgba(100, 100, 100, 0.25);
    border-radius: 10px;
    padding: 10px;

    position: absolute;
    bottom: 50px;
    right: 0px;
    width: 25px;

    cursor: grab;
}

div.audioplayer:active {
    cursor: grabbing;
}

div.audioplayer > img {
    display: block;
    width: 25px;   
    user-select: none;
}

div.audioplayer > img:hover {
    cursor: pointer;
    
    filter: drop-shadow(0px 0px 10px white) 
          drop-shadow(0px 0px 0 white);
}

div.audioplayer > div#musicvolume {  
    margin-top: 5px;
    width: 25px;
    
    text-align: center;
    color: white;
}

div.audioplayer > div#musicvolume > img {
    width: 15px;
    cursor: default;
    filter: none;
}

div.audioplayer > div#musicslots > div {
    border: 2px outset black;
    width: 22px;
    height: 22px;
    margin-top: 5px;

    text-align: center;
    color: white;
    font-size: large;

    display: grid;
    align-content: center;
}

div.audioplayer > div#musicslots > div.playback {
    background-color: white;
    color: black;
}

div.audioplayer > div#musicslots > div:hover {
    filter: drop-shadow(0px 0px 10px white) 
          drop-shadow(0px 0px 0 white);
}

div.audioplayer > div#musicslots > div:active {
    border: 2px inset black;
}
