body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #222;
    display: block;
}

body.kapitel-scroll-fix {
    overflow: hidden;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Kein overflow: hidden; */
}

/* Nur für Kapitel-Seite: spezielles Layout */
.container.kapitel-layout {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
}

.top-buttons {
    position: absolute;
    top: 40px;
    left: 0;
    width: 100vw;
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 0;
}

.nav-btn {
    background: #23243a;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 14px 36px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.nav-btn:hover {
    background: #35365a;
}

a.nav-btn {
    text-decoration: none;
    color: #fff;
}

a.nav-btn:visited {
    color: #fff;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 16px;
    margin-top: 0;
}

.subtitle {
    font-size: 1.1rem;
    margin-bottom: 32px;
}

.main-buttons {
    display: flex;
    gap: 2rem;
    margin-bottom: 32px;
}

.main-btn {
    background: #23243a;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 18px 38px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    display: inline-block;
}

.main-btn:hover {
    background: #35365a;
}

.main-btn:visited {
    color: #fff;
}

.tipp {
    font-size: 0.95rem;
    color: #444;
    margin-top: 0;
    margin-bottom: 0;
    text-align: center;
}

.form-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(35,36,58,0.08);
    padding: 2.5rem 2rem;
    min-width: 320px;
    margin-top: 1.5rem;
}

.form-box input {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid #c3cfe2;
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
    transition: border 0.2s;
}

.form-box input:focus {
    border: 1.5px solid #23243a;
}

.form-box button.main-btn {
    width: 100%;
    margin-top: 0.5rem;
}

.nav-btn.active {
    background: #35365a;
}

.form-link {
    margin-top: 1.2rem;
    text-align: center;
    font-size: 1rem;
}

.form-link a {
    color: #23243a;
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s;
}

.form-link a:hover {
    color: #35365a;
}

.back-btn {
    margin-top: 1.2rem;
    background: #c3cfe2;
    color: #23243a;
    font-weight: 600;
    text-align: center;
    display: block;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.back-btn:hover {
    background: #23243a;
    color: #fff;
}

.small-back-btn {
    font-size: 1.08rem;
    padding: 13px 36px;
    min-width: 160px;
    width: auto;
    margin: 1.5rem auto 0 auto;
    display: block;
    background: #c3cfe2;
    color: #23243a;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(35,36,58,0.10);
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.small-back-btn:hover {
    background: #23243a;
    color: #fff;
    box-shadow: 0 4px 16px rgba(35,36,58,0.13);
}

.account-box {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2rem;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(35,36,58,0.08);
    padding: 2.5rem 2rem;
    min-width: 320px;
    margin: 2rem 0 2.5rem 0;
}

.account-avatar-btn {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0;
    margin: 0;
    outline: none;
}

.account-avatar-btn:hover,
.account-avatar-btn:focus {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none;
}

.account-avatar {
    font-size: 2.1rem;
    background: #b0b8c9;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-align: center;
    color: #23243a;
}

.account-avatar-btn .account-avatar {
    transition: background 0.2s, color 0.2s;
    border: none;
}
.account-avatar-btn:hover .account-avatar {
    background: #23243a;
    color: #fff;
    border: none;
}

.account-info p {
    margin: 0.3rem 0;
    font-size: 1.1rem;
}

.welcome-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(35,36,58,0.08);
    padding: 3.5rem 3rem 2.8rem 3rem;
    min-width: 600px;
    max-width: 900px;
    width: 900px;
    margin: 0 auto;
    text-align: center;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    word-break: break-word;
    white-space: normal;
}

.welcome-box h2 {
    margin-top: 0;
    margin-bottom: 1.2rem;
    font-size: 1.4rem;
    font-weight: 700;
}

.welcome-box p {
    font-size: 1.05rem;
    color: #222;
    margin-bottom: 2.2rem;
    line-height: 1.6;
}

.welcome-box .main-btn {
    margin: 0 auto;
    display: block;
    min-width: 220px;
}

.welcome-nav {
    position: absolute;
    top: 40px;
    right: 40px;
    left: unset;
    width: auto;
    margin: 0;
    display: flex;
    justify-content: flex-end;
    z-index: 10;
}

a.nav-btn.logout-btn {
    background: #c3cfe2;
    color: #23243a;
    transition: background 0.2s, color 0.2s;
}
a.nav-btn.logout-btn:hover {
    background: #23243a;
    color: #fff;
}

.account-avatar-upload {
    position: relative;
    display: inline-block;
}
.account-avatar-upload .account-avatar {
    transition: background 0.2s, color 0.2s;
    border: none;
    position: relative;
    z-index: 1;
}
.account-avatar-upload:hover .account-avatar,
.account-avatar-upload:focus .account-avatar {
    background: #23243a;
    color: #fff;
}
.account-avatar-upload .avatar-hover-text {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(35,36,58,0.92);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 2;
    cursor: pointer;
}
.account-avatar-upload:hover .avatar-hover-text,
.account-avatar-upload:focus .avatar-hover-text {
    display: flex;
}

.kapitel-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, #6c63ff 0%, #48c6ef 100%);
    background-size: 300% 100%;
    background-position: 100% 0;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 22px 48px 16px 48px;
    font-size: 1.25rem;
    font-weight: 700;
    box-shadow: 0 4px 18px rgba(76,97,255,0.13);
    margin: 2.2rem auto 0 auto;
    text-decoration: none;
    transition: background-position 0.8s cubic-bezier(0.4,0,0.2,1), background 0.2s, box-shadow 0.2s, transform 0.2s;
    min-width: 220px;
    position: relative;
}
.kapitel-btn:hover {
    background-position: 0 0;
    background: linear-gradient(90deg, #48c6ef 0%, #6c63ff 100%);
    box-shadow: 0 8px 32px rgba(76,97,255,0.18);
    transform: translateY(-2px) scale(1.03);
}
.kapitel-btn-sub {
    font-size: 1.01rem;
    font-weight: 400;
    color: #e0e7ff;
    margin-top: 7px;
    letter-spacing: 0.01em;
}

.kapitel-btn-progress {
    position: absolute;
    top: 12px;
    right: 22px;
    background: #fff;
    color: #6c63ff;
    font-size: 1.01rem;
    font-weight: 700;
    padding: 2px 12px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(76,97,255,0.10);
    letter-spacing: 0.01em;
    pointer-events: none;
}

.kapitel-btn-icon {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    pointer-events: none;
}
.kapitel-btn-icon img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    display: block;
    background: transparent;
    box-shadow: none;
}

.sidebar {
    min-width: 250px;
    max-width: 300px;
    background: #9ba7bb;
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(76,97,255,0.07);
    padding: 2.2rem 1.2rem 2.2rem 1.2rem;
    margin-right: 2.5rem;
    margin-top: 0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    height: 100vh;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 100;
}
.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}
.sidebar-link {
    display: block;
    width: 100%;
    padding: 13px 18px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: none;
    color: #23243a;
    font-size: 1.08rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.sidebar-link.active {
    background: linear-gradient(90deg, #6c63ff 0%, #48c6ef 100%);
    color: #fff;
    pointer-events: none;
}
.sidebar-link:hover:not(.active) {
    background: linear-gradient(90deg, #6c63ff 0%, #48c6ef 100%);
    color: #fff;
}

.editor-preview-box {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    margin-top: 1.5rem;
    margin-bottom: 1.2rem;
    align-items: flex-start;
}
.html-editor-box {
    min-width: 600px;
    max-width: 900px;
    width: 900px;
    background: #23243a; /* Editor-Box Hintergrund */
    border-radius: 10px;
    box-shadow: 0 4px 18px rgba(35,36,58,0.13);
    padding: 0.7rem 1.2rem 0.5rem 1.2rem;
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
/* Abstand zwischen Editor und Vorschau */
.aufgabe-editor-preview > .html-editor-box {
    margin-bottom: 1.2rem;
}
.html-editor-label {
    color: #b0b8c9;
    font-size: 0.98rem;
    font-family: 'Fira Mono', 'Consolas', 'Menlo', monospace;
    margin-bottom: 0.3rem;
    margin-left: 0.2rem;
}
.html-editor {
    min-height: 260px;
    width: 100%;
    max-width: none;
    min-width: 0;
    resize: vertical;
    box-sizing: border-box;
    padding: 1rem 1.2rem;
    background: #1e1e1e;
    color: #d4d4d4;
    box-shadow: 0 2px 8px rgba(35,36,58,0.10);
    transition: border 0.2s;
}
.html-editor:focus {
    outline: 2px solid #6c63ff;
}
.live-preview-box {
    min-width: 600px;
    max-width: 900px;
    width: 900px;
    /* Höhe nicht setzen, damit Kind-Elemente nicht die Box stretchen */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: #fff; /* Vorschau-Box Hintergrund */
    box-shadow: 0 4px 18px rgba(76,97,255,0.07);
}
.live-preview-label {
    color: #6c63ff;
    font-size: 0.98rem;
    font-family: 'Fira Mono', 'Consolas', 'Menlo', monospace;
    margin-bottom: 0.3rem;
    margin-left: 0.2rem;
}
.live-preview {
    min-height: 260px;
    width: 100%;
    max-width: none;
    min-width: 0;
    resize: vertical;
    box-sizing: border-box;
}

#aufgaben-inhalt {
    margin-top: 3.5rem;
}

.welcome-box, .html-editor-box, .live-preview-box {
    min-width: 0;
    max-width: 900px;
    width: 900px;
    box-sizing: border-box;
    word-break: break-word;
    white-space: normal;
}

@media (max-width: 1000px) {
    .welcome-box, .html-editor-box, .live-preview-box {
        width: 98vw;
        max-width: 98vw;
        min-width: 0;
    }
}

@media (max-width: 900px) {
    .editor-preview-box {
        flex-direction: column;
        gap: 1.2rem;
    }
    .html-editor-box, .live-preview-box {
        width: 100%;
        min-width: 0;
    }
}

.main-content-scroll {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 1.5rem;
    box-sizing: border-box;
}

.nocopy, .nocopy *, .nocopy code, .nocopy ul, .nocopy li, .nocopy b, .nocopy span, .nocopy p, .nocopy h2 {
  user-select: none !important;
  -webkit-user-select: none !important;
  -ms-user-select: none !important;
  -moz-user-select: none !important;
  pointer-events: none;
}
.nocopy-except, .nocopy-except *, .show-more-errors {
  pointer-events: auto !important;
  user-select: auto !important;
}

.main-btn, .logout-btn {
    transition: background 0.2s, color 0.2s;
}
.main-btn#reset-progress-btn,
#delete-account-btn,
.logout-btn {
    background: #e74c3c !important;
    color: #fff !important;
    border: none;
}
.main-btn#reset-progress-btn:hover,
#delete-account-btn:hover,
.logout-btn:hover {
    background: #c0392b !important;
    color: #fff !important;
    filter: brightness(0.95);
    box-shadow: 0 2px 8px rgba(192,57,43,0.13);
}

/* Popout-Buttons gleich groß und einheitlich */
#delete-popup .popup-btns {
    display: flex;
    gap: 1.2rem;
    margin-top: 1.2rem;
    align-items: stretch;
}
#delete-popup .main-btn,
#delete-popup .back-btn {
    min-width: unset;
    width: unset;
    padding: 0 36px;
    height: 48px;
    font-size: 1.08rem;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(35,36,58,0.10);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #eaeaea;
    color: #23243a;
    margin: 0;
}
#delete-popup .main-btn {
    background: #e74c3c;
    color: #fff;
}
#delete-popup .main-btn:hover {
    background: #c0392b;
    color: #fff;
    box-shadow: 0 4px 16px rgba(192,57,43,0.18);
    transform: translateY(-2px) scale(1.04);
    filter: brightness(1.05);
    transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.15s, filter 0.2s;
}
#delete-popup .back-btn:hover {
    background: #c3cfe2;
    color: #23243a;
}

/* Account- und Logout-Button exakt gleich groß */
.top-buttons a.nav-btn,
.top-buttons a.nav-btn.logout-btn {
    height: 48px;
    min-width: 150px;
    width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.08rem;
    padding: 13px 22px;
    box-sizing: border-box;
}

/* Account-Löschen-Button oben rechts, exakt gleiche Höhe wie Account-Button */
#delete-account-btn {
    position: absolute !important;
    top: -4px;
    right: 40px;
    margin: 0 !important;
    height: 48px;
    min-width: 150px;
    width: 150px;
    background: #e74c3c;
    color: #fff;
    font-weight: 600;
    font-size: 1.08rem;
    border: none;
    border-radius: 7px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(231,76,60,0.08);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
#delete-account-btn:hover {
    background: #c0392b;
}

.top-buttons {
    align-items: center !important;
}

/* Logout-Button gleiche Größe wie Account-Löschen-Button */
a.nav-btn.logout-btn {
    height: 48px;
    min-width: 110px;
    width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.08rem;
    padding: 13px 22px;
}
