@font-face
{
  font-family: 'segmented7';
  src: url("fonts/segmented7.woff2") format('woff2');
}

@font-face
{
  font-family: 'roboto';
  src:  url("fonts/roboto.woff2") format('woff2');
}

@font-face
{
  font-family: 'roboto-bold';
  src:  url("fonts/roboto-bold.woff2") format('woff2');
}

@font-face
{
  font-family: 'roboto-mono';
  src:  url("fonts/roboto-mono.woff2") format('woff2');
}

:root {
  touch-action: none;
  height: 100%;
  --labelColor: #0268ff;
  /* any */
  /*-- light theme */
  --labelColorDark: #67a4ff;
  /* any */
  /*-- dark theme */
  color-scheme: light dark;
  color-scheme: normal dark;
  --font-default: roboto, roboto-bold, roboto-mono, segmented7, Arial, Helvetica, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-family: var(--font-default);
}

body
{
  --size: attr(data-size);
}

.size2
{
  font-size: 1.2em;
  vertical-align: top !important;
  margin-right: 0.2em;
}
/* image preload */
:root::before {
/*  content:  url(images/flag_red_000.svg)
            url(images/flag_lightgreen_000.svg)
            url(images/flag_lightblue_000.svg)
            url(images/mine_000000_transparent_transparent_transparent.svg)
            url(images/mine_000000_transparent_fff_transparent.svg);
*/
  position: fixed;
  top: -10000vh;
}

@media (prefers-color-scheme: dark) {
  :root:not([theme="light"]) {
    --labelColor: var(--labelColorDark);
  }
}

:root[theme="dark"] {
  color-scheme: dark;
  --labelColor: var(--labelColorDark);
}

:root[theme="light"] {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  fieldset {
    background-color: darkslategray;
  }
}

html {
  -webkit-user-select: none;
  user-select: none;
  font-size: 1em;
  line-height: 1.0em;
  background-color: #EEEEEE;
}

nav.control {
  display: flex;
  gap: 0.5em;
  flex-flow: wrap;
  padding: 0.4em 0.5em 0 0.4em;
  text-align: center;
  flex-direction: column-reverse;
}

.menu.popup input[type="number"] {
  width: 3.5em;
}

.menu.popup :first-child {
  flex-grow: 0;
  gap: 0.5em;
  vertical-align: middle;
}

.menu.popup label > :last-child {
  vertical-align: middle;
}

.hidden
{
  position: fixed;
  top: -10000vh;
}

body {
  margin: 0;
  padding: 0;
  /* overflow: hidden; */
  height: 100vh;/* font-family: 'roboto'; */
  /* opacity: 0; */
}


main {
  max-width: 100%;
  max-height: calc(100vh - 3.5em);
  /* display: flex; */
  flex-direction: column;
  padding: 0.5em;
  box-sizing: border-box;
  /* text-align: center; */
}


.menu {
  box-shadow: 0 0 8px 0px #7f7f7f7f;
  padding: 0;
  margin: 0;
  min-width: 8em;
  background-color: -moz-Dialog;
  background-color: Menu;
  color: -moz-DialogText;
  color: MenuText;
  z-index: 10;
  position: absolute;
  top: 10px;
  right: 10px;
  transition: top 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  /* display: table; */
  border-radius: 5px;
  /* overflow: auto; */
  /* max-height: 100vh; */
  /* table-layout: fixed; */
}

.menu-content
{
  overflow: auto;
  max-height: 80vh;
}
.default
{
  font-weight: bold;
  font-size: 1.2em;
}

:root[theme="dark"] .menu {
  box-shadow: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([theme]) .menu {
    box-shadow: none;
  }
}

.menu-content > * {
  padding: 0.5em 1.5em 0.5em 1.5em;
  display: block;
}

.menu > [data-type]:not([data-type="dropdown"]) {
  cursor: pointer;
}

/* .close-overlay
{
  background-color: blue;;
}
.close-overlay ~ * .close-overlay
{
  background-color: red;
} */
.menu > label .options {
  pointer-events: none;
}

.menu > .value:hover {
  background-color: rgba(127, 127, 127, 0.5);
}

.close-overlay {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  position: fixed;
  display: none;
  z-index: 2;
  /* background-color: transparent; */
  /* background-color: blue; */
  background-color: #202020B0;
}


.close-overlay ~ * .close-overlay {
  z-index: 10;
}

input#main-menu {
  display: none;
}

input#main-menu:checked ~ * .main-menu .close-overlay {
  display: block;
}

input#main-menu:not(:checked) ~ * .main-menu div.menu {
  /* display: none; */
  top: -170%;
  transition: top 0.3s cubic-bezier(0.6, -0.28, 0.74, 0.05);
}

.menu-icon {
  position: absolute;
  top: 0;
  right: 0;
  width: 1.5em;
  height: 1.5em;
  cursor: pointer;
  display: flex;
  padding: 0.5em;
  transition: top 0.1s ease, right 0.1s ease;
  opacity: 0.5;
  z-index: 10;
}

.menu-icon:hover {
  opacity: 1;
}

.navicon {
  background-color: var(--textColor);
  display: block;
  height: 0.1em;
  width: 100%;
  position: relative;
  margin: auto;
  top: 0;
  right: 0;
  transition: background-color 0.3s;
}

.navicon:before {
  top: 0.5em;
}

.navicon:after {
  top: -0.5em;
}

#main-menu:checked ~ * .main-menu .menu-icon {
  top: 0.4em;
  right: 0.4em;
}

#main-menu:checked ~ * .main-menu * .navicon {
  background-color: transparent;
  width: 70%;
  transition: top 0.1s ease, right 0.1s ease;
}

#main-menu:checked ~ * .main-menu * .navicon:before {
  background-color: MenuText;
  transform: rotate(-135deg);
  top: 0;
  right: 0;
}

#main-menu:checked ~ * .main-menu * .navicon:after {
  background-color: MenuText;
  transform: rotate(135deg);
  top: 0;
  right: 0;
}

.navicon:before,
.navicon:after {
  background-color: var(--textColor);
  display: block;
  width: 100%;
  height: 100%;
  content: "";
  position: absolute;
  transition: top 0.1s ease, right 0.1s ease, transform 0.3s ease;
}

#main-menu:checked ~ * .main-menu * .navicon:before,
#main-menu:checked ~ * .main-menu * .navicon:after {
  transition: top 0.1s ease-out, right 0.1s ease, transform 0.3s ease-out;
}

#main-menu:checked ~ *:not(header)
{
  filter: blur(2px);
}
.menu > header {
  min-height: 2em;
  border-bottom: 1px solid #7f7f7f7f;
  text-align: center;
  /* margin-right: 1em; */
  line-height: 2em;
  color: GrayText;
}



#board
{
  display: flex;
}

#board > *
{
  min-width: 2.3em;
  height: calc(2.2em * var(--size) + 0.1em);
  outline: 1px solid black;
  background-color: white;
  display: flex;
  flex-direction: column-reverse;
}

.players
{
  min-height: 2.5em;
  display: flex;
  align-items: center;
}

body[data-player="0"] .players > :nth-child(1),
body[data-player="1"] .players > :nth-child(2),
body[data-player="2"] .players > :nth-child(3),
body[data-player="3"] .players > :nth-child(4),
.players > *,
#board > * > *
{
  width: 2em;
  height: 2em;
  border-radius: 100%;
  display: inline-block;
  margin: 0.1em;
  font-size: 1em;
  line-height: 1em;
}
#board > * > *,
body[data-player="0"] .players > :nth-child(1)::after,
body[data-player="1"] .players > :nth-child(2)::after,
body[data-player="2"] .players > :nth-child(3)::after,
body[data-player="3"] .players > :nth-child(4)::after
{
  font-size: 1em;
  line-height: 2em;
}
.players > *
{
  width: 1em;
  height: 1em;
  font-size: 1em;
  display: none;
  transition: all 0.5s;
}
.players > *::after
{
  line-height: 1em;
  font-size: 0.5em;
}

.players > :nth-child(1)::after,
.players > :nth-child(2)::after,
.players > :nth-child(3)::after,
.players > :nth-child(4)::after,
.player0::after,
.player1::after,
.player2::after,
.player3::after
{
  width: 100%;
  display: inline-block;
  text-align: center;
  vertical-align: middle;
}
.players > :nth-child(1)::after,
.player0::after
{
  content: "1";
  color: white;
}
.players > :nth-child(1),
.player0
{
  background-color: black;
}
.players > :nth-child(2)::after,
.player1::after
{
  content: "2";
}
.players > :nth-child(2),
.player1
{
  background-color: red;
}

.players > :nth-child(3)::after,
.player2::after
{
  content: "3";
}
.players > :nth-child(3),
.player2
{
  background-color: #227fe9;
}

.players > :nth-child(4)::after,
.player3::after
{
  content: "4";
}
.players > :nth-child(4),
.player3
{
  background-color: #29c01b;
}

body[data-players="1"] .players > :nth-child(-n+1),
body[data-players="2"] .players > :nth-child(-n+2),
body[data-players="3"] .players > :nth-child(-n+3),
body[data-players="4"] .players > :nth-child(-n+4)
{
  display: block;
}
body.playerBot0 .player0,
body.playerBot1 .player1,
body.playerBot2 .player2,
body.playerBot3 .player3,
body.playerBot0 .players > :nth-child(1),
body.playerBot1 .players > :nth-child(2),
body.playerBot2 .players > :nth-child(3),
body.playerBot3 .players > :nth-child(4)
{
  border-radius: 33% !important;
}


body:not(.finished):not(.bot) #board > *:hover
{
  background-color: #eeeeee;
}
.win
{
  animation: win 2s infinite ease-in-out;
}

.match
{
  outline: 3px solid green;
}
@keyframes win
{
  0%
  {
    opacity: 1;
  }
  30%
  {
    opacity: 0.2;
  }
  60%
  {
    opacity: 1;
  }
}