:root {
  --dice-size: 100px;
  --dice-size-half: calc(var(--dice-size) / 2);
  --dice-pip-size: 20px;
  --dice-anim-ms: 100ms;
  --dice-face-color-A: rgba(2,0,36,1);
  --dice-face-color-B: rgba(9,9,121,1);
  --dice-face-color-C: rgba(0,212,255,1);
  --dice-pip-color-A: white;
  --dice-pip-color-B: #333333;
  --basic-gray: #333333;
  --primary-color: rgba(0, 100, 120, 1);
  --primary-color-soft: rgba(0, 100, 120, 0.3);
  --primary-color-faded: rgba(0, 100, 120, 0.1);
  --fallback-background-color: #000033;
  --standard-font-size: 16px;
  --toolbar-height: 40px;
}

::backdrop { /* Styling for modal backdrop of built in HTML dialog */
  backdrop-filter: blur(5px);
  background-color: rgba(0,0,0,0.5);
}

html,
body {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100vh;
}

html {
  min-width: 1200px;
}

body {
  overflow-y: auto;
  overflow-x: auto;
  background-color: var(--fallback-background-color);
  background-attachment: fixed;
  background-position: bottom;
  background-repeat: repeat;
  background-size: cover;
}

dialog {
  max-width: 50vw;
  min-width: 400px;
  border: 0;
}

dialog button {
  float: right;
  margin-left: 10px;
  min-width: 75px;
}

dialog .cancel-button {
  color: #777777;
}

dialog,
.toolbar,
.panel,
.dice-slots {
  border-radius: 5px;
}
dialog,
.panel,
.timer,
.dice-slots {
  box-shadow: 5px 5px 10px var(--basic-gray);
}
.toolbar {
  background-color: rgba(255, 255, 255, 0.7);
  z-index: 1000;
}
.panel,
.timer {
  background-color: rgba(255, 255, 255, 0.8);
}
.dice-slots {
  background-color: rgba(255, 255, 255, 0.95);
}

button {
  cursor: pointer;
  padding: 8px 10px 8px 10px;
  font-size: var(--standard-font-size);
}

button:hover {
  box-shadow: 0 0 15px inset var(--primary-color);
}

@font-face {
  font-size: var(--standard-font-size);
  font-family: FixedsysExcelsior301Regular;
  src: url(../fonts/fixedsys-excelsior.woff2) format("woff2");
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: none;
  font-smooth: never;
}

html, body, button, input {
  font-family: FixedsysExcelsior301Regular;
}

.toolbar {
  width: calc(100% - 20px);
  height: calc(var(--toolbar-height) - 1px); /* Account for our border */
  padding: 10px;
  border-radius: 0;
  border-bottom: 1px solid black;
}

.toolbar-item {
  display: inline-block;
  vertical-align: top;
  width: calc((100% / 3) - 10px);
}

.toolbar-start {
  text-align: left;
}
.toolbar-middle {
  text-align: center;
}
.toolbar-end {
  text-align: right;
}

.toolbar-divider {
  border-right: 3px solid var(--basic-gray);
  margin-left: 6px;
  margin-right: 14px;
  height: 40px;
}

.footer {
  width: 100%;
  position: fixed;
  bottom: 0;
  height: 30px;
  opacity: 0.95;
  background-image: url('../images/road-tile.png');
  background-repeat: repeat;
  z-index: 1;
}

.footer-car {
  position: absolute;
  width: 55px;
  height: 40px;
  bottom: 5px;
  left: 0;
  z-index: 2;
  cursor: e-resize;
  filter: hue-rotate(0deg);
  transition: left 10s;
  transition-timing-function: ease-in-out;
}

.footer-car:hover {
  animation: shake 1s;
  animation-iteration-count: infinite;
}

@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); }
}

.mod-button {
  padding-left: 20px;
  padding-right: 20px;
}

.panel {
  position: absolute;
  top: calc(var(--toolbar-height) + 20px + 20px); /* 20 for toolbar padding, 20 to space from it */
  width: 20vw;
}

.panel-header {
  background-color: var(--primary-color-soft);
  padding: 10px;
  font-size: 18px;
  border-radius: 5px 5px 0 0;
  cursor: row-resize;
  margin-bottom: 5px;
}

.panel-header:hover {
  filter: brightness(1.5);
}

.panel-content {
  overflow-y: auto;
  max-height: 50vh;
  padding: 10px 20px 10px 20px;
}

.panel-content ul {
  padding-left: 10px;
}

.panel-buttons {
  width: 100%;
}

.panel-buttons > * {
  display: block;
  width: 70%;
  margin-bottom: 5px;
  margin-left: auto;
  margin-right: auto;
}

.dice-button-wrap {
  width: 100%;
  text-align: center;
}

.dice-button-randomize,
.dice-button-back {
  display: inline-block;
}

.dice-button-randomize {
  width: calc(95% - 50px);
}

.dice-button-back {
  width: 50px;
}

.panel ul {
  margin-top: 0;
  margin-bottom: 0;
}

.timer {
  position: fixed;
  bottom: 0;
  right: 0;
  border-top-left-radius: 5px;
  padding: 10px;
  z-index: 5;
}

.page-instructions {
  left: 20px;
}

.travel-log {
  right: 20px;
}

.travel-log span {
  display: block;
}

.travel-log span::before {
  content: '🟇 ';
}

.dice-tray-wrap {
  width: 100%;
  text-align: center;
  padding: 15px 0 15px 0;
}

.dice-tray {
  max-width: 50%;
  display: inline-block;
  vertical-align: middle;
}

.dice-slots-wrap {
  width: 100%;
  padding-bottom: 5px;
}

.dice-slots {
  width: fit-content;
  min-width: 35vw;
  margin-left: auto;
  margin-right: auto;
  padding: 10px 10px 0 10px;
}

.welcome-image {
  float: right;
  height: 150px;
  margin-left: 10px;
  border: 2px inset black;
}

.lost-radio-wrap {
  padding-top: 10px;
  padding-bottom: 10px;
}

.lost-radio-wrap input,
.lost-radio-wrap label {
  cursor: pointer;
  font-size: 1.25em;
}

.end-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow-x: auto;
  overflow-y: auto;
  z-index: 10000;
  cursor: default;
  display: none;
  opacity: 0;
  transition: opacity 1s;
  transition-timing-function: linear;
  color: white;
  text-shadow: 2px 2px 5px black;
  text-align: center;
  background: linear-gradient(180deg, var(--fallback-background-color) 0%, black 100%);
}

.end-overlay img {
  position: absolute;
  left: 10px;
  top: 10px;
  max-width: 40%;
  border: 1px solid black;
  border-radius: 5px;
}

.end-overlay .content {
  width: 60%;
  padding-left: 40%;
}

.end-overlay .header {
  font-size: 150px;
}

.end-overlay .header2 {
  font-size: 64px;
}

.end-overlay .details {
  font-size: 32px;
  padding: 20px;
}

.end-overlay .details-pad {
  padding: 60px;
}

.end-overlay .unicon {
  font-size: 18px;
}

.resource-wrap {
  display: flex;
  gap: 10px;
}

.resource-bar {
  border: 1px inset black;
  background-color: #DDDDDD;
  height: var(--toolbar-height);
  width: calc(100% / 4);
}

.resource-bar-text {
  float: left;
  padding-left: 5px;
}

.resource-bar-color {
  background-color: var(--basic-gray);
  border-right: 1px dashed yellow;
  height: var(--toolbar-height);
  transition-timing-function: ease-out;
  transition: width 2s;
  /* Width is calculated automatically to fill in the progress bar */
}

.resource-fuel {
  background-color: sienna;
}

.resource-fun {
  background-color: mediumorchid;
}

.resource-memories {
  background-color: limegreen;
}

.resource-distance {
  background-color: goldenrod;
}

.dice-helper,
.dice-helper-text,
.dice-helper-text-big {
  display: inline-block;
  vertical-align: middle;
}
.dice-helper {
  font-family: monospace;
  font-size: 50px;
}
.dice-helper-text-big {
  font-size: 24px;
}

.dice-dropzone {
  display: inline-block;
  cursor: crosshair;
  width: calc(var(--dice-size) * 2.25);
  height: calc(var(--dice-size) + (calc(var(--dice-size)/2)));
  padding-bottom: 5px;
  text-align: center;
  vertical-align: middle;
  background-color: white;
  border: 3px inset #777777;
  border-radius: 10px;
  margin-bottom: 10px;
}
.dropzone-pad {
  margin-right: 10px;
}

.dice-dropzone label {
  display: block;
}

.dice-dropzone-active,
.dice-dropzone-hover {
  border-radius: 10px;
  background-color: rgba(0, 255, 0, 0.3);
  text-shadow: 0 0 10px #DDDD00;
  color: var(--basic-gray);
}

.dice-dropzone-hover {
  box-shadow: 0 0 20px inset #DDDD00;
}

.dice-socket {
  font-size: var(--dice-size);
}

.dice-wrapper {
  width: var(--dice-size);
  height: var(--dice-size);
  padding: 5px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-block;
}

.dice-wrapper-selected {
  filter: brightness(1.5) blur(2px);
  transform: scale(1.05);
}

.dice {
  width: var(--dice-size);
  height: var(--dice-size);
  position: relative;
  transform-style: preserve-3d;
  transition: transform var(--dice-anim-ms);
}

.dice-face {
  position: absolute;
  width: var(--dice-size);
  height: var(--dice-size);
  background: linear-gradient(0deg, var(--dice-face-color-A) 0%, var(--dice-face-color-B) 40%, var(--dice-face-color-C) 100%);
  border: 1px solid var(--basic-gray);
}

.dice-pip {
  background-color: white;
  background: radial-gradient(circle, var(--dice-pip-color-A) 0%, var(--dice-pip-color-B) 400%);
  border: 1px solid black;
  display: block;
  width: var(--dice-pip-size);
  height: var(--dice-pip-size);
  border-radius: 50%;
  margin: 5px;
}

.dice.show-1 { transform: translateZ(calc(var(--dice-size-half) * -1)) rotateY(   0deg); }
.dice.show-5 { transform: translateZ(calc(var(--dice-size-half) * -1)) rotateY( -90deg); }
.dice.show-6 { transform: translateZ(calc(var(--dice-size-half) * -1)) rotateY(-180deg); }
.dice.show-2 { transform: translateZ(calc(var(--dice-size-half) * -1)) rotateY(  90deg); }
.dice.show-4 { transform: translateZ(calc(var(--dice-size-half) * -1)) rotateX( -90deg); }
.dice.show-3 { transform: translateZ(calc(var(--dice-size-half) * -1)) rotateX(  90deg); }

.dice-face-1 { transform: rotateY(  0deg) translateZ(var(--dice-size-half)); }
.dice-face-5 { transform: rotateY( 90deg) translateZ(var(--dice-size-half)); }
.dice-face-6 { transform: rotateY(180deg) translateZ(var(--dice-size-half)); }
.dice-face-2 { transform: rotateY(-90deg) translateZ(var(--dice-size-half)); }
.dice-face-4 { transform: rotateX( 90deg) translateZ(var(--dice-size-half)); }
.dice-face-3 { transform: rotateX(-90deg) translateZ(var(--dice-size-half)); }

.allow-hover,
.allow-hover-firefox {
  transition: box-shadow 500ms;
  box-shadow: 0 0 10px var(--basic-gray);
}

.allow-hover:hover,
.allow-hover-firefox:hover {
  box-shadow: none;
}

.allow-hover:hover {
  transform-style: preserve-3d;
  animation-name: wiggle-dice;
  animation-duration: 3s;
  animation-delay: 1s;
  animation-iteration-count: infinite;
}

@keyframes wiggle-dice {
  0% {
    transform: rotateX(0deg) rotateY(0deg)
  }

  25% {
    transform: rotateX(-8deg) rotateY(-8deg) scale(1.05)
  }
  
  75% {
    transform: rotateX(8deg) rotateY(8deg) scale(0.95)
  }

  100% {
    transform: rotateX(0deg) rotateY(0deg) 
  }
}

.dice-face-1, .dice-face-2, .dice-face-3, .dice-face-4, .dice-face-5, .dice-face-6 {
  display: flex;
}

.dice-face-1 {
  justify-content: center;
  align-items: center;
}

.dice-face-2, .dice-face-3, .dice-face-5, .dice-face-4, .dice-face-6 {
  justify-content: space-between;
}

.dice-face-4 .column,
.dice-face-5 .column,
.dice-face-6 .column {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dice-face-2 .dice-pip:nth-of-type(2) {
  align-self: flex-end;
}

.dice-face-3 .dice-pip:nth-of-type(2) {
  align-self: center;
}

.dice-face-3 .dice-pip:nth-of-type(3) {
  align-self: flex-end;
}

.dice-face-5 .column:nth-of-type(2) {
  justify-content: center;
}
