/* Global Styles & Colors */
:root {
  --green: #6aaa64;
  --darkendGreen: #538d4e;
  --yellow: #c9b458;
  --darkendYellow: #b59f3b;
  --lightGray: #d8d8d8;
  --gray: #86888a;
  --darkGray: #939598;
  --white: #fff;
  --black: #212121;
  /* Colorblind colors */
  --orange: #f5793a;
  --blue: #85c0f9;
  font-family: 'Clear Sans', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  --header-height: 50px;
  --keyboard-height: 200px;
  --game-max-width: 500px;
}

/* Light theme colors */
:root {
  --color-tone-1: #1a1a1b;
  --color-tone-2: #787c7e;
  --color-tone-3: #878a8c;
  --color-tone-4: #d3d6da;
  --color-tone-5: #edeff1;
  --color-tone-6: #f6f7f8;
  --color-tone-7: #ffffff;
  --opacity-50: rgba(255, 255, 255, 0.5);
}

/* Dark Theme Colors */
.nightmode {
  --color-tone-1: #d7dadc;
  --color-tone-2: #818384;
  --color-tone-3: #565758;
  --color-tone-4: #3a3a3c;
  --color-tone-5: #272729;
  --color-tone-6: #1a1a1b;
  --color-tone-7: #121213;
  --opacity-50: rgba(0, 0, 0, 0.5);
}

/* Constant colors and colors derived from theme */
:root,
.nightmode {
  --color-background: var(--color-tone-7);
}

:root {
  --color-present: var(--yellow);
  --color-correct: var(--green);
  --color-absent: var(--color-tone-2);
  --tile-text-color: var(--color-tone-7);
  --key-text-color: var(--color-tone-1);
  --key-evaluated-text-color: var(--color-tone-7);
  --key-bg: var(--color-tone-4);
  --key-bg-present: var(--color-present);
  --key-bg-correct: var(--color-correct);
  --key-bg-absent: var(--color-absent);
  --modal-content-bg: var(--color-tone-7);
}

.nightmode {
  --color-present: var(--darkendYellow);
  --color-correct: var(--darkendGreen);
  --color-absent: var(--color-tone-4);
  --tile-text-color: var(--color-tone-1);
  --key-text-color: var(--color-tone-1);
  --key-evaluated-text-color: var(--color-tone-1);
  --key-bg: var(--color-tone-2);
  --key-bg-present: var(--color-present);
  --key-bg-correct: var(--color-correct);
  --key-bg-absent: var(--color-absent);
  --modal-content-bg: var(--color-tone-7);
}

.colorblind {
  --color-correct: var(--orange);
  --color-present: var(--blue);
  --tile-text-color: var(--white);
  --key-bg-present: var(--color-present);
  --key-bg-correct: var(--color-correct);
  --key-bg-absent: var(--color-absent);
}

html {
  height: 100%;
}

body {
  height: 100%;
  background-color: var(--color-background);
  margin: 0;
  padding: 0;
  /* Prevent scrollbar appearing on page transition */
  overflow-y: hidden;
}

.setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-tone-4);
  padding: 16px 0;
}

a,
a:visited {
  color: var(--color-tone-2);
}

.title {
  font-size: 18px;
}

.text {
  padding-right: 8px;
}

.description {
  font-size: 12px;
  color: var(--color-tone-2);
}

div.input {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
}

#footnote {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  color: var(--color-tone-2);
  font-size: 12px;
  text-align: right;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

#privacy-policy,
#copyright {
  text-align: left;
}

.tile {
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  line-height: 2rem;
  font-weight: bold;
  vertical-align: middle;
  box-sizing: border-box;
  color: var(--tile-text-color);
  text-transform: uppercase;
  user-select: none;
}

.row-select {
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  line-height: 2rem;
  font-weight: bold;
  vertical-align: middle;
  box-sizing: border-box;
  color: var(--green);
  text-transform: uppercase;
  user-select: none;
  border: 0;
}

.tile::before {
  content: '';
  display: inline-block;
  padding-bottom: 100%;
}

.tile[data-state='empty'] {
  border: 2px solid var(--color-tone-4);
}

.tile[data-state='tbd'] {
  background-color: var(--color-tone-7);
  border: 2px solid var(--color-tone-3);
  color: var(--color-tone-1);
}

.tile[data-state='correct'] {
  background-color: var(--color-correct);
}

.tile[data-state='present'] {
  background-color: var(--color-present);
}

.tile[data-state='absent'] {
  background-color: var(--color-absent);
}

.tile[data-animation='pop'] {
  animation-name: PopIn;
  animation-duration: 100ms;
}

@keyframes PopIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }

  40% {
    transform: scale(1.1);
    opacity: 1;
  }
}

.tile[data-animation='flip-in'] {
  animation-name: FlipIn;
  animation-duration: 250ms;
  animation-timing-function: ease-in;
}

@keyframes FlipIn {
  0% {
    transform: rotateX(0);
  }

  100% {
    transform: rotateX(-90deg);
  }
}

.tile[data-animation='flip-out'] {
  animation-name: FlipOut;
  animation-duration: 250ms;
  animation-timing-function: ease-in;
}

@keyframes FlipOut {
  0% {
    transform: rotateX(-90deg);
  }

  100% {
    transform: rotateX(0);
  }
}

:host {
  display: block;
}

:host([invalid]) {
  animation-name: Shake;
  animation-duration: 600ms;
}

.row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-gap: 5px;
}

.win {
  animation-name: Bounce;
  animation-duration: 1000ms;
}

@keyframes Bounce {

  0%,
  20% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-30px);
  }

  50% {
    transform: translateY(5px);
  }

  60% {
    transform: translateY(-15px);
  }

  80% {
    transform: translateY(2px);
  }

  100% {
    transform: translateY(0);
  }
}

@keyframes Shake {

  10%,
  90% {
    transform: translateX(-1px);
  }

  20%,
  80% {
    transform: translateX(2px);
  }

  30%,
  50%,
  70% {
    transform: translateX(-4px);
  }

  40%,
  60% {
    transform: translateX(4px);
  }
}

#game {
  width: 100%;
  max-width: var(--game-max-width);
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-height);
  color: var(--color-tone-1);
  border-bottom: 1px solid var(--color-tone-4);
}

header .title {
  font-weight: 700;
  font-size: 36px;
  letter-spacing: 0.2rem;
  /* text-transform: uppercase; */
  text-align: center;
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
}

@media (max-width: 360px) {
  header .title {
    font-size: 22px;
    letter-spacing: 0.1rem;
  }
}

#board-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-grow: 1;
  overflow: hidden;
}

#board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  grid-gap: 5px;
  padding: 10px;
  box-sizing: border-box;
}

button.icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
}

#debug-tools {
  position: absolute;
  bottom: 0;
}

.overlay {
  display: none;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  justify-content: center;
  align-items: center;
  background-color: var(--opacity-50);
  z-index: ".concat(3e3, ';

}

.content {
  position: relative;
  border-radius: 8px;
  border: 1px solid var(--color-tone-6);
  background-color: var(--modal-content-bg);
  color: var(--color-tone-1);
  box-shadow: 0 4px 23px 0 rgba(0, 0, 0, 0.2);
  width: 90%;
  max-height: 90%;
  overflow-y: auto;
  animation: SlideIn 200ms;
  max-width: var(--game-max-width);
  padding: 16px;
  box-sizing: border-box;
}

.content.closing {
  animation: SlideOut 200ms;
}

.close-icon {
  width: 24px;
  height: 24px;
  position: absolute;
  top: 16px;
  right: 16px;
}

game-icon {
  position: fixed;
  user-select: none;
  cursor: pointer;
}

@keyframes SlideIn {
  0% {
    transform: translateY(30px);
    opacity: 0;
  }

  100% {
    transform: translateY(0px);
    opacity: 1;
  }
}

@keyframes SlideOut {
  0% {
    transform: translateY(0px);
    opacity: 1;
  }

  90% {
    opacity: 0;
  }

  100% {
    opacity: 0;
    transform: translateY(60px);
  }
}

#gwlist-container {
  margin: 0 8px;
  user-select: none;
  justify-content: center;
  align-items: center;
}

#gwlist {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  grid-gap: 5px;
  padding: 10px;
  box-sizing: border-box;
}

span.gwlist {
  font-family: inherit;
  border: 0;
  padding: 0;
  margin: 0 6px 0 0;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  background-color: var(--key-bg);
  color: var(--key-text-color);
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.3);
}

.row {
  display: flex;
  width: 100%;
  margin: 0 auto 8px;
  /* https://stackoverflow.com/questions/46167604/ios-html-disable-double-tap-to-zoom */
  touch-action: manipulation;
}

.half {
  flex: 0.5;
}

.one {
  flex: 1;
}

.one-and-a-half {
  flex: 1.5;
  font-size: 12px;
}

.two {
  flex: 2;
}

button[data-state='correct'] {
  background-color: var(--key-bg-correct);
  color: var(--key-evaluated-text-color);
}

button[data-state='present'] {
  background-color: var(--key-bg-present);
  color: var(--key-evaluated-text-color);
}

button[data-state='absent'] {
  background-color: var(--key-bg-absent);
  color: var(--key-evaluated-text-color);
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
}

h1 {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 10px;
}

#statistics {
  display: flex;
}

.statistic-container {
  flex: 1;
}

.statistic-container .statistic {
  font-size: 36px;
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  letter-spacing: 0.05em;
  font-variant-numeric: proportional-nums;
}

.statistic.timer {
  font-variant-numeric: initial;
}

.statistic-container .label {
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#guess-distribution {
  width: 80%;
}

.graph-container {
  width: 100%;
  height: 20px;
  display: flex;
  align-items: center;
  padding-bottom: 4px;
  font-size: 14px;
  line-height: 20px;
}

.graph-container .graph {
  width: 100%;
  height: 100%;
  padding-left: 4px;
}

.graph-container .graph .graph-bar {
  height: 100%;
  /* Assume no wins */
  width: 0%;
  position: relative;
  background-color: var(--color-absent);
  display: flex;
  justify-content: center;
}

.graph-container .graph .graph-bar.highlight {
  background-color: var(--color-correct);
}

.graph-container .graph .graph-bar.align-right {
  justify-content: flex-end;
  padding-right: 8px;
}

.graph-container .graph .num-guesses {
  font-weight: bold;
  color: var(--tile-text-color);
}

#statistics,
#guess-distribution {
  padding-bottom: 10px;
}

.footer {
  display: flex;
  width: 100%;
}

.countdown {
  border-right: 1px solid var(--color-tone-1);
  padding-right: 12px;
  width: 50%;
}

.share {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-left: 12px;
  width: 50%;
}

.no-data {
  text-align: center;
}

button#share-button {
  background-color: var(--key-bg-correct);
  color: var(--key-evaluated-text-color);
  font-family: inherit;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  border: none;
  user-select: none;
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.3);
  width: 80%;
  font-size: 20px;
  height: 52px;
  -webkit-filter: brightness(100%);
}

button#share-button:hover {
  opacity: 0.9;
}

button#share-button game-icon {
  width: 24px;
  height: 24px;
  padding-left: 8px;
}

:host {}

.container {
  display: flex;
  justify-content: space-between;
}

.switch {
  height: 20px;
  width: 32px;
  vertical-align: middle;
  /* not quite right */
  background: var(--color-tone-3);
  border-radius: 999px;
  display: block;
  position: relative;
}

.knob {
  display: block;
  position: absolute;
  left: 2px;
  top: 2px;
  height: calc(100% - 4px);
  width: 50%;
  border-radius: 8px;
  background: var(--white);
  transform: translateX(0);
  transition: transform 0.3s;
}

:host([checked]) .switch {
  background: var(--color-correct);
}

:host([checked]) .knob {
  transform: translateX(calc(100% - 4px));
}

:host([disabled]) .switch {
  opacity: 0.5;
}

.instructions {
  font-size: 14px;
  color: var(--color-tone-1)
}

.examples {
  border-bottom: 1px solid var(--color-tone-4);
  border-top: 1px solid var(--color-tone-4);
}

.example {
  margin-top: 24px;
  margin-bottom: 24px;
}

game-tile {
  width: 40px;
  height: 40px;
}

:host([page]) section {
  padding: 16px;
  padding-top: 0px;
}

.overlay {
  display: none;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  justify-content: center;
  background-color: var(--color-background);
  animation: SlideIn 100ms linear;
  z-index: ".concat(2e3, ';

}

:host([open]) .overlay {
  display: flex;
}

.content {
  position: relative;
  color: var(--color-tone-1);
  padding: 0 32px;
  max-width: var(--game-max-width);
  width: 100%;
  overflow-y: auto;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.content-container {
  height: 100%;
}

.overlay.closing {
  animation: SlideOut 150ms linear;
}

header {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

h1 {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 10px;
}

game-icon {
  position: absolute;
  right: 0;
  user-select: none;
  cursor: pointer;
}

@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
  .content {
    max-width: 100%;
    padding: 0;
  }

  game-icon {
    padding: 0 16px;
  }
}

@keyframes SlideIn {
  0% {
    transform: translateY(30px);
    opacity: 0;
  }

  100% {
    transform: translateY(0px);
    opacity: 1;
  }
}

@keyframes SlideOut {
  0% {
    transform: translateY(0px);
    opacity: 1;
  }

  90% {
    opacity: 0;
  }

  100% {
    opacity: 0;
    transform: translateY(60px);
  }
}