hr{
    width: 100%;
}







#loginOrSignup{
    display: none;
}








input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
    color: rgb(170, 167, 167);
    opacity: 1; /* Firefox */
  }

  :-ms-input-placeholder { /* Internet Explorer 10-11 */
    color: rgb(170, 167, 167);
  }

  ::-ms-input-placeholder { /* Microsoft Edge */
    color: rgb(170, 167, 167);
  }




.titleGeneral{
    font-weight: bolder;
}

.inputGeneral{
    font-size: 3rem;
    padding: 0.5rem;
    text-align: center;
}

#taskDiv{
    font-size: 4em;
}

.smallerText{
    font-size: 1rem;
}

#progressContainer {
    width: 80%;
    max-width: 400px;
    height: 1.5rem;
    background-color: rgba(128, 128, 128, 0.3);
    border-radius: 0.75rem;
    overflow: hidden;
    margin: 0.5rem auto;
    border: 2px solid var(--color);
}

#progressBar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    transition: transform 0.3s ease;
    transform-origin: left;
    transform: scaleX(0);
}

#gameControls {
    position: fixed;
    top: calc(var(--header-height) + 0.5rem);
    left: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

#gameControls button {
    width: 3rem;
    height: 3rem;
    border: 2px solid var(--color);
    border-radius: 50%;
    background-color: var(--panel-color);
    color: var(--color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#gameControls button svg {
    display: block;
}

#gameControls #pauseButton {
    display: none;
}

#gameControls button:hover {
    opacity: 0.7;
}

#warningBtn {
    position: fixed;
    bottom: 3rem;
    left: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #cc3333;
    padding: 0;
    transform: rotate(-15deg);
    /* The warning remains still until the user opens it. */
    z-index: 100;
}

#warningBtn svg {
    width: 48px;
    height: 48px;
}

#warningBtn:hover {
    color: #ff4444;
}

@keyframes pulse {
    0%, 100% { transform: rotate(-15deg) scale(1); opacity: 1; }
    50% { transform: rotate(-15deg) scale(1.1); opacity: 0.8; }
}

#warningPopup {
    position: fixed;
    bottom: 2rem;
    left: 4.5rem;
    background-color: var(--panel-color);
    border: 2px solid #cc3333;
    border-radius: 0.5rem;
    padding: 1rem;
    max-width: 20rem;
    text-align: left;
    font-size: 1.4rem;
    line-height: 1.4;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

#warningPopup.hidden {
    display: none;
}

#warningPopup p {
    margin: 0;
}

/* Firefox
input[type=number] {
  /* -moz-appearance: textfield; */
/* } */ 

/* body{
    margin: 0;
} */

.playField{
    text-align: center;
    padding: 0.5rem;
    font-size: 2em;
    padding-inline: 2em;
    background-color: transparent;

    
}

.gameTypeBtn{
    text-shadow: -1px 0 var(--bgcolor), 0 1px var(--bgcolor), 1px 0 var(--bgcolor), 0 -1px var(--bgcolor); 
    text-align: center;
    padding: 0.5rem;
    font-size: 2em;
    padding-inline: 2em;
    background-color: transparent;

}

.gameTypeBtn:hover{
    opacity: 0.5;
}



#playAreaWrapper{
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    min-width: 50%;

}

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

#imageHolder{
    display: none;
}

#myCanvas{
    height: 90vh;
    aspect-ratio: 1/1;
    margin: 1rem;
}

#mainWrapper{
    display: flex;
    width: 100%;
    height: 100vh;


}

#answerInput{
    width: 50%;
    height: 3.5rem;
    margin: 1rem auto;
    transition: box-shadow 0.1s;
    border-radius: 0.75rem;
}

.error{
      animation: shake 0.2s ease-in-out 0s 2;
      box-shadow: 0 0 0.5em red;
}


@keyframes shake {
  0% { margin-left: 0rem; }
  25% { margin-left: 0.5rem; }
  75% { margin-left: -0.5rem; }
  100% { margin-left: 0rem; }
}

#menuDiv{
    background-color: var(--bgcolor);
    padding: 4rem;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 2px solid var(--color);
    border-radius: 1rem;
    z-index: 3;
}

#disableScreen{
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
    background-color: var(--bgcolor);
}


@media screen and (orientation:portrait) {
    
    #canvasWrapper{
    position: absolute;
    left: 0%;
    opacity: 0.1;
    
}

#playAreaWrapper{
    width: 90%;
    z-index: 2;
    
}

#myCanvas{
    height: 100vw;
    aspect-ratio: 1/1;
    margin: 0rem;
}

.playField{
    font-size: 1.5em;
    padding: 0.5rem;
    padding-inline: 1em;
}

}

/* Short landscape screens (Chromebooks with toolbars, etc.) */
@media screen and (orientation:landscape) and (max-height: 600px) {
    
    #mainWrapper {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    #myCanvas {
        height: 70vh;
        max-height: 400px;
    }

    #menuDiv {
        padding: 1.5rem 2rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    #taskDiv {
        font-size: 2.5em;
    }

    .inputGeneral {
        font-size: 2rem;
    }

    #answerInput {
        height: 2.5rem;
        margin: 0.5rem auto;
    }

    .playField {
        padding: 0.25rem;
        font-size: 1.5em;
    }

    .gameTypeBtn {
        font-size: 1.5em;
        padding: 0.3rem;
        padding-inline: 1.5em;
    }

    #playAreaWrapper {
        justify-content: center;
        gap: 0.5rem;
    }
}

/* Very short screens */
@media screen and (orientation:landscape) and (max-height: 450px) {
    
    #myCanvas {
        height: 60vh;
        max-height: 300px;
    }

    #menuDiv {
        padding: 1rem 1.5rem;
    }

    #taskDiv {
        font-size: 2em;
    }

    .gameTypeBtn {
        font-size: 1.2em;
        padding: 0.2rem;
        padding-inline: 1em;
    }

    .smallerText {
        font-size: 0.8rem;
    }
}

/* Numpad – skjult som standard, kun synlig på mobil/nettbrett */
#numpad {
    display: none;
}

/* Ren touch-enhet (mobil/nettbrett): ingen mus, skjerm <= 1024px */
@media (hover: none) and (pointer: coarse) and (max-width: 1024px) {
    #numpad {
        display: grid;
    }
}

#numpad {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    width: min(260px, 80vw);
    margin: 0.5rem auto;
}

.numpad-btn {
    font-size: 2rem;
    font-weight: bold;
    padding: 0.6rem;
    border: 2px solid var(--color);
    border-radius: 0.75rem;
    background-color: var(--panel-color);
    color: var(--color);
    cursor: pointer;
    min-height: 3.2rem;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: background-color 0.1s, transform 0.08s;
}

.numpad-btn:active {
    background-color: var(--hover-bg-color, #ddd);
    transform: scale(0.93);
}

.numpad-backspace {
    background-color: transparent;
    opacity: 0.7;
}

#numpad-send {
    background-color: #257125;
    color: #fff;
    border-color: #3a9a3a;
}

/* Allow ordinary controls and text to reflow separately from the square grid. */
#mainWrapper { min-height: calc(100dvh - var(--header-height)); height: auto; align-items: center; }
#playAreaWrapper, #canvasWrapper { min-width: 0; flex: 1 1 0; }
#canvasWrapper { max-width: 50%; }
#myCanvas { width: min(100%, 80vh); height: auto; aspect-ratio: 1; margin: 0; }
#answerInput { box-sizing: border-box; max-width: 100%; height: auto; min-height: 3.5rem; }
#menuDiv { box-sizing: border-box; width: max-content; max-width: calc(100% - 1rem); padding: 1rem; top: calc(var(--header-height) + 1rem); transform: translateX(-50%); }
.gameTypeBtn, .titleGeneral { overflow-wrap: anywhere; min-width: 0; }
.gameTypeBtn { padding-inline: 0.5rem; }
#warningPopup { box-sizing: border-box; max-width: calc(100vw - 2rem); left: 1rem; bottom: 6rem; max-height: 65dvh; overflow: auto; }
#multiplicationSummary { font-size: 1rem; text-align: center; margin: 0.25rem 0 0.75rem; }
@media (min-width: 701px) and (orientation: landscape) {
    #menuDiv { position: fixed; top: 50%; transform: translate(-50%, -50%); max-height: calc(100dvh - var(--header-height) - var(--header-height) - 2rem); overflow-y: auto; }
}
@media (max-width: 700px), (orientation: portrait) {
    #mainWrapper { flex-direction: column; padding-top: 3rem; }
    #playAreaWrapper { width: 100%; }
    #canvasWrapper { position: static; opacity: 1; max-width: 100%; width: 100%; }
    #myCanvas { width: 100%; height: auto; }
    .playField { padding-inline: 0.5rem; }
}
@media (prefers-reduced-motion: reduce) { .error, #warningBtn { animation: none; } }

#numpad-send:active {
    background-color: #2d7a2d;
}

@media screen and (orientation:portrait) {
    #numpad {
        width: min(300px, 88vw);
        gap: 0.6rem;
    }

    .numpad-btn {
        font-size: 2.2rem;
        min-height: 3.8rem;
    }
}

@media screen and (orientation:landscape) and (max-width: 1024px) {
    #numpad {
        display: flex;
        flex-wrap: nowrap;
        flex-direction: row;
        width: 100%;
        gap: 0;
        margin: 0.1rem auto;
    }

    .numpad-btn {
        font-size: 0.95rem;
        min-height: 1.8rem;
        padding: 0.1rem 0;
        flex: 1;
        border-radius: 0.3rem;
    }
}
