/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */

/* Document
   ========================================================================== */

/**
 * 1. Correct the line height in all browsers.
 * 2. Prevent adjustments of font size after orientation changes in iOS.
 */

html {
  line-height: 1.15; /* 1 */
  -webkit-text-size-adjust: 100%; /* 2 */
}

/* Sections
   ========================================================================== */

/**
 * Remove the margin in all browsers.
 */

body {
  margin: 0;
}

/**
 * Render the `main` element consistently in IE.
 */

main {
  display: block;
}

/**
 * Correct the font size and margin on `h1` elements within `section` and
 * `article` contexts in Chrome, Firefox, and Safari.
 */

h1 {
  font-size: 2em;
  margin: 0.67em 0;
}

/* Grouping content
   ========================================================================== */

/**
 * 1. Add the correct box sizing in Firefox.
 * 2. Show the overflow in Edge and IE.
 */

hr {
  box-sizing: content-box; /* 1 */
  height: 0; /* 1 */
  overflow: visible; /* 2 */
}

/**
 * 1. Correct the inheritance and scaling of font size in all browsers.
 * 2. Correct the odd `em` font sizing in all browsers.
 */

pre {
  font-family: monospace, monospace; /* 1 */
  font-size: 1em; /* 2 */
}

/* Text-level semantics
   ========================================================================== */

/**
 * Remove the gray background on active links in IE 10.
 */

a {
  background-color: transparent;
}

/**
 * 1. Remove the bottom border in Chrome 57-
 * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
 */

abbr[title] {
  border-bottom: none; /* 1 */
  text-decoration: underline; /* 2 */
  text-decoration: underline dotted; /* 2 */
}

/**
 * Add the correct font weight in Chrome, Edge, and Safari.
 */

b,
strong {
  font-weight: bolder;
}

/**
 * 1. Correct the inheritance and scaling of font size in all browsers.
 * 2. Correct the odd `em` font sizing in all browsers.
 */

code,
kbd,
samp {
  font-family: monospace, monospace; /* 1 */
  font-size: 1em; /* 2 */
}

/**
 * Add the correct font size in all browsers.
 */

small {
  font-size: 80%;
}

/**
 * Prevent `sub` and `sup` elements from affecting the line height in
 * all browsers.
 */

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}

sup {
  top: -0.5em;
}

/* Embedded content
   ========================================================================== */

/**
 * Remove the border on images inside links in IE 10.
 */

img {
  border-style: none;
}

/* Forms
   ========================================================================== */

/**
 * 1. Change the font styles in all browsers.
 * 2. Remove the margin in Firefox and Safari.
 */

button,
input,
optgroup,
select,
textarea {
  font-family: inherit; /* 1 */
  font-size: 100%; /* 1 */
  line-height: 1.15; /* 1 */
  margin: 0; /* 2 */
}

/**
 * Show the overflow in IE.
 * 1. Show the overflow in Edge.
 */

button,
input { /* 1 */
  overflow: visible;
}

/**
 * Remove the inheritance of text transform in Edge, Firefox, and IE.
 * 1. Remove the inheritance of text transform in Firefox.
 */

button,
select { /* 1 */
  text-transform: none;
}

/**
 * Correct the inability to style clickable types in iOS and Safari.
 */

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
}

/**
 * Remove the inner border and padding in Firefox.
 */

button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
  border-style: none;
  padding: 0;
}

/**
 * Restore the focus styles unset by the previous rule.
 */

button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
  outline: 1px dotted ButtonText;
}

/**
 * Correct the padding in Firefox.
 */

fieldset {
  padding: 0.35em 0.75em 0.625em;
}

/**
 * 1. Correct the text wrapping in Edge and IE.
 * 2. Correct the color inheritance from `fieldset` elements in IE.
 * 3. Remove the padding so developers are not caught out when they zero out
 *    `fieldset` elements in all browsers.
 */

legend {
  box-sizing: border-box; /* 1 */
  color: inherit; /* 2 */
  display: table; /* 1 */
  max-width: 100%; /* 1 */
  padding: 0; /* 3 */
  white-space: normal; /* 1 */
}

/**
 * Add the correct vertical alignment in Chrome, Firefox, and Opera.
 */

progress {
  vertical-align: baseline;
}

/**
 * Remove the default vertical scrollbar in IE 10+.
 */

textarea {
  overflow: auto;
}

/**
 * 1. Add the correct box sizing in IE 10.
 * 2. Remove the padding in IE 10.
 */

[type="checkbox"],
[type="radio"] {
  box-sizing: border-box; /* 1 */
  padding: 0; /* 2 */
}

/**
 * Correct the cursor style of increment and decrement buttons in Chrome.
 */

[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
  height: auto;
}

/**
 * 1. Correct the odd appearance in Chrome and Safari.
 * 2. Correct the outline style in Safari.
 */

[type="search"] {
  -webkit-appearance: textfield; /* 1 */
  outline-offset: -2px; /* 2 */
}

/**
 * Remove the inner padding in Chrome and Safari on macOS.
 */

[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

/**
 * 1. Correct the inability to style clickable types in iOS and Safari.
 * 2. Change font properties to `inherit` in Safari.
 */

::-webkit-file-upload-button {
  -webkit-appearance: button; /* 1 */
  font: inherit; /* 2 */
}

/* Interactive
   ========================================================================== */

/*
 * Add the correct display in Edge, IE 10+, and Firefox.
 */

details {
  display: block;
}

/*
 * Add the correct display in all browsers.
 */

summary {
  display: list-item;
}

/* Misc
   ========================================================================== */

/**
 * Add the correct display in IE 10+.
 */

template {
  display: none;
}

/**
 * Add the correct display in IE 10.
 */

[hidden] {
  display: none;
}

html,
body {
	width: 100%;
	min-height: 100%;
	overflow-x: hidden;
}

* {
	font-family: Liberation Sans, Arial;
}

h1,
h2,
h3,
.text-game {
	color: #fff;
	font-family: Impact, 'Anton', 'Arial Black', sans-serif;
	letter-spacing: 0.02em;
	text-shadow:
		 0.05em  0     0 #000,
		 0       0.05em 0 #000,
		-0.05em  0     0 #000,
		 0      -0.05em 0 #000,
		 0.05em  0.05em 0 #000,
		 0.05em -0.05em 0 #000,
		-0.05em  0.05em 0 #000,
		-0.05em -0.05em 0 #000;
}

section > * {
	color: #fff;
	text-shadow: 0 0 0.3em #000;
}

p {
	font-size: 18px;
}

.button {
	background-color: #009246;
	padding: 0.4em 0.6em;
	text-decoration: none;
	box-shadow:
		0 -0.2em 2em   0 rgba(0, 0, 0, 0.4) inset,
		0 0      0.2em 0 rgba(0, 0, 0, 0.8) inset;
	border-radius: 0.4em;
	color: #fff;
	font-family: Impact, 'Anton', 'Arial Black', sans-serif;
	letter-spacing: 0.04em;
	transition: box-shadow 0.2s;
	white-space: nowrap;
}

.button:hover {
	box-shadow:
		0 -0.2em 2em   0 rgba(0, 0, 0, 0.4) inset,
		0 0      0.4em 0 rgba(0, 0, 0, 0.8) inset;
}

.logo {
	text-align: center;
}

.logo h1 {
	font-size: 60px;
	display: inline-block;
	margin: 0.2em;
	text-shadow:
		0.06em 0.06em 0 #ce2b37,
		-0.06em -0.06em 0 #009246,
		0 0 0.2em #000;
}

.logo h1 small {
	display: block;
	font-size: 0.45em;
	color: #ffd75e;
}

.gl-background {
	width: 100%;
	height: 100%;
	position: fixed;
	background-image: url(static/background-fallback.5a994aca965b619ea6a1.jpg);
	background-size: cover;
	background-position: center;
}

.content {
	position: relative;
	width: 800px;
	max-width: 100%;
	margin: 0 auto;
}

.description {
	padding: 0.6em;
}

.description section {
	margin: 1em 0;
	padding: 0.4em;
	border-radius: 0.4em;
	background-color: rgba(0, 0, 0, 0.6);
}

.description section > *:first-child {
	margin-top: 0;
}

.description section > *:last-child {
	margin-bottom: 0;
}

footer {
	width: 100%;
	text-align: center;
}

.epilepsy-warning {
	margin: 0;
	padding: 0.3em;
	position: fixed;
	top: 10px;
	right: 10px;
	font-size: 16px;
	text-align: center;
	z-index: 10000;
	border: 0.3em solid #000;
	font-family: arial;
	font-weight: bold;
	background-color: #fff;
	cursor: pointer;
	transition: top 0.4s;
}

.epilepsy-warning.hide {
	top: calc(-4em);
}

.cc-revoke, .cc-window {
	line-height: 1em !important;
}

.game-menu {
	padding: 0.6em;
	font-size: 30px;
	display: flex;
}

.game-menu .fb-share-button,
.game-menu .twitter-share-button {
	margin: 6px 6px 0 0;
}

.game-menu .fb-share-button {
	transform: scale(1.4);
	padding: 5px 14px;
}

.game-menu .fb-share-button > * {
	display: block;
}

.game-menu .game-newgame {
	font-size: 0.7em;
	flex-shrink: 0;
}

.game-menu .game-score:before {
	content: "score: ";
}

.game-score {
	width: 100%;
	margin: 0;
}

.game-board {
	position: relative;
	width: 60vmin;
	height: 60vmin;
	margin: 0 auto;
	border-radius: 2vmin;
	background-color: rgba(0, 0, 0, 0.4);
	cursor: move;
}

.game-board * {
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	-khtml-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

@media (max-width: 991px) {
	.game-board {
		width: 80vmin;
		height: 80vmin;
	}
}

.game.game-state-begin .game-board:before {
	position: absolute;
	width: 100%;
	height: 100%;
	display: block;
	content: "";
	border-radius: 2vmin;
	z-index: 100;
	background-image: url(static/instruction-touch.fd6b019a14d6d34b7cb3.svg);
	background-position: center;
	background-repeat: no-repeat;
	background-size: 70%;
}

.game .game-lose {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	border-radius: 2vmin;
	background-color: rgba(0, 0, 0, 0.7);
	opacity: 0;
	z-index: 100;
	transition: opacity 2s;
	cursor: default;
	text-align: center;
	transform: scale(0);
}

.game .game-lose a {
	text-decoration: none;
	color: inherit;
}

.game .game-lose h2 {
	font-size: 6vmin;
	animation: anim-vibrate 0.08s infinite;
}

.game .game-lose p {
	font-size: 4vw;
	color: #fff;
}

.game .game-lose p.lose-text {
	display: none;
}

.game .game-lose .game-newgame {
	font-size: 3vmin;
}

.game.game-state-lose .game-lose {
	opacity: 1;
	transform: scale(1);
}

.game-board-bg {
	padding: 1vmin;
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
}

.game-board-bg > span {
	width: 25%;
	height: 25%;
	float: left;
}

.game-board-bg > span:before {
	display: block;
	width: calc(100% - 2vmin);
	height: calc(100% - 2vmin);
	margin: 1vmin;
	border-radius: 2vmin;
	content: "";
	background-color: rgba(0, 0, 0, 0.2);
}

.game-board-cells {
	top:    1vmin;
	left:   1vmin;
	right:  1vmin;
	bottom: 1vmin;
	position: absolute;
}

.game-cell {
	width: calc(25% - 2vmin);
	height: calc(25% - 2vmin);
	position: absolute;
	z-index: 1;
	opacity: 1;
	transition:
		left    0.2s,
		top     0.2s,
		opacity 0.2s;
	padding: 1vmin;
	border-radius: 2vmin;
}

.game-board {
	--cell-size: 14.5vmin;
}

@media (max-width: 991px) {
	.game-board {
		--cell-size: 19.5vmin;
	}
}

.game-cell > span {
	position: relative;
	display: block;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	overflow: hidden;
	border-radius: 2vmin;
	border: calc(var(--cell-size) * 0.04) solid var(--cell-color);
	background-color: #000;
	box-shadow: 0 0.6vmin 0 rgba(0, 0, 0, 0.35);
	color: #fff;
	text-align: center;
	line-height: 1;
}

.game-cell-sprite {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}

.game-cell-name {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: calc(var(--cell-size) * 0.12) 4% calc(var(--cell-size) * 0.03);
	background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.85) 55%);
	font-family: Impact, 'Anton', 'Arial Narrow', sans-serif;
	font-weight: normal;
	font-size: calc(var(--cell-size) * 0.1);
	line-height: 1.05;
	text-transform: uppercase;
	text-shadow: 0 0 0.2em #000;
}

.game-cell-val {
	position: absolute;
	top: 3%;
	left: 3%;
	padding: 0.1em 0.3em;
	border-radius: 0.3em;
	background-color: rgba(0, 0, 0, 0.65);
	font-style: normal;
	font-weight: bold;
	font-family: Impact, 'Anton', 'Arial Black', sans-serif;
	font-size: calc(var(--cell-size) * 0.12);
}

.game-cell.fade-out {
	z-index: 0;
}

/* The big boys get a bit of extra attitude. */
.game-cell-128,
.game-cell-256,
.game-cell-512,
.game-cell-1024 {
	.game-cell-sprite {
		animation: sprite-vibrate 0.12s infinite;
	}
}

.game-cell-2048,
.game-cell-4096,
.game-cell-8192 {
	.game-cell-sprite {
		animation: sprite-wiggle 0.5s infinite;
	}
	& > span {
		animation: border-tricolore 0.6s infinite;
	}
}

/* Scaled up so the picture's edges stay out of view while it moves. */
@keyframes sprite-vibrate {
	0%   {transform: scale(1.1) translate(2%, 0)}
	33%  {transform: scale(1.1) translate(-2%, 0)}
	66%  {transform: scale(1.1) translate(0, 2%)}
	100% {transform: scale(1.1) translate(0, -2%)}
}

@keyframes sprite-wiggle {
	0%   {transform: scale(1.35) rotate(-8deg)}
	50%  {transform: scale(1.35) rotate(8deg)}
	100% {transform: scale(1.35) rotate(-8deg)}
}

@keyframes border-tricolore {
	0%   {border-color: #009246;}
	33%  {border-color: #f1f2f1;}
	66%  {border-color: #ce2b37;}
	100% {border-color: #009246;}
}

/* The "cast" section on the page that lists all characters. */
.character-list {
	--cell-size: 110px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0;
	margin: 0;
	list-style: none;

	li {
		cursor: pointer;
	}

	.game-cell {
		position: relative;
		width: var(--cell-size);
		height: var(--cell-size);
		padding: 0;
	}

	.game-cell > span {
		border-radius: 12px;
	}
}

.animations {
	position: relative;
}

.animations .anim {
	position: fixed;
	transform: translate(-50%, -50%);
	pointer-events: none;
	z-index: 100;
}

.anim-text {
	font-size: 60px;
	white-space: nowrap;
}

.anim.anim-explosion {
	object-fit: contain;
}

/* Character card shown when a new character is unlocked. */
.anim.anim-intro {
	text-align: center;
	white-space: nowrap;
	animation: anim-intro 1.2s 1 forwards;

	.anim-intro-sprite {
		display: block;
		width: 36vmin;
		height: 36vmin;
		margin: 0 auto;
		border: 1.2vmin solid #fff;
		border-radius: 3vmin;
		box-shadow: 0 1vmin 3vmin rgba(0, 0, 0, 0.6);
		animation: anim-wiggle 0.4s infinite;
	}

	.anim-intro-name {
		font-size: 9vmin;
	}
}

@keyframes anim-intro {
	0%   {transform: translate(-50%, -50%) scale(0) rotate(-30deg); opacity: 1}
	15%  {transform: translate(-50%, -50%) scale(1.2) rotate(5deg)}
	25%  {transform: translate(-50%, -50%) scale(1) rotate(0deg)}
	70%  {transform: translate(-50%, -50%) scale(1); opacity: 1}
	100% {transform: translate(-50%, -50%) scale(3); opacity: 0}
}

/* Something flying across the screen: crocodile bombers, sneaker sharks... */
.anim.anim-flyby {
	transition-property: top, left;
	transition-timing-function: linear;
	transition-duration: 1s;
	/* Wiggle the container, the sprite itself may be flipped with a transform. */
	animation: anim-wiggle-centered 0.3s infinite;

	.anim-flyby-sprite {
		display: block;
		border-radius: 50%;
		border: 4px solid #fff;
		box-shadow: 0 0.5em 1.5em rgba(0, 0, 0, 0.5);
		object-fit: cover;
	}

	&.anim-flyby-steady {
		animation: none;
	}
}

.anim.anim-spin {
	width: 140px;
	height: 140px;
	border-radius: 50%;
	border: 4px solid #fff;
	box-shadow: 0 0.5em 1.5em rgba(0, 0, 0, 0.5);
	animation: anim-spin 1.5s 1 ease-out;
}

@keyframes anim-spin {
	0%   {transform: translate(-50%, -50%) scale(0) rotate(0deg)}
	30%  {transform: translate(-50%, -50%) scale(1) rotate(360deg)}
	100% {transform: translate(-50%, -50%) scale(0.2) rotate(1440deg)}
}

@keyframes anim-pulse {
	0%   {transform: scale(0)}
	25%  {transform: scale(1)}
	50%  {transform: scale(0.25)}
	75%  {transform: scale(1)}
	100% {transform: scale(0)}
}

@keyframes anim-wiggle {
	0%   {transform: rotate(-20deg)}
	50%  {transform: rotate(20deg)}
	100% {transform: rotate(-20deg)}
}

@keyframes anim-wiggle-centered {
	0%   {transform: translate(-50%, -50%) rotate(-20deg)}
	50%  {transform: translate(-50%, -50%) rotate(20deg)}
	100% {transform: translate(-50%, -50%) rotate(-20deg)}
}

@keyframes anim-vibrate {
	0%   {transform: translate(3px, 0)}
	33%  {transform: translate(-3px, 0)}
	66%  {transform: translate(0, 3px)}
	100% {transform: translate(0, -3px)}
}

