cr-player {
  width: 100%;
  height: 100%;
  min-height: 100px;
}

#Controls {
  font-family: monospace;
}

#Version {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 10;
  display: block;
  color: #fff;
  font-weight: bold;
  background-color: transparent;
  font-size: 18px;
  padding: 4px;
}

/* aj: resolve these later */
/*
	Small screen
*/
@media only screen and (max-width: 767px) {
  div {
    background-color: transparent;
    font-family: arial;
    margin: 0px;
  }

  body {
    background: #333;
    font-family: arial;
    margin: 0px;

    display: flex;
    flex-direction: column;
  }

  #PlayerContainer {
    width: 100%;
    height: 100%;
    background: #00f;
    min-height: 30vh;
    position: relative;
  }

  timeline-plotter {
    height: 100%;
    min-height: 30vh;
  }

  cr-player {
    min-height: 50vh;
  }

 

  #StateLabels {
    left: 0;
    bottom: 0;
    display: flex;
  }

  #StateLabels>* {
    font-weight: normal;
    border: 0;
    padding: 0.5em;
    margin: 0;
    visibility: hidden;
    display: none;
  }

  #StateLabels>*[state=true] {
    display: inline-block;
    visibility: visible;
  }

  #DurationLabel {
    background-color: transparent;
  }

  #DurationLabel>* {
    margin: 12px;
  }

  #Controls {
    min-height: 1.5em;
    color: #eee;
    background-color: #333;
    padding: 0.5em;
    display: flex;
    flex-direction: column;
  }

  #Controls_buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 10px 2px;
  }

  #Controls_buttons>* {
    padding: 4px;
  }

  #StateTree,
  #Streams,
  #DecoderParamsContainer {
    background: #fff;
  }

  #DecoderParams {
    overflow: auto;
  }

  #TimelineContainer {
    width: 100%;
    min-height: 100px;
    background: #000;
    display: block;
    position: relative;
    overflow: auto;
  }


  #TimelineContainer input {
    position: absolute;
    bottom: 20px;
    right: 4px;
    height: 40px;
    background-color: #fff;
    opacity: 0.7
  }

  #TimeScrubberOutput {
    text-align: right;
    min-width: 3.5em;
  }

  #TimeScrubber[disabled] {
    opacity: 0.9;
    background: repeating-conic-gradient(#808080 0% 25%, transparent 0% 50%) 50% / 10px 10px;
  }

  #TimeScrubber {
    --StreamMaxTime: 100;
    --StreamMinTime: 0;
    --DecodeMinTime: 25;
    --DecodeMaxTime: 50;
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    /* we can't pass variables to psudeo elements, so draw a background to indicate the decode-timespan */
    --LeftOffset: calc(var(--DecodeMinTime) / var(--StreamMaxTime) * 100%);
    --RightOffset: calc(var(--DecodeMaxTime) / var(--StreamMaxTime) * 100%);
    --Width: calc((var(--DecodeMaxTime) - var(--DecodeMinTime)) / var(--StreamMaxTime) * 100%);
    background: grey;
    background-image: linear-gradient(to right,
        blue 0% var(--LeftOffset),
        lime var(--LeftOffset) var(--RightOffset),
        blue var(--RightOffset) 100%);
  }

  #TimeScrubber::-webkit-slider-runnable-track {
    height: 20px;
  }

  #TimeScrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid yellow;
    height: 20px;

    width: 4px;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
    box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
  }

  #Error,
  #Info {
    background-color: rgb(253, 162, 162);
    font-weight: bold;
    line-height: 1.4em;
    padding: 10px;
  }

  #Info {
    background-color: rgb(162, 186, 253);
  }

  #Info:empty, #Error:empty {
    padding: 0;
  }
}


/*
	Large screen
*/
@media only screen and (min-width: 767px) {
  body {
    background: #333;
    font-family: arial;

    display: grid;
    grid-template-areas: "Info Info"
      "Error Error"
      "Version Version"
      "StreamList Player"
      "DecoderParams Player"
      "DecoderParams Controls"
      "DecoderParams Timeline";
    grid-template-columns: 14em 1fr;
    grid-template-rows: 0fr 0fr 0fr 0.5fr 0.5fr 0fr minmax(100px, 40vmin);

    /* stretch grid to fill */
    height: 100vh;
    margin: 0px;
    overflow: hidden;
  }

  #Controls {
    grid-area: Controls;
    min-height: 1.5em;
    background: #000;
    color: #eee;
    padding: 0.5em;
    display: flex;
  }

  #Streams {
    grid-area: StreamList;
    overflow: auto;
  }

  #DecoderParamsContainer {
    grid-area: DecoderParams;
    background: #fff;
  }

  #DecoderParams {
    overflow: auto;
  }

  #StateTree,
  #Streams,
  #DecoderParamsContainer {
    position: relative;
  }

  #StateTree:after,
  #Streams:after,
  #DecoderParamsContainer:after {
    position: absolute;
    top: 0.1em;
    right: 0.1em;
    content: "Params";
    z-index: 1;
    width: 20em;
    height: 1em;
    font-size: 200%;
    text-align: right;
    pointer-events: none;
    opacity: 30%;
  }

  #Streams:after {
    content: "Streams";
  }

  #StateTree:after {
    content: "State";
  }

  #PlayerContainer {
    grid-area: Player;
    width: 100%;
    height: 100%;
    background: #00f;
    min-height: 100px;
    position: relative;
  }


  #Error,
  #Info,
  {
    position: absolute;
    top: 0em;
    right: 0em;
    min-width: 15em;
    z-index: 10;

    display: block;
    grid-area: Error;
    background: #d33;
    color: #eee;
    border: 1px solid #fff;
    padding: 0.4em;
    margin: 0.4em;
    font-size: 80%;
  }
 
  /* gr: make all these into one div that sit after each other */
  #Info {
    top: 4em;
  }

  #Version {
    top: 0em;
  }

  #Error {
    top: 6em;
  }

  #Error a,
  #Info a,
  {
    color: #eee;
  }

  #Info {
    background: #3d3;
  }

  #Error:empty,
  #Info:empty,
  #Version:empty
  {
    display: none;
  }

  #StateLabels>* {
    color: #fff;
    font-size: 8pt;
    font-weight: bold;
    border: 1px solid #fff;
    padding: 0.5em;
    margin: 1em;
    visibility: hidden;
  }

  #TimelineContainer {
    grid-area: Timeline;
    width: 100%;
    min-height: 100px;
    background: #000;
    display: block;
    position: relative;
    overflow: auto;
    /* on mobile-ish screens this was forcing everything else to shrink */
  }

  timeline-plotter {
    height: 100%;
  }

  #TimelineContainer input {
    position: absolute;
    bottom: 1em;
    right: 6em;
  }


  #StateTree {
    grid-area: StateTree;
  }

  #StateTree,
  #DecoderParamsContainer {
    background: #fff;
    border: 1px solid #000;
    padding: 0.05em;
    font-family: Arial;
    overflow: auto;
    font-size: 50%;
    font-weight: 100;
  }


  #Controls {
    font-family: monospace;
  }

  #TimeScrubberOutput {
    text-align: right;
    min-width: 3.5em;
    /* 123.456 */
  }

  /* false = current time data */
  #TimeScrubber[disabled] {
    opacity: 0.9;
    background: repeating-conic-gradient(#808080 0% 25%, transparent 0% 50%) 50% / 10px 10px;
  }

  #TimeScrubber {
    --StreamMaxTime: 100;
    --StreamMinTime: 0;
    --DecodeMinTime: 25;
    --DecodeMaxTime: 50;

    -webkit-appearance: none;
    appearance: none;

    flex: 1;

    /* we can't pass variables to psudeo elements, so draw a background to indicate the decode-timespan */
    --LeftOffset: calc(var(--DecodeMinTime) / var(--StreamMaxTime) * 100%);
    --RightOffset: calc(var(--DecodeMaxTime) / var(--StreamMaxTime) * 100%);
    --Width: calc((var(--DecodeMaxTime) - var(--DecodeMinTime)) / var(--StreamMaxTime) * 100%);
    background: grey;
    background-image: linear-gradient(to right,
        blue 0% var(--LeftOffset),
        lime var(--LeftOffset) var(--RightOffset),
        blue var(--RightOffset) 100%);


  }

  #TimeScrubber::-webkit-slider-runnable-track {
    height: 10px;
  }

  #TimeScrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid yellow;
    height: 20px;
    /*100%;*/

    width: 2px;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    margin-top: -14px;
    /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
    box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
    /* Add cool effects to your sliders! */
  }
}
