/* --- OVERLAY FÜR DIE STARTSEITE --- */
#profile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.profile-container {
    width: 95%;
    max-width: 1100px;
    height: 90%;
    max-height: 750px;
    background: linear-gradient(135deg, #1f140f 0%, #2a1a12 100%);
    border: 6px solid #8b6b43;
    outline: 2px solid #3a2214;
    outline-offset: 4px;
    padding: 30px;
    box-sizing: border-box;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9), 0 15px 40px rgba(0, 0, 0, 0.8);
    display: grid;
    grid-template-areas:
        "sidebar header"
        "sidebar main";
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr;
    gap: 25px;
}

/* --- Header --- */
.profile-header {
    grid-area: header;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 20px;
}

.edit-icon,
.close-button {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
    transition: all 0.2s;
}

.edit-icon {
    background: radial-gradient(circle, #5a422a, #2a1a12);
    border: 2px solid #cda873;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
}

.edit-icon:hover {
    background: radial-gradient(circle, #7a5a3a, #3a2214);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(205, 168, 115, 0.3);
}

.close-button {
    background: linear-gradient(to bottom, #6a1a1a, #3a0a0a);
    border: 2px solid #a63a3a;
    position: relative;
}

.close-button::before,
.close-button::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 25px;
    background-color: #e8dcc4;
    top: 50%;
    left: 50%;
    border-radius: 2px;
}

.close-button::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.close-button::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* --- Sidebar --- */
.sidebar-content {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.profile-pic-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.4);
    padding: 10px;
    border: 1px solid #4a3b2c;
    border-radius: 8px;
    margin-bottom: 5px;
}

.profile-pic {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, #4a3b2c, #1a0f0a);
    border: 3px solid #cda873;
    box-shadow: 0 0 15px rgba(205, 168, 115, 0.4), inset 0 0 20px #000;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8em;
    color: #8b6b43;
    flex-shrink: 0;
}

.welcome-rank {
    font-size: 1.05em;
    text-shadow: 1px 1px 3px #000;
    line-height: 1.3;
}

.username-limit {
    display: inline-block;
    max-width: 15ch;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.welcome-rank .highlight-text {
    color: #cda873;
    font-weight: bold;
    font-size: 1.15em;
}

.navigation-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
    justify-content: center;
}

/* --- Buttons --- */
.fantasy-button {
    position: relative;
    width: 100%;
    height: 45px;
    background: linear-gradient(to bottom, #3a281c 0%, #1a0f0a 100%);
    border: 2px solid #8b6b43;
    border-radius: 4px;
    color: #e8dcc4;
    font-family: 'Georgia', serif;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.2s;
    text-shadow: 2px 2px 4px #000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.fantasy-button:hover {
    border-color: #cda873;
    color: #fff;
    transform: translateY(-2px);
}

.fantasy-button.active {
    background: linear-gradient(to bottom, #5a3c24 0%, #2a1810 100%);
    border-color: #fce2a6;
    color: #fff;
    box-shadow: 0 0 15px rgba(205, 168, 115, 0.6);
}

/* Streamer & DND Modus */
.streamer-mode-toggle {
    margin-top: auto;
    height: 45px;
    transition: background 0.3s, border-color 0.3s;
}

body .streamer-off {
    background: linear-gradient(to bottom, #3a1a1a, #1a0505);
    border-color: #8a2a2a;
}

/* Färbt nur noch exakt die Status-Anzeigen (AUS) rot */
.streamer-off #streamerStatus,
.streamer-off #dndStatus {
    color: #ff6b6b;
}

body .streamer-on {
    background: linear-gradient(to bottom, #1a3a1a, #051a05);
    border-color: #2a8a2a;
}

/* Färbt nur noch exakt die Status-Anzeigen (AN) grün mit Leuchteffekt */
.streamer-on #streamerStatus,
.streamer-on #dndStatus {
    color: #6bff6b;
    text-shadow: 0 0 10px #6bff6b;
}

/* --- Hauptbereich (Dynamische Ansichten) --- */
.main-content-area {
    grid-area: main;
    position: relative;
    overflow: hidden;
}

.view-section {
    display: none;
    width: 100%;
    height: 100%;
    animation: fadeIn 0.4s ease-in-out;
    flex-direction: column;
}

.view-section.active-view {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    color: #cda873;
    font-size: 1.4em;
    border-bottom: 2px solid #5a422a;
    padding-bottom: 10px;
    margin-bottom: 15px;
    text-shadow: 1px 1px 2px #000;

    /* Zwingt beide Titel auf exakt dieselbe Höhe */
    display: flex;
    align-items: center;
    height: 35px;
}

/* Profil Layout */
#view-profil {
    display: none;
    grid-template-columns: 1fr 280px;
    gap: 25px;
}

#view-profil.active-view {
    display: grid;
}

.center-content,
.friends-list-content {
    display: flex;
    flex-direction: column;
}

.char-image-container {
    flex-grow: 1;
    background-color: rgba(0, 0, 0, 0.45);
    border: 4px solid #5a422a;
    box-shadow: inset 0 0 30px #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.char-placeholder-text {
    color: #5a422a;
    font-size: 1.2em;
    text-align: center;
    border: 2px dashed #5a422a;
    padding: 20px;
    border-radius: 10px;
}

.friends-list-container {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #5a422a;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.friends-list-container ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.friends-list-container li {
    padding: 10px;
    border-bottom: 1px solid #3a2214;
    color: #cda873;
}

.single-column {
    flex-direction: column;
}

.content-box {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #5a422a;
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.scrollable-text {
    max-height: 500px;
    line-height: 1.6;
}

/* Hilfe & Feedback Boxen */
.split-content-box {
    display: flex;
    gap: 20px;
    flex-grow: 1;
}

.half-box {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #5a422a;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.half-box h3 {
    color: #cda873;
    margin-top: 0;
}

.half-box p {
    color: #b59f71;
    line-height: 1.5;
    flex-grow: 1;
}

.small-gold-button {
    background: linear-gradient(#8b6b43, #5a3c24);
    border: 1px solid #cda873;
    color: #fff;
    padding: 10px;
    cursor: pointer;
    font-family: 'Georgia', serif;
    margin-top: 15px;
}

.small-gold-button:hover {
    background: linear-gradient(#a38155, #704b2d);
}

.stats-list {
    list-style: none;
    padding: 0;
    font-size: 1.2em;
    line-height: 2;
}

.stats-list strong {
    color: #cda873;
}

/* --- Modales Fenster (Bearbeitung) --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 10020;
}

.modal-box {
    background: linear-gradient(135deg, #2a1a12 0%, #1f140f 100%);
    border: 4px solid #cda873;
    padding: 30px;
    width: 500px;
    box-shadow: 0 0 50px #000;
}

.modal-box h2 {
    color: #fce2a6;
    margin-top: 0;
    border-bottom: 1px solid #8b6b43;
    padding-bottom: 10px;
}

.edit-group {
    margin-bottom: 25px;
}

.edit-group label {
    display: block;
    color: #cda873;
    font-weight: bold;
    margin-bottom: 5px;
}

.hint-text {
    font-size: 0.85em;
    color: #8b6b43;
    margin-top: 0;
    margin-bottom: 10px;
}

.file-input {
    background: #1a0f0a;
    color: #cda873;
    padding: 10px;
    border: 1px solid #5a422a;
    width: 100%;
    box-sizing: border-box;
}

.fantasy-select {
    width: 100%;
    padding: 10px;
    background: #1a0f0a;
    color: #cda873;
    border: 1px solid #5a422a;
    font-family: 'Georgia', serif;
    font-size: 1.1em;
}

.modal-footer {
    text-align: right;
    margin-top: 30px;
}

.close-modal-btn {
    width: auto;
    padding: 0 20px;
    height: 40px;
}

/* =========================================
   ERWEITERUNG: ACHIEVEMENTS STYLING
   ========================================= */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 20px;
    padding: 0 15px;
}

.category-tabs .tab-btn {
    flex: 1 1 calc(25% - 10px);
    min-width: 110px;
    max-width: 200px;
    padding: 10px 5px;
    text-align: center;
    box-sizing: border-box;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.2;
}

.tab-btn {
    position: relative;
    background: linear-gradient(to bottom, #3a281c 0%, #1a0f0a 100%);
    border: 2px solid #5a422a;
    color: #cda873;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-family: 'Georgia', serif;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: linear-gradient(to bottom, #4a3525 0%, #2a1810 100%);
    border-color: #8b6b43;
}

.tab-btn.active {
    background: linear-gradient(to bottom, #5a3c24 0%, #2a1810 100%);
    border-color: #fce2a6;
    color: #fff;
    box-shadow: 0 0 10px rgba(205, 168, 115, 0.4);
}

.achievement-content-area {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #4a3b2c;
    border-radius: 8px;
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.category-panel {
    display: none;
}

.category-panel.active {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.achievement-card {
    position: relative;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid #5a422a;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.achievement-card:hover {
    transform: translateY(-3px);
    cursor: pointer;
}

.achievement-card.unlocked {
    border-color: #cda873;
    box-shadow: inset 0 0 15px rgba(205, 168, 115, 0.1);
}

.achievement-card.unlocked .achievement-icon {
    text-shadow: 0 0 10px #cda873;
}

.achievement-card.locked {
    opacity: 0.5;
    border-style: dashed;
}

.achievement-card.locked .achievement-icon {
    filter: grayscale(100%);
}

.achievement-icon {
    font-size: 35px;
}

.achievement-details h2 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    color: #fce2a6;
}

.achievement-details p {
    margin: 0;
    font-size: 0.9em;
    color: #b59f71;
    line-height: 1.3;
}

.friend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #5a422a;
    border-radius: 5px;
    margin-bottom: 8px;
}

.friend-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
    overflow: hidden;
}

.friend-avatar,
.friend-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;

    /* --- DIE LÖSUNG --- */
    flex-shrink: 0;
    min-width: 40px;
    min-height: 40px;
}

.friend-avatar-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #4a3b2c;
    font-size: 14px;
}

body .friend-name-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: none;
}

.friend-name {
    color: #e8dcc4;
    font-weight: bold;
    font-size: 1rem;
    white-space: nowrap;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- STATUS FARBEN --- */
body .friend-item .status-badge {
    font-size: 0.75rem;
    font-weight: bold;
    background: none;
    border: none;
    padding: 0;
    text-transform: none;
}

.status-badge.status-offline {
    color: #888888;
}

/* Grau */
.status-badge.status-online {
    color: #00ff88;
}

/* Grün */
.status-badge.status-lobby {
    color: #ffd700;
}

/* Gelb */
.status-badge.status-game {
    color: #ff4d4d;
}

/* Rot */

/* Buttons zum Löschen/Interagieren */
.friend-actions button {
    background: none;
    border: none;
    color: #ff4d4d;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    opacity: 0.6;
}

.friend-actions button:hover {
    opacity: 1;
}

/* --- STREAMERMODUS: CODES VERSTECKEN --- */
.streamer-hidden {
    filter: blur(8px) grayscale(1);
    pointer-events: none;
    user-select: none;
    transition: filter 0.3s ease;
}

/* Verhindert, dass der Text im Beitritts-Feld sichtbar ist */
body #lobby-code-input.streamer-hidden {
    color: transparent;
    text-shadow: 0 0 12px #FFD700;
    letter-spacing: 10px;
    filter: none;
    pointer-events: auto;
    letter-spacing: 5px;
}

/* --- Schicke Scrollbalken für Datenschutz & Impressum --- */

.achievement-content-area {
    max-height: 450px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Breite des gesamten Scrollbalkens */
.scrollable-text::-webkit-scrollbar {
    width: 8px;
}

/* Der Hintergrund (die Schiene) des Scrollbalkens */
.scrollable-text::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.1);
}

/* Der anfassbare Balken selbst */
.scrollable-text::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #FFD700, #DAA520);
    border-radius: 10px;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.5);
}

/* Wenn man mit der Maus über den Balken fährt */
.scrollable-text::-webkit-scrollbar-thumb:hover {
    background: #FFD700;
}

#friend-status-msg {
    transition: all 0.3s ease;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.char-image-container {
    width: 340px;
    /* Hier deutlich breiter (vorher 300px) */
    height: 380px;
    /* Minimal angepasst (vorher 375px) */
    margin: 20px auto;
    border: 5px solid #8b6b43;
    background-color: rgba(0, 0, 0, 0.45);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.9), 0 10px 25px rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

#char-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: opacity 0.3s ease-in-out;
}

/* ==========================================
   GLOBALE RANG-STREIFEN (Profil & Freundesliste)
   ========================================== */
body .rank-inhaber {
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

body .rank-admin {
    color: #ff4c4c;
    text-shadow: 0 0 10px rgba(255, 76, 76, 0.5);
}

body .rank-moderator {
    color: #3498db;
    text-shadow: 0 0 10px rgba(52, 152, 219, 0.4);
}

body .rank-freund {
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
}

body .rank-streamer {
    color: #b768ff;
    text-shadow: 0 0 10px rgba(183, 104, 255, 0.4);
}

body .rank-spieler {
    color: #aaaaaa;
}

/* ======================================================== */
/* --- 1. GRUND-SETUP NUR FÜR RÄNGE MIT ICONS --- */
/* ======================================================== */
/* Wichtig: .rank-spieler fehlt hier absichtlich! */
.rank-inhaber::before,
.rank-admin::before,
.rank-moderator::before,
.rank-freund::before,
.rank-streamer::before {
    content: '';
    display: inline-block;

    /* Hier kannst du die Grösse deiner Icons anpassen */
    width: 32px;
    height: 32px;
    margin-right: 6px;

    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;

    vertical-align: middle;
    position: relative;
    top: 1px;
}

/* ======================================================== */
/* --- 2. DEINE EIGENEN BILDER VERLINKEN --- */
/* ======================================================== */
.rank-inhaber::before {
    background-image: url('/images/Inhaber.png');
}

.rank-admin::before {
    background-image: url('/images/Admin.png');
}

.rank-moderator::before {
    background-image: url('/images/Moderator.png');
}

.rank-freund::before {
    background-image: url('/images/Freund.png');
}

.rank-streamer::before {
    background-image: url('/images/Twitch.png');
}

/* ======================================================== */
/* --- 3. DER KORREKTE FIX FÜR DEN SPIELER --- */
/* ======================================================== */
/* Zerstört die Box beim Spieler, damit kein Abstand entsteht */
body .rank-spieler::before {
    display: none;
    content: none;
}

/* ======================================================== */
/* --- 4. OPTIMIERUNGEN --- */
/* ======================================================== */
/* Icons im grossen Profil-Schild ausblenden */
body #profile-overlay-rank::before {
    display: none;
}

/* Optional: Ein kleiner Leuchteffekt für Namen in der Liste */
.friend-item .friend-name {
    font-weight: bold;
    transition: all 0.3s ease;
}

/* ==========================================
   MODERNES FANTASY DROPDOWN (Custom Select)
   ========================================== */
.custom-select-wrapper {
    position: relative;
    width: 100%;
    user-select: none;
    font-family: inherit;
}

/* Der sichtbare Button (Das zugeklappte Feld) */
.custom-select-trigger {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #8b6b43;
    color: #fff;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.custom-select-trigger:hover {
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

/* Der goldene Pfeil */
.custom-select-trigger::after {
    content: '▼';
    font-size: 0.8rem;
    color: #FFD700;
    transition: transform 0.3s;
}

.custom-select-wrapper.open .custom-select-trigger::after {
    transform: rotate(180deg);
}

/* Die aufklappbare Liste */
.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1f140f;
    border: 2px solid #8b6b43;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8);
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 999;
}

.custom-select-wrapper.open .custom-select-options {
    display: block;
}

/* Ein einzelner Charakter in der Liste */
.custom-option {
    padding: 10px 15px;
    color: #ccc;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.custom-option:hover,
.custom-option.selected {
    background: rgba(255, 215, 0, 0.15);
    color: #FFD700;
}

/* Der moderne Scrollbalken für das Dropdown */
.custom-select-options::-webkit-scrollbar {
    width: 8px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #FFD700, #DAA520);
    border-radius: 10px;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
    background: #FFD700;
}

/* ======================================================== */
/* --- FREUNDESLISTE SCROLLBAR MACHEN --- */
/* ======================================================== */
#friends-list-container {
    flex-grow: 1;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
}

/* --- DAS DESIGN DES SCROLLBALKENS --- */
#friends-list-container::-webkit-scrollbar {
    width: 6px;
}

/* Der Hintergrund (die Spur) des Balkens */
#friends-list-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

/* Der anfassbare Balken selbst (passend zu deinem Braun/Gold-Theme) */
#friends-list-container::-webkit-scrollbar-thumb {
    background: #8b6b43;
    border-radius: 4px;
    transition: background 0.3s ease;
}

/* Wenn man mit der Maus über den Balken fährt */
#friends-list-container::-webkit-scrollbar-thumb:hover {
    background: #FFD700;
}

/* ======================================================== */
/* --- FANTASY SELECT DROPDOWN DESIGN --- */
/* ======================================================== */

/* Der Container um das gesamte Dropdown */
.custom-select-wrapper {
    position: relative;
    width: 100%;
    margin-top: 5px;
    user-select: none;
}

/* Das Hauptfeld, das man anklickt (der Button) */
.select-trigger {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #8b6b43;
    color: #FFD700;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.select-trigger:hover {
    border-color: #FFD700;
}

/* Die Liste mit allen Charakteren/Rängen */
.custom-options {
    position: absolute;
    display: none;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a1a;
    border: 1px solid #8b6b43;
    border-top: none;
    z-index: 9999;
    max-height: 250px;
    overflow-y: auto;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

/* Wird vom JavaScript hinzugefügt, um die Liste aufzuklappen */
.custom-options.open {
    display: block;
}

/* Ein einzelner Name in der Liste */
.custom-option {
    padding: 10px 15px;
    color: #fff;
    cursor: pointer;
    border-bottom: 1px solid rgba(139, 107, 67, 0.2);
    transition: background 0.2s, color 0.2s;
}

/* Wenn man mit der Maus über einen Namen fährt */
.custom-option:hover {
    background: #8b6b43;
    color: #FFD700;
}

/* Entfernt den Strich unterm letzten Element */
.custom-option:last-child {
    border-bottom: none;
}

/* Das Design der Scrollbar im Dropdown (passend zum Theme) */
.custom-options::-webkit-scrollbar {
    width: 6px;
}

.custom-options::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.custom-options::-webkit-scrollbar-thumb {
    background: #8b6b43;
    border-radius: 3px;
}

/* ==========================================
   --- FREUNDESLISTE SCROLLBAR ---
   ========================================== */
#friends-list-container {
    max-height: 458px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
}

/* --- Design des Scrollbalkens (Passend zur Spielewelt) --- */
#friends-list-container::-webkit-scrollbar {
    width: 8px;
}

#friends-list-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

#friends-list-container::-webkit-scrollbar-thumb {
    background: #ffd900ce;
    border-radius: 4px;
}

#friends-list-container::-webkit-scrollbar-thumb:hover {
    background: #FFD700;
}

/* ========================================= */
/* --- KATEGORIE BADGES (ZAHLEN) --- */
/* ========================================= */
.ach-badge {
    display: none;
    align-items: center;
    justify-content: center;
    background: #FFD700;
    color: #111;
    font-size: 0.7rem;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 12px;
    margin-left: 8px;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
    min-width: 18px;
    height: 18px;
    line-height: 1;
}

/* ======================================================== */
/* --- RESPONSIVE ADJUSTMENTS FOR TABLETS & SMALLER DEVICES --- */
/* ======================================================== */

/* 1. General fluid adjustments for medium screens */
@media (max-width: 1150px) {
    .profile-container {
        width: 95%;
        padding: 20px;
        gap: 20px;
    }
}

/* 2. Tablet optimization (Landscape & Portrait) */
@media (max-width: 1000px) {
    .profile-container {
        grid-template-columns: 220px 1fr;
        gap: 15px;
        padding: 20px;
    }

    .profile-pic-container {
        padding: 8px;
        gap: 8px;
    }

    .welcome-rank {
        font-size: 0.95em;
    }

    body .profil-avatar,
    body #profil-default-svg {
        width: 70px;
        height: 70px;
    }

    body #profil-default-svg svg {
        width: 35px;
        height: 35px;
    }

    /* Stack Favorite Character and Friends List vertically to fit narrower widths */
    #view-profil {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 20px;
        overflow-y: auto;
    }

    .char-image-container {
        width: 100%;
        max-width: 300px;
        height: 340px;
        margin: 10px auto;
    }

    .split-content-box {
        flex-direction: column;
        gap: 15px;
    }
}

/* 3. Small height adjustments (Landscape mode on tablets / smaller laptops) */
@media (max-height: 800px) {
    .profile-container {
        padding: 15px;
        gap: 15px;
    }

    .sidebar-content {
        gap: 8px;
    }

    .profile-pic-container {
        padding: 6px;
        margin-bottom: 0;
    }

    body .profil-avatar,
    body #profil-default-svg {
        width: 65px;
        height: 65px;
    }

    body #profil-default-svg svg {
        width: 30px;
        height: 30px;
    }

    .welcome-rank {
        font-size: 0.9em;
    }

    .fantasy-button {
        height: 38px;
        font-size: 1rem;
    }

    .streamer-mode-toggle {
        height: 38px;
        margin-top: 5px;
    }

    .char-image-container {
        height: 280px;
        margin: 5px auto;
    }

    .section-title {
        height: 30px;
        font-size: 1.25em;
        margin-bottom: 10px;
    }

    /* Make sure achievement content areas fit without issues */
    .achievement-content-area {
        max-height: 320px;
    }

    .scrollable-text {
        max-height: 380px;
    }
}

/* 4. Mobile layout fallback for extra narrow widths */
@media (max-width: 700px) {
    .profile-container {
        grid-template-areas:
            "header"
            "sidebar"
            "main";
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        height: 95%;
        max-height: 95vh;
        overflow-y: auto;
        padding: 15px;
        gap: 15px;
    }

    .profile-header {
        justify-content: flex-end;
        width: 100%;
    }

    .sidebar-content {
        flex-direction: column;
        gap: 15px;
    }

    .profile-pic-container {
        justify-content: center;
        max-width: 360px;
        margin: 0 auto;
        width: 100%;
        box-sizing: border-box;
    }

    .navigation-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
        max-width: 480px;
        margin: 0 auto;
    }

    .streamer-mode-toggle {
        margin: 0 auto;
        width: 100%;
        max-width: 480px;
    }

    body #dndToggle {
        margin-top: 0;
    }
}