body {
  background: black url(bg.jpg) fixed 50% 50%;
  background-size: cover;
  color: white;
  font-family: sans-serif;
  font-size: 16px;
  height: 100%;
  margin: 0;
  padding: 0;
}

form {
  margin-block-end: 1em;
}

table {
  background: transparent;
}
table th, table td {
  border: none;
  margin: 2px 0;
  padding: 4px 0;
}

/* Modal dialogs. */
#modal-shade {
  background: rgba(0, 0, 0, 0.5);
  height: 100%;
  left: 0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 98;
}
body:not(.modal) #modal-shade {
  display: none;
}
body:not(.modal) #modal {
  display: none;
}
#modal {
  z-index: 99;
}
body.modal {
  height: 100%;
  overflow: hidden;
}

#modal {
  align-items: center;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  left: 0;
  position: fixed;
  top: 0;
  width: 100%;
}

#modal button {
  margin: 1ex;
  width: 15em;
}

/* Messages. */
#messages {
  bottom: 0;
  margin: 1ex;
  opacity: 0.8;
  position: fixed;
  right: 0;
  width: 500px;
  z-index: 5;
}
#messages .alert {
  animation: 7s ease-out;
  animation-name: message;
}
@keyframes message {
    0% { opacity: 1.0; }
   90% { opacity: 1.0; }
  100% { opacity: 0.0; }
}

/********************************* Sections ***********************************/

body:not(#connecting) section#connecting,
body:not(#error) section#error,
body:not(#entry) section#entry,
body:not(#lobby) section#lobby,
body:not(#game) section#game
{
  display: none;
}

/********************************** Loading ***********************************/

section#connecting {
  margin: auto;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translateX(-50%) translateY(-50%);
}

/*********************************** Error ************************************/

section#error {
  margin: 20%;
}

/*********************************** Entry ************************************/

section#entry {
  margin: 10vh auto auto auto;
  width: 519px;
}

section#entry button {
  width: 100%;
}

section#entry cite {
  display: block;
  font-size: 0.9em;
  margin-top: 1.5rem;
}

/*********************************** Lobby ************************************/

section#lobby {
  margin: auto;
  max-width: 1000px;
  min-width: 500px;
  padding: 0 20px;
  text-align: center;
}

section#lobby ul.players {
  list-style: none;
  padding: 0;
}

section#lobby ul.players li {
  display: inline-block;
}

section#lobby .alert {
  margin: auto;
  width: 600px;
}

section#lobby form .alert {
  margin-bottom: 1em;
}

section#lobby > .alert {
  margin: 1em auto;
}

section#lobby .alert a {
  font-weight: normal;
  text-decoration: underline;
}

/************************************ Game ************************************/

/* Buttons. */
section#game card > button,
section#game card > .buttons
{
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translateX(-50%) translateY(-50%);
}
section#game card > button {
  font-size: 20px;
  height: auto;
  padding: 8px 20px;
}

section#game button {
  display: none;
  z-index: 10;
}
section#game.my-turn player.me card:hover button[data=play],
section#game.over button[data=another-game]
{
  display: block;
}

section#game button[data=another-game] {
  margin: 10px auto;
}

/* Players. */
section#game #players {
  text-align: center;
}

section#game #players player {
  border-radius: 6px;
  box-shadow: 5px 5px 40px #222;
  display: inline-block;
  margin: 10px;
  text-align: left;
  width: 840px;
}
section#game #players player.active {
  box-shadow: 0 0 17px orange inset;
}

section#game #players player p {
  font-size: 16px;
  font-weight: bold;
  margin: 6px 6px 0 12px;
}

section#game #players player .point {
  display: inline-block;
  height: 23px;
  margin-left: 8px;
  width: 43px;
}

section#game player .hand,
section#game player .played
{
  display: inline-block;
}


/* Cards. */
section#game player card {
  box-shadow: 0 0 7px black;
  position: relative;
  z-index: 1;
}
section#game player card:hover {
  z-index: 2;
}

section#game player card:not(:hover) .peek,
section#game player card[face-up] .peek
{
  display: none;
}
section#game player card .peek {
  left: 0;
  margin: 0;
  position: absolute;
  top: 0;
}

/* Cards' layout. */
section#game player .hand, section#game player .played {
  vertical-align: top;
}
section#game player .hand {
  margin: 20px;
  position: relative;
  width: 425px;
}
section#game player .hand > card {
  transform: rotate(3deg);
}
section#game player .hand > card + card {
  left: 120px;
  position: absolute;
}
section#game player.out .hand {
  display: none;
}


section#game player .played {
  height: 339px;
  margin: 10px 80px 80px 10px;
  position: relative;
  width: 240px;
}
section#game player .played card {
  left: 0;
  position: absolute;
  top: 0;
  transform-origin: 70px 339px;
}

section#game player.out .played card {
  transform-origin: bottom left;
}

/* Draw pile. */
section#game #draw-pile {
  bottom: -70px;
  left: -50px;
  position: fixed;
  z-index: 5;
}
section#game #draw-pile:before {
  content: 'Draw Pile';
  display: block;
  left: 73px;
  position: absolute;
  text-align: center;
  top: -295px;
  width: 100px;
}

section#game #draw-pile card {
  bottom: 0;
  box-shadow: 0 0 7px black;
  left: 30px;
  position: absolute;
  transform: scale(0.5);
}
section#game #draw-pile card:nth-child(1) { left: 0; }
section#game #draw-pile card:nth-child(2) { left: 10px; }
section#game #draw-pile card:nth-child(3) { left: 20px; }

