:root {
    --bg-main: #0b0b0e;        /* Tiefes Schwarz als Hauptgrundton */
    --bg-secondary: #16161c;   /* Dunkle Box-Farbe */
    --bg-tertiary: #0d0d11;    /* Noch dunkleres Schwarz für Eingabefelder */
    --accent-purple: #6d28d9;  /* Edles Dunkellila */
    --accent-purple-hover: #5b21b6; /* Satters Dunkellila beim Hover */
    --text-main: #e2e8f0;      /* Hellgrauer Text für optimale Lesbarkeit */
    --text-muted: #94a3b8;     /* Gedämpfter Text */
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column; /* Elemente untereinander anordnen */
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
    overflow: auto; /* Geändert von hidden auf auto, damit größere Ansichten wie Charakterblätter nicht abgeschnitten werden */
}

/* --- NEU: Der Riesen-Panther als Hintergrund-Wasserzeichen --- */
.bg-panther {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    /* KORREKTUR: Direkter relativer Pfad, da in .css-Datei */
    background-image: url('panther.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover; /* Identisch zur Login-Layout-Vorschau */
    opacity: 0.07; /* Sehr transparent, nur als dezentes Wasserzeichen */
    z-index: -1; /* Ganz nach hinten hinter alle anderen Elemente */
    pointer-events: none; /* Klicks gehen durch das Bild hindurch */
}

/* --- Längliche Logo-Box (angepasst) --- */
.logo-box {
    width: 100%;
    max-width: 390px;
    background: var(--bg-secondary);
    padding: 20px; /* Mehr Luft für den Schriftzug */
    display: flex;
    align-items: center;
    justify-content: center; /* Text ist jetzt perfekt zentriert */
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.6);
    border: 1px solid #202028;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.login-version {
    margin: -12px 0 16px;
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}

/* Das Bild-Element in der Box wird ausgeblendet */
.logo-img {
    display: none; 
}

.logo-text {
    color: #a78bfa; /* Edles Lila für den Schriftzug */
    font-weight: bold;
    font-size: clamp(2rem, 8vw, 3rem);
    letter-spacing: clamp(3px, 1.5vw, 7px);
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(167, 139, 250, 0.4); /* Leichter Glow-Effekt */
}

.container {
    width: 100%;
    max-width: 390px;
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    box-sizing: border-box;
    border: 1px solid #202028;
}

/* Dashboard status and release cards */
.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    padding: 10px 12px;
    text-align: left;
    background: rgba(13, 13, 17, .72);
    border: 1px solid #292936;
    border-radius: 6px;
    font-size: 12px;
}
.connection-status__indicator {
    flex: 0 0 9px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, .12);
}
.connection-status.is-online { border-color: rgba(34, 197, 94, .45); }
.connection-status.is-online .connection-status__indicator { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .12); }
.connection-status.is-offline { border-color: rgba(248, 113, 113, .5); }
.connection-status.is-offline .connection-status__indicator { background: #f87171; box-shadow: 0 0 0 3px rgba(248, 113, 113, .12); }
.connection-status__copy { display: grid; gap: 2px; min-width: 0; }
.connection-status__copy strong { color: var(--text-main); font-size: 12px; }
.connection-status__copy small { color: var(--text-muted); }
.connection-status__retry {
    width: auto;
    margin: 0 0 0 auto;
    padding: 5px 8px;
    font-size: 11px;
    white-space: nowrap;
}
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 20px;
    text-align: left;
}
.dashboard-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
    padding: 13px;
    background: #16161c;
    border: 1px solid #292936;
    border-radius: 6px;
}
.dashboard-card__eyebrow { color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.dashboard-card__value { color: #fff; font-size: 16px; }
.dashboard-card__detail { min-height: 28px; color: var(--text-muted); font-size: 11px; }
.dashboard-card__action { margin-top: auto; color: #c4b5fd; font-size: 11px; }
.dashboard-card__status { color: #86efac; font-size: 11px; }
.diagnostics-card {
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    margin: 0 0 18px; padding: 12px; text-align: left; background: rgba(13,13,17,.72);
    border: 1px solid #292936; border-radius: 6px;
}
.diagnostics-card .connection-status__indicator { flex: 0 0 9px; }
.diagnostics-card .connection-status__indicator.is-online { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.15), 0 0 10px #22c55e; }
.dashboard-card__ping { margin-left: auto; color: #86efac; font-size: 12px; white-space: nowrap; }
.diagnostics-card strong, .diagnostics-card small { display: block; margin-top: 3px; }
.diagnostics-card strong { color: #86efac; font-size: 12px; }
.diagnostics-card small { color: var(--text-muted); font-size: 11px; }
.scale-control { min-width: 105px; margin: 0; font-size: 10px; }
.scale-control select { margin-top: 4px; padding: 5px; font-size: 12px; }

@media (max-width: 520px) {
    body {
        padding: 12px;
    }

    .logo-box {
        padding: 14px;
        margin-bottom: 12px;
    }

    .container {
        padding: 22px;
    }

    .dashboard-cards { grid-template-columns: 1fr; }
}

h2 {
    color: #ffffff;
    text-align: center;
    margin-top: 0;
}

p {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

label {
    display: block;
    margin-top: 12px;
    margin-bottom: 5px;
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid #202028;
    border-radius: 4px;
    color: var(--text-main);
    box-sizing: border-box;
    font-size: 1rem;
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent-purple);
    outline: none;
}

button {
    width: 100%;
    padding: 12px;
    background-color: var(--accent-purple);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.2s;
}

button:hover {
    background-color: var(--accent-purple-hover);
}

.links {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    font-size: 0.9rem;
}

a {
    color: #a78bfa; /* Sanftes Lila für Links auf schwarzem Grund */
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ==========================================================
   --- SPIELFELD / GAME BOARD ERWEITERUNGEN (SCHWARZES GRID) ---
   ========================================================== */

/* Wrapper für den Zoom-Bereich der Karte */
.map-viewport {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 80vh;
    background-color: var(--bg-tertiary);
    border: 1px solid #202028;
    border-radius: 8px;
}

/* Das eigentliche Kartenelement */
.map-container {
    position: absolute;
    transform-origin: 0 0;
}

/* Kartenbild selbst */
.map-image {
    display: block;
    max-width: none;
    pointer-events: none; /* Klicks gehen durch das Bild hindurch */
}

/* SCHWARZES GRID ALS SEPARATE EBENE (Skaliert mit Zoom & liegt über dem Bild) */
.map-container::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 2px dicke, tiefschwarze Rasterlinien */
    background-image: 
        linear-gradient(to right, rgba(0, 0, 0, 0.95) 2px, transparent 2px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.95) 2px, transparent 2px);
    background-size: 50px 50px; /* Rasterfeld-Größe (bei Bedarf anpassen, z.B. 40px) */
    pointer-events: none;
    z-index: 5; /* Über dem Bild, aber unter den Tokens */
}

/* Stil für Spielsteine / Tokens auf dem Spielfeld */
.game-token {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
    cursor: grab;
    transform: translate(-50%, -50%);
    z-index: 10; /* Über dem Grid, damit sie anklickbar bleiben */
}

.game-token:active {
    cursor: grabbing;
}
.map-coordinates {
    position: fixed; left: 12px; bottom: 12px; z-index: 30; padding: 5px 8px;
    border-radius: 4px; background: rgba(18,18,24,.9); color: #c4b5fd; font: 11px monospace;
}
#dnd-update-panel {
    position: fixed; left: 12px; bottom: 12px; z-index: 1200; width: min(320px, calc(100vw - 24px));
    max-height: calc(100vh - 24px); overflow-y: auto; padding: 10px; box-sizing: border-box;
    color: var(--text-main); background: rgba(18,18,24,.97); border: 1px solid var(--accent-purple);
    border-radius: 7px; box-shadow: 0 8px 24px rgba(0,0,0,.45); font-size: 12px;
}
#dnd-update-panel section { border-top: 1px solid #292936; padding-top: 8px; margin-top: 8px; }
#dnd-update-panel input, #dnd-update-panel textarea { margin: 5px 0; padding: 6px; font-size: 12px; }
#dnd-update-panel textarea { min-height: 50px; resize: vertical; }
#dnd-update-panel button { margin-top: 4px; padding: 6px; font-size: 11px; }
.dnd-panel-head { display:flex; justify-content:space-between; align-items:center; gap:8px; color:#c4b5fd; cursor:move; }
.dnd-panel-head .dnd-panel-actions { display:flex; gap:4px; }
.dnd-panel-head button { margin:0; min-width:22px; padding:2px 6px; }
.floating-box-header { position:relative; }
.dnd-notification-dot { width:8px; height:8px; margin-left:auto; border-radius:50%; background:#ef4444; box-shadow:0 0 0 2px #16161c; }
#dnd-update-panel.dnd-collapsed { max-height: none; width: min(220px, calc(100vw - 24px)); overflow:hidden; }
#dnd-update-panel.dnd-collapsed .dnd-panel-body { display:none; }
#dnd-chat-panel.dnd-collapsed, #dnd-handout-panel.dnd-collapsed, #builder-sidebar.dnd-collapsed { max-height: none; height: auto; overflow: hidden; }
#dnd-chat-panel.dnd-collapsed > :not(.floating-box-header), #dnd-handout-panel.dnd-collapsed > :not(.floating-box-header), #builder-sidebar.dnd-collapsed > :not(.floating-box-header) { display:none; }
#builder-sidebar.dnd-collapsed { width: 190px; }
#builder-sidebar.dnd-collapsed .floating-box-header { margin-bottom: -12px; }
#dnd-save-status.error { color: #f87171; }
.dnd-chat { max-height: 120px; overflow-y: auto; margin: 5px 0; }
.dnd-chat-layout { display:grid; grid-template-columns:92px minmax(0,1fr); gap:8px; min-height:190px; }
.dnd-chat-users { border-right:1px solid #292936; overflow-y:auto; }
.dnd-chat-users button { width:100%; margin:0 0 4px; padding:6px 4px; text-align:left; font-size:10px; background:#202028; }
.dnd-chat-users button.active { background:var(--accent-purple); }
.dnd-chat-user-dot { display:inline-block; width:7px; height:7px; margin-left:5px; border-radius:50%; background:#ef4444; vertical-align:middle; }
.dnd-chat-user-dot[hidden], .dnd-notification-dot[hidden] { display:none !important; }
.dnd-chat-window { min-width:0; display:flex; flex-direction:column; }
.dnd-chat-window .dnd-chat { flex:1; max-height:145px; overflow-y:auto; }
.dnd-handouts { max-height:260px; overflow-y:auto; }
.dnd-file-form { display:grid; gap:5px; margin-top:8px; }
.dnd-grid-coordinates { position:absolute; inset:0; z-index:25; pointer-events:none; display:none; }
.dnd-grid-coordinates.visible { display:block; }
.dnd-grid-coordinate { position:absolute; color:#c4b5fd; background:rgba(0,0,0,.7); padding:1px 3px; font:10px monospace; }
.dnd-scrollbar, .dnd-scrollbar * { scrollbar-color: var(--accent-purple) #0b0b0e; scrollbar-width:thin; }
#dnd-init-list > div { padding: 3px; }
#dnd-init-list > div.active { background: rgba(139,92,246,.3); border-radius: 3px; }
@media (max-width: 700px) {
    #dnd-update-panel { left: 8px; bottom: 8px; width: calc(100vw - 16px); max-height: 42vh; }
}