:root {
  --bg: #14161a;
  --card-bg: #20242b;
  --card-border: #343a44;
  --text: #e8eaed;
  --selected: #4c8bf5;
  --matched: #2ecc71;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
}

pose-card {
  display: block;
}

.pose-card__button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  color: inherit;
  border: 2px solid var(--card-border);
  border-radius: 0.75rem;
  font: inherit;
}

.pose-card__button:not(:disabled) {
  cursor: pointer;
}

.pose-card__emoji {
  font-size: 3rem;
  line-height: 1;
}

.pose-card__hand {
  display: block;
  font-size: 1.1rem;
}

.pose-card__hand[hidden] {
  display: none;
}

.pose-card--mirrored .pose-card__emoji {
  display: inline-block;
  transform: scaleX(-1);
}

.pose-card--selected .pose-card__button {
  border-color: var(--selected);
}

.pose-card--matched .pose-card__button {
  border-color: var(--matched);
  background: color-mix(in srgb, var(--matched) 20%, var(--card-bg));
}

setup-view,
end-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5vh;
  padding: 3vh 2vw;
  font-size: max(2.4vh, 0.75rem);
}

end-view p {
  margin: 0;
}

.setup__title,
end-view h1 {
  margin: 0;
  font-size: max(5vh, 1.25rem);
}

.setup__poses {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1.5vw;
  width: min(100%, 90vh);
}

.setup__poses .pose-card__button {
  gap: 0.5vh;
  padding: 1.5vh 0.5vw;
  border-radius: 1.5vh;
}

.setup__poses .pose-card__emoji {
  font-size: max(min(9vh, 6vw), 1.5rem);
}

.setup__poses .pose-card__hand {
  font-size: max(2.2vh, 0.6rem);
}

.setup__rounds input {
  width: 4rem;
  padding: 0.25rem 0.5rem;
  background: var(--card-bg);
  color: inherit;
  border: 2px solid var(--card-border);
  border-radius: 0.5rem;
  font: inherit;
}

.setup__play,
.end__play {
  padding: 1.5vh 5vh;
  background: var(--selected);
  color: var(--text);
  border: none;
  border-radius: 1.5vh;
  font: inherit;
  font-size: max(3vh, 0.9rem);
  cursor: pointer;
}

.setup__play:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.setup__error {
  min-height: 1.25rem;
  margin: 0;
  color: #e74c3c;
}

game-view {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto 1fr;
  justify-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  box-sizing: border-box;
  overflow: hidden;
}

.game__header,
.game__progress,
.game__targets {
  grid-column: 1;
  z-index: 1;
}

.game__header {
  margin: 0;
  padding: 0.25rem 1rem;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  border-radius: 0.5rem;
}

.game__progress {
  width: min(100%, 30rem);
  height: 1rem;
  accent-color: var(--matched);
}

.game__targets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  justify-items: center;
  gap: 1.5rem;
  width: 100%;
}

.game__targets[hidden] {
  display: none;
}

.game__targets > * {
  width: min(100%, 12rem);
}

.game__targets .pose-card__button {
  background: color-mix(in srgb, var(--card-bg) 60%, transparent);
}

.game__targets .pose-card--matched .pose-card__button {
  background: color-mix(in srgb, var(--matched) 45%, transparent);
}

.game__targets .pose-card__emoji {
  font-size: 6rem;
}

.game__camera {
  position: absolute;
  inset: 0;
}

.game__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.game__pause {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  font-size: 4rem;
  font-weight: bold;
}

.game__pause[hidden] {
  display: none;
}

.game__exit,
.game__sound {
  position: absolute;
  top: 0.75rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  color: var(--text);
  border: 2px solid var(--card-border);
  border-radius: 0.75rem;
  cursor: pointer;
}

.game__exit {
  right: 0.75rem;
}

.game__sound {
  right: 4.25rem;
}

setup-view .game__sound,
end-view .game__sound {
  position: fixed;
  right: 0.75rem;
}

.game__exit svg,
.game__sound svg {
  width: 1.5rem;
  height: 1.5rem;
}

.game__countdown {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  font-size: 12rem;
  font-weight: bold;
}

.game__countdown[hidden] {
  display: none;
}

@media (orientation: portrait) {
  .game__progress {
    width: 100%;
  }

  .game__targets {
    gap: 0.75rem;
  }

  .game__targets .pose-card__emoji {
    font-size: min(6rem, 18vw);
  }

  .game__countdown {
    font-size: 40vw;
  }
}

rotate-device {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: color-mix(in srgb, var(--bg) 95%, transparent);
  color: var(--text);
}

rotate-device[hidden] {
  display: none;
}

.rotate-device__icon {
  width: 6rem;
  height: 6rem;
  animation: rotate-device-turn 2s ease-in-out infinite;
}

.rotate-device__message {
  margin: 0;
  font-size: 1.75rem;
  font-weight: bold;
  text-align: center;
}

@keyframes rotate-device-turn {
  0%,
  20% {
    transform: rotate(0deg);
  }
  70%,
  100% {
    transform: rotate(-90deg);
  }
}
