div {
  &.field, &.actions {
    margin-bottom: 10px;
  }
}

:root {
  --label-width: 8em;
  --input-max-width: 40em;
}

form {
  flex-flow: column;
  padding: 0 5vw;
  display: flex;

  & .field {
    justify-content: center;
    align-items: center;
    display: flex;

    & label {
      width: var(--label-width);
      text-align: right;
      flex: none;
      padding: 0 1em;
      font-weight: bolder;
    }

    & input {
      height: 1.5em;
    }

    & input, & textarea {
      max-width: var(--input-max-width);
      flex: 4 auto;
    }

    &.search {
      & button {
        width: auto;
      }
    }
  }

  & .actions {
    max-width: calc(var(--label-width)  + var(--input-max-width));
    justify-content: flex-end;
    display: flex;
  }

  & button {
    align-self: center;
    width: 30%;
  }
}

table {
  border-collapse: collapse;
}

table, thead, tbody, th, td, tr {
  display: block;
}

th .icon {
  width: 1.2em;
  height: .6em;
  margin: 0 .5em;
}

tr:nth-child(2n) {
  background-color: var(--table-even-row-color);
}

th, td {
  text-align: center;
  padding: 0 1rem 0 0;
}

thead, tr {
  border-bottom: 2px solid #000;
  grid-template-rows: auto auto;
  display: grid;
}

thead {
  background-color: var(--body-background-color);
  position: sticky;
  top: 0;
}

th {
  background-color: var(--body-background-color);
}

td.thumbnail {
  & img {
    height: 4em;
  }
}

@media only screen and (width <= 760px), (device-width >= 768px) and (device-width <= 1024px) {
  thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
}

.events {
  & thead, & tr {
    grid-template-columns: repeat(5, 1fr);
  }
}

.game_create {
  & table {
    margin-bottom: 1em;
  }

  & thead {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  & td {
    padding: .4vmax;
  }

  & td.image {
    grid-area: 1 / 1 / 2 / 2;
  }

  & td.name {
    grid-area: 2 / 1 / 3 / 2;
    font-weight: bolder;
  }

  & td.description {
    text-align: justify;
    grid-area: 1 / 2 / 3 / 3;
  }

  & td.pick {
    grid-area: 3 / 1 / 4 / 4;
  }
}

.games {
  & th.pitch {
    visibility: hidden;
    display: none;
  }

  & td.pitch {
    text-align: left;

    & p {
      text-align: left;
    }

    &.present {
      border-bottom: 1px dotted gray;
    }

    &.absent {
      height: 0;
      margin: 0;
      padding: 0;
    }
  }

  @media only screen and (width >= 760px) {
    & thead, & tr {
      grid-template-columns: 2fr 4fr repeat(4, 1fr) 2fr 3fr 4fr 4fr;
    }

    & thead {
      place-items: stretch stretch;
    }

    & td.pitch {
      grid-area: 1 / 1 / 1 / 11;
      justify-content: center;
      padding: 1em 3em;
    }

    & .thumbnail {
      grid-column: 1;
    }

    & .game {
      grid-column: 2;
    }

    & .minplayers {
      grid-column: 3;
    }

    & .maxplayers {
      grid-column: 4;
    }

    & .duration {
      grid-column: 5;
    }

    & .interested {
      grid-column: 6;
    }

    & .teachers {
      grid-column: 7;
    }

    & .me {
      grid-column: 8;
      justify-self: center;
    }

    & .tools {
      grid-column: 9;

      & div {
        flex-direction: row;
        justify-content: center;
      }
    }

    & .notes {
      grid-column: 10;
    }

    & td.whoelse:not(.empty) {
      text-align: right;
      background-color: #fff;
      border: 2px solid #000;
      border-radius: .5em;
      padding: 1.2em;
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);

      & ul {
        text-align: left;
        padding-inline-start: 2em;
      }

      & h3 {
        margin: .2em;
      }
    }
  }

  @media only screen and (width <= 760px), (device-width >= 768px) and (device-width <= 1024px) {
    & thead {
      position: absolute;
      top: -9999px;
      left: -9999px;
    }

    & tr {
      grid-template-rows: auto;
      grid-template-columns: 3fr 2fr;
      place-items: stretch stretch;
      margin: 0 0 1rem;
    }

    & td {
      margin-bottom: 2px;
    }

    & td.pitch {
      text-align: justify;
      grid-area: 1 / 1 / 1 / 3;
      max-height: 5em;
      overflow: auto;

      &.present {
        padding: 1em;
      }
    }

    & td.thumbnail, & td.game {
      grid-column: 1;
    }

    & td.thumbnail {
      grid-row: 2 / span 3;
    }

    & td.game {
      grid-row: 5;
    }

    & td.minplayers, & td.maxplayers, & td.length, & td.interest-level, & td.teachers {
      grid-column: 2;
    }

    & td.minplayers {
      grid-row: 2;

      &:before {
        content: "Min:";
      }
    }

    & td.maxplayers {
      grid-row: 3;

      &:before {
        content: "Max: ";
      }
    }

    & td.duration {
      grid-row: 4;

      &:after {
        content: " minutes";
      }
    }

    & td.interest-level {
      grid-row: 5;

      &:before {
        content: "Interested: ";
      }
    }

    & td.teachers {
      grid-row: 6;

      &:before {
        content: "Know rules: ";
      }
    }

    & td.me {
      grid-area: 7 / 1 / 8 / 3;
      justify-self: center;
    }

    & td.tools {
      grid-area: 8 / 1 / 9 / 3;

      & div {
        flex-direction: row;
        justify-content: center;
      }
    }

    & td.notes {
      grid-area: 10 / 1 / 10 / 3;
    }
  }
}

.whatshouldweplay {
  & thead, & tr {
    grid-template-columns: repeat(8, 1fr);
    place-items: center;
  }

  & td.image {
    min-height: 4em;

    & img {
      height: 4em;
    }
  }

  & td.whoelse-list {
    text-align: right;
    background-color: #fff;
    border: 2px solid #000;
    border-radius: .5em;
    padding: 1.2em;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    & ul {
      text-align: left;
      padding-inline-start: 2em;
    }

    & h3 {
      margin: .2em;
    }
  }

  & td.empty.whoelse {
    display: none;
    position: absolute;
  }

  @media only screen and (width <= 760px), (device-width >= 768px) and (device-width <= 1024px) {
    & thead {
      position: absolute;
      top: -9999px;
      left: -9999px;
    }

    & tr {
      grid-template-rows: auto;
      grid-template-columns: 3fr 2fr;
      place-items: stretch stretch;
      margin: 0 0 1rem;
    }

    & td.image, & td.name {
      grid-column: 1;
    }

    & td.image {
      grid-row: 1 / span 2;
    }

    & td.name {
      grid-row: 3;
    }

    & td.players, & td.length, & td.interested, & td.teachers, & td.added {
      grid-column: 2;
    }

    & td.players {
      grid-row: 1;

      &:after {
        content: " Players";
      }
    }

    & td.length {
      grid-row: 2;

      &:after {
        content: " Minutes";
      }
    }

    & td.interested {
      grid-row: 3;

      &:before {
        content: "Interested: ";
      }
    }

    & td.teachers {
      grid-row: 4;

      &:before {
        content: "Know rules: ";
      }
    }

    & td.whoelse-button {
      grid-area: 5 / 1 / auto / span 3;
    }
  }
}

.toast-tray {
  flex-flow: column;
  align-items: flex-end;
  padding: .1em;
  display: flex;
  position: fixed;
  bottom: 0;
  right: 0;
}

.toast-tray .toast {
  background-color: #fff;
  border: 2px solid #000;
  border-radius: .3em;
  flex-flow: row;
  align-items: center;
  margin: .1em;
  padding: .2em;
  line-height: 14px;
  display: flex;
}

.toast-tray .toast p {
  margin: .5em;
}

.toast-tray .toast button {
  box-shadow: none;
  margin: 0 .1em;
}

.toast-tray button svg {
  margin: 0;
  padding: 0;
}

:root {
  --main-link-color: black;
  --visited-link-color: #666;
  --main-text-color: #333;
  --button-text-color: white;
  --button-background-color: #009fc7;
  --table-even-row-color: #e7e7e7;
  --body-background-color: white;
  --body-margin: 32px;
}

* {
  box-sizing: border-box;
}

a {
  color: var(--main-link-color);
  text-decoration: underline;
}

a:visited {
  color: var(--visited-link-color);
}

body {
  background-color: var(--body-background-color);
  color: var(--main-text-color);
  margin: var(--body-margin);
  font-family: verdana, arial, helvetica, sans-serif;
  font-size: 16px;
  line-height: 18px;
}

nav {
  grid-template-columns: 70px auto;
  display: grid;
}

.footer {
  text-align: center;
  margin: auto 2em 2em;
}

.page {
  max-width: 1480px;
  min-height: calc(100vh - 2 * var(--body-margin));
  flex-flow: column;
  margin: 0 auto;
  display: flex;
}

.menu {
  text-align: right;
  margin: 0;
  list-style: none;
  overflow: hidden;
}

ul.menu {
  box-sizing: border-box;
  font-family: verdana, arial, helvetica, sans-serif;
  font-size: 13px;
  line-height: 18px;
}

.menu li {
  padding: 1rem;
  display: inline-block;
}

.menu button {
  background: var(--button-background-color);
  color: var(--button-text-color);
  cursor: pointer;
  text-align: center;
  border: none;
  margin: .1vh;
  font-family: sans-serif;
  font-size: 1rem;
  text-decoration: none;
  transition: background .25s ease-in-out, transform .15s;
  display: inline-block;
}

a.button, button {
  background-color: var(--button-background-color);
  color: var(--button-text-color);
  text-wrap-mode: nowrap;
  border-width: 0;
  border-radius: .5vw;
  flex-wrap: nowrap;
  justify-content: space-around;
  align-items: center;
  min-width: 2em;
  height: 2em;
  margin: .1vh .1vh .4vh;
  padding: .5rem;
  padding-block: 1px;
  padding-inline: 6px;
  font-size: 1rem;
  text-decoration: none;
  display: inline-flex;
  box-shadow: 0 .4vh .1vw #ccc;
}

a.button:active, button:active {
  box-shadow: none;
  position: relative;
  top: .4vh;
  left: .1vw;
}

a.button svg, button svg {
  height: 70%;
  fill: var(--button-text-color);
  margin: auto;
  padding: 0 1em;
}

a.button span, button span {
  vertical-align: middle;
  height: fit-content;
  margin: auto;
  padding: 0 1em;
  display: inline-block;
}

.account {
  justify-content: center;
  display: flex;
}

h1 {
  text-align: center;
}

.need-reg {
  text-align: right;
}
