:root {
    --color-key-bg: #fff;
    --color-correct-bg: #b6dba2;
    --color-correct-text: #20432c;
    --color-near-correct-bg: #efd58a;
    --color-near-correct-text: #8d552c;
}

body.dark {
    --color-key-bg: #232323;
    --color-correct-bg: #43513b;
    --color-correct-text: #c5c8c3;
    --color-near-correct-bg: #6d5e3d;
    --color-near-correct-text: #c8c7c3;
}

#splashScreen {
    background-color: var(--color-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: 999999;
	user-select: none;
}

#splashScreenMovable {
	user-select: none;
}

#splashScreenTitle {
	user-select: none;
}

#splashScreenLoading {
	user-select: none;
}

.splashAnimFadeIn {
	animation: splashAnimFadeIn 0.12s linear forwards;
}

.splashAnimFadeOut {
	animation: splashAnimFadeOut 0.25s linear forwards;
}

.splashAnimLoadingFadeOut {
	animation: splashAnimFadeOut 0.12s linear forwards;
}

.splashAnimPositionIn {
	animation: splashAnimPositionIn 0.25s ease-out forwards;
}

.splashAnimPositionOut {
	animation: splashAnimPositionOut 0.25s ease-in forwards;
}

.delayedOpacity {
	animation: delayedOpacity 2s linear forwards;
}

.zeroOpacity {
	opacity: 0;
}

@keyframes splashAnimFadeIn {
	  0% { opacity: 0; }
	100% { opacity: 1; }
}

@keyframes splashAnimFadeOut {
	  0% { opacity: 1; }
	100% { opacity: 0; }
}

@keyframes splashAnimPositionIn {
	  0% { opacity: 0; transform: translateY(150px); }
	100% { opacity: 1; transform: translateY(0px); }
}

@keyframes splashAnimPositionOut {
	  0% { opacity: 1; transform: translateY(0px); }
	100% { opacity: 0; transform: translateY(-150px); }
}

@keyframes delayedOpacity {
	  0% { opacity: 0; }
	 49% { opacity: 0; }
	 51% { opacity: 1; }
	100% { opacity: 1; }
}

/*
:focus-visible {
    all: unset;
}

:focus-visible::after {
    all: unset;
    box-sizing: border-box;
    border-bottom: 5px inset var(--color-btn-0);
    content: "";
    display: block;
    margin-left: 35%;
    margin-right: 35%;
}
*/

#game-scene {
    position: relative;
    max-height: 1000px;
    flex-direction: column;
}

.title-btn {
    position: absolute;
    top: 6px;
    left: 0;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
}
#menuButton { 
    display: flex;
    align-items: center;
    justify-content: center;
}
#menuButton svg {
    fill: none;
    stroke: #8aa3a3;
    stroke-linecap: round;
    stroke-width: 4px;
    width: 28px;
    height: auto;
}
#titleGameButtons {
    position: absolute;
    top: 6px;
    right: 0;
    display: flex;
    gap: 6px;
    flex-direction: column-reverse;
}
#titleGameButtons .title-btn {
    position: relative;
    top: 0;
}
#howToPlayButton span {
    display: block;
    width: 28px;
    height: 28px;
    margin: 4px;
    line-height: 26px;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 16px;
    color: #8aa3a3;
    border: 2px solid #8aa3a3;
}
#statsButton span {
    display: flex;
    align-items: end;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 4px;
}
#statsButton svg {
    width: 32px;
    fill: none;
    stroke: #8aa3a3;
    stroke-width: 3.5px;
}
@media screen and (min-width: 360px) {
    #titleGameButtons {
        flex-direction: row;
    }
}

#levelNumber {
    font-size: 18px;
    color: var(--color-game-text);
}
#levelNumber.tutorial-progress {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}
.tutorial-progress div {
    flex: 1;
    height: 8px;
    margin-left: 0.5rem;
    border-radius: 4px;
    overflow: hidden;
    background-color: rgb(0 0 0 / 5%);
}
.tutorial-progress span {
    display: block;
    height: 100%;
    background-color: #8aa3a3;
}
.tutorial-progress svg {
    display: block;
    width: 24px;
    fill: none;
    stroke-width: 5px;
    stroke: #8aa3a3;
}

#guessesScrollContainer {
    flex: 2;
    overflow-y: auto;
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}
#guessesScrollContainer::-webkit-scrollbar {
    display: none;
}
#guessesContainer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-direction: column;
    height: 100%;
    color: var(--color-game-text);
}
#guessesContainer div {
    display: flex;
    margin-top: 0.5rem;
}
#guessesContainer div span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin: 0 1px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 0.375rem;
    background-color: var(--color-key-bg);
}
#guessesContainer .correct, body #modalWinGuesses span.correct {
    color: var(--color-correct-text);
    background-color: var(--color-correct-bg);
}
#guessesContainer .nearCorrect, body #modalWinGuesses span.nearCorrect {
    color: var(--color-near-correct-text);
    background-color: var(--color-near-correct-bg);
}

#answerSpacesContainer {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0 1rem;
    color: var(--color-game-text);
}
#answerSpaces {
    display: grid;
    gap: 5px;
    grid-template-columns: repeat(var(--letter-spaces), minmax(20px, 54px));
    flex-shrink: 1;
}
#answerSpaces div {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20% 0 6% 0;
    font-size: clamp(9px,6vw,32px);
    font-weight: 600;
    border-radius: 0.5rem;
    aspect-ratio: 1;
    background-color: var(--color-key-bg);
}
#answerSpaces:not([data-letter-spaces="0"]) ~ #answerPlaceholders .additionalPlaceholder:first-of-type {
    opacity: 1;
}
#answerSpaces div.correct {
	animation: correctLetter 0.3s ease-out;
    animation-fill-mode: forwards;
}
@keyframes correctLetter {
    50% { transform: translateY(-16%); color: #218428; }
	100% { transform: translateY(0); color: #218428; }
}
#answerSpaces div.nearCorrect {
	animation: nearCorrectLetter 0.3s ease-out;
    animation-fill-mode: forwards;
}
@keyframes nearCorrectLetter {
    50% { transform: translateY(-16%); color: #f1b426; }
	100% { transform: translateY(0); color: #f1b426; }
}
#answerSpaces div.incorrect {
	animation: incorrectLetter 0.3s ease-in-out;
    animation-fill-mode: forwards;
}
@keyframes incorrectLetter {
    25% { transform: translateX(4%); color: #d54231; }
    75% { transform: translateX(-4%); color: #d54231; }
	100% { transform: translateY(0); color: #d54231; }
}
#answerSpacePlaceholder {
    color: var(--color-key-bg);
}
#answerSpacePlaceholder img {
    visibility: hidden;
}
#answerSpaces img {
    width: 45%;
    height: auto;
    margin-bottom: 2%;
}
#answerSpaces span, #answerDotsNeeded {
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    font-weight: 600;
    font-size: 0.875rem;
    animation: slideUp 0.12s ease-out;
}
@keyframes slideUp {
	0% { opacity: 0.5; top: -16px; }
    25% { opacity: 1; }
    50% { top: -26px; }
	100% { top: -20px; }
}
#answerPlaceholders {
    display: grid;
    gap: 5px;
    grid-template-columns: repeat(var(--letter-spaces), minmax(20px, 54px));
    flex-shrink: 1;
	margin-left: 5px;
}
.additionalPlaceholder {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20% 0 6% 0;
    font-size: clamp(9px, 6vw, 32px);
    font-weight: 600;
    border-radius: 0.5rem;
    aspect-ratio: 1;
    background-color: var(--color-key-bg);
    color: var(--color-key-bg);
	opacity: 0.35;
}
#answerPlaceholders img {
    width: 45%;
    height: auto;
    margin-bottom: 2%;
    visibility: hidden;
}
#answerPlaceholders span {
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    font-weight: 600;
    font-size: 0.875rem;
    animation: slideUp 0.12s ease-out;
}
#answerDots {
    position: relative;
    display: grid;
    gap: 0.25rem;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: 100%;
    font-size: clamp(9px,7vw,32px);
    margin-left: 0.5rem;
}
#answerDots span {
    display: inline-block;
}
#answerDots.correct {
    color: var(--color-game-text-correct);
}
#answerDots.nearCorrect {
    color: var(--color-game-text-near-correct);
}
#answerDots.over-sum {
    color: var(--color-game-text-incorrect);
}
#hintsButton {
    top: 6px;
    left: 0;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
}
#modalHintsContainer {
    display: flex;
	flex-direction: column;
    flex-grow: 1;
}
#modalHintsContainer li {
    margin: 0.5em 0;
}
.attract-animation {
	animation: attract-animation 4s linear infinite;
}

@keyframes attract-animation {
	  0% { filter: brightness(1)   hue-rotate(0deg); }
	 12% { filter: brightness(1.4) hue-rotate(-120deg); }
	 24% { filter: brightness(1)   hue-rotate(0deg); }
	100% { filter: brightness(1)   hue-rotate(0deg); }
}
#answerMessage {
    height: 40px;
    line-height: 40px;
}
#answerMessage.correct {
    font-size: 2rem;
    animation: correctWord 0.3s ease-out;
    animation-fill-mode: forwards;
}
@keyframes correctWord {
    50%{ transform: translateY(-20%); }
	100%{ transform: translateY(0); color: var(--color-correct-text) background-color: var(--color-correct-bg); }
}

#keyboardContainer {
	display: flex;
    position: relative;
	width: 100%;
    max-width: 600px;
    margin: auto auto 0 auto;
    padding: 0.75rem 0 2rem 0;
	touch-action: manipulation; /*Prevent iOS zoom on double tap*/
	user-select: none;
	-webkit-user-select: none;
}
@media only screen and (max-height : 600px) {
	#keyboardContainer {
    	padding: 0.75rem 0 0rem 0;
	}
}
#statusContainer {
    display: flex;
	flex-direction: row;
}
#statusLettersFoundCorrect {
    display: flex;
	flex-grow: 0;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
#statusLettersFoundIncorrect {
    display: flex;
	flex-grow: 0;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
#statusCurrentGuess {
    display: flex;
	flex-grow: 0;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
#statusPreviousGuesses {
    display: flex;
	flex-grow: 0;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
#statusHintsButton {
    display: flex;
	flex-grow: 0;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
#statusReadout {
/*	background-color: white;*/
    display: flex;
	width: 100%;
    margin-right: 5px;
	flex-grow: 1;
    min-height: 2em;
    border-radius: 0.5rem;
	align-items: center;
    justify-content: center;
	flex-shrink: 1;
}
#statusReadoutVisibleText {
    width: 100%;
}
#modalWinGuessesAria {
    display: flex;
	flex-grow: 0;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
#modalWinGuessesShare {
    position: absolute;
    top: -10%;
    right: -100%;
}
#keyboard {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    max-width: 600px;
	touch-action: manipulation; /*Prevent iOS zoom on double tap*/
	user-select: none;
	-webkit-user-select: none;
}
#keyboard > div {
    display: flex;
	width: 100%;
    max-width: 600px;
    justify-content: center;
	touch-action: manipulation; /*Prevent iOS zoom on double tap*/
	user-select: none;
	-webkit-user-select: none;
}
.braille-key {
    position: relative;
    width: 9.1%;
    margin: 0.5%;
    padding: 1% 1% 0.5% 1%;
    border-radius: 0.8vw;
    color: var(--color-game-text);
    background-color: var(--color-key-bg);
	user-select: none;
	-webkit-user-select: none;
}
.braille-key img {
	position: relative;
    display: block;
    width: 100%;
	height: auto;
}
.braille-key.incorrect {
    background: none;
}
.braille-key.incorrect img {
    filter: invert(1) brightness(0.7) sepia(0.2);
}
.braille-key.correct {
    color: var(--color-correct-text);
    background-color: var(--color-correct-bg);
}
.braille-key.nearCorrect {
    color: var(--color-near-correct-text);
    background-color: var(--color-near-correct-bg);
}
#nativeKeyboardInput {
	display: flex;
	flex-grow: 1;
    height: 40px;
	padding: 0;
	margin: 0;
	background: none;
	background-color: transparent;
	border: none;
	border-color: transparent;
	outline: none;
	outline-color: transparent;
}
::-webkit-input-placeholder {
	color: #000000;
	opacity: 0.25;
}
::-moz-placeholder {
	color: #000000;
	opacity: 0.25;
}
:-ms-input-placeholder {
	color: #000000;
	opacity: 0.25;
}
:-moz-placeholder {
	color: #000000;
	opacity: 0.25;
}
.braille-key-button {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width: 14.1%;
    font-weight: 600;
    font-size: clamp(9px,3vw,15px);
    color: var(--color-btn-text);
}
#brailleKeyENTER {
    background-color: var(--color-btn-0);
}
#brailleKeyBACKSPACE {
    width: 28.8%;
    height: 40px;
    background-color: var(--color-btn-1);
}
#brailleKeyBLANK { /* An unused key at the bottom left */
	color: transparent;
}
#brailleKeySPACER { /* An unused key at the top */
    flex-grow: 1;
	height: 1px;
	background: none;
	color: transparent;
}
#brailleKeySWAP {
    background-color: var(--color-btn-2);
}
.braille-key svg {
    fill: none;
    stroke: #000;
    stroke-linecap: round;
    stroke-width: 5px;
    width: 40%;
    height: auto;
    opacity: 0.65;
}
#brailleKeySWAP svg {
    stroke: none;
    fill: #000;
    width: 50%;
}
#brailleKeyBACKSPACE svg {
    width: 17.25%;
}
.braille-key span {
    font-weight: 600;
    font-size: clamp(11px,3vw,14px);
}
#keyboard[data-keyboard="letters"] .braille-key img {
    visibility: hidden;
}

#actionButtons .btn {
    height: 96px;
	font-size: 48px;
	background-size: auto 70%;
	background-position: center;
	background-repeat: no-repeat;
}
#btnPlay {
    grid-column: 1 / 6;
}
#btnActions, #btnCover {
    grid-column: 6 / 8;
}
#btnSettings {
    grid-column: 8 / 10;
	background-image: url("../img/btn_settings.svg");
}

.modal {
	display: flex;
	opacity: 1;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	width: 100%;
	height: 100%;
    padding: 1rem;
    font-size: 14px;
	background-color: rgb(0 0 0 / 30%);
	z-index: 1000;
	animation: fadeIn 0.2s ease-out;
	animation-fill-mode: both;
	position: absolute;
}
.modal > div {
    display: flex;
    flex-direction: column;
    width: 100%;
	max-width: 500px;
    max-height: 100%;
	padding: 1rem;
    text-align: left;
	border-radius: 12px;
	background: var(--color-key-bg);
    overflow-y: auto;
    transform: translateY(0);
    animation: transIn 0.2s ease-out;
	animation-fill-mode: both;
	min-height: 240px;
}
.modal button {
	animation-fill-mode: both;
}
@keyframes fadeIn {
	0% { opacity: 0; }
	100% { opacity: 1; }
}
@keyframes transIn {
	0% { opacity: 0; transform: translateY(50px); }
	100% { opacity: 1; transform: translateY(0); }
}
modalTitle {
    font-size: 175%;
	color: #000;
    font-weight: 600;
}
.modal .btn {
    display: block;
    width: 200px;
    margin: 0.375rem auto 0 auto;
	font-size: 100%;
}
.modal h2 {
    margin: 1rem 0 0.375rem;
    color: #000;
    font-size: 125%;
}
.modal ul {
    margin-left: 1rem;
}
.modal li::marker {
    color: #000;
}
.hidden {
    display: none;
}

.modal p:first-of-type {
	margin: 1rem 0;
    font-size: 125%;
}

#modalHowToPlay li {
	margin-bottom: 0.5rem;
}
#modalHowToPlay img {
    margin: 0.375rem 0 0.75rem;
}

#modalWin > div {
    max-width: 400px;
    text-align: center;
}
#modalWinGuesses {
    font-weight: 600;
}
#modalWinGuesses > div {
    margin-bottom: 0.25rem;
}
#modalWinGuesses span {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    background-color: #e9e7e5;
}
#modalWin .btn {
    margin-top: 1rem;
}
#modalWin #btnWinShare {
    margin: 1rem auto -0.25rem;
}
#modalWinStats .game-stats {
    margin-top: 0.5rem;
}
#modalWinStats .game-guesses-graph {
    height: 60px;
    max-width: 288px;
    font-size: 70%;
}
#modalWinStats .game-guesses-graph span {
    font-size: 130%;
}

#modalStats > div {
    max-width: 320px;
    text-align: center;
}
.game-stats {
    display: flex;
    gap: 0.375rem;
    margin-top: 1rem;
    font-size: 13px;
    line-height: 13px;
}
.game-stats > div {
    flex: 1;
    padding: 0.375rem 0.25rem 0.25rem;
    border-radius: 0.25rem;
    background-color: #f4f3f2;
}
.game-stats span {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 22px;
    font-weight: 600;
    line-height: 22px;
    color: var(--color-game-text);
}
.game-guesses-graph {
    display: grid;
    gap: 0.375rem;
    grid-template-columns: repeat(8, 1fr);
    align-items: flex-end;
    height: 100px;
    margin: 0 auto calc(1rem + 20px) auto;
}
.game-guesses-graph div {
    position: relative;
    display: flex;
    justify-content: center;
    padding-top: 1px;
    font-weight: 600;
    color: var(--color-correct-text);
    background-color: var(--color-correct-bg);
}
.game-guesses-graph span {
    position: absolute;
    bottom: -20px;
    width: 100%;
    font-weight: 400;
    color: var(--color-text);
}
#modalError {
    z-index: 1000000;
}
#modalErrorDetails {
    display: block;
    overflow-wrap: break-word;
    max-height: 100px;
    overflow-y: auto;
    font-size: small;
    font-family: monospace;
    margin: 1em 0;
    color: indianred;
    user-select: all;
}

/*-------------------------------------------------------
DARK THEME
-------------------------------------------------------*/

.dark #answerSpaces img {
    filter: invert(1) contrast(0.7);
}
.dark .braille-key img {
    filter: invert(1) contrast(0.55);
}
.dark .braille-key.incorrect img {
    filter: invert(1) contrast(0.55) brightness(0.2);
}
.dark .braille-key svg {
    stroke: #fff;
    opacity: 0.7;
}
.dark #brailleKeySWAP svg {
    fill: #fff;
}
.dark modalTitle, .dark .modal h2, .dark .modal li::marker {
	color: #fff;
}
.dark .tutorial-progress div {
    background-color: rgb(255 255 255 / 7%);
}
.dark #modalWinGuesses span {
    background-color: #141414;
}
.dark .game-stats div {
    background-color: #1c1c1c;
}
.dark #nativeKeyboardInput::placeholder {
    color: rgba(255 255 255 / 40%);
}

@media screen and (min-width: 600px) {
	#guessesContainer div span {
        width: 36px;
        height: 36px;
        margin: 0 2px;
        font-size: 18px;
        border-radius: 0.375rem;
    }

    .modal > div {
        padding: 1.5rem 2rem;
        font-size: 16px;
    }
}