:root {
    --button-width: 48px;
    --button-height: 24px;
    --toggle-diameter: 20px;
    --button-toggle-offset: calc((var(--button-height) - var(--toggle-diameter)) / 2);
    --toggle-shadow-offset: 10px;
    --toggle-wider: 24px;
    --color-grey: #E9E9E9;
    --color-dark-grey: #39393D;
    --color-green: #30D158;
}

* {
    font-family: sans-serif;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background-image: url("./assets/bg.gif");
}

#recognized-text {
    width: calc(100% - 32px);
    border-radius: 8px;
}

#text-question-btn {
    position: fixed;
    top: 0;
    left: 0;
    margin: 6px 12px;
    width: 36px;
    height: 36px;
    box-shadow: 0 0 4px #333;
    border-radius: 8px;
    padding: 6px 0 0 0;
}

#voice-lang, #voice-mode {
    background-color: #fff;
    color: #333;
    border: none;
    outline: none;
    width: 56px;
    position: fixed;
    top: 0;
    right: 0;
    padding: 4px 8px;
    margin: 12px;
    border: none;
    outline: none;
    border-radius: 8px;
    box-shadow: 0 0 4px #333;
    cursor: pointer;
}

#voice-mode {
    margin-right: 80px;
    
}

textarea {
    width: calc(100% - 40px);
    resize: vertical;
    min-height: 38px;
    background-color: black;
    color: #fff;
    padding: 16px;
    border-radius: 8px;
}

button {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background-color: #fff;
    color: #333;
    cursor: pointer;
}

button:hover {
    box-shadow: 0 0 16px #777;
}

button:active {
    background: none;
    color: #fff;
    box-shadow: 0 0 2px #fff;
}

#app {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#answer-text {
    height: calc(100vh - 412px);
}

#recognition-indicator {
    position: fixed;
    top: o;
    left: 0;
    background-color: #333;
    height: 50px;
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: start;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 0 16px #333;
    padding-left: 56px;
}

#reload_question_btn, #cancel_question_btn {
    margin-left: 16px;
}

.donate_btn {
    position: fixed;
    bottom: 0;
    left: 0;
    margin: 8px;
    height: 32px;
    width: 216px;
}

.speech-placeholder {
    border-radius: 8px;
    background-color: lightgreen;
    margin: 8px;
    padding: 2px 16px;
    text-align: center;
    color: #333;
    font-size: 24px;
}

.card {
    border-radius: 8px;
    background-color: #333;
    box-shadow: 0 0 16px #333;
    color: #fff;
    padding: 8px;
    text-align: center;
    width: calc(100% - 32px);
    max-width: 480px;
    margin: 64px auto 16px auto;
}

.card-init>img {
    height: auto;
    width: 100%;
    max-width: 256px;
}

.card-init>button {
    margin: 8px auto;
}

.speech-toggle {
    margin: 12px;
    position: fixed;
    bottom: 0;
    right: 0;
    cursor: pointer;
    display: flex;
    flex-direction: row;
}

.speech-toggle-title {
    background-color: #fff;
    color: #333;
    padding: 4px;
    border-radius: 8px;
    margin: 0 12px 0 0;
    font-size: 12px;
}

span {
    display: inline-block;
    width: var(--button-width);
    height: var(--button-height);
    background-color: var(--color-grey);
    border-radius: calc(var(--button-height) / 2);
    position: relative;
    transition: .3s all ease-in-out;
}

span::after {
    content: '';
    display: inline-block;
    width: var(--toggle-diameter);
    height: var(--toggle-diameter);
    background-color: #fff;
    border-radius: calc(var(--toggle-diameter) / 2);
    position: absolute;
    top: var(--button-toggle-offset);
    transform: translateX(var(--button-toggle-offset));
    box-shadow: var(--toggle-shadow-offset) 0 calc(var(--toggle-shadow-offset) * 4) rgba(0, 0, 0, .10);
    transition: .3s all ease-in-out;
}

input[type="checkbox"]:checked+span {
    background-color: var(--color-green);
}

input[type="checkbox"]:checked+span::after {
    transform: translateX(calc(var(--button-width) - var(--toggle-diameter) - var(--button-toggle-offset)));
    box-shadow: calc(var(--toggle-shadow-offset) * -1) 0 calc(var(--toggle-shadow-offset) * 4) rgba(0, 0, 0, .10);
}

input[type="checkbox"] {
    display: none;
}

input[type="checkbox"]:active+span::after {
    width: var(--toggle-wider);
}

input[type="checkbox"]:checked:active+span::after {
    transform: translateX(calc(var(--button-width) - var(--toggle-wider) - var(--button-toggle-offset)));
}

@media(prefers-color-scheme: dark) {
    body {
        background-color: black;
    }

    span {
        background-color: var(--color-dark-grey);
    }
}

@media (max-width: 400px) { 
    .speech-toggle {
        display: none;
    }
}