* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 16px;
    color: #3d3428;
    background: linear-gradient(to bottom, #f2e8d9, #dcc9ad);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hidden {
    display: none !important;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.screen {
    flex: 1;
    width: 100%;
}

/* obere Navigationsleiste */

.topbar {
    background: #c4b08a;
    border-bottom: 2px solid #8a7555;
    padding: 0.75rem 1.5rem;
}

.topbar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem 2rem;
}

.topbar-nav__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    color: #3d3428;
    font-size: 0.8rem;
    cursor: pointer;
}

.topbar-nav__icon {
    width: 2.6rem;
    height: 2.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #5c4a32;
    border-radius: 50%;
    background: #ede4d4;
    font-size: 1rem;
    line-height: 1;
}

.topbar-nav__link--active .topbar-nav__icon {
    background: #f8f2e8;
    border-width: 3px;
}

.topbar-nav__link:hover .topbar-nav__icon {
    background: #f8f2e8;
}

/* Startbildschirm */

.start-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.5rem 3rem;
}

.login-link {
    align-self: flex-end;
    margin-bottom: 2rem;
    color: #3d3428;
    text-decoration: underline;
    font-size: 0.95rem;
}

.login-link:hover {
    color: #000;
}

.begin-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.begin-label {
    font-size: 1.1rem;
    font-weight: 600;
}

.begin-row input {
    width: 14rem;
    max-width: 60vw;
    padding: 0.4rem 0.6rem;
    border: 2px solid #8a7555;
    background: #f8f2e8;
    font: inherit;
    color: inherit;
}

.begin-row input:focus {
    outline: 2px solid #8a7555;
    outline-offset: 1px;
}

/* Spielkarten */

.game-cards {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    max-width: 18rem;
}

.game-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 7.5rem;
    padding: 1.25rem;
    color: inherit;
    background: #ede4d4;
    border: 2px solid #5c4a32;
}

.game-card__title {
    font-size: 1.25rem;
    font-weight: 600;
}

.game-card__btn {
    margin-top: 0.25rem;
    padding: 0.35rem 0.75rem;
    border: 2px solid #5c4a32;
    background: #f8f2e8;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.game-card__btn:hover {
    background: #fff;
}

/* Mathris L-Block */

.mathris-preview {
    display: grid;
    grid-template-columns: repeat(2, 1.25rem);
    grid-template-rows: repeat(2, 1.25rem);
    gap: 3px;
}

.mathris-preview .mathris-cell {
    background: #b85c28;
    border: 1px solid #5c4a32;
}

.mathris-preview .mathris-cell:first-child {
    grid-column: 1;
    grid-row: 1;
}

.mathris-preview .mathris-cell:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
}

.mathris-preview .mathris-cell:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
}

.zehner-equation {
    font-size: 1.35rem;
}

/* gemeinsame Panel- und Layout-Stile */

.screen-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.panel {
    background: #ede4d4;
    border: 2px solid #5c4a32;
    padding: 1.25rem;
}

.start-layout,
.game-layout,
.highscore-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 1.5rem;
    max-width: 72rem;
    margin: 0 auto;
    width: 100%;
}

.start-layout {
    align-items: flex-start;
}

.start-main {
    flex: 2;
    min-width: 16rem;
}

.start-right {
    flex: 1;
    min-width: 14rem;
}

.start-main p,
.start-right ul {
    margin-bottom: 1rem;
    line-height: 1.5;
}

.start-right ul {
    padding-left: 1.25rem;
}

.start-main label,
.settings-row h3 {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.start-main select,
.start-main input[type="number"],
.game-center input[type="number"] {
    padding: 0.4rem 0.6rem;
    border: 2px solid #8a7555;
    background: #f8f2e8;
    font: inherit;
    color: inherit;
}

.settings-row label {
    font-weight: normal;
    display: inline;
    margin: 0;
}

button {
    margin-top: 1rem;
    padding: 0.45rem 1rem;
    border: 2px solid #5c4a32;
    background: #f8f2e8;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

button:hover {
    background: #fff;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Spiel-Layouts */

.game-layout {
    align-items: stretch;
}

.game-left,
.game-right {
    flex: 1;
    min-width: 12rem;
}

.game-center {
    flex: 2;
    min-width: 18rem;
    text-align: center;
}

.game-left p,
.game-center p {
    margin-bottom: 0.5rem;
}

.game-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.game-actions button {
    margin-top: 0;
}

/* Mathtris */

#mathtrisTargetBlock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4rem;
    min-height: 4rem;
    margin: 1rem auto;
    padding: 0.75rem 1.25rem;
    background: #b85c28;
    border: 2px solid #5c4a32;
    color: #f8f2e8;
    font-size: 1.75rem;
    font-weight: 700;
}

#mathtrisNumberGrid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    max-width: 20rem;
    margin: 1rem auto;
}

.mathtris-number-cell {
    margin: 0;
    padding: 0.65rem;
    min-height: auto;
    background: #f8f2e8;
    border: 2px solid #8a7555;
    font-weight: 600;
}

.mathtris-number-cell.selected {
    background: #c4b08a;
    border-color: #5c4a32;
}

#mathtrisFeedback {
    margin-top: 1rem;
    min-height: 1.5rem;
}

/* 10er Aufgabe */

.aufgabe {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.box {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 3rem;
    min-height: 3rem;
    padding: 0.5rem;
    background: #f8f2e8;
    border: 2px solid #5c4a32;
    font-size: 1.25rem;
    font-weight: 600;
}

#answer10er {
    width: 5rem;
    text-align: center;
}

#feedback10er {
    margin-top: 0.75rem;
    min-height: 1.5rem;
}

/* Highscore */

.highscore-layout {
    justify-content: center;
}

.highscore-container {
    flex: 1;
    min-width: 16rem;
    max-width: 24rem;
}

.highscore-container ol {
    padding-left: 1.5rem;
    line-height: 1.6;
}
