html {
	font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
	font-size: 1.3em;
	line-height: 1.5rem;
}

html,
body {
	background: var(--white);
	position: relative;
}

/* variables */
:root {
	--keyboard-height: 200px;
	--game-max-width: 500px;
	--selected-indicator: black;
	--selected-indicator-dark-mode: white;
	--completed-indicator: #99db89;
	--share-color: rgb(88, 163, 81);
	--failed-indicator: #f2865f;
	--playing-indicator: #f6e784;
	--not-completed-indicator: var(--almost-white);;
	--black: #000000;
	--white: #ffffff;
	--almost-white: #efe9e6;
	--almost-black: #111a20;
}


* {
	user-select: none;
}

a {
	color: black;
	text-decoration: none;
	font-weight: bold;
}

a:hover {
	color: gray;
}

button {
	font-size: 20px;
	font-weight: 700;
	padding: 10px;
	border: none;
	border-radius: 5px;
	cursor: pointer;
	touch-action: manipulation;
}

button.letter-button {
	width: 40px;
	height: 58px;
	margin: 5px;
	background: var(--almost-white);;
	color: var(--black);;
}

button.letter-button:active {
	background: #5a534e;
	color: var(--white);;
}

button.letter-special {
	width: 40px;
	height: 58px;
	margin: 5px;
	background: var(--almost-white);;
	color: var(--black);;
}

button.letter-bksp {
	position: absolute;
	right: 0;
	width: 56px;
}

button.letter-special:active {
	background: #5a534e;
	color: var(--white);;
}


button.black {
	height: 40px;
	padding: 0 30px;
	background: var(--black);;
	color: var(--white);;
	border: 3px solid var(--black);;
	border-radius: 40px;
}

button.black:active {
	background: var(--white);;
	color: var(--black);;
}

button.white {
	height: 40px;
	padding: 0 30px;
	background: var(--white);;
	color: var(--black);;
	border: 3px solid var(--black);;
	border-radius: 40px;
}

button.white:active {
	background: var(--black);;
	color: var(--white);;
}

button.with-icon {
	padding: 5px;
	margin-right: 10px;
	width: 42px;
	height: 42px;
	line-height: 20px;
	background: none;
    border: 2px solid var(--black);
    border-radius: 50%;
}

button.with-icon:active {
	background: var(--black);
	color: var(--white);
}

button.with-icon:active > img {
	filter: invert(1);
}

button.closeDialog {
	position: absolute;
    top: 20px;
    right: 20px;
    padding: 0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

button.closeDialog::after {
	content: "✕";
	margin: auto;
}

button.tutorial-ctrl {
	flex: 1;
}

button.share {
	display: flex;
	align-items: center;
	padding: 10px 20px;
	background-color: var(--share-color);
	border-radius: 40px;
	color: white;
}

button.share > svg {
	fill: white;
}

.header-subs {
	display: flex;
	justify-content: center;
	align-items: center;
}

dialog {
	position: relative;
	border-radius: 5px;
	padding: 20px;
	width: clamp(16rem, 50vw, 40rem);
	max-height: 80vh;
	transition: max-height 1s;
}

dialog h2 {
	position: relative;
	margin: 0;
}

dialog::backdrop {
	backdrop-filter: blur(2px);
}

dialog ul {
	width: 80%;
	list-style-type: none;
	padding: 0;
}

dialog ul li {
	position: relative;
}

dialog#statsDialog p {
	margin: 10px 0;
}

dialog#settingsDialog p {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-weight: bold;
}

dialog#settingsDialog p select {
	width: 120px;
	height: 2em;
	border: 3px solid var(--black);;
	border-radius: 5px;
	font-weight: bold;
}

.tutorial-controls {
	display: flex;
	align-items: center;
	justify-content: space-evenly;
}

.share-dialog-controls {
	display: flex;
	align-items: center;
	justify-content: space-around;
}

.resetStatsControls {
	margin: 20px 0;
	display: flex;
	align-items: center;
	justify-content: space-around;
}

.geek-stats {
	width: 100%;
	margin-bottom: 20px;
}

.stats-row {
	display: flex;
	align-items: center;
}

.stats-bar-container {
	flex: 1;
	height: 20px;
	display: flex;
	align-items: center;
	margin: 0 10px;
}

.stats-bar {
	background-color: var(--completed-indicator);
	height: 100%;
	width: 57%;
}

.stats-percent {
	flex: 0 30px;
}

.small-text {
	font-size: 14px;
}

header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--black);;
}

header.archive {
	align-items: center;
}

header h1 {
	position: relative;
	margin: 0;
	line-height: 40px;
}

.brand {
	position: relative;
}

.brand::after {
	position: absolute;
	top: 0;
	right: -10px;
	display: block;
	content: "";
	width: 15px;
	height: 15px;
	animation: rotate 20s linear infinite;
}

span.brand::after {
	right: -8px;
	width: 12px;
	height: 12px;
}

button span.brand::after {
	right: -8px;
	width: 8px;
	height: 8px;
}

footer span.brand::after {
	top: 1px;
	right: -3px;
	width: 5px;
	height: 5px;
}

header div {
	text-align: center;
}

header .header-chunk {
	width: 160px;
}

header .end {
	display: flex;
	align-items: center;
	justify-content: flex-end;
}

header div:first-child {
	text-align: left;
}

.timer-controls {
	visibility: hidden;
}

#splash {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: 120;

	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	background: var(--almost-white);;
	text-align: center;
}

#splash h2,
#splash h3 {
	margin: 0;
}

#splash h2 {
	margin-bottom: 10px;
}

#splash h3 {
	margin-bottom: 20px;
	font-weight: 400;
}

#splash p {
	padding: 0 20px;
}

#container {
	display: none;
	margin-top: 10px;
}

.working-word {
	margin: 10px 0;
	text-align: center;
}

.working-word span {
	position: relative;
}

.working-word #initial {
	display: inline-block;
}

.working-word #the-word::after {
	position: absolute;
	top: 0;
	right: -2px;
	display: block;
	content: "";
	width: 100%;
	height: 100%;
	border-right: 2px solid var(--almost-white);;
	animation: 1s blink infinite;
	box-sizing: border-box;
}

.grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	max-width: 500px;
	margin: 0 auto;
}

.submission {
	padding: 20px 20px 0;
	text-align: center;
}

.submission button {
	margin: 5px;
}

.message {
	font-weight: 600;
	text-align: center;
}

#message {
	white-space: pre-line;
}

.hidden {
	display: none;
}

.uppercase,
.uppercase button {
	text-transform: uppercase;
}

.shake {
	position: relative;
	animation: shakeLeftRight 0.2s linear infinite;
}

.stupid-btn {
	position: absolute;
	z-index:100;
	right: 0;
	margin-top: 10px;
}

.stupid-list {
	width: 100%;
}

.stupid-message {
	border: 1px solid var(--black);
    padding: 5px 10px;
    border-radius: 10px;
    margin: 5px 0;
	position: relative;
}

.stupid-message-selected {
	background-color: var(--black);
	color: var(--white)
}

.stupid-message-selected::after {
	content: "copied!";
	background-color: var(--completed-indicator);
	color: black;
	padding: 2px 10px;
	border-radius: 4px;
	position: absolute;
	top: -20px;
	animation: toast-hide 4s linear 2s forwards;
}

footer {
	text-align: center;
	padding: 20px;
	font-size: 0.75rem;
	line-height: 1rem;
	color: gray;
}

footer a {
	color: gray;
}

@keyframes blink {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes rotate {
	0%,
	100% {
		transform: rotate(0deg);
	}
	25% {
		transform: rotate(90deg);
	}
	50% {
		transform: rotate(180deg);
	}
	75% {
		transform: rotate(270deg);
	}
}

@keyframes shakeLeftRight {
	0%,
	100% {
		transform: translateX(0);
	}
	25% {
		transform: translateX(-5px);
	}
	50% {
		transform: translateX(0);
	}
	75% {
		transform: translateX(5px);
	}
}

form:not([method="dialog"]) {
	padding: 20px;
	background: var(--almost-white);;
	border-radius: 20px;
}

form fieldset {
	margin: 0 0 10px;
	padding: 0;
	border: 0;
}

form fieldset legend {
	padding-inline-start: 0;
}

form p {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	margin-top: 0;
}

hr {
	margin: 20px 0;
	border: 0;
	border-top: 3px solid var(--black);;
}

.container {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
	max-width: var(--game-max-width);
	margin: 0 auto;
}

.panel-light {
	background-color: var(--white);
}

.splash-panel-light {
	background-color: var(--almost-white);
}

.splash-bg {
	height: 500px;
	width: 100%;
	position: relative;
	z-index: 0;
}

.splash-puzzle-container {
	width: 100%;
	height: 100px;
	display: flex;
	align-items: center;
	z-index: -2;
}

.bg {
	height: 500px;
	width: 100%;
	position: relative;
	z-index: 0;
}

.fg-top {
	height: 249.5px;
	position: absolute;
	top: 0;
	width: 100%;
	z-index: 100;
	transition: opacity 2s;
}

.fg-bottom {
	height: 249.5px;
	position: absolute;
	bottom: 0;
	width: 100%;
	z-index: 100;
	transition: opacity 2s;
}

.fg-center {
	height: 1px;
	position: absolute;
	top: 249.5px;
	width: 100%;
}

.bang {
    background-image: radial-gradient(#7ed56f, #28b485);
	mask-image: radial-gradient(circle, transparent 25%, rgba(0, 0, 0, 1) 25%);
	position: fixed;
    width: 50px;
    height: 50px;
	margin: -35px 25px;
	border-radius: 50%;
	z-index: 100;
	transition: transform 0.8s cubic-bezier(0.86, 0, 0.07, 1);
}

.bang-expand {
	transform: scale(200);
}

@keyframes reveal-transition {
	0% {
		opacity: 100%;
	}
	100% {
		opacity: 75%;
	}
}

@keyframes darken-transition {
	0% {
		background-color: white;
	}
	100% {
		background-color: #ededed;
	}
}


.reveal {
	opacity: 75%;
}

.darken {
	animation: darken-transition 2s linear forwards;
}

@keyframes game-translate {
	0% {
		top: 300px;
	}
	80%, 100% {
		top: 0;
	}
}

.translucent {
	opacity: 80%;
}

.shape {
	background-color: transparent;
	height: 200px;
	position: absolute;
	width: 100%;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	animation: game-translate 5s linear infinite;
}

.shape img {
	max-height: 100%;
}

/* keyboard */

.keyboard {
	width: 100%;
	max-width: var(--game-max-width);
	margin: 0 8px;
	user-select: none;
  }
  
.kb-row {
	display: flex;
	width: 100%;
	margin: 0 auto 8px;
	/* https://stackoverflow.com/questions/46167604/ios-html-disable-double-tap-to-zoom */
	touch-action: manipulation;
	justify-content: center;
	position: relative;
}

.letter-space {
	flex:5;
}

.letter-enter {
	flex:2;
}

.letter-hint {
	flex: 1;
}

.fake-padding {
	flex: 2;
	display: flex;
}

.level-container {
	display: flex;
	align-items: center;
	height: 100%;
	margin: auto;
}

.level-nav {
	flex: 1;
	font-size: 48px;
}

.current-level {
	flex: 6;
	font-size: 48px;
	font-weight: 700;
}

.levels-grid {
	margin: 20px 0;
	display: grid;
	grid-template-columns: repeat(5, 60px);
	justify-content: space-evenly;
	row-gap: 10px;
}


.past-level {
	height: 58px;
}

.past-level:active {
	background: black;
	color:white;
}

.past-level-won {
	background: var(--completed-indicator);
}

.past-level-failed {
	background: var(--failed-indicator);
}

.past-level-playing {
	background: var(--playing-indicator);
}

.past-level-not-started {
	background: var(--not-completed-indicator);
}

.past-level-selected {
	outline: 3px solid var(--selected-indicator);
}

.answer {
	display: flex;
	flex-direction: column;
	align-items: center;
}

@keyframes toast-show {
	0% {
		opacity: 0%;
	}

	10%, 100% {
		opacity: 100%;
	}
}

@keyframes toast-hide {
	0% {
		opacity: 100%;
	}

	100% {
		opacity: 0%;
	}
}

.toast-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	position: absolute;
	top: 100px;
	width: 100%;
	z-index: 100;
}

.toast {
	margin: 0 20px;
	padding: 10px;
	background-color: var(--almost-white);;
	border-radius: 5px;
	line-height: normal;
}

.toast-show {
	animation: toast-show 7s linear forwards;
}

.toast-hide {
	animation: toast-hide 1s linear forwards;
}

.failed-attempts {
	display: flex;
	flex-wrap: wrap;
	position: absolute; /* TODO maybe remove this */
}

.failed-attempt {
	text-decoration: line-through;
	text-transform: uppercase;
	margin: 0 10px;
}

.level-controls {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin-bottom: 10px;
}

.level-controls > button {
	margin-top: 10px;
}

/* 
--------------------------------------------------------------------------------
dark mode
--------------------------------------------------------------------------------
*/

@media (prefers-color-scheme: dark) {
	html.dark,
	html.dark dialog,
	html.dark .word-result,
	html.dark .brand::after {
		filter: invert(1);
	}

	/* another invert on top to maintain success/fail/outline colors */
	html.dark .past-level-won,
	html.dark .past-level-failed,
	html.dark .past-level-playing {
		filter: invert(1);
	}

	html.dark .past-level-won.past-level-selected,
	html.dark .past-level-failed.past-level-selected,
	html.dark .past-level-playing.past-level-selected {
		outline: 3px solid var(--selected-indicator-dark-mode);
	}

	html.dark .share {
		filter: invert(1);
	}

	html.dark .past-level:active {
		background: white;
		color: black;
	}

	html.dark .stupid-btn span {
		filter: invert(1);
	}

	html.dark dialog#stupidDialog span {
		filter: invert(1);
	}
}

/*
--------------------------------------------------------------------------------
responsive dimensions
--------------------------------------------------------------------------------
*/


@media screen and (max-width: 520px) {
	h1 {
		font-size: 40px;
	}

	.working-word {
		font-size: 18px;
	}

	button {
		font-size: 16px;
		padding: 5px;
		border-radius: 2px;
	}

	button.with-icon {
		width: 38px;
		height: 38px;
		margin-right: 6px;
	}

	button.letter-button {
		font-size: 20px;
		width: 34px;
		height: 50px;
		margin: 2px;
		border-radius: 5px;
	}

	button.letter-special {
		font-size: 16px;
		width: 34px;
		height: 50px;
		border-radius: 5px;
		margin: 2px 6px;
	}

	button.letter-bksp {
		width: 42px;
	}
	
	button.black {
		padding: 0 16px;
	}

	button.closeDialog {
		padding: 0;
	}

	footer {
		font-size: 0.75rem;
		padding: 5px 0;
	}

	.toast {
		font-size: 16px;
	}
}

@media screen and (max-width: 380px) {
	h1 {
		font-size: 34px;
	}

	.working-word {
		font-size: 16px;
	}

	button {
		font-size: 14px;
		padding: 5px;
		border-radius: 2px;
	}

	button.with-icon {
		width: 34px;
		height: 34px;
		margin-right: 6px;
	}

	button.letter-button {
		font-size: 16px;
		width: 30px;
		height: 46px;
		margin: 2px;
		border-radius: 5px;
	}

	button.letter-special {
		font-size: 16px;
		width: 30px;
		height: 46px;
		border-radius: 5px;
		margin: 2px 6px;
	}

	button.letter-bksp {
		width: 42px;
	}

	button.black {
		padding: 0 14px;
	}

	button.closeDialog {
		padding: 0;
	}

	.levels-grid {
		grid-template-columns: repeat(4, 60px);
	}

	footer {
		font-size: 0.6rem;
		padding: 5px 0;
	}

	.toast {
		font-size: 14px;
	}
}

@media screen and (max-width: 320px) {
	h1 {
		font-size: 28px;
	}

	.working-word {
		font-size: 14px;
	}

	button {
		font-size: 12px;
		padding: 3px;
		border-radius: 2px;
	}

	button.with-icon {
		width: 30px;
		height: 30px;
		margin-right: 4px;
	}

	button.letter-button {
		font-size: 16px;
		width: 24px;
		height: 40px;
		margin: 1px;
		border-radius: 5px;
	}

	button.letter-special {
		font-size: 16px;
		width: 24px;
		height: 40px;
		border-radius: 5px;
	}

	button.letter-bksp {
		width: 36px;
		margin: 0 1px;
	}

	button.black {
		padding: 0 12px;
	}

	footer {
		font-size: 0.6rem;
		padding: 5px 0;
	}
}

/*
--------------------------------------------------------------------------------
responsive height for game
--------------------------------------------------------------------------------
*/

@media screen and (max-height: 1000px) {
	.bg {
		height: 300px;
	}
	
	.fg-top {
		height: 149.5px;
	}
	
	.fg-bottom {
		height: 149.5px;
	}
	
	.fg-center {
		height: 1px;
		top: 149.5px;
	}

	.shape {
		height: 150px;
		position: absolute;
		animation: game-translate-shallow 5s linear infinite;
	}

	button.level-nav-prev,
	button.level-nav-next {
		top: 150px;
	}

	@keyframes game-translate-shallow {
		0% {
			top: 150px;
		}
		80%, 100% {
			top: 0;
		}
	}
}

@media screen and (max-height: 740px) {
	.bg {
		height: 200px;
	}
	
	.fg-top {
		height: 99.5px;
	}
	
	.fg-bottom {
		height: 99.5px;
	}
	
	.fg-center {
		height: 1px;
		top: 99.5px;
	}

	.shape {
		height: 100px;
		position: absolute;
		animation: game-translate-super-shallow 5s linear infinite;
	}

	button.level-nav-prev,
	button.level-nav-next {
		top: 100px;
	}

	.toast-container {
		top: 60px;
	}

	@keyframes game-translate-super-shallow {
		0% {
			top: 100px;
		}
		80%, 100% {
			top: 0;
		}
	}
}

@media screen and (max-height: 600px) {
	.bg {
		height: 160px;
	}
	
	.fg-top {
		height: 79.5px;
	}
	
	.fg-bottom {
		height: 79.5px;
	}
	
	.fg-center {
		height: 1px;
		top: 79.5px;
	}

	.shape {
		height: 80px;
		position: absolute;
		animation: game-translate-super-shallow 5s linear infinite;
	}

	button.level-nav-prev,
	button.level-nav-next {
		top: 80px;
	}

	.toast-container {
		top: 50px;
	}

	@keyframes game-translate-super-shallow {
		0% {
			top: 80px;
		}
		80%, 100% {
			top: 0;
		}
	}
}
