:root {
    --vh: 1vh;
    --vw: 1vw;
    --vmin: 1vmin;
    --zoom: 100;

    --headerHeight: 0px;

    --keyboardHeight: 0px;
    --keyboardBottomPadding: 0px;

    --puzzlePaddingMin: 0px;
    --puzzlePaddingMax: 0px;
    --puzzlePaddingScale: 0px;
    --puzzlePadding: 0px;

    --standardPadding: 0px;
    --keyboardPadding: 0px;
    --innerCellBorders: 0px;

    --focusBorderMin: 0px;
    --focusBorderMax: 0px;
    --focusBorderScale: 0px;
    --focusBorder: 0px;

    --focusMarginMin: 0px;
    --focusMarginMax: 0px;
    --focusMarginScale: 0px;
    --focusMargin: 0px;

    --borderHeavySize: 0px;
    --borderLightSize: 0px;

    --totalHeaderHeight: 0px;
    --totalKeyboardHeight: 0px;
    --totalPuzzleCommitted: 0px;
    --totalVerticalCommitted: 0px;
    
    --totalGridCorrection: 0px;

    --totalBodyHeight: 0px;
    --totalPuzzleHeight: 0px;

    --modalRowHeight: 0px;

    --boxSize: 0px;
    --cellSize: 0px;
    --scratchSize: 0px;

    --exampleBoxSize: 0px;

    --fontSizeGuess: 0px;
    --fontSizeScratch: 0px;
    --fontSizeTimer: 0px;
    --fontSizeHeader: 0px;
    --fontSizeBody: 0px;
    --fontSizeNote: 0px;

    --stripingSize: 0px;

    --colorBackground: white;
    --colorBorders: black;
    --colorPrimary: black;
    --colorAccent: grey;
    --colorFaded: #9e9e9e;
    --colorShrunkGuessText: #4e4e4e;
    --colorCorrect: #93c572;
    --colorCorrectRowOrColumn: #fbec5d;
    --colorCorrectColumn: #fbec5d;
    --colorCorrectRow: #e2a35c;
    --colorActive: white;
    --colorIncorrect: #d3d3d3;
    --colorFocus: #0096ff;
    --colorAlert: #e6572c;
    --colorAlertAccent: #e28468;
    --colorStriping: #e7e7e7;
    --colorHintStriping: #a3db7e;
    --colorButton: lightgrey;
    --colorButtonText: black;
    --colorButtonClicked: #4e4e4e;
    --colorButtonClickedText: white;
    --colorButtonHover: grey;
    --colorButtonHoverText: white;
    --colorButtonActive: #abe485;
    --colorButtonActiveClicked: #678d4e;
    --colorButtonActiveHover: #93c572;
    --colorButtonDisabled: grey;
    --colorButtonDisabledText: lightgrey;
    --colorButtonIncorrect: black;
    --colorButtonIncorrectText: lightgrey;
    --colorButtonScratch: #0096ff;
    --colorButtonScratchText: white;

    --colorBackgroundLight: white;
    --colorBordersLight: black;
    --colorPrimaryLight: black;
    --colorAccentLight: grey;
    --colorFadedLight: #9e9e9e;
    --colorShrunkGuessTextLight: #4e4e4e;
    --colorCorrectLight: #93c572;
    --colorCorrectRowOrColumnLight: #fbec5d;
    --colorActiveLight: white;
    --colorIncorrectLight: #d3d3d3;
    --colorStripingLight: #e7e7e7;

    --colorBackgroundDark: #2b2b2b;
    --colorBordersDark: lightgrey;
    --colorPrimaryDark: lightgrey;
    --colorAccentDark: grey;
    --colorFadedDark: #3d3d3d;
    --colorShrunkGuessTextDark: lightgrey;
    --colorCorrectDark: #49702f;
    --colorCorrectRowOrColumnDark: #91830b;
    --colorActiveDark: #3d3d3d;
    --colorIncorrectDark: #505050;
    --colorStripingDark: #181818;

    --fontFamily: Geneva, sans-serif;

    --borderHeavy: var(--borderHeavySize) solid;
    --borderLight: var(--borderLightSize) solid;
}

/* Hide the scrollbar in Firefox */
html {
    scrollbar-width: none;;
}

body {
    margin: 0px;
    height: 100%;
    max-height: calc(100 * var(--vh));
    overflow: hidden;
    background-color: var(--colorBackground);
}

/* Hide the scrollbar in Chrome, Safarie, Edge, etc. */
body::-webkit-scrollbar {
    display: none;
}

header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    height: var(--headerHeight);
    color: var(--colorPrimary);
    border-bottom: var(--borderHeavy) var(--colorBorders);
}

header .Title {
    font-family: var(--fontFamily);
    font-size: calc(50px / (var(--zoom) / 100));
    font-weight: 750;
    text-align: center;
}

#MenuButton {
    display: flex;
    margin: 0px 0px 0px calc(2 * var(--vw));
    padding: 0px;
    align-items: center;
    border: 0px;
    color: var(--colorPrimary);
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    background-color: var(--colorBackground);
    box-shadow: none;
    justify-content: flex-start;
}

#StatisticsButton {
    display: flex;
    margin: 0px calc(2 * var(--vw)) 0px 0px;
    padding: 0px;
    align-items: center;
    border: 0px;
    color: var(--colorPrimary);
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    background-color: var(--colorBackground);
    box-shadow: none;
    justify-content: flex-end;
}

@media (hover: hover) {
    #MenuButton:hover, #StatisticsButton:hover {
        color: var(--colorButtonHover);
    }
}

#MenuButton:active, #StatisticsButton:active {
    color: var(--colorButtonClicked);
}

#MenuButton i, #StatisticsButton i {
    font-size: calc(25px / (var(--zoom) / 100));
}

.PuzzleContainer {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

.StatusBar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    height: var(--headerHeight);
    color: var(--colorPrimary);
    border: 0px;
}

#Hints {
    font-size: min(var(--fontSizeHeader), calc(30px / (var(--zoom) / 100)));
    font-family: var(--fontFamily);
    font-weight: 450;
    text-align: right;
    padding-right: calc(5 * var(--vw));
}

#Timer {
    font-size: min(var(--fontSizeTimer), calc(40px / (var(--zoom) / 100)));
    font-family: var(--fontFamily);
    font-weight: 450;
    text-align: center;
}

#HintPenalty {
    font-size: min(var(--fontSizeHeader), calc(30px / (var(--zoom) / 100)));
    font-family: var(--fontFamily);
    font-weight: 450;
    text-align: left;
    padding-left: calc(5 * var(--vw));
}

#HintPenalty.GavelDown i {
    animation: gavelDown 1s;
}

@keyframes gavelDown {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(40deg); }
    50% { transform: rotate(40deg); }
    75% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

.Puzzle {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    padding: var(--puzzlePadding);
    height: var(--totalPuzzleHeight);
}

.Sudoku {
    display: grid;
    grid-template-columns: repeat(3, var(--boxSize));
    grid-template-rows: repeat(3, var(--boxSize));
    gap: var(--standardPadding);
    padding: var(--standardPadding);
    background-color: var(--colorBorders);
}

.SudokuBox {
    display: grid;
    grid-template-columns: repeat(3, var(--cellSize));
    grid-template-rows: repeat(3, var(--cellSize));
    gap: var(--innerCellBorders);
    background-color: var(--colorBorders);
}

.SudokuExample {
    display: grid;
    grid-template-columns: repeat(1, var(--boxSize));
    grid-template-rows: repeat(1, var(--exampleBoxSize));
    gap: var(--standardPadding);
    padding: var(--standardPadding);
    background-color: var(--colorBorders);
}

.SudokuBoxExample {
    display: grid;
    grid-template-columns: repeat(3, var(--cellSize));
    grid-template-rows: 1;
    gap: var(--innerCellBorders);
    background-color: var(--colorBorders);
}

.ButtonsContainer {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    padding: 0px 0px var(--keyboardBottomPadding) 0px;
}

.ButtonsRows {
    margin-top: auto;
    display: grid;
    grid-template-columns: repeat(9, var(--cellSize));
    gap: var(--keyboardPadding);
    height: var(--keyboardHeight);
    background-color: var(--colorBackground);
}

.Button {
    height: calc((var(--keyboardHeight) - var(--keyboardPadding)) / 2);
    padding: 0px;
}

.Button button {
    height: calc((var(--keyboardHeight) - var(--keyboardPadding)) / 2);
    width: 100%;
    font-size: min(var(--fontSizeGuess), calc(40px / (var(--zoom) / 100)));
    font-family: var(--fontFamily);
    text-align: center;
    padding: 0px;
    border: 0px;
    color: var(--colorButtonText);
    background-color: var(--colorButton);
    box-shadow: none;
    border-radius: calc(4px / (var(--zoom) / 100));
    cursor: default;
}

.Button button:focus {
    color: var(--colorButtonText);
    background-color: var(--colorButton);
    border-color: var(--colorButton);
}

/* .Button button:hover {
    color: var(--colorButtonHoverText);
    background-color: var(--colorButtonHover);
} */

@media (hover: hover) {
    .Button button:hover {
        color: var(--colorButtonHoverText);
        background-color: var(--colorButtonHover);
        border-color: var(--colorButtonHover);
    }
}

.Button button:active {
    color: var(--colorButtonClickedText);
    background-color: var(--colorButtonClicked);
    border-color: var(--colorButtonClicked);
}

button.ActiveButton {
    background-color: var(--colorButtonActive);
    border-color: var(--colorButtonActive);
}

button.ActiveButton:hover {
    color: var(--colorButtonHoverText);
    background-color: var(--colorButtonActiveHover);
    border-color: var(--colorButtonActiveHover);
}

button.ActiveButton:active {
    color: var(--colorButtonClickedText);
    background-color: var(--colorButtonActiveClicked);
    border-color: var(--colorButtonActiveClicked);
}

button:disabled {
    color: var(--colorButtonDisabledText);
    background-color: var(--colorButtonDisabled);
    border-color: var(--colorButtonDisabled);
}

button:disabled:hover {
    color: var(--colorButtonDisabledText);
    background-color: var(--colorButtonDisabled);
    border-color: var(--colorButtonDisabled);
    cursor: default;
}

.fa-turn-down {
    transform: rotate(90deg);
}

.SudokuCell {
    display: block;
    position: relative;
    margin: 0px;
    padding: 0px;
    background-color: var(--colorBackground);
    cursor: default;
}

.SudokuCellExample {
    display: block;
    position: relative;
    margin: 0px;
    padding: 0px;
    background-color: var(--colorBackground);
    cursor: default; 
}

.SudokuCell.Guessed {
    cursor: default;
}

.SudokuScratches {
    display: grid;
    grid-template-rows: repeat(3, var(--scratchSize));
    position: absolute;
    top: 0;
    left: 0;
}

.CellRow {
    display: grid;
    grid-template-columns: repeat(3, var(--scratchSize));
}

.ScratchInput {
    font-family: var(--fontFamily);
    font-size: var(--fontSizeScratch);
    color: var(--colorPrimary);
    visibility: visible;
}

.ScratchInput.ScratchFaded:not(.ColorIncorrect):not(.ColorCorrectRowOrColumn):not(.ColorCorrectRow):not(.ColorCorrectColumn) {
    color: var(--colorFaded);
}

.ScratchInput.ColorIncorrect, .ScratchInput.ColorCorrectRowOrColumn, .ScratchInput.ColorCorrectRow, .ScratchInput.ColorCorrectColumn {
    color: var(--colorShrunkGuessText);
}

.CellRow .ScratchInput {
    height: var(--scratchSize);
    line-height: var(--scratchSize);
    display: block;
    z-index: 1;
}

.FocusRow:not(.Button) {
    border-bottom: solid var(--focusBorder) var(--colorFocus);
    z-index: 5;
}

.Focus:not(.Button) {
    border: solid var(--focusBorder) var(--colorFocus);
    border-radius: var(--focusBorder);
    margin: var(--focusMargin);
    z-index: 10;
}

.Alert {
    color: var(--colorAlert);
    background-color: var(--colorAlertAccent);
}

.Alert .GuessInput {
    background-color: var(--colorAlertAccent);
}

.Alert.Solved .GuessInput { 
    color: var(--colorAlert);
    background-color: var(--colorBackground);
}

.Duplicate .GuessInput {
    color: var(--colorAlert);
    animation: wigglePause 0.75s infinite;
}

@keyframes wigglePause {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(0deg); }
    50% { transform: rotate(7deg); }
    75% { transform: rotate(-7deg); }
    100% { transform: rotate(0deg); }
}

.GuessInput {
    font-family: var(--fontFamily);
    font-size: var(--fontSizeGuess);
    color: var(--colorPrimary);
    height: var(--cellSize);
    line-height: var(--cellSize);
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

.GuessInputExample {
    font-family: var(--fontFamily);
    font-size: var(--fontSizeGuess);
    color: var(--colorPrimary);
    height: var(--cellSize);
    line-height: var(--cellSize);
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

label {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-focus-ring-color: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    background: transparent;
    border: none;
    border-radius: 0xp;
    -webkit-border-radius: 0px;
    height: 100%;
    width: 100%;
    text-align: center;
    padding: 0;
    margin: 0px;
    cursor: inherit;
}

label::-webkit-input-placeholder {
    line-height:normal!important;
}

/* input:focus {
    outline: 0;
    outline-width: 0;
    caret-color: transparent;
}

input:disabled {
    color: black;
    -webkit-text-fill-color: rgba(0, 0, 0, 1);
    -webkit-opacity: 1;
    opacity: 1;
}

/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type=number] {
    -moz-appearance: textfield;
}

.Button.Focus button {
    border: solid var(--focusBorder) var(--colorFocus);
    border-radius: var(--focusBorder);
    background-color: var(--colorBackground);
    color: var(--colorPrimary);
}

.Button.Focus button:hover {
    color: var(--colorPrimary);
}

.ColorCorrectRow, .ColorCorrectRow button {
    background-color: var(--colorCorrectRow);
}

.ColorCorrectColumn, .ColorCorrectColumn button {
    background-color: var(--colorCorrectColumn);
}

.ColorCorrectRowOrColumn, .ColorCorrectRowOrColumn button {
    background-color: var(--colorCorrectRowOrColumn);
}

.ColorIncorrect {
    background-color: var(--colorIncorrect);
}

.ColorActive {
    background-color: var(--colorAccent);
}

.ColorIncorrect button {
    color: var(--colorButtonIncorrectText);
    background-color: var(--colorButtonIncorrect);
}

.Shrunk, .Solved {
    background-color: var(--colorBackground);
}

.Solved .GuessInput {
    background: repeating-linear-gradient(
        135deg,
        var(--colorBackground),
        var(--colorBackground) var(--stripingSize),
        var(--colorStriping) var(--stripingSize),
        var(--colorStriping) calc(2 * var(--stripingSize))
    );
}

.Hinted .GuessInput {
    background: repeating-linear-gradient(
        135deg,
        var(--colorCorrect),
        var(--colorCorrect) var(--stripingSize),
        var(--colorHintStriping) var(--stripingSize),
        var(--colorHintStriping) calc(2 * var(--stripingSize))
    );
}

.ColorPerfect, .ColorPerfect button {
    background-color: var(--colorCorrect);
}

.Hinted button {
    background-color: var(--colorCorrect);
}

.Button {
    background-color: var(--colorBackground);
}

.ScratchButton button {
    color: var(--colorButtonScratchText);
    background-color: var(--colorButtonScratch);
}

.ColorPerfect .ScratchInput:not(.Guessed):not(.Hinted) {
    visibility: hidden;
}

/* @media screen and (max-width: 768px) {
    .ArrowMode {
        visibility: hidden;
        display: none;
    }
} */

.Modal {
    display: none;
    position: absolute;
    z-index: 100;
    left: 0;
    top: var(--totalHeaderHeight);
    width: 100%;
    height: var(--totalBodyHeight);
    font-family: var(--fontFamily);
    font-size: var(--fontSizeNote);
    background-color: var(--colorBackground);
}

.Modal.Visible {
    display: block;
    animation: fadein 0.5s;
    animation-fill-mode: forwards;
}

.Modal.Background {
    z-index: 95;
}

.Modal.Hide {
    animation: fadeout 0.5s;
    animation-fill-mode: forwards;
}

@keyframes fadein {
	from { 
        opacity: 0
    }
	to { 
        opacity: 1
    }
}

@keyframes fadeout {
	from { 
        opacity: 1
    }
	to { 
        opacity: 0
    }
}

.Hide .ModalCloseButton, .Hide .ModalCloseButton:hover, .Hide .ModalCloseButton:active {
    color: var(--colorBackground);
}

.ModalContent {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    padding-left: calc(5 * var(--vw));
    padding-right: calc(5 * var(--vw));
    color: var(--colorPrimary);
}

.ContentHidden {
    display:none;
}

.Help p {
    line-height: 125%;
    margin-top: 5px;
    margin-bottom: 10px;
    color: var(--colorPrimary);
}

.ModalRow {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--puzzlePadding);
    height: var(--modalRowHeight);
    color: var(--colorPrimary);
    border: 0px;
}

.ModalCloseButton, .HelpNextButton, .HelpBackButton {
    display: flex;
    margin: 0px;
    padding: 5px;
    border: 0px;
    color: var(--colorPrimary);
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    background-color: var(--colorBackground);
    box-shadow: none;
    font-size: calc(var(--modalRowHeight) * 0.5);
    font-family: var(--fontFamily);
    text-align: center;
    vertical-align: middle;
}

.HelpNextButton:hover, .HelpBackButton:hover {
    color: var(--colorAccent);
}

.ModalCloseButton:hover {
    color: var(--colorAlert);
}

.ModalCloseButton:active {
    color: var(--colorBackground);
}

#HelpDigits {
    background-image: url("helpdigits.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    width: 100%
}

.ModalButton {
    display: inline-block;
    text-decoration: none;
    font-family: var(--fontFamily);
    font-weight: 400;
    font-size: 16pt;
    text-align: center;
    padding: 6px;
    color: var(--colorButtonText);
    background-color: var(--colorButton);
    border: 2px solid var(--colorButton);
    border-radius: 4px;
    box-shadow: none;
    cursor: pointer;
}

.ModalButton:hover {
    color: var(--colorButtonHoverText);
    background-color: var(--colorButtonHover);
    border: 2px solid var(--colorButtonHover);
}

.ResumeButton {
    color: var(--colorButtonText);
    background-color: var(--colorButtonActive);
    border: 2px solid var(--colorButtonActive);
}

.ResumeButton:hover {
    color: var(--colorButtonHoverText);
    background-color: var(--colorButtonActiveHover);
    border: 2px solid var(--colorButtonActiveHover);
}

.RestartButton {
    color: var(--colorButtonText);
    background-color: var(--colorAlertAccent);
    border: 2px solid var(--colorAlertAccent);
}

.RestartButton:hover {
    color: var(--colorButtonHoverText);
    background-color: var(--colorAlert);
    border: 2px solid var(--colorAlert);
}

.DiscordButton {
    display: inline-block;
    text-decoration: none;
    font-family: Whitney, "Open Sans", Helvetica, sans-serif;
    font-weight: 400;
    font-size: 11pt;
    padding: 6px;
    color: #fff;
    background-color: #7289da;
    border: 2px solid #7289da;
    border-radius: 3px;
    box-shadow: none;
    cursor: pointer;
}

.DiscordButton:hover {
    background-color: #4d5e9b;
    border: 2px solid #4d5e9b;
}

.GameStatus {
    text-align: center;
    font-size: var(--fontSizeHeader);
    color: var(--colorPrimary);
}

.GameOverMessage {
    text-align: center;
    font-size: var(--fontSizeBody);
    padding-top: 5px;
    color: var(--colorPrimary);
}

.StatisticsContent, .EndGameStatistics {
    display: flex;
    flex-direction: column;
    font-size: var(--fontSizeHeader);
    color: var(--colorPrimary);
}

.StatisticsContent, .EndGameStatistics {
    flex-grow: 1;
}

.EndGameStatistics .LeftColumn {
    width: 50px;
    flex: 0 0 50px;
    text-align: center;
    padding-right: 5px;
}

.Statistics .LeftColumn {
    width: 50px;
    flex: 0 0 50px;
    text-align: center;
    padding-right: 5px;
}

.Statistics .LeftColumnCanGrow {
    flex-grow: 1;
    text-align: left;
    padding-right: 5px;
}

.Statistics .MiddleColumNoPadding {
    flex-grow: 1;
    text-align: left;
}

.Statistics .MiddleColumn {
    flex-grow: 1;
    padding-left: 2px;
    padding-right: 15px;
    text-align: left;
}

.Statistics .RightColumn {
    flex-grow: 1;
    text-align: right;
}

.StatisticsRow, .EndGameStatisticsRow {
    display: flex;
    flex-direction: row;
    padding-top: 5px;
}

.StatisticsRow span {
    color: var(--colorPrimary);
}

#AveragesButton, #TotalsButton {
    font-size: var(--fontSizeHeader);
    padding: 6px 20px 6px;
}

@supports (display: grid){
    .UnsupportedDevice {
        display: none;
    }
}

@supports not (display: grid){
    .UnsupportedDevice {
        display: block;
    }

    .PuzzleContainer {
        display: none;
    }
}