:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --background: #f1f5f9;
    --surface: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #cbd5e1;
    --success: #16a34a;
    --danger: #dc2626;
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
}

nav {
    max-width: 1200px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    font-size: 22px;
    font-weight: bold;
    color: var(--primary);
    text-decoration: none;
}

.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.04);
}

.login-card {
    max-width: 450px;
    margin: 60px auto;
}

h1, h2, h3 {
    line-height: 1.3;
    margin-top: 0;
}

a {
    color: var(--primary);
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
}

input, textarea, select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    background: var(--surface);
    color: var(--text);
}

input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.form-group {
    margin-bottom: 18px;
}

.btn {
    display: inline-block;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    font-size: 16px;
    cursor: pointer;
    text-align: center;
}

.btn:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #64748b;
}

.btn-danger {
    background: var(--danger);
}

.btn-success {
    background: var(--success);
}

.btn-block {
    width: 100%;
}

.alert {
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 8px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.muted {
    color: var(--muted);
}

.grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit, minmax(250px, 1fr)
    );
    gap: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

footer {
    text-align: center;
    color: var(--muted);
    padding: 25px;
    font-size: 13px;
}

@media (max-width: 600px) {
    .container {
        padding: 0 12px;
        margin-top: 15px;
    }

    .card {
        padding: 18px;
    }

    .login-card {
        margin: 25px auto;
    }
}

/* Verwaltung der Vokabellisten */

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.toolbar h1,
.toolbar h2 {
    margin: 0;
}

.stat-number {
    font-size: 42px;
    font-weight: bold;
    color: var(--primary);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.status-active,
.status-inactive {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-inactive {
    background: #e2e8f0;
    color: #475569;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: normal;
}

.checkbox-label input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.vocab-row {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr)
        42px;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.vocab-row .btn {
    padding: 10px;
    font-size: 20px;
}

.vocab-heading {
    padding: 0 5px;
}

#vocab-rows {
    margin-bottom: 15px;
}

#schnelleingabe {
    font-family: monospace;
    font-size: 15px;
    line-height: 1.8;
}

@media (max-width: 600px) {

    .vocab-row {
        gap: 5px;
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr)
            36px;
    }

    .vocab-row input {
        padding: 10px 7px;
    }

    .actions .btn {
        flex-grow: 1;
    }
}

/* Vokabelspiel */

.game-header {
    text-align: center;
}

.game-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
    margin: 20px 0;
    font-size: 18px;
}

.game-progress {
    height: 12px;
    background: #e2e8f0;
    border-radius: 20px;
    overflow: hidden;
}

#game-progress-bar {
    width: 0;
    height: 100%;
    background: var(--success);
    transition: width 0.3s ease;
}

.game-board {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr);
    gap: 30px;
    max-width: 900px;
    margin: auto;
}

.game-column h2 {
    text-align: center;
    font-size: 20px;
    margin-bottom: 20px;
}

.game-word {
    display: block;
    width: 100%;
    min-height: 65px;
    padding: 12px;
    margin-bottom: 12px;

    background: #f8fafc;
    color: var(--text);

    border: 2px solid #cbd5e1;
    border-radius: 12px;

    font-size: 19px;
    font-weight: 500;

    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;

    overflow-wrap: anywhere;

    transition:
        background 0.2s,
        border-color 0.2s;
}

.game-word[data-side="right"] {
    background: #eff6ff;
    border-color: #93c5fd;
}

.game-word:hover:not(:disabled) {
    border-color: var(--primary);
}

.game-word.selected {
    background: #dbeafe;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px #bfdbfe;
}

.game-word.matched {
    background: #dcfce7;
    border-color: #22c55e;
    color: #166534;
    cursor: default;
    opacity: 1;
}

.game-word.matched::before {
    content: "✓ ";
    font-weight: bold;
}

.game-word.wrong {
    background: #fee2e2;
    border-color: #dc2626;
    color: #991b1b;
}

.game-word.dragging {
    opacity: 0.4;
}

.game-drag-ghost {
    position: fixed;
    z-index: 9999;
    pointer-events: none;

    transform: translate(-50%, -50%);

    background: #2563eb;
    color: white;

    padding: 15px 25px;
    border-radius: 12px;

    font-size: 19px;
    font-weight: bold;

    max-width: 80vw;

    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}

.game-message {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    min-height: 30px;
    margin-top: 25px;
}

.game-message.success {
    color: #16a34a;
}

.game-message.error {
    color: #dc2626;
}

#game-result {
    text-align: center;
    border: 2px solid #22c55e;
}

@media (max-width: 600px) {

    .game-board {
        gap: 12px;
    }

    .game-word {
        min-height: 55px;
        font-size: 16px;
        padding: 8px;
    }

    .game-column h2 {
        font-size: 17px;
    }

    .game-stats {
        font-size: 15px;
    }
}

/* Verwaltung: Kopieren und Löschen */

.inline-form {
    display: inline-flex;
    margin: 0;
    padding: 0;
}

.inline-form .btn {
    margin: 0;
}

/* QR-Code */

.qr-card {
    text-align: center;
}

#qrcode {
    display: flex;
    justify-content: center;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    padding: 20px;
    margin: 30px auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-sizing: border-box;
}

#qrcode img,
#qrcode canvas {
    max-width: 100%;
    height: auto;
}

.qr-link {
    overflow-wrap: anywhere;
    font-size: 14px;
}

@media (max-width: 600px) {

    .inline-form {
        flex-grow: 1;
    }

    .inline-form .btn {
        width: 100%;
    }
}

/* Druckansicht */

@media print {

    header,
    footer,
    nav,
    .no-print {
        display: none !important;
    }

    body {
        background: #ffffff;
        color: #000000;
    }

    .container {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .qr-card {
        border: none;
        box-shadow: none;
    }

    #qrcode {
        border: none;
        break-inside: avoid;
    }
}

/* Import und Export */

.secondary-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.upload-area {
    padding: 25px;
    border: 2px dashed #94a3b8;
    border-radius: 12px;
    background: #f8fafc;
    text-align: center;
    margin: 15px 0;
}

.upload-area input[type="file"] {
    width: 100%;
    max-width: 500px;
    padding: 10px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-sizing: border-box;
}

.upload-area input::file-selector-button {
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 10px 15px;
    margin-right: 10px;
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

@media (max-width: 600px) {

    .upload-area {
        padding: 15px;
    }

    .secondary-actions .btn {
        font-size: 14px;
    }
}

/* Benutzerverwaltung */

.user-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.role-admin {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 600;
}

.role-user {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    background: #f1f5f9;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
}

.nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.nav-username {
    font-size: 14px;
    font-weight: 600;
}

@media (max-width: 768px) {

    header nav {
        flex-wrap: wrap;
        gap: 12px;
    }

    .nav-links {
        gap: 10px;
        flex-wrap: wrap;
    }

    .nav-username {
        width: 100%;
    }

    .user-badges {
        margin-bottom: 5px;
    }
}

/* ----------------------------------------
   Persönliches Benutzerprofil
   ---------------------------------------- */

.profile-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 20px;
}

.profile-container .card {
    margin-bottom: 0;
}

.profile-container input[readonly] {
    background: #f1f5f9;
    color: #64748b;
    cursor: default;
}

.profile-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px 0;
    margin: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.profile-details label {
    display: block;
    margin-bottom: 8px;
}

.field-hint {
    font-size: 13px;
    margin-top: 6px;
    line-height: 1.5;
}

.profile-container .checkbox-label {
    margin-top: 15px;
}

.profile-container .actions {
    margin-top: 20px;
}

@media (max-width: 768px) {

    .profile-container {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 400px) {

    .profile-details {
        grid-template-columns: 1fr;
        gap: 15px;
    }

}

/* ----------------------------------------
   Suche, Filter und Sortierung
   ---------------------------------------- */

.filter-card {
    margin-bottom: 24px;
}

.filter-card h2 {
    margin-bottom: 20px;
}

.search-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.search-row input {
    flex: 1;
    min-width: 0;
}

.search-row .btn {
    flex-shrink: 0;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
}

.filter-grid select {
    width: 100%;
}

.filter-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 15px;
    margin-top: 5px;
    border-top: 1px solid var(--border);
}

.filter-result {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    font-size: 14px;
    color: var(--muted);
}

.filter-result strong {
    color: var(--primary);
}

.filter-active {
    display: inline-block;
    padding: 4px 10px;
    margin-left: 5px;
    border-radius: 20px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 600;
}

.list-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.list-tag {
    display: inline-block;
    padding: 5px 10px;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 13px;
    color: #475569;
}

.list-date {
    font-size: 12px;
    margin: 12px 0 18px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state .actions {
    justify-content: center;
    margin-top: 20px;
}

/* Tablet */

@media (max-width: 900px) {

    .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

/* Smartphone */

@media (max-width: 480px) {

    .filter-grid {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .search-row {
        flex-direction: column;
    }

    .search-row .btn {
        width: 100%;
    }

    .filter-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-footer .btn {
        text-align: center;
    }

    .filter-result {
        justify-content: center;
    }

}

/* ========================================
   Erweiterte Spieleinstellungen
   ======================================== */

.game-intro {
    margin-bottom: 20px;
}

.game-settings-card {
    max-width: 720px;
    margin: 0 auto 25px;
}

.game-setting-group {
    margin: 20px 0;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.game-setting-group > label:first-child {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
}

.game-setting-group .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
    font-weight: normal;
    cursor: pointer;
}

.game-setting-group input[type="radio"],
.game-setting-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--primary);
}

.game-settings-card .btn-block {
    width: 100%;
    padding: 14px;
    font-size: 17px;
}

/* ========================================
   Spielfeld
   ======================================== */

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.game-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 15px;
    margin: 20px 0;
}

.game-stat {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.game-stat strong {
    font-size: 24px;
    color: var(--primary);
}

.game-words {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-word {
    width: 100%;
    min-height: 58px;
    overflow-wrap: anywhere;
    white-space: normal;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.game-word.matched {
    opacity: 1;
    cursor: default;
}

.game-word:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

.game-drag-ghost {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    transform: translate(-50%, -50%);
    max-width: 240px;
    overflow-wrap: anywhere;
    padding: 14px 20px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* ========================================
   Spielergebnis
   ======================================== */

.game-result-card {
    max-width: 800px;
    margin: 20px auto;
}

.result-heading {
    text-align: center;
    margin-bottom: 25px;
}

.result-trophy {
    font-size: 60px;
    margin-bottom: 12px;
}

.result-heading h1 {
    color: var(--success);
    margin-bottom: 10px;
}

.result-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 25px;
}

.result-stat {
    flex: 1;
    min-width: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 10px;
    background: #f1f5f9;
    border-radius: 12px;
}

.result-stat strong {
    font-size: 26px;
}

.result-stat span {
    font-size: 13px;
    color: var(--muted);
}

.result-green {
    color: var(--success);
}

.result-red {
    color: var(--danger);
}

.result-blue {
    color: var(--primary);
}

#result-review {
    margin: 25px 0;
}

.review-table {
    width: 100%;
    table-layout: fixed;
    margin: 15px 0;
}

.review-table th,
.review-table td {
    padding: 12px;
    overflow-wrap: anywhere;
}

.review-table tbody tr:nth-child(odd) {
    background: #f8fafc;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 25px;
}

.result-actions .btn {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

/* ========================================
   Smartphone und Tablet
   ======================================== */

@media (max-width: 600px) {

    .game-word {
        min-height: 52px;
        font-size: 14px;
        padding: 10px 8px;
    }

    .game-words {
        gap: 8px;
    }

    .game-stat strong {
        font-size: 20px;
    }

    .game-stat .muted {
        font-size: 12px;
    }

    .result-stat {
        padding: 15px 5px;
    }

    .result-stat strong {
        font-size: 22px;
    }

    .result-stat span {
        font-size: 11px;
    }

    .game-setting-group .checkbox-label {
        line-height: 1.5;
    }

    .result-trophy {
        font-size: 48px;
    }

}

/* ========================================
   Spieleinstellungen der Lehrkraft
   ======================================== */

.teacher-game-settings {
    margin-top: 20px;
}

.teacher-settings-group {
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

.teacher-settings-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.teacher-settings-group h3 {
    margin: 0 0 15px;
    font-size: 17px;
}

.teacher-settings-group .checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 0;
    font-weight: normal;
    cursor: pointer;
}

.teacher-settings-group input[type="radio"],
.teacher-settings-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--primary);
}

/* Bewertungsmodus */

.teacher-mode-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-weight: normal;
}

.teacher-mode-option:has(input:checked) {
    border-color: var(--primary);
    background: #eff6ff;
}

.teacher-mode-option input {
    margin-top: 3px;
}

.teacher-mode-option strong {
    display: block;
    margin-bottom: 6px;
}

.teacher-mode-option small {
    display: block;
    font-size: 13px;
    line-height: 1.6;
    color: var(--muted);
}

/* Deaktivierte Optionen */

.option-disabled {
    opacity: 0.45;
    cursor: not-allowed !important;
}

/* Schülerberechtigungen */

.teacher-settings-info {
    margin-top: 15px;
    padding: 16px;
    border-radius: 10px;
    background: #f1f5f9;
    border-left: 4px solid #64748b;
}

.teacher-settings-info strong {
    display: block;
    margin-bottom: 6px;
}

.teacher-settings-info p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--muted);
}

.teacher-settings-info.student-settings-allowed {
    background: #eff6ff;
    border-left-color: var(--primary);
}

/* Vokabeleingabe */

#vocab-counter {
    font-size: 14px;
    font-weight: 600;
}

#vocab-rows {
    margin-bottom: 15px;
}

.edit-save-actions {
    margin: 20px 0 30px;
}

/* Mobile Darstellung */

@media (max-width: 600px) {

    .teacher-mode-option {
        padding: 12px;
    }

    .teacher-settings-group {
        padding: 15px 0;
    }

    .teacher-settings-group .checkbox-label {
        align-items: flex-start;
        line-height: 1.5;
    }

    .edit-save-actions {
        flex-direction: column;
    }

    .edit-save-actions .btn {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }

}

/* ========================================
   Vokabellisten – Spieleinstellungen
   ======================================== */

.list-game-settings {
    margin: 16px 0;
    padding: 16px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.list-game-settings-title {
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.list-game-settings-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.list-game-setting {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.list-game-label {
    color: var(--muted);
    font-size: 12px;
}

.list-game-setting strong {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

/* Weitere Spieloptionen */

.list-game-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.list-game-option {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.game-option-on {
    color: #166534;
    background: #dcfce7;
}

.game-option-off {
    color: #64748b;
    background: #e2e8f0;
}

/* Inaktive Vokabellisten */

.vocabulary-list-inactive {
    border-left: 4px solid #94a3b8;
}

.vocabulary-list-inactive .list-game-settings {
    background: #f8fafc;
}

.inactive-list-hint {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 13px;
}

/* Beschreibung */

.list-description {
    line-height: 1.6;
    overflow-wrap: anywhere;
}

/* Tablet */

@media (max-width: 900px) {

    .list-game-settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

}

/* Smartphone */

@media (max-width: 480px) {

    .list-game-settings {
        padding: 12px;
    }

    .list-game-settings-grid {
        gap: 12px;
    }

    .list-game-setting strong {
        font-size: 13px;
    }

    .list-game-options {
        gap: 6px;
    }

    .list-game-option {
        font-size: 11px;
        padding: 5px 8px;
    }

}

/* ========================================
   Erweiterte Spielmodi
   ======================================== */

.game-mode-label {
    display: inline-block;
    margin-top: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.game-instructions {
    margin: 15px 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--muted);
}

/* Wort-Buttons */

.game-word {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 58px;
    overflow-wrap: anywhere;
    user-select: none;
    -webkit-user-select: none;
}

.game-word-text {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.game-word.selected {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.game-word.drop-target {
    outline: 3px dashed var(--primary);
    outline-offset: 2px;
}

.game-word.dragging {
    opacity: 0.45;
}

/* ========================================
   Abschließender Bewertungsmodus
   ======================================== */

.game-final-mode #game-progress-bar {
    background: #64748b;
}

.game-word.assigned {
    background: #f1f5f9;
    border: 2px solid var(--pair-color);
    color: #1e293b;
}

.game-pair-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 5px;
    box-sizing: border-box;
    border-radius: 50px;
    background: var(--pair-color, #64748b);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.game-final-mode .game-word {
    cursor: grab;
}

.game-final-mode .game-word:active {
    cursor: grabbing;
}

/* Neutrale Rückmeldung */

.game-message.neutral {
    color: #475569;
}

/* ========================================
   Abschließende Auswertung
   ======================================== */

.game-evaluation-actions {
    margin-top: 20px;
}

.game-evaluation-actions .actions {
    justify-content: space-between;
}

.game-evaluation-actions button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.game-table-scroll {
    width: 100%;
    overflow-x: auto;
}

.evaluation-table {
    width: 100%;
    border-collapse: collapse;
}

.evaluation-table th,
.evaluation-table td {
    padding: 12px;
    text-align: left;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

.evaluation-table th {
    background: #f1f5f9;
    font-size: 13px;
}

.evaluation-table td {
    font-size: 14px;
}

.evaluation-correct {
    background: #f0fdf4;
}

.evaluation-wrong {
    background: #fef2f2;
}

.answer-correct {
    color: #166534;
    font-weight: 600;
}

.answer-wrong {
    color: #b91c1c;
    font-weight: 600;
}

.correct-solution {
    font-weight: 600;
}

#result-evaluation {
    margin: 25px 0;
}

#result-evaluation h2 {
    font-size: 19px;
}

.game-unavailable {
    max-width: 720px;
    margin: 30px auto;
}

/* ========================================
   Smartphone
   ======================================== */

@media (max-width: 600px) {

    .game-word {
        min-height: 52px;
        padding: 10px 8px;
        gap: 5px;
    }

    .game-word-text {
        font-size: 14px;
    }

    .game-pair-marker {
        min-width: 23px;
        height: 23px;
        font-size: 11px;
        padding: 0 4px;
    }

    .game-evaluation-actions .actions {
        flex-direction: column;
    }

    .game-evaluation-actions .btn {
        width: 100%;
    }

    .evaluation-table th,
    .evaluation-table td {
        padding: 8px;
        font-size: 12px;
    }

    .game-instructions {
        font-size: 13px;
    }


}

/* ========================================
   Korrektur SVG-Verbindungslinien
   ======================================== */

#game-board {
    position: relative !important;
    display: grid !important;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr) !important;
    gap: 120px !important;
    isolation: isolate;
}

#game-board > #game-connection-lines {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    pointer-events: none !important;
    overflow: visible !important;
    z-index: 2 !important;
}

#game-board > .game-column {
    position: relative;
    min-width: 0;
    z-index: 3;
}

@media (max-width: 900px) {
    #game-board {
        gap: 80px !important;
    }
}

@media (max-width: 600px) {
    #game-board {
        gap: 45px !important;
    }
}

@media (max-width: 380px) {
    #game-board {
        gap: 32px !important;
    }
}

/* ========================================
   Hilfe und Bedienungsanleitung
   ======================================== */

.help-intro {
    border-left: 4px solid var(--primary, #2563eb);
}

.help-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.help-navigation a {
    display: inline-block;
    padding: 9px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: #1d4ed8;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.help-navigation a:hover {
    background: #dbeafe;
}

.help-section {
    scroll-margin-top: 25px;
}

.help-section > h2 {
    margin-bottom: 20px;
}

/* Aufklappbare Hilfethemen */

.help-item {
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    margin-bottom: 10px;
    background: #ffffff;
    overflow: hidden;
}

.help-item:last-child {
    margin-bottom: 0;
}

.help-item summary {
    padding: 16px 18px;
    cursor: pointer;
    font-weight: 600;
    color: #1e293b;
    background: #f8fafc;
    line-height: 1.5;
}

.help-item summary:hover {
    background: #eff6ff;
}

.help-item summary:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: -3px;
}

.help-item summary::marker {
    color: #2563eb;
}

.help-item[open] > summary {
    background: #eff6ff;
    color: #1d4ed8;
    border-bottom: 1px solid #dbeafe;
}

.help-content {
    padding: 18px 22px;
    line-height: 1.7;
}

.help-content p {
    margin: 0 0 14px;
}

.help-content p:last-child {
    margin-bottom: 0;
}

.help-content h4 {
    margin: 20px 0 8px;
    font-size: 16px;
}

.help-content h4:first-child {
    margin-top: 0;
}

.help-content ul,
.help-content ol {
    padding-left: 24px;
    margin: 10px 0 18px;
}

.help-content li {
    margin-bottom: 6px;
}

/* Hinweise */

.help-tip {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
    padding: 13px 16px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
    color: #1e40af;
}

.help-warning {
    background: #fff7ed;
    border-left: 4px solid #ea580c;
    padding: 13px 16px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
    color: #9a3412;
}

/* Beispiele für Schnelleingabe */

.help-code {
    font-family: monospace;
    font-size: 15px;
    line-height: 1.8;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    padding: 18px;
    margin: 16px 0;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    user-select: text;
}

/* Tabellen */

.help-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    margin: 16px 0;
}

.help-table th {
    background: #f1f5f9;
    font-weight: 600;
}

.help-table th,
.help-table td {
    padding: 11px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    overflow-wrap: anywhere;
}

/* Grafische Spielbeispiele */

.help-example-board {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(35px, 100px)
        minmax(0, 1fr);
    align-items: center;
    max-width: 650px;
    margin: 20px auto;
}

.help-example-word {
    padding: 14px 8px;
    background: #f8fafc;
    border: 2px solid #94a3b8;
    border-radius: 9px;
    text-align: center;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.help-example-line {
    height: 3px;
    background: #64748b;
}

.help-example-correct {
    background: #dcfce7;
    border-color: #16a34a;
    color: #166534;
}

.help-line-correct {
    background: #16a34a;
}

.help-example-wrong {
    background: #fee2e2;
    border-color: #dc2626;
    color: #991b1b;
}

.help-line-wrong {
    background: #dc2626;
}

.help-example-neutral {
    background: #f5f3ff;
    border-color: #7c3aed;
    color: #5b21b6;
}

.help-line-neutral {
    background: #7c3aed;
}

/* Abschluss */

.help-feedback {
    border-left: 4px solid #64748b;
}

.help-bottom {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin: 25px 0;
}

/* Smartphone und Tablet */

@media (max-width: 600px) {

    .help-navigation {
        gap: 7px;
    }

    .help-navigation a {
        font-size: 13px;
        padding: 8px 10px;
    }

    .help-item summary {
        padding: 13px 12px;
        font-size: 15px;
    }

    .help-content {
        padding: 14px 12px;
        font-size: 14px;
    }

    .help-content ul,
    .help-content ol {
        padding-left: 20px;
    }

    .help-table th,
    .help-table td {
        padding: 8px 6px;
        font-size: 12px;
    }

    .help-example-board {
        grid-template-columns:
            minmax(0, 1fr)
            40px
            minmax(0, 1fr);
    }

    .help-example-word {
        font-size: 13px;
        padding: 12px 5px;
    }

    .help-bottom .btn {
        flex: 1;
        text-align: center;
    }

}
